equal
deleted
inserted
replaced
38 */ |
38 */ |
39 int32 CmdSetPlayerColor(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
39 int32 CmdSetPlayerColor(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
40 { |
40 { |
41 Player *p, *pp; |
41 Player *p, *pp; |
42 byte colour; |
42 byte colour; |
43 LiveryScheme scheme = GB(p1, 0, 8); |
43 LiveryScheme scheme = (LiveryScheme)GB(p1, 0, 8); |
44 byte state = GB(p1, 8, 2); |
44 byte state = GB(p1, 8, 2); |
45 |
45 |
46 if (p2 >= 16) return CMD_ERROR; // max 16 colours |
46 if (p2 >= 16) return CMD_ERROR; // max 16 colours |
47 colour = p2; |
47 colour = p2; |
48 |
48 |
269 { |
269 { |
270 #ifndef _DEBUG |
270 #ifndef _DEBUG |
271 if (_networking) return CMD_ERROR; |
271 if (_networking) return CMD_ERROR; |
272 #endif |
272 #endif |
273 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
273 SET_EXPENSES_TYPE(EXPENSES_OTHER); |
274 return (int32)p1; |
274 return -(int32)p1; |
275 } |
275 } |
276 |
276 |
277 /** Transfer funds (money) from one player to another. |
277 /** Transfer funds (money) from one player to another. |
278 * To prevent abuse in multiplayer games you can only send money to other |
278 * To prevent abuse in multiplayer games you can only send money to other |
279 * players if you have paid off your loan (either explicitely, or implicitely |
279 * players if you have paid off your loan (either explicitely, or implicitely |
294 if (!_networking || !IsValidPlayer((PlayerID)p2)) return CMD_ERROR; |
294 if (!_networking || !IsValidPlayer((PlayerID)p2)) return CMD_ERROR; |
295 |
295 |
296 if (flags & DC_EXEC) { |
296 if (flags & DC_EXEC) { |
297 /* Add money to player */ |
297 /* Add money to player */ |
298 PlayerID old_cp = _current_player; |
298 PlayerID old_cp = _current_player; |
299 _current_player = p2; |
299 _current_player = (PlayerID)p2; |
300 SubtractMoneyFromPlayer(-amount); |
300 SubtractMoneyFromPlayer(-amount); |
301 _current_player = old_cp; |
301 _current_player = old_cp; |
302 } |
302 } |
303 |
303 |
304 /* Subtract money from local-player */ |
304 /* Subtract money from local-player */ |