summaryrefslogtreecommitdiff
path: root/economy.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-12-08 12:31:34 +0000
committerpeter1138 <peter1138@openttd.org>2006-12-08 12:31:34 +0000
commit6648621e08950d0fc4265af96439c2e3ee00900f (patch)
tree9fd6206f8eed12c780a12f0c23a44475bbbc6af8 /economy.c
parentd23210e0485f41a56bf40cdba61ed49194ee833f (diff)
downloadopenttd-6648621e08950d0fc4265af96439c2e3ee00900f.tar.xz
(svn r7433) -Fix (r2301): Town ratings were not reset when a company went bankrupt.
Diffstat (limited to 'economy.c')
-rw-r--r--economy.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/economy.c b/economy.c
index 83b166751..61dc1a20d 100644
--- a/economy.c
+++ b/economy.c
@@ -244,6 +244,7 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
// use PLAYER_SPECTATOR as new_player to delete the player.
void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
{
+ Town *t;
PlayerID old = _current_player;
_current_player = old_player;
@@ -266,10 +267,9 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
}
/* Take care of rating in towns */
- if (new_player != PLAYER_SPECTATOR) {
- Town *t;
- FOR_ALL_TOWNS(t) {
- /* If a player takes over, give the ratings to that player. */
+ FOR_ALL_TOWNS(t) {
+ /* If a player takes over, give the ratings to that player. */
+ if (new_player != PLAYER_SPECTATOR) {
if (HASBIT(t->have_ratings, old_player)) {
if (HASBIT(t->have_ratings, new_player)) {
// use max of the two ratings.
@@ -279,10 +279,11 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
t->ratings[new_player] = t->ratings[old_player];
}
}
-
- t->ratings[old_player] = 500;
- CLRBIT(t->have_ratings, old_player);
}
+
+ /* Reset the ratings for the old player */
+ t->ratings[old_player] = 500;
+ CLRBIT(t->have_ratings, old_player);
}
{