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