equal
deleted
inserted
replaced
22 * @param tile unused |
22 * @param tile unused |
23 * @param flags operation to perform |
23 * @param flags operation to perform |
24 * @param p1 unused |
24 * @param p1 unused |
25 * @param p2 face bitmasked |
25 * @param p2 face bitmasked |
26 */ |
26 */ |
27 int32 CmdSetPlayerFace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
27 CommandCost CmdSetPlayerFace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
28 { |
28 { |
29 PlayerFace pf = (PlayerFace)p2; |
29 PlayerFace pf = (PlayerFace)p2; |
30 |
30 |
31 if (!IsValidPlayerFace(pf)) return CMD_ERROR; |
31 if (!IsValidPlayerFace(pf)) return CMD_ERROR; |
32 |
32 |
43 * @param p1 bitstuffed: |
43 * @param p1 bitstuffed: |
44 * p1 bits 0-7 scheme to set |
44 * p1 bits 0-7 scheme to set |
45 * p1 bits 8-9 set in use state or first/second colour |
45 * p1 bits 8-9 set in use state or first/second colour |
46 * @param p2 new colour for vehicles, property, etc. |
46 * @param p2 new colour for vehicles, property, etc. |
47 */ |
47 */ |
48 int32 CmdSetPlayerColor(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
48 CommandCost CmdSetPlayerColor(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
49 { |
49 { |
50 Player *p, *pp; |
50 Player *p, *pp; |
51 byte colour; |
51 byte colour; |
52 LiveryScheme scheme = (LiveryScheme)GB(p1, 0, 8); |
52 LiveryScheme scheme = (LiveryScheme)GB(p1, 0, 8); |
53 byte state = GB(p1, 8, 2); |
53 byte state = GB(p1, 8, 2); |
122 * @param flags operation to perform |
122 * @param flags operation to perform |
123 * @param p1 unused |
123 * @param p1 unused |
124 * @param p2 when 0: loans LOAN_INTERVAL |
124 * @param p2 when 0: loans LOAN_INTERVAL |
125 * when 1: loans the maximum loan permitting money (press CTRL), |
125 * when 1: loans the maximum loan permitting money (press CTRL), |
126 */ |
126 */ |
127 int32 CmdIncreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
127 CommandCost CmdIncreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
128 { |
128 { |
129 Player *p = GetPlayer(_current_player); |
129 Player *p = GetPlayer(_current_player); |
130 |
130 |
131 if (p->current_loan >= _economy.max_loan) { |
131 if (p->current_loan >= _economy.max_loan) { |
132 SetDParam(0, _economy.max_loan); |
132 SetDParam(0, _economy.max_loan); |
159 * @param flags operation to perform |
159 * @param flags operation to perform |
160 * @param p1 unused |
160 * @param p1 unused |
161 * @param p2 when 0: pays back LOAN_INTERVAL |
161 * @param p2 when 0: pays back LOAN_INTERVAL |
162 * when 1: pays back the maximum loan permitting money (press CTRL), |
162 * when 1: pays back the maximum loan permitting money (press CTRL), |
163 */ |
163 */ |
164 int32 CmdDecreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
164 CommandCost CmdDecreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
165 { |
165 { |
166 Player *p = GetPlayer(_current_player); |
166 Player *p = GetPlayer(_current_player); |
167 |
167 |
168 if (p->current_loan == 0) return_cmd_error(STR_702D_LOAN_ALREADY_REPAYED); |
168 if (p->current_loan == 0) return_cmd_error(STR_702D_LOAN_ALREADY_REPAYED); |
169 |
169 |
197 * @param tile unused |
197 * @param tile unused |
198 * @param flags operation to perform |
198 * @param flags operation to perform |
199 * @param p1 unused |
199 * @param p1 unused |
200 * @param p2 unused |
200 * @param p2 unused |
201 */ |
201 */ |
202 int32 CmdChangeCompanyName(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
202 CommandCost CmdChangeCompanyName(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
203 { |
203 { |
204 StringID str; |
204 StringID str; |
205 Player *p; |
205 Player *p; |
206 |
206 |
207 if (_cmd_text[0] == '\0') return CMD_ERROR; |
207 if (_cmd_text[0] == '\0') return CMD_ERROR; |
225 * @param tile unused |
225 * @param tile unused |
226 * @param flags operation to perform |
226 * @param flags operation to perform |
227 * @param p1 unused |
227 * @param p1 unused |
228 * @param p2 unused |
228 * @param p2 unused |
229 */ |
229 */ |
230 int32 CmdChangePresidentName(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
230 CommandCost CmdChangePresidentName(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
231 { |
231 { |
232 StringID str; |
232 StringID str; |
233 Player *p; |
233 Player *p; |
234 |
234 |
235 if (_cmd_text[0] == '\0') return CMD_ERROR; |
235 if (_cmd_text[0] == '\0') return CMD_ERROR; |
264 * @param tile unused |
264 * @param tile unused |
265 * @param flags operation to perform |
265 * @param flags operation to perform |
266 * @param p1 0 = decrease pause counter; 1 = increase pause counter |
266 * @param p1 0 = decrease pause counter; 1 = increase pause counter |
267 * @param p2 unused |
267 * @param p2 unused |
268 */ |
268 */ |
269 int32 CmdPause(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
269 CommandCost CmdPause(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
270 { |
270 { |
271 if (flags & DC_EXEC) { |
271 if (flags & DC_EXEC) { |
272 _pause_game += (p1 == 1) ? 1 : -1; |
272 _pause_game += (p1 == 1) ? 1 : -1; |
273 if (_pause_game == (byte)-1) _pause_game = 0; |
273 if (_pause_game == (byte)-1) _pause_game = 0; |
274 InvalidateWindow(WC_STATUS_BAR, 0); |
274 InvalidateWindow(WC_STATUS_BAR, 0); |
283 * @param tile unused |
283 * @param tile unused |
284 * @param flags operation to perform |
284 * @param flags operation to perform |
285 * @param p1 the amount of money to receive (if negative), or spend (if positive) |
285 * @param p1 the amount of money to receive (if negative), or spend (if positive) |
286 * @param p2 unused |
286 * @param p2 unused |
287 */ |
287 */ |
288 int32 CmdMoneyCheat(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
288 CommandCost CmdMoneyCheat(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
289 { |
289 { |
290 #ifndef _DEBUG |
290 #ifndef _DEBUG |
291 if (_networking) return CMD_ERROR; |
291 if (_networking) return CMD_ERROR; |
292 #endif |
292 #endif |
293 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
293 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
301 * @param tile unused |
301 * @param tile unused |
302 * @param flags operation to perform |
302 * @param flags operation to perform |
303 * @param p1 the amount of money to transfer; max 20.000.000 |
303 * @param p1 the amount of money to transfer; max 20.000.000 |
304 * @param p2 the player to transfer the money to |
304 * @param p2 the player to transfer the money to |
305 */ |
305 */ |
306 int32 CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
306 CommandCost CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
307 { |
307 { |
308 const Player *p = GetPlayer(_current_player); |
308 const Player *p = GetPlayer(_current_player); |
309 int32 amount = min((int32)p1, 20000000); |
309 CommandCost amount = min((int32)p1, 20000000); |
310 |
310 |
311 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
311 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
312 |
312 |
313 /* You can only transfer funds that is in excess of your loan */ |
313 /* You can only transfer funds that is in excess of your loan */ |
314 if (p->money64 - p->current_loan < amount || amount <= 0) return CMD_ERROR; |
314 if (p->money64 - p->current_loan < amount || amount <= 0) return CMD_ERROR; |
334 * @param flags operation to perform |
334 * @param flags operation to perform |
335 * @param p1 the difficulty setting being changed. If it is -1, the difficulty level |
335 * @param p1 the difficulty setting being changed. If it is -1, the difficulty level |
336 * itself is changed. The new value is inside p2 |
336 * itself is changed. The new value is inside p2 |
337 * @param p2 new value for a difficulty setting or difficulty level |
337 * @param p2 new value for a difficulty setting or difficulty level |
338 */ |
338 */ |
339 int32 CmdChangeDifficultyLevel(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
339 CommandCost CmdChangeDifficultyLevel(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
340 { |
340 { |
341 if (p1 != (uint32)-1L && ((int32)p1 >= GAME_DIFFICULTY_NUM || (int32)p1 < 0)) return CMD_ERROR; |
341 if (p1 != (uint32)-1L && ((int32)p1 >= GAME_DIFFICULTY_NUM || (int32)p1 < 0)) return CMD_ERROR; |
342 |
342 |
343 if (flags & DC_EXEC) { |
343 if (flags & DC_EXEC) { |
344 if (p1 != (uint32)-1L) { |
344 if (p1 != (uint32)-1L) { |