Loading...
Searching...
No Matches
CProgramStorageObjectImpl Class Reference
Inheritance diagram for CProgramStorageObjectImpl:
[legend]

## Public Member Functions

| CProgramStorageObjectImpl (ObjectInterfaceTypes &types, CObject *object)
bool | IntroduceVirus () override
void | SetActiveVirus (bool bActive) override
bool | GetActiveVirus () override
| Checks virus active status.
bool | ReadProgram (Program *program, const std::string &filename) override
| Read program from a given file.
bool | WriteProgram (Program *program, const std::string &filename) override
| Write program to a given file.
bool | GetCompile (Program *program) override
| Check if program was compiled successfully.
Program * | AddProgram () override
| Add a new program.
void | AddProgram (std::unique_ptr< Program > program) override
| Add given program to the program list stored in this robot.
void | RemoveProgram (Program *program) override
| Remove program.
Program * | CloneProgram (Program *program) override
| Clone a program.
std::vector< std::unique_ptr< Program > > & | GetPrograms () override
| Return a std::vector of all available programs.
int | GetProgramCount () override
| Return count of all programs.
Program * | GetProgram (int index) override
| Return program with the given index.
Program * | GetOrAddProgram (int index) override
| Return program at the given index (creating it and all previous ones as needed).
int | GetProgramIndex (Program *program) override
| Return index in the list of given Program instance.
void | SetProgramStorageIndex (int programStorageIndex) override
| Set index for use in filename for saved programs (-1 to disable).
int | GetProgramStorageIndex () override
| Return index that is used while saving programs.
void | SaveAllUserPrograms (const std::string &userSource) override
| Save all user programs.
void | LoadAllProgramsForLevel (CLevelParserLine *levelSource, const std::string &userSource, bool loadSoluce) override
| Load all programs when loading the level including previously saved user programs.
void | SaveAllProgramsForSavedScene (CLevelParserLine *levelSourceLine, const std::string &levelSource) override
| Save all programs when saving the saved scene.
void | LoadAllProgramsForSavedScene (CLevelParserLine *levelSourceLine, const std::string &levelSource) override
| Load all programs when loading the saved scene.
Public Member Functions inherited from CProgramStorageObject
| CProgramStorageObject (ObjectInterfaceTypes &types)

## Member Function Documentation

## IntroduceVirus()

bool CProgramStorageObjectImpl::IntroduceVirus | ( |  | ) |

override virtual

Infects a random program of a robot with virus

Returns
  true if program was successfully infected, false on failure (no programs or no suitable keywords to infect found)

Implements CProgramStorageObject.

## SetActiveVirus()

void CProgramStorageObjectImpl::SetActiveVirus | ( | bool | bActive | ) |

override virtual

Sets the virus as active, this controls the "Program infected" message and is cleared after you edit the program. Note that this status is independent from the virus particles (see COldObject::SetVirusMode for that)

Implements CProgramStorageObject.

## GetActiveVirus()

bool CProgramStorageObjectImpl::GetActiveVirus | ( |  | ) |

override virtual

Checks virus active status.

Implements CProgramStorageObject.

## ReadProgram()

bool CProgramStorageObjectImpl::ReadProgram | ( | Program * | program,
|  | const std::string & | filename )

override virtual

Read program from a given file.

Implements CProgramStorageObject.

## WriteProgram()

bool CProgramStorageObjectImpl::WriteProgram | ( | Program * | program,
|  | const std::string & | filename )

override virtual

Write program to a given file.

Implements CProgramStorageObject.

## GetCompile()

bool CProgramStorageObjectImpl::GetCompile | ( | Program * | program | ) |

override virtual

Check if program was compiled successfully.

Implements CProgramStorageObject.

## AddProgram() [1/2]

Program * CProgramStorageObjectImpl::AddProgram | ( |  | ) |

override virtual

Add a new program.

Implements CProgramStorageObject.

## AddProgram() [2/2]

void CProgramStorageObjectImpl::AddProgram | ( | std::unique_ptr< Program > | program | ) |

override virtual

Add given program to the program list stored in this robot.

Implements CProgramStorageObject.

## RemoveProgram()

void CProgramStorageObjectImpl::RemoveProgram | ( | Program * | program | ) |

override virtual

Remove program.

Implements CProgramStorageObject.

## CloneProgram()

Program * CProgramStorageObjectImpl::CloneProgram | ( | Program * | program | ) |

override virtual

Clone a program.

Implements CProgramStorageObject.

## GetPrograms()

std::vector< std::unique_ptr< Program > > & CProgramStorageObjectImpl::GetPrograms | ( |  | ) |

override virtual

Return a std::vector of all available programs.

Implements CProgramStorageObject.

## GetProgramCount()

int CProgramStorageObjectImpl::GetProgramCount | ( |  | ) |

override virtual

Return count of all programs.

Implements CProgramStorageObject.

## GetProgram()

Program * CProgramStorageObjectImpl::GetProgram | ( | int | index | ) |

override virtual

Return program with the given index.

Implements CProgramStorageObject.

## GetOrAddProgram()

Program * CProgramStorageObjectImpl::GetOrAddProgram | ( | int | index | ) |

override virtual

Return program at the given index (creating it and all previous ones as needed).

Implements CProgramStorageObject.

## GetProgramIndex()

int CProgramStorageObjectImpl::GetProgramIndex | ( | Program * | program | ) |

override virtual

Return index in the list of given Program instance.

Implements CProgramStorageObject.

## SetProgramStorageIndex()

void CProgramStorageObjectImpl::SetProgramStorageIndex | ( | int | programStorageIndex | ) |

override virtual

Set index for use in filename for saved programs (-1 to disable).

Implements CProgramStorageObject.

## GetProgramStorageIndex()

int CProgramStorageObjectImpl::GetProgramStorageIndex | ( |  | ) |

override virtual

Return index that is used while saving programs.

Implements CProgramStorageObject.

## SaveAllUserPrograms()

void CProgramStorageObjectImpl::SaveAllUserPrograms | ( | const std::string & | userSource | ) |

override virtual

Save all user programs.

Implements CProgramStorageObject.

## LoadAllProgramsForLevel()

void CProgramStorageObjectImpl::LoadAllProgramsForLevel | ( | CLevelParserLine * | levelSource,
|  | const std::string & | userSource,
|  | bool | loadSoluce )

override virtual

Load all programs when loading the level including previously saved user programs.

Implements CProgramStorageObject.

## SaveAllProgramsForSavedScene()

void CProgramStorageObjectImpl::SaveAllProgramsForSavedScene | ( | CLevelParserLine * | levelSourceLine,
|  | const std::string & | levelSource )

override virtual

Save all programs when saving the saved scene.

Implements CProgramStorageObject.

## LoadAllProgramsForSavedScene()

void CProgramStorageObjectImpl::LoadAllProgramsForSavedScene | ( | CLevelParserLine * | levelSourceLine,
|  | const std::string & | levelSource )

override virtual

Load all programs when loading the saved scene.

Implements CProgramStorageObject.

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

- src/object/implementation/program_storage_impl.h
- src/object/implementation/program_storage_impl.cpp