equal
deleted
inserted
replaced
143 |
143 |
144 Money loan; |
144 Money loan; |
145 switch (p2) { |
145 switch (p2) { |
146 default: return CMD_ERROR; // Invalid method |
146 default: return CMD_ERROR; // Invalid method |
147 case 0: // Take some extra loan |
147 case 0: // Take some extra loan |
148 loan = (IsHumanPlayer(_current_player) || _settings.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI; |
148 loan = (IsHumanPlayer(_current_player) || _settings_game.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI; |
149 break; |
149 break; |
150 case 1: // Take a loan as big as possible |
150 case 1: // Take a loan as big as possible |
151 loan = _economy.max_loan - p->current_loan; |
151 loan = _economy.max_loan - p->current_loan; |
152 break; |
152 break; |
153 } |
153 } |
179 |
179 |
180 Money loan; |
180 Money loan; |
181 switch (p2) { |
181 switch (p2) { |
182 default: return CMD_ERROR; // Invalid method |
182 default: return CMD_ERROR; // Invalid method |
183 case 0: // Pay back one step |
183 case 0: // Pay back one step |
184 loan = min(p->current_loan, (Money)(IsHumanPlayer(_current_player) || _settings.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI); |
184 loan = min(p->current_loan, (Money)(IsHumanPlayer(_current_player) || _settings_game.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI); |
185 break; |
185 break; |
186 case 1: // Pay back as much as possible |
186 case 1: // Pay back as much as possible |
187 loan = max(min(p->current_loan, p->player_money), (Money)LOAN_INTERVAL); |
187 loan = max(min(p->current_loan, p->player_money), (Money)LOAN_INTERVAL); |
188 loan -= loan % LOAN_INTERVAL; |
188 loan -= loan % LOAN_INTERVAL; |
189 break; |
189 break; |
357 * @param p1 the amount of money to transfer; max 20.000.000 |
357 * @param p1 the amount of money to transfer; max 20.000.000 |
358 * @param p2 the player to transfer the money to |
358 * @param p2 the player to transfer the money to |
359 */ |
359 */ |
360 CommandCost CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
360 CommandCost CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
361 { |
361 { |
362 if (!_settings.economy.give_money) return CMD_ERROR; |
362 if (!_settings_game.economy.give_money) return CMD_ERROR; |
363 |
363 |
364 const Player *p = GetPlayer(_current_player); |
364 const Player *p = GetPlayer(_current_player); |
365 CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL)); |
365 CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL)); |
366 |
366 |
367 /* You can only transfer funds that is in excess of your loan */ |
367 /* You can only transfer funds that is in excess of your loan */ |