(svn r1023) -Fix: [Network] [ 1083692 ] You can no longer buy out a company in MP

because of the lag between commands (anyway, I hope)
This commit is contained in:
truelight
2004-12-12 14:00:25 +00:00
parent a501e89624
commit 242f2c7b60
2 changed files with 12 additions and 3 deletions

View File

@@ -1466,6 +1466,8 @@ static void DoAcquireCompany(Player *p)
DeletePlayerWindows(pi);
}
extern int GetAmountOwnedBy(Player *p, byte owner);
int32 CmdBuyShareInCompany(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
Player *p;
@@ -1476,6 +1478,13 @@ int32 CmdBuyShareInCompany(int x, int y, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_OTHER);
p = DEREF_PLAYER(p1);
/* Those lines are here for network-protection (clients can be slow) */
if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0)
return 0;
/* We can not buy out a real player in networking */
if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai)
return 0;
cost = CalculateCompanyValue(p) >> 2;
if (flags & DC_EXEC) {
b = p->share_owners;