summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-16 20:29:08 +0000
committerrubidium <rubidium@openttd.org>2009-07-16 20:29:08 +0000
commit665fa7f9c170774f6a640ecf381f714b50b6b174 (patch)
treec50cc3aa827d9d7f6d3db036b1b2cee952bd3cb6 /src/saveload
parentdea1144bcb52b6c5f2c985395b2775cedcbff5ce (diff)
downloadopenttd-665fa7f9c170774f6a640ecf381f714b50b6b174.tar.xz
(svn r16851) -Codechange: use StationSpecList in waypoint too
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp15
-rw-r--r--src/saveload/waypoint_sl.cpp34
2 files changed, 25 insertions, 24 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 9d1537a7d..9ef1f8986 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1008,18 +1008,19 @@ bool AfterLoadGame()
if (wp->delete_ctr == 0) {
const StationSpec *statspec = NULL;
- if (HasBit(_m[wp->xy].m3, 4))
+ if (HasBit(_m[wp->xy].m3, 4)) {
statspec = GetCustomStationSpec(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1);
+ }
if (statspec != NULL) {
- wp->stat_id = _m[wp->xy].m4 + 1;
- wp->grfid = statspec->grffile->grfid;
- wp->localidx = statspec->localidx;
+ wp->spec.spec = statspec;
+ wp->spec.grfid = statspec->grffile->grfid;
+ wp->spec.localidx = statspec->localidx;
} else {
/* No custom graphics set, so set to default. */
- wp->stat_id = 0;
- wp->grfid = 0;
- wp->localidx = 0;
+ wp->spec.spec = NULL;
+ wp->spec.grfid = 0;
+ wp->spec.localidx = 0;
}
/* Move ground type bits from m2 to m4. */
diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp
index 46a2ddb2a..b6b27a337 100644
--- a/src/saveload/waypoint_sl.cpp
+++ b/src/saveload/waypoint_sl.cpp
@@ -22,12 +22,12 @@ void AfterLoadWaypoints()
FOR_ALL_WAYPOINTS(wp) {
uint i;
- if (wp->grfid == 0) continue;
+ if (wp->spec.grfid == 0) continue;
for (i = 0; i < GetNumCustomStations(STAT_CLASS_WAYP); i++) {
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, i);
- if (statspec != NULL && statspec->grffile->grfid == wp->grfid && statspec->localidx == wp->localidx) {
- wp->stat_id = i;
+ if (statspec != NULL && statspec->grffile->grfid == wp->spec.grfid && statspec->localidx == wp->spec.localidx) {
+ wp->spec.spec = statspec;
break;
}
}
@@ -53,20 +53,20 @@ void FixOldWaypoints()
}
static const SaveLoad _waypoint_desc[] = {
- SLE_CONDVAR(Waypoint, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
- SLE_CONDVAR(Waypoint, xy, SLE_UINT32, 6, SL_MAX_VERSION),
- SLE_CONDVAR(Waypoint, town_index, SLE_UINT16, 12, SL_MAX_VERSION),
- SLE_CONDVAR(Waypoint, town_cn, SLE_FILE_U8 | SLE_VAR_U16, 12, 88),
- SLE_CONDVAR(Waypoint, town_cn, SLE_UINT16, 89, SL_MAX_VERSION),
- SLE_CONDVAR(Waypoint, string_id, SLE_STRINGID, 0, 83),
- SLE_CONDSTR(Waypoint, name, SLE_STR, 0, 84, SL_MAX_VERSION),
- SLE_VAR(Waypoint, delete_ctr, SLE_UINT8),
-
- SLE_CONDVAR(Waypoint, build_date, SLE_FILE_U16 | SLE_VAR_I32, 3, 30),
- SLE_CONDVAR(Waypoint, build_date, SLE_INT32, 31, SL_MAX_VERSION),
- SLE_CONDVAR(Waypoint, localidx, SLE_UINT8, 3, SL_MAX_VERSION),
- SLE_CONDVAR(Waypoint, grfid, SLE_UINT32, 17, SL_MAX_VERSION),
- SLE_CONDVAR(Waypoint, owner, SLE_UINT8, 101, SL_MAX_VERSION),
+ SLE_CONDVAR(Waypoint, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
+ SLE_CONDVAR(Waypoint, xy, SLE_UINT32, 6, SL_MAX_VERSION),
+ SLE_CONDVAR(Waypoint, town_index, SLE_UINT16, 12, SL_MAX_VERSION),
+ SLE_CONDVAR(Waypoint, town_cn, SLE_FILE_U8 | SLE_VAR_U16, 12, 88),
+ SLE_CONDVAR(Waypoint, town_cn, SLE_UINT16, 89, SL_MAX_VERSION),
+ SLE_CONDVAR(Waypoint, string_id, SLE_STRINGID, 0, 83),
+ SLE_CONDSTR(Waypoint, name, SLE_STR, 0, 84, SL_MAX_VERSION),
+ SLE_VAR(Waypoint, delete_ctr, SLE_UINT8),
+
+ SLE_CONDVAR(Waypoint, build_date, SLE_FILE_U16 | SLE_VAR_I32, 3, 30),
+ SLE_CONDVAR(Waypoint, build_date, SLE_INT32, 31, SL_MAX_VERSION),
+ SLE_CONDVAR(Waypoint, spec.localidx, SLE_UINT8, 3, SL_MAX_VERSION),
+ SLE_CONDVAR(Waypoint, spec.grfid, SLE_UINT32, 17, SL_MAX_VERSION),
+ SLE_CONDVAR(Waypoint, owner, SLE_UINT8, 101, SL_MAX_VERSION),
SLE_END()
};