autoreplace_func.h File Reference

Functions related to autoreplacing. More...

#include "autoreplace_type.h"
#include "player_base.h"

Go to the source code of this file.

Functions

void RemoveAllEngineReplacement (EngineRenewList *erl)
 Remove all engine replacement settings for the player.
EngineID EngineReplacement (EngineRenewList erl, EngineID engine, GroupID group)
 Retrieve the engine replacement in a given renewlist for an original engine type.
CommandCost AddEngineReplacement (EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags)
 Add an engine replacement to the given renewlist.
CommandCost RemoveEngineReplacement (EngineRenewList *erl, EngineID engine, GroupID group, uint32 flags)
 Remove an engine replacement from a given renewlist.
static void RemoveAllEngineReplacementForPlayer (Player *p)
 Remove all engine replacement settings for the given player.
static EngineID EngineReplacementForPlayer (const Player *p, EngineID engine, GroupID group)
 Retrieve the engine replacement for the given player and original engine type.
static bool EngineHasReplacementForPlayer (const Player *p, EngineID engine, GroupID group)
 Check if a player has a replacement set up for the given engine.
static CommandCost AddEngineReplacementForPlayer (Player *p, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags)
 Add an engine replacement for the player.
static CommandCost RemoveEngineReplacementForPlayer (Player *p, EngineID engine, GroupID group, uint32 flags)
 Remove an engine replacement for the player.


Detailed Description

Functions related to autoreplacing.

Definition in file autoreplace_func.h.


Function Documentation

CommandCost AddEngineReplacement ( EngineRenewList erl,
EngineID  old_engine,
EngineID  new_engine,
GroupID  group,
uint32  flags 
)

Add an engine replacement to the given renewlist.

Parameters:
erl The renewlist to add to.
old_engine The original engine type.
new_engine The replacement engine type.
flags The calling command flags.
Returns:
0 on success, CMD_ERROR on failure.

Definition at line 514 of file engine.cpp.

References PoolItem< T, Tid, Tpool >::CanAllocateItem(), CMD_ERROR, DC_EXEC, GetEngineReplacement(), EngineRenew::group_id, EngineRenew::next, and EngineRenew::to.

Referenced by AddEngineReplacementForPlayer().

static CommandCost AddEngineReplacementForPlayer ( Player *  p,
EngineID  old_engine,
EngineID  new_engine,
GroupID  group,
uint32  flags 
) [inline, static]

Add an engine replacement for the player.

Parameters:
p Player.
old_engine The original engine type.
new_engine The replacement engine type.
flags The calling command flags.
Returns:
0 on success, CMD_ERROR on failure.

Definition at line 86 of file autoreplace_func.h.

References AddEngineReplacement().

Referenced by CmdSetAutoReplace().

static bool EngineHasReplacementForPlayer ( const Player *  p,
EngineID  engine,
GroupID  group 
) [inline, static]

Check if a player has a replacement set up for the given engine.

Parameters:
p Player.
engine Engine type to be replaced.
Returns:
true if a replacement was set up, false otherwise.

Definition at line 73 of file autoreplace_func.h.

References EngineReplacementForPlayer().

EngineID EngineReplacement ( EngineRenewList  erl,
EngineID  engine,
GroupID  group 
)

Retrieve the engine replacement in a given renewlist for an original engine type.

Parameters:
erl The renewlist to search in.
engine Engine type to be replaced.
Returns:
The engine type to replace with, or INVALID_ENGINE if no replacement is in the list.

Definition at line 504 of file engine.cpp.

References DEFAULT_GROUP, GetEngineReplacement(), and EngineRenew::to.

Referenced by EngineReplacementForPlayer().

static EngineID EngineReplacementForPlayer ( const Player *  p,
EngineID  engine,
GroupID  group 
) [inline, static]

Retrieve the engine replacement for the given player and original engine type.

Parameters:
p Player.
engine Engine type.
Returns:
The engine type to replace with, or INVALID_ENGINE if no replacement is in the list.

Definition at line 62 of file autoreplace_func.h.

References EngineReplacement().

Referenced by CheckSendAircraftToHangarForReplacement(), EngineHasReplacementForPlayer(), and GenerateReplaceVehList().

void RemoveAllEngineReplacement ( EngineRenewList erl  ) 

Remove all engine replacement settings for the player.

Parameters:
erl The renewlist for a given player.
Returns:
The new renewlist for the player.

Definition at line 491 of file engine.cpp.

References EngineRenew::next.

Referenced by RemoveAllEngineReplacementForPlayer().

static void RemoveAllEngineReplacementForPlayer ( Player *  p  )  [inline, static]

Remove all engine replacement settings for the given player.

Parameters:
p Player.

Definition at line 50 of file autoreplace_func.h.

References RemoveAllEngineReplacement().

CommandCost RemoveEngineReplacement ( EngineRenewList erl,
EngineID  engine,
GroupID  group,
uint32  flags 
)

Remove an engine replacement from a given renewlist.

Parameters:
erl The renewlist from which to remove the replacement
engine The original engine type.
flags The calling command flags.
Returns:
0 on success, CMD_ERROR on failure.

Definition at line 539 of file engine.cpp.

References CMD_ERROR, DC_EXEC, EngineRenew::from, EngineRenew::group_id, and EngineRenew::next.

Referenced by RemoveEngineReplacementForPlayer().

static CommandCost RemoveEngineReplacementForPlayer ( Player *  p,
EngineID  engine,
GroupID  group,
uint32  flags 
) [inline, static]

Remove an engine replacement for the player.

Parameters:
p Player.
engine The original engine type.
flags The calling command flags.
Returns:
0 on success, CMD_ERROR on failure.

Definition at line 98 of file autoreplace_func.h.

References RemoveEngineReplacement().

Referenced by CmdDeleteGroup(), and CmdSetAutoReplace().


Generated on Mon Sep 22 20:34:21 2008 for openttd by  doxygen 1.5.6