(svn r16897) -Codechange: use the 'generic' station spec to station allocation for waypoints too

This commit is contained in:
rubidium
2009-07-21 11:20:34 +00:00
parent 43eda3dfbf
commit ed5ced71c8
6 changed files with 11 additions and 33 deletions

View File

@@ -25,8 +25,8 @@ void AfterLoadWaypoints()
for (uint i = 0; i < GetNumCustomStations(STAT_CLASS_WAYP); i++) {
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, i);
if (statspec != NULL && statspec->grffile->grfid == wp->speclist->grfid && statspec->localidx == wp->speclist->localidx) {
wp->speclist->spec = statspec;
if (statspec != NULL && statspec->grffile->grfid == wp->speclist[1].grfid && statspec->localidx == wp->speclist[1].localidx) {
wp->speclist[1].spec = statspec;
break;
}
}
@@ -65,7 +65,7 @@ static void Save_WAYP()
if (wp->num_specs == 0) {
_waypoint_spec.grfid = 0;
} else {
_waypoint_spec = *wp->speclist;
_waypoint_spec = wp->speclist[1];
}
SlSetArrayIndex(wp->index);
@@ -86,9 +86,9 @@ static void Load_WAYP()
SlObject(wp, _waypoint_desc);
if (_waypoint_spec.grfid != 0) {
wp->num_specs = 1;
wp->speclist = MallocT<StationSpecList>(1);
*wp->speclist = _waypoint_spec;
wp->num_specs = 2;
wp->speclist = CallocT<StationSpecList>(2);
wp->speclist[1] = _waypoint_spec;
}
if (CheckSavegameVersion(84)) wp->name = (char *)(size_t)_waypoint_string_id;