OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ScenarioParameterDef Class Reference

#include <C4ScenarioParameters.h>

Classes

struct  Option
 

Public Types

enum  ParameterType { SPDT_Enum }
 

Public Member Functions

 C4ScenarioParameterDef ()
 
 ~C4ScenarioParameterDef ()
 
const char * GetName () const
 
const char * GetDescription () const
 
const char * GetID () const
 
ParameterType GetType () const
 
int32_t GetDefault () const
 
int32_t GetLeagueValue () const
 
const OptionGetOptionByValue (int32_t val) const
 
const OptionGetOptionByIndex (size_t idx) const
 
bool IsAchievement () const
 
const char * GetAchievement () const
 
void CompileFunc (StdCompiler *pComp)
 

Detailed Description

Definition at line 41 of file C4ScenarioParameters.h.

Member Enumeration Documentation

Enumerator
SPDT_Enum 

Definition at line 45 of file C4ScenarioParameters.h.

46  {
47  SPDT_Enum, // only one type so far
48  };

Constructor & Destructor Documentation

C4ScenarioParameterDef::C4ScenarioParameterDef ( )
inline

Definition at line 73 of file C4ScenarioParameters.h.

73 : Default(0), LeagueValue(0) {}
C4ScenarioParameterDef::~C4ScenarioParameterDef ( )
inline

Definition at line 74 of file C4ScenarioParameters.h.

74 {}

Member Function Documentation

void C4ScenarioParameterDef::CompileFunc ( StdCompiler pComp)

Definition at line 104 of file C4ScenarioParameters.cpp.

References StdCompiler::excNotFound(), mkNamingAdapt(), mkParAdapt(), mkSTLContainerAdapt(), StdCompiler::Name(), StdCompiler::NameEnd(), StdCompiler::RCT_All, StdCompiler::RCT_Idtf, StdCompiler::SEP_NONE, SPDT_Enum, and StdCompiler::Value().

105 {
106  if (!pComp->Name("ParameterDef")) { pComp->NameEnd(); pComp->excNotFound("ParameterDef"); }
108  pComp->Value(mkNamingAdapt(mkParAdapt(Description, StdCompiler::RCT_All), "Description", StdCopyStrBuf()));
110  StdEnumEntry<ParameterType> ParTypeEntries[] =
111  {
112  { "Enumeration", SPDT_Enum },
113  { nullptr, SPDT_Enum }
114  };
115  pComp->Value(mkNamingAdapt(mkEnumAdaptT<uint8_t>(Type, ParTypeEntries), "Type", SPDT_Enum));
116  pComp->Value(mkNamingAdapt(Default, "Default", 0));
117  pComp->Value(mkNamingAdapt(LeagueValue, "LeagueValue", 0));
118  pComp->Value(mkNamingAdapt(mkParAdapt(Achievement, StdCompiler::RCT_Idtf), "Achievement", StdCopyStrBuf()));
119  pComp->Value(mkNamingAdapt(mkSTLContainerAdapt(Options, StdCompiler::SEP_NONE), "Options"));
120  pComp->NameEnd();
121 }
Definition: StdAdaptors.h:760
virtual bool Name(const char *szName)
Definition: StdCompiler.h:87
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
void excNotFound(const char *szMessage,...)
Definition: StdCompiler.h:243
void Value(const T &rStruct)
Definition: StdCompiler.h:171
StdSTLContainerAdapt< C > mkSTLContainerAdapt(C &rTarget, StdCompiler::Sep eSep=StdCompiler::SEP_SEP)
Definition: StdAdaptors.h:679
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:456
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:88

Here is the call graph for this function:

const char* C4ScenarioParameterDef::GetAchievement ( ) const
inline

Definition at line 86 of file C4ScenarioParameters.h.

References StdStrBuf::getData().

Referenced by C4ScenarioListLoader::Scenario::LoadCustomPre().

86 { return Achievement.getData(); }
const char * getData() const
Definition: StdBuf.h:450

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4ScenarioParameterDef::GetDefault ( ) const
inline

Definition at line 80 of file C4ScenarioParameters.h.

Referenced by C4ScenarioListLoader::Scenario::LoadCustomPre().

80 { return Default; }

Here is the caller graph for this function:

const char* C4ScenarioParameterDef::GetDescription ( ) const
inline

Definition at line 77 of file C4ScenarioParameters.h.

References StdStrBuf::getData().

77 { return Description.getData(); }
const char * getData() const
Definition: StdBuf.h:450

Here is the call graph for this function:

const char* C4ScenarioParameterDef::GetID ( ) const
inline

Definition at line 78 of file C4ScenarioParameters.h.

References StdStrBuf::getData().

Referenced by C4GameParameters::EnforceLeagueRules(), and C4ScenarioListLoader::Scenario::LoadCustomPre().

78 { return ID.getData(); }
const char * getData() const
Definition: StdBuf.h:450

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4ScenarioParameterDef::GetLeagueValue ( ) const
inline

Definition at line 81 of file C4ScenarioParameters.h.

Referenced by C4GameParameters::EnforceLeagueRules().

81 { return LeagueValue; }

Here is the caller graph for this function:

const char* C4ScenarioParameterDef::GetName ( ) const
inline

Definition at line 76 of file C4ScenarioParameters.h.

References StdStrBuf::getData().

76 { return Name.getData(); }
const char * getData() const
Definition: StdBuf.h:450

Here is the call graph for this function:

const C4ScenarioParameterDef::Option * C4ScenarioParameterDef::GetOptionByIndex ( size_t  idx) const

Definition at line 98 of file C4ScenarioParameters.cpp.

99 {
100  if (idx >= Options.size()) return nullptr;
101  return &Options[idx];
102 }
const C4ScenarioParameterDef::Option * C4ScenarioParameterDef::GetOptionByValue ( int32_t  val) const

Definition at line 89 of file C4ScenarioParameters.cpp.

Referenced by C4ScenarioListLoader::Scenario::LoadCustomPre().

90 {
91  // search option by value
92  for (auto i = Options.cbegin(); i != Options.cend(); ++i)
93  if (i->Value == val)
94  return &*i;
95  return nullptr;
96 }

Here is the caller graph for this function:

ParameterType C4ScenarioParameterDef::GetType ( ) const
inline

Definition at line 79 of file C4ScenarioParameters.h.

79 { return Type; }
bool C4ScenarioParameterDef::IsAchievement ( ) const
inline

Definition at line 85 of file C4ScenarioParameters.h.

References StdStrBuf::getLength().

Referenced by C4ScenarioListLoader::Scenario::LoadCustomPre().

85 { return Achievement.getLength()>0; }
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

Here is the caller graph for this function:


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