01.02.2013, 12:49
Good lord, I didn't have occasion to code lately and I forget the basics. Anyway, here's piece of code:
Here's the same code after preprocessing (these are simple macros for namespacing includes)
Now I get invalid function or declaration error line starting with "Modules__Cargo__Cargos[0]".
This code on the other hand:
will work as planned. I don't want to use this syntax due to further complications. Can someone tell my where am I making a mistake?
pawn Код:
#define MAX_ALLOWED_CARGOS 26
enum NS-><CargoTypes> {
id,
name[SHORT_STRING],
weightRange[2],
carsPermitted[MAX_VEHICLE_TYPES]
};
new NS-><Cargos[MAX_ALLOWED_CARGOS][NS-><CargoTypes>]>;
NS-><Cargos[0]> = { 1, "Hello", { 1, 2 }, {1} };
pawn Код:
enum Modules__Cargo__CargoTypes {
id,
name[64],
weightRange[2],
carsPermitted[8]
};
new Modules__Cargo__Cargos[26][Modules__Cargo__CargoTypes];
Modules__Cargo__Cargos[0] = { 1, "Hello", { 1, 2 }, {1} };
Modules__Cargo__Cargos[1] = { 2, "Hello", { 1, 2 }, {1} };
This code on the other hand:
pawn Код:
new Modules__Cargo__Cargos[26][Modules__Cargo__CargoTypes] = {
{ 1, "Hello", { 1, 2 }, {1} };
{ 2, "Hello", { 1, 2 }, {1} };
};