equal
deleted
inserted
replaced
1531 int i; |
1531 int i; |
1532 |
1532 |
1533 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
1533 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
1534 p = DEREF_PLAYER(p1); |
1534 p = DEREF_PLAYER(p1); |
1535 |
1535 |
|
1536 /* Check if buying shares is allowed (protection against modified clients */ |
|
1537 if (!_patches.allow_shares) |
|
1538 return CMD_ERROR; |
|
1539 |
1536 /* Those lines are here for network-protection (clients can be slow) */ |
1540 /* Those lines are here for network-protection (clients can be slow) */ |
1537 if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) |
1541 if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) |
1538 return 0; |
1542 return 0; |
|
1543 |
1539 /* We can not buy out a real player in networking */ |
1544 /* We can not buy out a real player in networking */ |
1540 if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) |
1545 if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) |
1541 return 0; |
1546 return 0; |
1542 |
1547 |
1543 cost = CalculateCompanyValue(p) >> 2; |
1548 cost = CalculateCompanyValue(p) >> 2; |
1544 if (flags & DC_EXEC) { |
1549 if (flags & DC_EXEC) { |
1545 b = p->share_owners; |
1550 b = p->share_owners; |
1546 while (*b != 0xFF) b++; /* share owners is guaranteed to contain at least one 0xFF */ |
1551 while (*b != 0xFF) b++; /* share owners is guaranteed to contain at least one 0xFF */ |
1547 *b = _current_player; |
1552 *b = _current_player; |
1565 byte *b; |
1570 byte *b; |
1566 |
1571 |
1567 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
1572 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
1568 p = DEREF_PLAYER(p1); |
1573 p = DEREF_PLAYER(p1); |
1569 |
1574 |
|
1575 /* Check if selling shares is allowed (protection against modified clients */ |
|
1576 if (!_patches.allow_shares) |
|
1577 return CMD_ERROR; |
|
1578 |
1570 /* Those lines are here for network-protection (clients can be slow) */ |
1579 /* Those lines are here for network-protection (clients can be slow) */ |
1571 if (GetAmountOwnedBy(p, _current_player) == 0) |
1580 if (GetAmountOwnedBy(p, _current_player) == 0) |
1572 return 0; |
1581 return 0; |
1573 |
1582 |
1574 /* adjust it a little to make it less profitable to sell and buy */ |
1583 /* adjust it a little to make it less profitable to sell and buy */ |