2011-03-16 11:09:22 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
|
|
|
#ifndef GAME_CLIENT_COMPONENTS_COUNTRYFLAGS_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_COUNTRYFLAGS_H
|
|
|
|
#include <base/vmath.h>
|
|
|
|
#include <base/tl/sorted_array.h>
|
|
|
|
#include <game/client/component.h>
|
|
|
|
|
|
|
|
class CCountryFlags : public CComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct CCountryFlag
|
|
|
|
{
|
|
|
|
int m_CountryCode;
|
2011-07-31 00:04:46 +00:00
|
|
|
char m_aCountryCodeString[8];
|
2011-03-16 11:09:22 +00:00
|
|
|
int m_Texture;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2011-07-31 00:04:46 +00:00
|
|
|
bool operator<(const CCountryFlag &Other) { return str_comp(m_aCountryCodeString, Other.m_aCountryCodeString) < 0; }
|
2011-03-16 11:09:22 +00:00
|
|
|
};
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2011-03-16 11:09:22 +00:00
|
|
|
void OnInit();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2011-03-16 11:09:22 +00:00
|
|
|
int Num() const;
|
2011-06-29 20:27:32 +00:00
|
|
|
const CCountryFlag *GetByCountryCode(int CountryCode) const;
|
|
|
|
const CCountryFlag *GetByIndex(int Index) const;
|
|
|
|
//int Find(int CountryCode) const;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2011-03-16 11:09:22 +00:00
|
|
|
private:
|
2011-06-29 20:27:32 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CODE_LB=-1,
|
|
|
|
CODE_UB=999,
|
|
|
|
CODE_RANGE=CODE_UB-CODE_LB+1,
|
|
|
|
};
|
2011-03-16 11:09:22 +00:00
|
|
|
sorted_array<CCountryFlag> m_aCountryFlags;
|
2011-06-29 20:27:32 +00:00
|
|
|
int m_CodeIndexLUT[CODE_RANGE];
|
2011-03-16 11:09:22 +00:00
|
|
|
|
|
|
|
void LoadCountryflagsIndexfile();
|
|
|
|
};
|
|
|
|
#endif
|