summaryrefslogtreecommitdiffstats
path: root/source/MobTypesManager.h
blob: 6fc8bcfebe9c199f6af58732cd3ebb636366f5e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

#pragma once

#include "Mobs/Monster.h" // this is a side effect of declaring cMonster::eType inside cMonster MG TODO : make a namespace




// fwd:
class cFastRandom;





/**
This class aggregates static functions about mob types:
 - create a mob from its type (as enum) (in that way it is a compiler-proxy for mobs)
 - transform MobTypes from enums to string and vice versa
 - return mob family from given type
*/
class cMobTypesManager
{
public:
	static AString MobTypeToString(cMonster::eType a_MobType);
	static cMonster::eType StringToMobType(const AString& a_MobTypeName);
	static cMonster::eFamily FamilyFromType(cMonster::eType a_MobType);

	/** create a new object of the specified mob.
	a_MobType is the type of the mob to be created
	a_Size is the size (for mobs with size)
	if a_Size is let to -1 for entities that need size, size will be random
	asserts and returns null if mob type is not specified
	asserts if invalid size for mobs that need size
	*/
	static cMonster * NewMonsterFromType(cMonster::eType a_MobType, int a_Size = -1);

protected : 
	typedef const std::map<cMonster::eType,std::string> tMobTypes2Names;
	static tMobTypes2Names& m_MobsTypes2Names(void);
	static tMobTypes2Names MobTypes2NamesInitializerBeforeCx11(void);

	typedef const std::map<cMonster::eType,cMonster::eFamily> tMobType2Family;
	static tMobType2Family& m_MobsType2Family(void);
	static tMobType2Family MobType2FamilyInitializerBeforeCx11(void);

	static cFastRandom & m_Random(void);
	
public :
} ;