1/*
2 * LegacyClonk
3 *
4 * Copyright (c) 1998-2000, Matthes Bender (RedWolf Design)
5 * Copyright (c) 2017-2019, The LegacyClonk Team and contributors
6 *
7 * Distributed under the terms of the ISC license; see accompanying file
8 * "COPYING" for details.
9 *
10 * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11 * See accompanying file "TRADEMARK" for details.
12 *
13 * To redistribute this file separately, substitute the full license texts
14 * for the above references.
15 */
16
17/* Rank list for players or crew members */
18
19#pragma once
20
21#include "C4Constants.h"
22#include "C4ForwardDeclarations.h"
23#include "StdBuf.h"
24
25class C4RankSystem
26{
27public:
28 C4RankSystem();
29 ~C4RankSystem() { Clear(); }
30
31 enum { EXP_NoPromotion = -1 }; // experience value for NextRankExp: No more promotion possible
32
33protected:
34 char Register[256 + 1];
35 char RankName[C4MaxName + 1];
36 int RankBase;
37 char **pszRankNames; // loaded rank names for non-registry ranks
38 char *szRankNames; // loaded rank-name buffer
39 int iRankNum; // number of ranks for loaded rank-names
40 char **pszRankExtensions; // rank extensions (e.g. "%s First class") for even more ranks!
41 int iRankExtNum; // number of rank extensions
42
43public:
44 void Default();
45 void Clear();
46 int Init(const char *szRegister, const char *szDefRanks, int iRankBase);
47 bool Load(C4Group &hGroup, const char *szFilenames, int DefRankBase, const char *szLanguage); // init based on nk file in group
48 int Experience(int iRank);
49 int RankByExperience(int iExp); // get rank by experience
50 StdStrBuf GetRankName(int iRank, bool fReturnLastIfOver);
51 int32_t GetExtendedRankNum() const { return iRankExtNum; }
52
53 static bool DrawRankSymbol(C4FacetExSurface *fctSymbol, int32_t iRank, C4FacetEx *pfctRankSymbols, int32_t iRankSymbolCount, bool fOwnSurface, int32_t iXOff = 0, C4Facet *cgoDrawDirect = nullptr); // create facet from rank symbol for definition - use custom rank facets if present
54};
55