Mercurial > hg > openttd
changeset 5284:66be99d68589 draft
(svn r7433) -Fix (r2301): Town ratings were not reset when a company went bankrupt.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Fri, 08 Dec 2006 12:31:34 +0000 |
parents | e25d51a2a83d |
children | 30d45a9429cc |
files | economy.c |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/economy.c +++ b/economy.c @@ -244,6 +244,7 @@ // 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 @@ } /* 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 @@ 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); } {