-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathsystem.h
More file actions
62 lines (46 loc) · 1.87 KB
/
system.h
File metadata and controls
62 lines (46 loc) · 1.87 KB
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
55
56
57
58
59
60
61
62
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_SYSTEM_H
#define SC_SYSTEM_H
extern DatabaseType SD2Database;
extern std::string strSD2Version; // version info: database entry and revision
#define TEXT_SOURCE_RANGE -1000000 // the amount of entries each text source has available
#define TEXT_SOURCE_TEXT_START TEXT_SOURCE_RANGE
#define TEXT_SOURCE_TEXT_END TEXT_SOURCE_RANGE*2 + 1
#define TEXT_SOURCE_CUSTOM_START TEXT_SOURCE_RANGE*2
#define TEXT_SOURCE_CUSTOM_END TEXT_SOURCE_RANGE*3 + 1
#define TEXT_SOURCE_GOSSIP_START TEXT_SOURCE_RANGE*3
#define TEXT_SOURCE_GOSSIP_END TEXT_SOURCE_RANGE*4 + 1
#define pSystemMgr SystemMgr::Instance()
struct PathInformation
{
uint32 lastWaypoint;
};
class SystemMgr
{
public:
SystemMgr();
~SystemMgr() {}
static SystemMgr& Instance();
typedef std::map < uint32 /*entry*/, std::map < int32 /*pathId*/, PathInformation > > EntryPathInfo;
// Database
void LoadVersion();
void LoadScriptTexts();
void LoadScriptTextsCustom();
void LoadScriptGossipTexts();
void LoadScriptWaypoints();
PathInformation const* GetPathInfo(uint32 entry, int32 pathId) const
{
EntryPathInfo::const_iterator findEntry = m_pathInfo.find(entry);
if (findEntry == m_pathInfo.end())
return NULL;
std::map<int32, PathInformation>::const_iterator findPath = findEntry->second.find(pathId);
if (findPath == findEntry->second.end())
return NULL;
return &(findPath->second);
}
private:
EntryPathInfo m_pathInfo;
};
#endif