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 ()=default
 
 ~C4ScenarioParameterDef ()=default
 
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 24 of file C4ScenarioParameters.h.

Member Enumeration Documentation

Enumerator
SPDT_Enum 

Definition at line 28 of file C4ScenarioParameters.h.

29  {
30  SPDT_Enum, // only one type so far
31  };

Constructor & Destructor Documentation

C4ScenarioParameterDef::C4ScenarioParameterDef ( )
default
C4ScenarioParameterDef::~C4ScenarioParameterDef ( )
default

Member Function Documentation

void C4ScenarioParameterDef::CompileFunc ( StdCompiler pComp)

Definition at line 47 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().

48 {
49  if (!pComp->Name("ParameterDef")) { pComp->NameEnd(); pComp->excNotFound("ParameterDef"); }
51  pComp->Value(mkNamingAdapt(mkParAdapt(Description, StdCompiler::RCT_All), "Description", StdCopyStrBuf()));
53  StdEnumEntry<ParameterType> ParTypeEntries[] =
54  {
55  { "Enumeration", SPDT_Enum },
56  { nullptr, SPDT_Enum }
57  };
58  pComp->Value(mkNamingAdapt(mkEnumAdaptT<uint8_t>(Type, ParTypeEntries), "Type", SPDT_Enum));
59  pComp->Value(mkNamingAdapt(Default, "Default", 0));
60  pComp->Value(mkNamingAdapt(LeagueValue, "LeagueValue", 0));
61  pComp->Value(mkNamingAdapt(mkParAdapt(Achievement, StdCompiler::RCT_Idtf), "Achievement", StdCopyStrBuf()));
62  pComp->Value(mkNamingAdapt(mkSTLContainerAdapt(Options, StdCompiler::SEP_NONE), "Options"));
63  pComp->NameEnd();
64 }
Definition: StdAdaptors.h:762
virtual bool Name(const char *szName)
Definition: StdCompiler.h:77
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
void excNotFound(const char *szMessage,...)
Definition: StdCompiler.h:233
void Value(const T &rStruct)
Definition: StdCompiler.h:161
StdSTLContainerAdapt< C > mkSTLContainerAdapt(C &rTarget, StdCompiler::Sep eSep=StdCompiler::SEP_SEP)
Definition: StdAdaptors.h:681
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:458
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:78

Here is the call graph for this function:

const char* C4ScenarioParameterDef::GetAchievement ( ) const
inline

Definition at line 69 of file C4ScenarioParameters.h.

References StdStrBuf::getData().

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

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

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 63 of file C4ScenarioParameters.h.

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

63 { return Default; }

Here is the caller graph for this function:

const char* C4ScenarioParameterDef::GetDescription ( ) const
inline

Definition at line 60 of file C4ScenarioParameters.h.

References StdStrBuf::getData().

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

Here is the call graph for this function:

const char* C4ScenarioParameterDef::GetID ( ) const
inline

Definition at line 61 of file C4ScenarioParameters.h.

References StdStrBuf::getData().

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

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

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 64 of file C4ScenarioParameters.h.

Referenced by C4GameParameters::EnforceLeagueRules().

64 { return LeagueValue; }

Here is the caller graph for this function:

const char* C4ScenarioParameterDef::GetName ( ) const
inline

Definition at line 59 of file C4ScenarioParameters.h.

References StdStrBuf::getData().

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

Here is the call graph for this function:

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

Definition at line 41 of file C4ScenarioParameters.cpp.

42 {
43  if (idx >= Options.size()) return nullptr;
44  return &Options[idx];
45 }
const C4ScenarioParameterDef::Option * C4ScenarioParameterDef::GetOptionByValue ( int32_t  val) const

Definition at line 32 of file C4ScenarioParameters.cpp.

References C4ScenarioParameterDef::Option::Value.

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

33 {
34  // search option by value
35  for (const auto & Option : Options)
36  if (Option.Value == val)
37  return &Option;
38  return nullptr;
39 }

Here is the caller graph for this function:

ParameterType C4ScenarioParameterDef::GetType ( ) const
inline

Definition at line 62 of file C4ScenarioParameters.h.

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

Definition at line 68 of file C4ScenarioParameters.h.

References StdStrBuf::getLength().

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

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

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: