OpenClonk
C4PlayerControlFile Class Reference

#include <C4PlayerControl.h>

Public Member Functions

void Clear ()
 
void CompileFunc (StdCompiler *pComp)
 
bool Load (C4Group &hGroup, const char *szFilename, C4LangStringTable *pLang)
 
bool Save (C4Group &hGroup, const char *szFilename)
 
const C4PlayerControlDefsGetControlDefs () const
 
const C4PlayerControlAssignmentSetsGetAssignmentSets () const
 

Detailed Description

Definition at line 309 of file C4PlayerControl.h.

Member Function Documentation

◆ Clear()

void C4PlayerControlFile::Clear ( )

Definition at line 868 of file C4PlayerControl.cpp.

869 {
870  ControlDefs.Clear();
871  AssignmentSets.Clear();
872 }

◆ CompileFunc()

void C4PlayerControlFile::CompileFunc ( StdCompiler pComp)

Definition at line 840 of file C4PlayerControl.cpp.

References mkNamingAdapt(), and StdCompiler::Value().

841 {
842  pComp->Value(mkNamingAdapt(ControlDefs, "ControlDefs", C4PlayerControlDefs()));
843  pComp->Value(mkNamingAdapt(AssignmentSets, "ControlSets", C4PlayerControlAssignmentSets()));
844 }
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
void Value(const T &rStruct)
Definition: StdCompiler.h:161
Here is the call graph for this function:

◆ GetAssignmentSets()

const C4PlayerControlAssignmentSets& C4PlayerControlFile::GetAssignmentSets ( ) const
inline

Definition at line 321 of file C4PlayerControl.h.

Referenced by C4Game::InitPlayerControlSettings(), and C4Game::LoadAdditionalSystemGroup().

321 { return AssignmentSets; }
Here is the caller graph for this function:

◆ GetControlDefs()

const C4PlayerControlDefs& C4PlayerControlFile::GetControlDefs ( ) const
inline

Definition at line 320 of file C4PlayerControl.h.

Referenced by C4Game::InitPlayerControlSettings(), and C4Game::LoadAdditionalSystemGroup().

320 { return ControlDefs; }
Here is the caller graph for this function:

◆ Load()

bool C4PlayerControlFile::Load ( C4Group hGroup,
const char *  szFilename,
C4LangStringTable pLang 
)

Definition at line 846 of file C4PlayerControl.cpp.

References C4Group::LoadEntryString(), and C4LangStringTable::ReplaceStrings().

Referenced by C4Game::InitPlayerControlSettings(), and C4Game::LoadAdditionalSystemGroup().

847 {
848  // clear previous
849  Clear();
850  // load and prepare file contents
851  StdStrBuf Buf;
852  if (!hGroup.LoadEntryString(szFilename, &Buf)) return false;
853  if (pLang) pLang->ReplaceStrings(Buf);
854  // parse it!
855  if (!CompileFromBuf_LogWarn<StdCompilerINIRead>(*this, Buf, szFilename)) return false;
856  return true;
857 }
void ReplaceStrings(StdStrBuf &rBuf)
bool LoadEntryString(const char *szEntryName, StdStrBuf *Buf)
Definition: C4Group.cpp:1932
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Save()

bool C4PlayerControlFile::Save ( C4Group hGroup,
const char *  szFilename 
)

Definition at line 859 of file C4PlayerControl.cpp.

References C4Group::Add().

860 {
861  // decompile to buffer and save buffer to group
862  StdStrBuf Buf;
863  if (!DecompileToBuf_Log<StdCompilerINIWrite>(*this, &Buf, szFilename)) return false;
864  hGroup.Add(szFilename, Buf, false, true);
865  return true;
866 }
bool Add(const char *szFile, const char *szAddAs)
Definition: C4Group.cpp:1316
Here is the call graph for this function:

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