(svn r11792) -Codechange: move some (virtually) globally included AI related structs to a place where they are only included a few times.

This commit is contained in:
rubidium
2008-01-09 16:40:02 +00:00
parent 323f6e461a
commit 98b4fa7c07
11 changed files with 1227 additions and 1215 deletions
+8 -8
View File
@@ -80,8 +80,8 @@ uint AiNew_GetSpecialVehicleFlag(Player* p, Vehicle* v)
uint i;
for (i = 0; i < AI_MAX_SPECIAL_VEHICLES; i++) {
if (p->ainew.special_vehicles[i].veh_id == v->index) {
return p->ainew.special_vehicles[i].flag;
if (_players_ainew[p->index].special_vehicles[i].veh_id == v->index) {
return _players_ainew[p->index].special_vehicles[i].flag;
}
}
@@ -96,13 +96,13 @@ bool AiNew_SetSpecialVehicleFlag(Player* p, Vehicle* v, uint flag)
uint i;
for (i = 0; i < AI_MAX_SPECIAL_VEHICLES; i++) {
if (p->ainew.special_vehicles[i].veh_id == v->index) {
p->ainew.special_vehicles[i].flag |= flag;
if (_players_ainew[p->index].special_vehicles[i].veh_id == v->index) {
_players_ainew[p->index].special_vehicles[i].flag |= flag;
return true;
}
if (new_id == -1 &&
p->ainew.special_vehicles[i].veh_id == 0 &&
p->ainew.special_vehicles[i].flag == 0) {
_players_ainew[p->index].special_vehicles[i].veh_id == 0 &&
_players_ainew[p->index].special_vehicles[i].flag == 0) {
new_id = i;
}
}
@@ -112,7 +112,7 @@ bool AiNew_SetSpecialVehicleFlag(Player* p, Vehicle* v, uint flag)
DEBUG(ai, 1, "special_vehicles list is too small");
return false;
}
p->ainew.special_vehicles[new_id].veh_id = v->index;
p->ainew.special_vehicles[new_id].flag = flag;
_players_ainew[p->index].special_vehicles[new_id].veh_id = v->index;
_players_ainew[p->index].special_vehicles[new_id].flag = flag;
return true;
}