comparison src/station_cmd.cpp @ 5716:3c620ec4e6c7 draft

(svn r8207) -Fix Remove the write-only attribute RoadStop::station
author tron <tron@openttd.org>
date Wed, 17 Jan 2007 21:14:17 +0000
parents ae0941f46aeb
children e9077998bcac
comparison
equal deleted inserted replaced
5715:54ea61b8c5ca 5716:3c620ec4e6c7
1359 st = GetClosestStationFromTile(tile, 8, _current_player); 1359 st = GetClosestStationFromTile(tile, 8, _current_player);
1360 if (st != NULL && st->facilities != 0) st = NULL; 1360 if (st != NULL && st->facilities != 0) st = NULL;
1361 } 1361 }
1362 1362
1363 //give us a road stop in the list, and check if something went wrong 1363 //give us a road stop in the list, and check if something went wrong
1364 road_stop = new RoadStop(tile, INVALID_STATION); 1364 road_stop = new RoadStop(tile);
1365 if (road_stop == NULL) { 1365 if (road_stop == NULL) {
1366 return_cmd_error(type ? STR_3008B_TOO_MANY_TRUCK_STOPS : STR_3008A_TOO_MANY_BUS_STOPS); 1366 return_cmd_error(type ? STR_3008B_TOO_MANY_TRUCK_STOPS : STR_3008A_TOO_MANY_BUS_STOPS);
1367 } 1367 }
1368 1368
1369 if (st != NULL && 1369 if (st != NULL &&
1410 //point to the correct item in the _busstops or _truckstops array 1410 //point to the correct item in the _busstops or _truckstops array
1411 *currstop = road_stop; 1411 *currstop = road_stop;
1412 1412
1413 //initialize an empty station 1413 //initialize an empty station
1414 road_stop->prev = prev; 1414 road_stop->prev = prev;
1415 road_stop->station = st->index;
1416 if (!st->facilities) st->xy = tile; 1415 if (!st->facilities) st->xy = tile;
1417 st->facilities |= (type) ? FACIL_TRUCK_STOP : FACIL_BUS_STOP; 1416 st->facilities |= (type) ? FACIL_TRUCK_STOP : FACIL_BUS_STOP;
1418 st->owner = _current_player; 1417 st->owner = _current_player;
1419 1418
1420 st->build_date = _date; 1419 st->build_date = _date;
2850 SLE_VAR(RoadStop,xy, SLE_UINT32), 2849 SLE_VAR(RoadStop,xy, SLE_UINT32),
2851 SLE_VAR(RoadStop,used, SLE_BOOL), 2850 SLE_VAR(RoadStop,used, SLE_BOOL),
2852 SLE_VAR(RoadStop,status, SLE_UINT8), 2851 SLE_VAR(RoadStop,status, SLE_UINT8),
2853 /* Index was saved in some versions, but this is not needed */ 2852 /* Index was saved in some versions, but this is not needed */
2854 SLE_CONDNULL(4, 0, 8), 2853 SLE_CONDNULL(4, 0, 8),
2855 SLE_VAR(RoadStop,station, SLE_UINT16), 2854 SLE_CONDNULL(2, 0, 44),
2856 SLE_CONDNULL(1, 0, 25), 2855 SLE_CONDNULL(1, 0, 25),
2857 2856
2858 SLE_REF(RoadStop,next, REF_ROADSTOPS), 2857 SLE_REF(RoadStop,next, REF_ROADSTOPS),
2859 SLE_REF(RoadStop,prev, REF_ROADSTOPS), 2858 SLE_REF(RoadStop,prev, REF_ROADSTOPS),
2860 2859
3005 3004
3006 /* In older versions, we had just 1 tile for a bus/lorry, now we have more.. 3005 /* In older versions, we had just 1 tile for a bus/lorry, now we have more..
3007 * convert, if needed */ 3006 * convert, if needed */
3008 if (CheckSavegameVersion(6)) { 3007 if (CheckSavegameVersion(6)) {
3009 if (st->bus_tile_obsolete != 0) { 3008 if (st->bus_tile_obsolete != 0) {
3010 st->bus_stops = new RoadStop(st->bus_tile_obsolete, st->index); 3009 st->bus_stops = new RoadStop(st->bus_tile_obsolete);
3011 if (st->bus_stops == NULL) 3010 if (st->bus_stops == NULL)
3012 error("Station: too many busstations in savegame"); 3011 error("Station: too many busstations in savegame");
3013 3012
3014 } 3013 }
3015 if (st->lorry_tile_obsolete != 0) { 3014 if (st->lorry_tile_obsolete != 0) {
3016 st->truck_stops = new RoadStop(st->lorry_tile_obsolete, st->index); 3015 st->truck_stops = new RoadStop(st->lorry_tile_obsolete);
3017 if (st->truck_stops == NULL) 3016 if (st->truck_stops == NULL)
3018 error("Station: too many truckstations in savegame"); 3017 error("Station: too many truckstations in savegame");
3019 3018
3020 } 3019 }
3021 } 3020 }
3038 static void Load_ROADSTOP(void) 3037 static void Load_ROADSTOP(void)
3039 { 3038 {
3040 int index; 3039 int index;
3041 3040
3042 while ((index = SlIterateArray()) != -1) { 3041 while ((index = SlIterateArray()) != -1) {
3043 RoadStop *rs = new (index) RoadStop(INVALID_TILE, INVALID_STATION); 3042 RoadStop *rs = new (index) RoadStop(INVALID_TILE);
3044 3043
3045 SlObject(rs, _roadstop_desc); 3044 SlObject(rs, _roadstop_desc);
3046 } 3045 }
3047 } 3046 }
3048 3047