|
@@ -54,36 +54,34 @@ void CcGiveMoney(bool success, TileIndex
|
|
|
snprintf(msg, sizeof(msg), "%d", p1);
|
|
|
|
|
|
if (!_network_server) {
|
|
|
NetworkClientSendChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg);
|
|
|
} else {
|
|
|
NetworkServerSendChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg, CLIENT_ID_SERVER);
|
|
|
}
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
}
|
|
|
|
|
|
void HandleOnEditText(const char *str)
|
|
|
{
|
|
|
_cmd_text = str;
|
|
|
|
|
|
switch (_rename_what) {
|
|
|
#ifdef ENABLE_NETWORK
|
|
|
case 3: { // Give money, you can only give money in excess of loan
|
|
|
const Company *c = GetCompany(_current_company);
|
|
|
Money money = min(c->money - c->current_loan, (Money)(atoi(str) / _currency->rate));
|
|
|
|
|
|
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_c, _rename_id, CcGiveMoney, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS));
|
|
|
DoCommandP(0, money_c, _rename_id, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS), CcGiveMoney, str);
|
|
|
} break;
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
default: NOT_REACHED();
|
|
|
}
|
|
|
|
|
|
_rename_id = _rename_what = -1;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* This code is shared for the majority of the pushbuttons.
|
|
|
* Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters
|
|
|
*
|
|
@@ -262,25 +260,25 @@ struct MainWindow : Window
|
|
|
case 'R' | WKC_CTRL: MarkWholeScreenDirty(); break;
|
|
|
|
|
|
#if defined(_DEBUG)
|
|
|
case '0' | WKC_ALT: // Crash the game
|
|
|
*(byte*)0 = 0;
|
|
|
break;
|
|
|
|
|
|
case '1' | WKC_ALT: // Gimme money
|
|
|
/* Server can not cheat in advertise mode either! */
|
|
|
#ifdef ENABLE_NETWORK
|
|
|
if (!_networking || !_network_server || !_settings_client.network.server_advertise)
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
DoCommandP(0, 10000000, 0, NULL, CMD_MONEY_CHEAT);
|
|
|
DoCommandP(0, 10000000, 0, CMD_MONEY_CHEAT);
|
|
|
break;
|
|
|
|
|
|
case '2' | WKC_ALT: // Update the coordinates of all station signs
|
|
|
UpdateAllStationVirtCoord();
|
|
|
break;
|
|
|
#endif
|
|
|
|
|
|
case '1' | WKC_CTRL:
|
|
|
case '2' | WKC_CTRL:
|
|
|
case '3' | WKC_CTRL:
|
|
|
case '4' | WKC_CTRL:
|
|
|
case '5' | WKC_CTRL:
|