equal
deleted
inserted
replaced
38 #include "functions.h" |
38 #include "functions.h" |
39 #include "window_func.h" |
39 #include "window_func.h" |
40 #include "date_func.h" |
40 #include "date_func.h" |
41 #include "vehicle_func.h" |
41 #include "vehicle_func.h" |
42 #include "sound_func.h" |
42 #include "sound_func.h" |
|
43 #include "track_type.h" |
|
44 #include "track_func.h" |
|
45 #include "rail_map.h" |
43 |
46 |
44 /** |
47 /** |
45 * Multiply two integer values and shift the results to right. |
48 * Multiply two integer values and shift the results to right. |
46 * |
49 * |
47 * This function multiplies two integer values. The result is |
50 * This function multiplies two integer values. The result is |
421 { |
424 { |
422 TileIndex tile = 0; |
425 TileIndex tile = 0; |
423 do { |
426 do { |
424 ChangeTileOwner(tile, old_player, new_player); |
427 ChangeTileOwner(tile, old_player, new_player); |
425 } while (++tile != MapSize()); |
428 } while (++tile != MapSize()); |
|
429 |
|
430 if (new_player != PLAYER_SPECTATOR) { |
|
431 /* Update all signals because there can be new segment that was owned by two players |
|
432 * and signals were not propagated */ |
|
433 tile = 0; |
|
434 |
|
435 do { |
|
436 if (IsTileType(tile, MP_RAILWAY) && IsTileOwner(tile, new_player) && HasSignals(tile)) { |
|
437 TrackBits tracks = GetTrackBits(tile); |
|
438 do { // there may be two tracks with signals for TRACK_BIT_HORZ and TRACK_BIT_VERT |
|
439 Track track = RemoveFirstTrack(&tracks); |
|
440 if (HasSignalOnTrack(tile, track)) SetSignalsOnBothDir(tile, track); |
|
441 } while (tracks != TRACK_BIT_NONE); |
|
442 } |
|
443 } while (++tile != MapSize()); |
|
444 } |
426 } |
445 } |
427 |
446 |
428 /* Change color of existing windows */ |
447 /* Change color of existing windows */ |
429 if (new_player != PLAYER_SPECTATOR) ChangeWindowOwner(old_player, new_player); |
448 if (new_player != PLAYER_SPECTATOR) ChangeWindowOwner(old_player, new_player); |
430 |
449 |