summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-08 13:35:25 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-08 13:35:25 +0000
commite4aed988272eee0b6bde40c26f174a977cba3e71 (patch)
tree91a7682c9f1673532672c2e43c514ba3476fde89
parent05e2c6b886d28cda1dfd2a4d6e6eaa6b4ecca76b (diff)
downloadopenttd-e4aed988272eee0b6bde40c26f174a977cba3e71.tar.xz
(svn r4782) - Newstations: fix issue with saving/loading games with newstations on big endian architectures.
-rw-r--r--newgrf_station.c10
-rw-r--r--station.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/newgrf_station.c b/newgrf_station.c
index 2b699e217..a6a470261 100644
--- a/newgrf_station.c
+++ b/newgrf_station.c
@@ -18,6 +18,10 @@
static StationClass station_classes[STAT_CLASS_MAX];
+enum {
+ MAX_SPECLIST = 255,
+};
+
/**
* Reset station classes to their default state.
* 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;
/* 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;
}
- 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 (i == 256) return -1;
+ if (i == MAX_SPECLIST) return -1;
if (exec) {
if (i >= st->num_specs) {
diff --git a/station.h b/station.h
index 5f2a36dad..4101a4d08 100644
--- a/station.h
+++ b/station.h
@@ -72,7 +72,7 @@ struct Station {
byte trainst_w, trainst_h;
/** List of custom stations (StationSpecs) allocated to the station */
- uint num_specs;
+ uint8 num_specs;
StationSpecList *speclist;
uint16 build_date;