(svn r25843) -Codechange: Rename MAX_SPECLIST to NUM_STATIONSSPECS_PER_STATION.

This commit is contained in:
frosch 2013-10-12 16:35:32 +00:00
parent 1b6ceef086
commit 29f5eab56c

View File

@ -48,7 +48,7 @@ bool NewGRFClass<Tspec, Tid, Tmax>::IsUIAvailable(uint index) const
INSTANTIATE_NEWGRF_CLASS_METHODS(StationClass, StationSpec, StationClassID, STAT_CLASS_MAX) INSTANTIATE_NEWGRF_CLASS_METHODS(StationClass, StationSpec, StationClassID, STAT_CLASS_MAX)
static const uint MAX_SPECLIST = 255; static const uint NUM_STATIONSSPECS_PER_STATION = 255; ///< Maximum number of parts per station.
enum TriggerArea { enum TriggerArea {
TA_TILE, TA_TILE,
@ -697,17 +697,17 @@ int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exe
if (statspec == NULL || st == NULL) return 0; if (statspec == NULL || st == NULL) return 0;
for (i = 1; i < st->num_specs && i < MAX_SPECLIST; i++) { for (i = 1; i < st->num_specs && i < NUM_STATIONSSPECS_PER_STATION; i++) {
if (st->speclist[i].spec == NULL && st->speclist[i].grfid == 0) break; if (st->speclist[i].spec == NULL && st->speclist[i].grfid == 0) break;
} }
if (i == MAX_SPECLIST) { if (i == NUM_STATIONSSPECS_PER_STATION) {
/* As final effort when the spec list is already full... /* As final effort when the spec list is already full...
* try to find the same spec and return that one. This might * try to find the same spec and return that one. This might
* result in slightly "wrong" (as per specs) looking stations, * result in slightly "wrong" (as per specs) looking stations,
* but it's fairly unlikely that one reaches the limit anyways. * but it's fairly unlikely that one reaches the limit anyways.
*/ */
for (i = 1; i < st->num_specs && i < MAX_SPECLIST; i++) { for (i = 1; i < st->num_specs && i < NUM_STATIONSSPECS_PER_STATION; i++) {
if (st->speclist[i].spec == statspec) return i; if (st->speclist[i].spec == statspec) return i;
} }