equal
deleted
inserted
replaced
10 #include "saveload.h" |
10 #include "saveload.h" |
11 #include "economy.h" |
11 #include "economy.h" |
12 #include "industry.h" |
12 #include "industry.h" |
13 #include "town.h" |
13 #include "town.h" |
14 |
14 |
15 static void UpdatePlayerHouse(Player *p, uint score) |
15 void UpdatePlayerHouse(Player *p, uint score) |
16 { |
16 { |
17 byte val; |
17 byte val; |
18 uint tile = p->location_of_house; |
18 uint tile = p->location_of_house; |
19 |
19 |
20 if (tile == 0) |
20 if (tile == 0) |
80 return value; |
80 return value; |
81 } |
81 } |
82 |
82 |
83 // if update is set to true, the economy is updated with this score |
83 // if update is set to true, the economy is updated with this score |
84 // (also the house is updated, should only be true in the on-tick event) |
84 // (also the house is updated, should only be true in the on-tick event) |
85 void UpdateCompanyRatingAndValue(Player *p, bool update) |
85 int UpdateCompanyRatingAndValue(Player *p, bool update) |
86 { |
86 { |
87 byte owner = p->index; |
87 byte owner = p->index; |
88 int score = 0; |
88 int score = 0; |
89 |
89 |
90 memset(_score_part[owner], 0, sizeof(_score_part[owner])); |
90 memset(_score_part[owner], 0, sizeof(_score_part[owner])); |
223 UpdatePlayerHouse(p, score); |
223 UpdatePlayerHouse(p, score); |
224 p->old_economy[0].company_value = CalculateCompanyValue(p); |
224 p->old_economy[0].company_value = CalculateCompanyValue(p); |
225 } |
225 } |
226 |
226 |
227 InvalidateWindow(WC_PERFORMANCE_DETAIL, 0); |
227 InvalidateWindow(WC_PERFORMANCE_DETAIL, 0); |
|
228 return score; |
228 } |
229 } |
229 |
230 |
230 // use 255 as new_player to delete the player. |
231 // use 255 as new_player to delete the player. |
231 void ChangeOwnershipOfPlayerItems(byte old_player, byte new_player) |
232 void ChangeOwnershipOfPlayerItems(byte old_player, byte new_player) |
232 { |
233 { |
383 if (IS_HUMAN_PLAYER(owner)) { |
384 if (IS_HUMAN_PLAYER(owner)) { |
384 p->bankrupt_asked = 255; |
385 p->bankrupt_asked = 255; |
385 p->bankrupt_timeout = 0x456; |
386 p->bankrupt_timeout = 0x456; |
386 } else { |
387 } else { |
387 p->money64 = p->player_money = 100000000; |
388 p->money64 = p->player_money = 100000000; |
388 ChangeOwnershipOfPlayerItems(owner, 0xFF); |
389 ChangeOwnershipOfPlayerItems(owner, 0xFF); // 255 is no owner |
389 p->is_active = false; |
390 p->is_active = false; |
390 } |
391 } |
391 } |
392 } |
392 } |
393 } |
393 |
394 |