mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r4782) - Newstations: fix issue with saving/loading games with newstations on big endian architectures.
This commit is contained in:
parent
e33db100b9
commit
7d41c0d7cf
@ -18,6 +18,10 @@
|
|||||||
|
|
||||||
static StationClass station_classes[STAT_CLASS_MAX];
|
static StationClass station_classes[STAT_CLASS_MAX];
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MAX_SPECLIST = 255,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset station classes to their default state.
|
* Reset station classes to their default state.
|
||||||
* This includes initialising the Default and Waypoint classes with an empty
|
* This includes initialising the Default and Waypoint classes with an empty
|
||||||
@ -539,15 +543,15 @@ int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec)
|
|||||||
if (statspec == NULL) return 0;
|
if (statspec == NULL) return 0;
|
||||||
|
|
||||||
/* Check if this spec has already been allocated */
|
/* Check if this spec has already been allocated */
|
||||||
for (i = 1; i < st->num_specs && i < 256; i++) {
|
for (i = 1; i < st->num_specs && i < MAX_SPECLIST; i++) {
|
||||||
if (st->speclist[i].spec == statspec) return i;
|
if (st->speclist[i].spec == statspec) return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < st->num_specs && i < 256; i++) {
|
for (i = 1; i < st->num_specs && i < MAX_SPECLIST; 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 == 256) return -1;
|
if (i == MAX_SPECLIST) return -1;
|
||||||
|
|
||||||
if (exec) {
|
if (exec) {
|
||||||
if (i >= st->num_specs) {
|
if (i >= st->num_specs) {
|
||||||
|
@ -72,7 +72,7 @@ struct Station {
|
|||||||
byte trainst_w, trainst_h;
|
byte trainst_w, trainst_h;
|
||||||
|
|
||||||
/** List of custom stations (StationSpecs) allocated to the station */
|
/** List of custom stations (StationSpecs) allocated to the station */
|
||||||
uint num_specs;
|
uint8 num_specs;
|
||||||
StationSpecList *speclist;
|
StationSpecList *speclist;
|
||||||
|
|
||||||
uint16 build_date;
|
uint16 build_date;
|
||||||
|
Loading…
Reference in New Issue
Block a user