src/economy.cpp
branchnoai
changeset 10455 22c441f5adf9
parent 10358 73d8177db39e
child 10513 33cb70ff2f5d
equal deleted inserted replaced
10412:ef44f62cb8b9 10455:22c441f5adf9
     1 /* $Id$ */
     1 /* $Id$ */
     2 
     2 
     3 /** @file economy.cpp */
     3 /** @file economy.cpp Handling of the economy. */
     4 
     4 
     5 #include "stdafx.h"
     5 #include "stdafx.h"
     6 #include "openttd.h"
     6 #include "openttd.h"
     7 #include "currency.h"
     7 #include "currency.h"
     8 #include "landscape.h"
     8 #include "landscape.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 "settings_type.h"
    47 #include "settings_type.h"
       
    48 #include "autoreplace_func.h"
       
    49 #include "player_gui.h"
    48 
    50 
    49 #include "table/strings.h"
    51 #include "table/strings.h"
    50 #include "table/sprites.h"
    52 #include "table/sprites.h"
    51 
    53 
    52 /**
    54 /**
   451 			} while (++tile != MapSize());
   453 			} while (++tile != MapSize());
   452 		}
   454 		}
   453 
   455 
   454 		/* update signals in buffer */
   456 		/* update signals in buffer */
   455 		UpdateSignalsInBuffer();
   457 		UpdateSignalsInBuffer();
       
   458 	}
       
   459 
       
   460 	/* In all cases clear replace engine rules.
       
   461 	 * Even if it was copied, it could interfere with new owner's rules */
       
   462 	RemoveAllEngineReplacementForPlayer(GetPlayer(old_player));
       
   463 
       
   464 	if (new_player == PLAYER_SPECTATOR) {
       
   465 		RemoveAllGroupsForPlayer(old_player);
       
   466 	} else {
       
   467 		Group *g;
       
   468 		FOR_ALL_GROUPS(g) {
       
   469 			if (g->owner == old_player) g->owner = new_player;
       
   470 		}
   456 	}
   471 	}
   457 
   472 
   458 	/* Change color of existing windows */
   473 	/* Change color of existing windows */
   459 	if (new_player != PLAYER_SPECTATOR) ChangeWindowOwner(old_player, new_player);
   474 	if (new_player != PLAYER_SPECTATOR) ChangeWindowOwner(old_player, new_player);
   460 
   475