mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-12 09:09:09 +00:00
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
(in prepare of dynamic arrays): - DEREF_XXX is changed into GetXXX - All direct call are directed via GetXXX - struct Industry has now an index-field - ENUM'd some stuff - Replaced home built loops with FOR_ALL_XXX - Added _stations_size, _vehicles_size, ... which gives the length of the array (which will be dynamic in the near future) - Changed lengtof(XXX) to _XXX_size (e.g. _stations_size) - Removed all endof(XXX) (because mostly it was part of a FOR_ALL_XXX) - Made the sort-functions of all 4 dynamic - Made all 4 Initialize functions more of the same - Some minor tab-fixing and stuff (tnx to Tron for proof-reading my 100kb patch ;)) Note for all: please do NOT directly call _stations, _vehicles, _towns and _industries, but use the right wrapper to access them. Thank you. Ps: please also do not use 'v++', where v is of type Vehicle *.
This commit is contained in:
17
engine.c
17
engine.c
@@ -737,17 +737,22 @@ static void NewVehicleAvailable(Engine *e)
|
||||
// prevent that player from getting future intro periods for a while.
|
||||
if (e->flags&ENGINE_INTRODUCING) {
|
||||
FOR_ALL_PLAYERS(p) {
|
||||
uint block_preview = p->block_preview;
|
||||
|
||||
if (!HASBIT(e->player_avail,p->index))
|
||||
continue;
|
||||
|
||||
for(v=_vehicles;;) {
|
||||
/* We assume the user did NOT build it.. prove me wrong ;) */
|
||||
p->block_preview = 20;
|
||||
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (v->type == VEH_Train || v->type == VEH_Road || v->type == VEH_Ship ||
|
||||
(v->type == VEH_Aircraft && v->subtype <= 2)) {
|
||||
if (v->owner == p->index && v->engine_type == index) break;
|
||||
}
|
||||
if (++v == endof(_vehicles)) {
|
||||
p->block_preview = 20;
|
||||
break;
|
||||
if (v->owner == p->index && v->engine_type == index) {
|
||||
/* The user did prove me wrong, so restore old value */
|
||||
p->block_preview = block_preview;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user