diff options
author | smatz <smatz@openttd.org> | 2008-01-05 22:04:11 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-01-05 22:04:11 +0000 |
commit | e165aad4dbeaecef69e9173b280b1e8e9ded1b5a (patch) | |
tree | 57eea703fc934e6e1547df4a0e0407ba67818f6b /src | |
parent | 91be5d75311a4a032164d733f6ed97dc87419cca (diff) | |
download | openttd-e165aad4dbeaecef69e9173b280b1e8e9ded1b5a.tar.xz |
(svn r11763) -Fix: update signal states after merging a company
Diffstat (limited to 'src')
-rw-r--r-- | src/economy.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index dae1ab3ad..8e6a7e2d1 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -40,6 +40,9 @@ #include "date_func.h" #include "vehicle_func.h" #include "sound_func.h" +#include "track_type.h" +#include "track_func.h" +#include "rail_map.h" /** * Multiply two integer values and shift the results to right. @@ -423,6 +426,22 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player) do { ChangeTileOwner(tile, old_player, new_player); } while (++tile != MapSize()); + + if (new_player != PLAYER_SPECTATOR) { + /* Update all signals because there can be new segment that was owned by two players + * and signals were not propagated */ + tile = 0; + + do { + if (IsTileType(tile, MP_RAILWAY) && IsTileOwner(tile, new_player) && HasSignals(tile)) { + TrackBits tracks = GetTrackBits(tile); + do { // there may be two tracks with signals for TRACK_BIT_HORZ and TRACK_BIT_VERT + Track track = RemoveFirstTrack(&tracks); + if (HasSignalOnTrack(tile, track)) SetSignalsOnBothDir(tile, track); + } while (tracks != TRACK_BIT_NONE); + } + } while (++tile != MapSize()); + } } /* Change color of existing windows */ |