relations between arrays using ID.. loops.. acceptable?
#1

So, my gamemode currently uses quite a few loops (as necessary) to find & use relations between arrays.

For example, I preload HomeInfo[MAX_HOMES][enum] during OnGameModeInit() from a database, and PlayerStats[MAX_PLAYERS][enum] on player's successful login. PlayerStats has an enum "charID"... HomeInfo has "ownerID".

I then loop through the HomeInfo array to find relationships:

Код:
for(new i=0;i<MAX_HOMES;i++) { 
    if(HomeInfo[i][ownerID] == PlayerStats[playerid][charID) {
        DoSomething();
        break;
    }
}
Now I know this works, obviously, but I'm going to be using these loops fairly frequently.. Is this safe? Is it efficient? Should I be storing these relationships in some other way?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)