(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
This commit is contained in:
@@ -94,10 +94,10 @@ void HandleOnEditText(const char *str)
|
||||
const Player *p = GetPlayer(_current_player);
|
||||
Money money = min(p->player_money - p->current_loan, atoi(str) / _currency->rate);
|
||||
|
||||
money = clamp(money, 0, 20000000); // Clamp between 20 million and 0
|
||||
uint32 money_c = clamp(ClampToI32(money), 0, 20000000); // Clamp between 20 million and 0
|
||||
|
||||
/* Give 'id' the money, and substract it from ourself */
|
||||
DoCommandP(0, money, id, CcGiveMoney, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS));
|
||||
DoCommandP(0, money_c, id, CcGiveMoney, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS));
|
||||
} break;
|
||||
#endif /* ENABLE_NETWORK */
|
||||
default: NOT_REACHED();
|
||||
|
Reference in New Issue
Block a user