src/economy.cpp
changeset 10365 fa999605dd21
parent 10321 6d58c7470699
child 10429 1b99254f9607
equal deleted inserted replaced
10363:d47dabff0d29 10365:fa999605dd21
    42 #include "track_func.h"
    42 #include "track_func.h"
    43 #include "road_func.h"
    43 #include "road_func.h"
    44 #include "rail_map.h"
    44 #include "rail_map.h"
    45 #include "signal_func.h"
    45 #include "signal_func.h"
    46 #include "gfx_func.h"
    46 #include "gfx_func.h"
       
    47 #include "autoreplace_func.h"
    47 
    48 
    48 #include "table/strings.h"
    49 #include "table/strings.h"
    49 #include "table/sprites.h"
    50 #include "table/sprites.h"
    50 
    51 
    51 /**
    52 /**
   450 			} while (++tile != MapSize());
   451 			} while (++tile != MapSize());
   451 		}
   452 		}
   452 
   453 
   453 		/* update signals in buffer */
   454 		/* update signals in buffer */
   454 		UpdateSignalsInBuffer();
   455 		UpdateSignalsInBuffer();
       
   456 	}
       
   457 
       
   458 	/* In all cases clear replace engine rules.
       
   459 	 * Even if it was copied, it could interfere with new owner's rules */
       
   460 	RemoveAllEngineReplacementForPlayer(GetPlayer(old_player));
       
   461 
       
   462 	if (new_player == PLAYER_SPECTATOR) {
       
   463 		RemoveAllGroupsForPlayer(old_player);
       
   464 	} else {
       
   465 		Group *g;
       
   466 		FOR_ALL_GROUPS(g) {
       
   467 			if (g->owner == old_player) g->owner = new_player;
       
   468 		}
   455 	}
   469 	}
   456 
   470 
   457 	/* Change color of existing windows */
   471 	/* Change color of existing windows */
   458 	if (new_player != PLAYER_SPECTATOR) ChangeWindowOwner(old_player, new_player);
   472 	if (new_player != PLAYER_SPECTATOR) ChangeWindowOwner(old_player, new_player);
   459 
   473