All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Go to the documentation of this file.
1 /*
2  * OpenClonk,
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH,
6  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
7  *
8  * Distributed under the terms of the ISC license; see accompanying file
9  * "COPYING" for details.
10  *
11  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
12  * See accompanying file "TRADEMARK" for details.
13  *
14  * To redistribute this file separately, substitute the full license texts
15  * for the above references.
16  */
18 /* Structures for object and player info components */
20 #ifndef INC_C4InfoCore
21 #define INC_C4InfoCore
23 #include "lib/C4InputValidation.h"
24 #include "object/C4Id.h"
26 #include "script/C4ValueMap.h"
28 const int32_t C4MaxPhysical = 100000,
32 {
33 public:
35 public:
37  char Name[C4MaxName+1];
38  int32_t Participation;
39  int32_t Rank;
42  int32_t NextRankExp; // EXP_NoPromotion for no more promotion; 0 if standard rank system is used
43  int32_t Experience,Rounds;
44  int32_t DeathCount;
45  char TypeName[C4MaxName+1+1];
47  int32_t Age;
50 public:
51  bool Save(C4Group &hGroup, class C4DefList *pDefs);
52  bool Load(C4Group &hGroup);
53  void Default(C4ID n_id=C4ID::None, class C4DefList *pDefs=nullptr, const char *cpNames=nullptr);
54  void Promote(int32_t iRank, C4RankSystem &rRanks, bool fForceRankName);
55  bool GetNextRankInfo(C4RankSystem &rDefaultRanks, int32_t *piNextRankExp, StdStrBuf *psNextRankName);
56  void CompileFunc(StdCompiler *pComp);
57 protected:
58  bool Compile(const char *szSource);
59  bool Decompile(char **ppOutput, size_t *ipSize);
61  void UpdateCustomRanks(C4DefList *pDefs); // sets NextRankName and NextRankExp
62 };
65 {
66 public:
68  uint32_t Date = 0;
69  int32_t Duration = 0;
70  int32_t Won = 0;
71  int32_t Score = 0, FinalScore = 0, TotalScore = 0;
72  int32_t Bonus = 0;
73  int32_t Level = 0;
74 public:
75  void Default();
76  void CompileFunc(StdCompiler *pComp);
77 };
80 {
81 public:
83 public:
84  // Player Info
87  int32_t Rank;
89  int32_t TotalScore;
95  // Preferences
96  StdCopyStrBuf PrefControl; // name of control set from definition file
97  int32_t PrefMouse;
98  int32_t PrefColor;
100  int32_t PrefClonkSkin;
101  // Old control method - loaded for backwards compatilibity if PrefControl is unassigned
102  // and stored back so you can use the same player file for CR and OC
103  int32_t OldPrefControl;
107  // achievements indexed by achievement name and scenario
109 public:
110  void Default(C4RankSystem *pRanks=nullptr);
111  void Promote(int32_t iRank, C4RankSystem &rRanks);
112  bool Load(C4Group &hGroup);
113  bool Save(C4Group &hGroup);
114  bool CheckPromotion(C4RankSystem &rRanks);
115  static DWORD GetPrefColorValue(int32_t iPrefColor);
116  void CompileFunc(StdCompiler *pComp);
117 };
119 #endif
int32_t OldPrefControlStyle
Definition: C4InfoCore.h:104
const int32_t C4MaxPhysical
Definition: C4InfoCore.h:28
bool GetNextRankInfo(C4RankSystem &rDefaultRanks, int32_t *piNextRankExp, StdStrBuf *psNextRankName)
Definition: C4InfoCore.cpp:262
int32_t OldPrefAutoContextMenu
Definition: C4InfoCore.h:105
int32_t TotalScore
Definition: C4InfoCore.h:71
int32_t TotalPlayingTime
Definition: C4InfoCore.h:91
int32_t Rounds
Definition: C4InfoCore.h:43
void Default(C4ID n_id=C4ID::None, class C4DefList *pDefs=nullptr, const char *cpNames=nullptr)
Definition: C4InfoCore.cpp:181
int32_t Won
Definition: C4InfoCore.h:70
int32_t Score
Definition: C4InfoCore.h:71
int32_t RoundsWon
Definition: C4InfoCore.h:90
int32_t OldPrefControl
Definition: C4InfoCore.h:103
bool Decompile(char **ppOutput, size_t *ipSize)
Definition: C4InfoCore.cpp:347
bool Save(C4Group &hGroup, class C4DefList *pDefs)
Definition: C4InfoCore.cpp:297
char PrefName[C4MaxName+1]
Definition: C4InfoCore.h:85
int32_t PrefClonkSkin
Definition: C4InfoCore.h:100
char LeagueName[C4MaxName+1]
Definition: C4InfoCore.h:94
StdCopyStrBuf PrefControl
Definition: C4InfoCore.h:96
StdStrBuf sRankName
Definition: C4InfoCore.h:40
char DeathMessage[C4MaxDeathMsg+1]
Definition: C4InfoCore.h:48
int32_t Participation
Definition: C4InfoCore.h:38
int32_t PrefMouse
Definition: C4InfoCore.h:97
C4ValueMapData ExtraData
Definition: C4InfoCore.h:93
int32_t RoundsLost
Definition: C4InfoCore.h:90
int32_t TotalPlayingTime
Definition: C4InfoCore.h:46
char Comment[C4MaxComment+1]
Definition: C4InfoCore.h:86
static DWORD GetPrefColorValue(int32_t iPrefColor)
Definition: C4InfoCore.cpp:67
const unsigned int C4MaxComment
int32_t NextRankExp
Definition: C4InfoCore.h:42
bool Load(C4Group &hGroup)
Definition: C4InfoCore.cpp:78
uint32_t Date
Definition: C4InfoCore.h:68
void Default(C4RankSystem *pRanks=nullptr)
Definition: C4InfoCore.cpp:40
bool Save(C4Group &hGroup)
Definition: C4InfoCore.cpp:107
const int32_t C4MaxDeathMsg
Definition: C4InfoCore.h:29
static const C4ID None
Definition: C4Id.h:39
C4ValueMapData ExtraData
Definition: C4InfoCore.h:49
char RankName[C4MaxName+1]
Definition: C4InfoCore.h:88
int32_t Birthday
Definition: C4InfoCore.h:46
const unsigned int C4MaxName
char Name[C4MaxName+1]
Definition: C4InfoCore.h:37
void UpdateCustomRanks(C4DefList *pDefs)
Definition: C4InfoCore.cpp:231
void CompileFunc(StdCompiler *pComp)
Definition: C4InfoCore.cpp:372
int32_t PrefColor
Definition: C4InfoCore.h:98
bool CheckPromotion(C4RankSystem &rRanks)
Definition: C4InfoCore.cpp:124
uint32_t PrefColorDw
Definition: C4InfoCore.h:99
Definition: C4Id.h:25
StdStrBuf sNextRankName
Definition: C4InfoCore.h:41
uint32_t PrefColor2Dw
Definition: C4InfoCore.h:99
void CompileFunc(StdCompiler *pComp)
Definition: C4InfoCore.cpp:134
int32_t FinalScore
Definition: C4InfoCore.h:71
void Promote(int32_t iRank, C4RankSystem &rRanks, bool fForceRankName)
Definition: C4InfoCore.cpp:223
int32_t TotalScore
Definition: C4InfoCore.h:89
void CompileFunc(StdCompiler *pComp)
Definition: C4InfoCore.cpp:309
bool Load(C4Group &hGroup)
Definition: C4InfoCore.cpp:290
int32_t Experience
Definition: C4InfoCore.h:43
bool Compile(const char *szSource)
Definition: C4InfoCore.cpp:336
int32_t Rounds
Definition: C4InfoCore.h:90
void Promote(int32_t iRank, C4RankSystem &rRanks)
Definition: C4InfoCore.cpp:118
uint32_t DWORD
int32_t DeathCount
Definition: C4InfoCore.h:44
int32_t Duration
Definition: C4InfoCore.h:69
int32_t Level
Definition: C4InfoCore.h:73
C4ScenarioParameters Achievements
Definition: C4InfoCore.h:108
int32_t Bonus
Definition: C4InfoCore.h:72
char TypeName[C4MaxName+1+1]
Definition: C4InfoCore.h:45
StdCopyStrBuf Title
Definition: C4InfoCore.h:67
C4RoundResult LastRound
Definition: C4InfoCore.h:92