diff options
author | rubidium <rubidium@openttd.org> | 2009-05-17 10:19:00 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-05-17 10:19:00 +0000 |
commit | 6b2f9e8c9edd6a8e5528898db0bbdb884b0221a2 (patch) | |
tree | 11aa3acb6ccf66deee909b5ff688cc1670886f06 /src | |
parent | 871107f52952ee59c353feab933126ed206e60bf (diff) | |
download | openttd-6b2f9e8c9edd6a8e5528898db0bbdb884b0221a2.tar.xz |
(svn r16328) -Fix: desync when removing lots of stations
Diffstat (limited to 'src')
-rw-r--r-- | src/saveload/misc_sl.cpp | 2 | ||||
-rw-r--r-- | src/saveload/oldloader_sl.cpp | 3 | ||||
-rw-r--r-- | src/saveload/station_sl.cpp | 3 | ||||
-rw-r--r-- | src/station_cmd.cpp | 14 | ||||
-rw-r--r-- | src/variables.h | 4 |
5 files changed, 8 insertions, 18 deletions
diff --git a/src/saveload/misc_sl.cpp b/src/saveload/misc_sl.cpp index 499dec754..088c1b26e 100644 --- a/src/saveload/misc_sl.cpp +++ b/src/saveload/misc_sl.cpp @@ -65,7 +65,7 @@ static const SaveLoadGlobVarList _date_desc[] = { SLEG_CONDVAR(_cur_tileloop_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLEG_CONDVAR(_cur_tileloop_tile, SLE_UINT32, 6, SL_MAX_VERSION), SLEG_VAR(_disaster_delay, SLE_UINT16), - SLEG_VAR(_station_tick_ctr, SLE_UINT16), + SLE_CONDNULL(2, 0, 119), SLEG_VAR(_random.state[0], SLE_UINT32), SLEG_VAR(_random.state[1], SLE_UINT32), SLEG_CONDVAR(_cur_town_ctr, SLE_FILE_U8 | SLE_VAR_U32, 0, 9), diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index 0dce4a5ae..787adde34 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -1707,8 +1707,7 @@ static const OldChunks main_chunk[] = { OCL_CNULL( OC_TTD, 144 ), ///< AI cargo-stuff, calculated in InitializeLandscapeVariables OCL_NULL( 2 ), ///< Company indexes of companies, no longer in use - - OCL_VAR ( OC_FILE_U8 | OC_VAR_U16, 1, &_station_tick_ctr ), + OCL_NULL( 1 ), ///< Station tick counter, no longer in use OCL_VAR ( OC_UINT8, 1, &_settings_game.locale.currency ), OCL_VAR ( OC_UINT8, 1, &_settings_game.locale.units ), diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index e166e93a0..715ded17a 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -195,9 +195,6 @@ static void Load_STNS() SaveLoad_STNS(st); } - - /* This is to ensure all pointers are within the limits of _stations_size */ - if (_station_tick_ctr > GetMaxStationIndex()) _station_tick_ctr = 0; } static void Save_ROADSTOP() diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index f307c8701..ef936ddfe 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2699,7 +2699,11 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i return VETSB_CONTINUE; } -/* this function is called for one station each tick */ +/** + * This function is called for each station once every 250 ticks. + * Not all stations will get the tick at the same time. + * @param st the station receiving the tick. + */ static void StationHandleBigTick(Station *st) { UpdateStationAcceptance(st, true); @@ -2839,11 +2843,6 @@ void OnTick_Station() { if (_game_mode == GM_EDITOR) return; - uint i = _station_tick_ctr; - if (++_station_tick_ctr > GetMaxStationIndex()) _station_tick_ctr = 0; - - if (Station::IsValidID(i)) StationHandleBigTick(Station::Get(i)); - Station *st; FOR_ALL_STATIONS(st) { StationHandleSmallTick(st); @@ -2852,6 +2851,7 @@ void OnTick_Station() * Station index is included so that triggers are not all done * at the same time. */ if ((_tick_counter + st->index) % 250 == 0) { + StationHandleBigTick(st); StationAnimationTrigger(st, st->xy, STAT_ANIM_250_TICKS); } } @@ -3211,8 +3211,6 @@ void InitializeStations() /* Clean the roadstop pool and create 1 block in it */ _RoadStop_pool.CleanPool(); _RoadStop_pool.AddBlockToPool(); - - _station_tick_ctr = 0; } static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) diff --git a/src/variables.h b/src/variables.h index 5ef2d9c50..6a4c9f527 100644 --- a/src/variables.h +++ b/src/variables.h @@ -18,10 +18,6 @@ VARDEF byte _age_cargo_skip_counter; /* Also save scrollpos_x, scrollpos_y and zoom */ VARDEF uint16 _disaster_delay; -/* Determines what station to operate on in the - * tick handler. */ -VARDEF uint16 _station_tick_ctr; - /* Determines how often to run the tree loop */ VARDEF byte _trees_tick_ctr; |