Loading...
Searching...
No Matches
CBot::CBotIf Class Reference

Instruction if (condition) { ... } else { ... }. More...

`#include <src/CBot/CBotInstr/CBotIf.h>`

Inheritance diagram for CBot::CBotIf:
[legend]

## Public Member Functions

bool | Execute (CBotStack *&pj) override
| Execute Execution of the instruction.
void | RestoreState (CBotStack *&pj, bool bMain) override
| RestoreState.
bool | HasReturn () override
| Check 'if' and 'else' for return statements. Returns true when 'if' and 'else' have return statements, if not, the next block or instruction is checked.
Public Member Functions inherited from CBot::CBotInstr
| CBotInstr ()
| Constructor.
virtual | ~CBotInstr ()
| Destructor.
virtual bool | Execute (CBotStack *&pj, CBotVar *pVar)
| Execute.
virtual bool | ExecuteVar (CBotVar *&pVar, CBotCStack *&pile)
| ExecuteVar.
virtual bool | ExecuteVar (CBotVar *&pVar, CBotStack *&pile, CBotToken *prevToken, bool bStep, bool bExtend)
| ExecuteVar.
virtual void | RestoreStateVar (CBotStack *&pile, bool bMain)
| RestoreStateVar.
void | SetToken (CBotToken *p)
| SetToken Set the token corresponding to the instruction.
int | GetTokenType ()
| GetTokenType Return the type of the token assicated with the instruction.
CBotToken * | GetToken ()
| GetToken Return associated token.
void | AddNext (CBotInstr *n)
| AddNext Adds the statement following the other.
CBotInstr * | GetNext ()
| GetNext Returns next statement.
void | AddNext3 (CBotInstr *n)
| AddNext3.
CBotInstr * | GetNext3 ()
| GetNext3.
void | AddNext3b (CBotInstr *n)
| AddNext3b.
CBotInstr * | GetNext3b ()
| GetNext3b.

## Static Public Member Functions

static CBotInstr * | Compile (CBotToken *&p, CBotCStack *pStack)
| Compile Compilation (static routine) called when the token "if" has been found.
Static Public Member Functions inherited from CBot::CBotInstr
static CBotInstr * | Compile (CBotToken *&p, CBotCStack *pStack)
| Compile an instruction.
static CBotInstr * | CompileArray (CBotToken *&p, CBotCStack *pStack, CBotTypResult type, bool first=true)
| CompileArray.
static void | IncLvl (std::string &label)
| IncLvl Adds a level with a label.
static void | IncLvl ()
| IncLvl Adds a level (switch statement).
static void | DecLvl ()
| DecLvl Free a level.
static bool | ChkLvl (const std::string &label, int type)
| ChkLvl Control validity of break and continue.

## Protected Member Functions

virtual const std::string | GetDebugName () override
| Returns the name of this class.
virtual std::map< std::string, CBotInstr * > | GetDebugLinks () override
Protected Member Functions inherited from CBot::CBotInstr
virtual std::string | GetDebugData ()
| Returns additional data associated with this instruction for debugging purposes.

## Additional Inherited Members

Protected Attributes inherited from CBot::CBotInstr
CBotToken | m_token
| Keeps the token.
CBotInstr * | m_next
| Linked command.
CBotInstr * | m_next2b
| Second list definition chain.
CBotInstr * | m_next3
| Third list for indices and fields.
CBotInstr * | m_next3b
| Necessary for reporting tables.
Static Protected Attributes inherited from CBot::CBotInstr
static int | m_LoopLvl = 0
| Counter of nested loops, to determine the break and continue valid.

## Detailed Description

Instruction if (condition) { ... } else { ... }.

## Member Function Documentation

## Compile()

CBotInstr * CBot::CBotIf::Compile | ( | CBotToken *& | p,
|  | CBotCStack * | pStack )

static

Compile Compilation (static routine) called when the token "if" has been found.

Parameters

  p |
  pStack |

Returns

## Execute()

bool CBot::CBotIf::Execute | ( | CBotStack *& | pj | ) |

override virtual

Execute Execution of the instruction.

Parameters

  pj |

Returns

Reimplemented from CBot::CBotInstr.

## RestoreState()

void CBot::CBotIf::RestoreState | ( | CBotStack *& | pj,
|  | bool | bMain )

override virtual

RestoreState.

Parameters

  pj |
  bMain |

Reimplemented from CBot::CBotInstr.

## HasReturn()

bool CBot::CBotIf::HasReturn | ( |  | ) |

override virtual

Check 'if' and 'else' for return statements. Returns true when 'if' and 'else' have return statements, if not, the next block or instruction is checked.

Returns
  true if a return statement is found.

Reimplemented from CBot::CBotInstr.

## GetDebugName()

virtual const std::string CBot::CBotIf::GetDebugName | ( |  | ) |

inline override protected virtual

Returns the name of this class.

See also
  CBotDebug

Implements CBot::CBotInstr.

## GetDebugLinks()

std::map< std::string, CBotInstr * > CBot::CBotIf::GetDebugLinks | ( |  | ) |

override protected virtual

Returns a map of all instructions connected with this one

See also
  CBotDebug

Reimplemented from CBot::CBotInstr.

The documentation for this class was generated from the following files:

- src/CBot/CBotInstr/CBotIf.h
- src/CBot/CBotInstr/CBotIf.cpp