309 * @param p Player. |
309 * @param p Player. |
310 * @param engine Engine type. |
310 * @param engine Engine type. |
311 * @return The engine type to replace with, or INVALID_ENGINE if no |
311 * @return The engine type to replace with, or INVALID_ENGINE if no |
312 * replacement is in the list. |
312 * replacement is in the list. |
313 */ |
313 */ |
314 static inline EngineID EngineReplacementForPlayer(const Player *p, EngineID engine) { return EngineReplacement(p->engine_renew_list, engine); } |
314 static inline EngineID EngineReplacementForPlayer(const Player *p, EngineID engine, GroupID group) { return EngineReplacement(p->engine_renew_list, engine, group); } |
315 |
315 |
316 /** |
316 /** |
317 * Check if a player has a replacement set up for the given engine. |
317 * Check if a player has a replacement set up for the given engine. |
318 * @param p Player. |
318 * @param p Player. |
319 * @param engine Engine type to be replaced. |
319 * @param engine Engine type to be replaced. |
320 * @return true if a replacement was set up, false otherwise. |
320 * @return true if a replacement was set up, false otherwise. |
321 */ |
321 */ |
322 static inline bool EngineHasReplacementForPlayer(const Player *p, EngineID engine) { return EngineReplacementForPlayer(p, engine) != INVALID_ENGINE; } |
322 static inline bool EngineHasReplacementForPlayer(const Player *p, EngineID engine, GroupID group) { return EngineReplacementForPlayer(p, engine, group) != INVALID_ENGINE; } |
323 |
323 |
324 /** |
324 /** |
325 * Add an engine replacement for the player. |
325 * Add an engine replacement for the player. |
326 * @param p Player. |
326 * @param p Player. |
327 * @param old_engine The original engine type. |
327 * @param old_engine The original engine type. |
328 * @param new_engine The replacement engine type. |
328 * @param new_engine The replacement engine type. |
329 * @param flags The calling command flags. |
329 * @param flags The calling command flags. |
330 * @return 0 on success, CMD_ERROR on failure. |
330 * @return 0 on success, CMD_ERROR on failure. |
331 */ |
331 */ |
332 static inline int32 AddEngineReplacementForPlayer(Player *p, EngineID old_engine, EngineID new_engine, uint32 flags) { return AddEngineReplacement(&p->engine_renew_list, old_engine, new_engine, flags); } |
332 static inline int32 AddEngineReplacementForPlayer(Player *p, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags) { return AddEngineReplacement(&p->engine_renew_list, old_engine, new_engine, group, flags); } |
333 |
333 |
334 /** |
334 /** |
335 * Remove an engine replacement for the player. |
335 * Remove an engine replacement for the player. |
336 * @param p Player. |
336 * @param p Player. |
337 * @param engine The original engine type. |
337 * @param engine The original engine type. |
338 * @param flags The calling command flags. |
338 * @param flags The calling command flags. |
339 * @return 0 on success, CMD_ERROR on failure. |
339 * @return 0 on success, CMD_ERROR on failure. |
340 */ |
340 */ |
341 static inline int32 RemoveEngineReplacementForPlayer(Player *p, EngineID engine, uint32 flags) {return RemoveEngineReplacement(&p->engine_renew_list, engine, flags); } |
341 static inline int32 RemoveEngineReplacementForPlayer(Player *p, EngineID engine, GroupID group, uint32 flags) {return RemoveEngineReplacement(&p->engine_renew_list, engine, group, flags); } |
342 |
342 |
343 /** |
343 /** |
344 * Reset the livery schemes to the player's primary colour. |
344 * Reset the livery schemes to the player's primary colour. |
345 * This is used on loading games without livery information and on new player start up. |
345 * This is used on loading games without livery information and on new player start up. |
346 * @param p Player to reset. |
346 * @param p Player to reset. |