Fix #9348, 4d74e51: don't try to sell shares of spectators (#9349)

"new_owner" can be INVALID_OWNER, and as INVALID_OWNER ==
COMPANY_SPECTATORS, we could end up trying to sell shares of
nobody.

(cherry picked from commit ef25afd55a)
This commit is contained in:
Patric Stout
2021-06-11 00:18:20 +02:00
committed by Jonathan G Rennison
parent 7aa63e9726
commit 5b50ae72f8
2 changed files with 5 additions and 3 deletions

View File

@@ -71,7 +71,7 @@ Company::Company(uint16 name_1, bool is_ai)
this->purchase_land_limit = (uint32)_settings_game.construction.purchase_land_frame_burst << 16;
this->build_object_limit = (uint32)_settings_game.construction.build_object_frame_burst << 16;
for (uint j = 0; j < 4; j++) this->share_owners[j] = COMPANY_SPECTATOR;
for (uint j = 0; j < 4; j++) this->share_owners[j] = INVALID_OWNER;
InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, INVALID_COMPANY);
}