2D Array in enum?
#1

pawn Код:
enum fInfo
{
    fLeader[MAX_PLAYER_NAME],
    fMembers,
    fRank[10][24],  // Line 325
    fDeptName[4][24],
    fDeptTag[4][12]
}
new FactionInfo[MAX_FACTIONS][fInfo];
I found out that this causes an error
Quote:

error 001: expected token: "}", but found "["

How to fix it or another way without having fRank 10 times.
Reply
#2

an enum is just a list of constants therefor it can only be 1d

the savest way would be to exclude these variables like
pawn Код:
enum fInfo
{
    fLeader[MAX_PLAYER_NAME],
    fMembers
}
new FactionInfo[MAX_FACTIONS][fInfo];
new FractionRank[MAX_FACTIONS][10][24];

enum fDept
{
    fDeptName[24],
    fDeptTag[12]
}
new FractionDept[MAX_FACTIONS][4][fDept];
the other way would be to use maths (not recommended because the compiler / server wont case errors if you are out of bounds)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)