13 #include "economy.h" |
13 #include "economy.h" |
14 #include "network.h" |
14 #include "network.h" |
15 #include "variables.h" |
15 #include "variables.h" |
16 |
16 |
17 /** Change the player's face. |
17 /** Change the player's face. |
18 * @param x,y unused |
18 * @param tile unused |
19 * @param p1 unused |
19 * @param p1 unused |
20 * @param p2 face bitmasked |
20 * @param p2 face bitmasked |
21 */ |
21 */ |
22 int32 CmdSetPlayerFace(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
22 int32 CmdSetPlayerFace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
23 { |
23 { |
24 if (flags & DC_EXEC) { |
24 if (flags & DC_EXEC) { |
25 GetPlayer(_current_player)->face = p2; |
25 GetPlayer(_current_player)->face = p2; |
26 MarkWholeScreenDirty(); |
26 MarkWholeScreenDirty(); |
27 } |
27 } |
28 return 0; |
28 return 0; |
29 } |
29 } |
30 |
30 |
31 /** Change the player's company-colour |
31 /** Change the player's company-colour |
32 * @param x,y unused |
32 * @param tile unused |
33 * @param p1 unused |
33 * @param p1 unused |
34 * @param p2 new colour for vehicles, property, etc. |
34 * @param p2 new colour for vehicles, property, etc. |
35 */ |
35 */ |
36 int32 CmdSetPlayerColor(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
36 int32 CmdSetPlayerColor(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
37 { |
37 { |
38 Player *p, *pp; |
38 Player *p, *pp; |
39 byte colour; |
39 byte colour; |
40 |
40 |
41 if (p2 >= 16) return CMD_ERROR; // max 16 colours |
41 if (p2 >= 16) return CMD_ERROR; // max 16 colours |
56 } |
56 } |
57 return 0; |
57 return 0; |
58 } |
58 } |
59 |
59 |
60 /** Increase the loan of your company. |
60 /** Increase the loan of your company. |
61 * @param x,y unused |
61 * @param tile unused |
62 * @param p1 unused |
62 * @param p1 unused |
63 * @param p2 when set, loans the maximum amount in one go (press CTRL) |
63 * @param p2 when set, loans the maximum amount in one go (press CTRL) |
64 */ |
64 */ |
65 int32 CmdIncreaseLoan(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
65 int32 CmdIncreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
66 { |
66 { |
67 Player *p; |
67 Player *p; |
68 |
68 |
69 p = GetPlayer(_current_player); |
69 p = GetPlayer(_current_player); |
70 |
70 |
85 |
85 |
86 return 0; |
86 return 0; |
87 } |
87 } |
88 |
88 |
89 /** Decrease the loan of your company. |
89 /** Decrease the loan of your company. |
90 * @param x,y unused |
90 * @param tile unused |
91 * @param p1 unused |
91 * @param p1 unused |
92 * @param p2 when set, pays back the maximum loan permitting money (press CTRL) |
92 * @param p2 when set, pays back the maximum loan permitting money (press CTRL) |
93 */ |
93 */ |
94 int32 CmdDecreaseLoan(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
94 int32 CmdDecreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
95 { |
95 { |
96 Player *p; |
96 Player *p; |
97 int32 loan; |
97 int32 loan; |
98 |
98 |
99 p = GetPlayer(_current_player); |
99 p = GetPlayer(_current_player); |
175 if (p->name_1 == STR_SV_UNNAMED) { |
175 if (p->name_1 == STR_SV_UNNAMED) { |
176 char buf[80]; |
176 char buf[80]; |
177 |
177 |
178 snprintf(buf, lengthof(buf), "%s Transport", _cmd_text); |
178 snprintf(buf, lengthof(buf), "%s Transport", _cmd_text); |
179 _cmd_text = buf; |
179 _cmd_text = buf; |
180 DoCommandByTile(0, 0, 0, DC_EXEC, CMD_CHANGE_COMPANY_NAME); |
180 DoCommand(0, 0, 0, DC_EXEC, CMD_CHANGE_COMPANY_NAME); |
181 } |
181 } |
182 MarkWholeScreenDirty(); |
182 MarkWholeScreenDirty(); |
183 } else |
183 } else |
184 DeleteName(str); |
184 DeleteName(str); |
185 |
185 |
188 |
188 |
189 /** Pause/Unpause the game (server-only). |
189 /** Pause/Unpause the game (server-only). |
190 * Increase or decrease the pause counter. If the counter is zero, |
190 * Increase or decrease the pause counter. If the counter is zero, |
191 * the game is unpaused. A counter is used instead of a boolean value |
191 * the game is unpaused. A counter is used instead of a boolean value |
192 * to have more control over the game when saving/loading, etc. |
192 * to have more control over the game when saving/loading, etc. |
193 * @param x,y unused |
193 * @param tile unused |
194 * @param p1 0 = decrease pause counter; 1 = increase pause counter |
194 * @param p1 0 = decrease pause counter; 1 = increase pause counter |
195 * @param p2 unused |
195 * @param p2 unused |
196 */ |
196 */ |
197 int32 CmdPause(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
197 int32 CmdPause(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
198 { |
198 { |
199 if (flags & DC_EXEC) { |
199 if (flags & DC_EXEC) { |
200 _pause += (p1 == 1) ? 1 : -1; |
200 _pause += (p1 == 1) ? 1 : -1; |
201 if (_pause == (byte)-1) _pause = 0; |
201 if (_pause == (byte)-1) _pause = 0; |
202 InvalidateWindow(WC_STATUS_BAR, 0); |
202 InvalidateWindow(WC_STATUS_BAR, 0); |
206 } |
206 } |
207 |
207 |
208 /** Change the financial flow of your company. |
208 /** Change the financial flow of your company. |
209 * This is normally only enabled in offline mode, but if there is a debug |
209 * This is normally only enabled in offline mode, but if there is a debug |
210 * build, you can cheat (to test). |
210 * build, you can cheat (to test). |
211 * @param x,y unused |
211 * @param tile unused |
212 * @param p1 the amount of money to receive (if negative), or spend (if positive) |
212 * @param p1 the amount of money to receive (if negative), or spend (if positive) |
213 * @param p2 unused |
213 * @param p2 unused |
214 */ |
214 */ |
215 int32 CmdMoneyCheat(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
215 int32 CmdMoneyCheat(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
216 { |
216 { |
217 #ifndef _DEBUG |
217 #ifndef _DEBUG |
218 if (_networking) return CMD_ERROR; |
218 if (_networking) return CMD_ERROR; |
219 #endif |
219 #endif |
220 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
220 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
223 |
223 |
224 /** Transfer funds (money) from one player to another. |
224 /** Transfer funds (money) from one player to another. |
225 * To prevent abuse in multiplayer games you can only send money to other |
225 * To prevent abuse in multiplayer games you can only send money to other |
226 * players if you have paid off your loan (either explicitely, or implicitely |
226 * players if you have paid off your loan (either explicitely, or implicitely |
227 * given the fact that you have more money than loan). |
227 * given the fact that you have more money than loan). |
228 * @param x,y unused |
228 * @param tile unused |
229 * @param p1 the amount of money to transfer; max 20.000.000 |
229 * @param p1 the amount of money to transfer; max 20.000.000 |
230 * @param p2 the player to transfer the money to |
230 * @param p2 the player to transfer the money to |
231 */ |
231 */ |
232 int32 CmdGiveMoney(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
232 int32 CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
233 { |
233 { |
234 const Player *p = GetPlayer(_current_player); |
234 const Player *p = GetPlayer(_current_player); |
235 int32 amount = min((int32)p1, 20000000); |
235 int32 amount = min((int32)p1, 20000000); |
236 |
236 |
237 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
237 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
254 |
254 |
255 /** Change difficulty level/settings (server-only). |
255 /** Change difficulty level/settings (server-only). |
256 * We cannot really check for valid values of p2 (too much work mostly); stored |
256 * We cannot really check for valid values of p2 (too much work mostly); stored |
257 * in file 'settings_gui.c' _game_setting_info[]; we'll just trust the server it knows |
257 * in file 'settings_gui.c' _game_setting_info[]; we'll just trust the server it knows |
258 * what to do and does this correctly |
258 * what to do and does this correctly |
259 * @param x,y unused |
259 * @param tile unused |
260 * @param p1 the difficulty setting being changed. If it is -1, the difficulty level |
260 * @param p1 the difficulty setting being changed. If it is -1, the difficulty level |
261 * itself is changed. The new value is inside p2 |
261 * itself is changed. The new value is inside p2 |
262 * @param p2 new value for a difficulty setting or difficulty level |
262 * @param p2 new value for a difficulty setting or difficulty level |
263 */ |
263 */ |
264 int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
264 int32 CmdChangeDifficultyLevel(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
265 { |
265 { |
266 if (p1 != (uint32)-1L && ((int32)p1 >= GAME_DIFFICULTY_NUM || (int32)p1 < 0)) return CMD_ERROR; |
266 if (p1 != (uint32)-1L && ((int32)p1 >= GAME_DIFFICULTY_NUM || (int32)p1 < 0)) return CMD_ERROR; |
267 |
267 |
268 if (flags & DC_EXEC) { |
268 if (flags & DC_EXEC) { |
269 if (p1 != (uint32)-1L) { |
269 if (p1 != (uint32)-1L) { |