1
0
Fork 0

(svn r3087) Rewrite GetPlayerRailtypes() so it doesn't depend on magical numbers to sort out wagons

release/0.4.5
tron 2005-10-25 18:29:32 +00:00
parent 7cace07e01
commit 66e688cba3
1 changed files with 10 additions and 12 deletions

View File

@ -617,20 +617,18 @@ void DeletePlayerWindows(PlayerID pi)
byte GetPlayerRailtypes(PlayerID p) byte GetPlayerRailtypes(PlayerID p)
{ {
Engine *e; byte rt = 0;
int rt = 0; uint i;
int i;
for(e = _engines, i = 0; i != lengthof(_engines); e++, i++) { for (i = 0; i != TOTAL_NUM_ENGINES; i++) {
if (!HASBIT(e->player_avail, p)) const Engine* e = GetEngine(i);
continue;
/* Skip all wagons */ if (e->type == VEH_Train &&
if ((i >= 27 && i < 54) || (i >= 57 && i < 84) || (i >= 89 && i < 116)) HASBIT(e->player_avail, p) &&
continue; !(RailVehInfo(i)->flags & RVI_WAGON)) {
assert(e->railtype < RAILTYPE_END);
assert(e->railtype < RAILTYPE_END); SETBIT(rt, e->railtype);
SETBIT(rt, e->railtype); }
} }
return rt; return rt;