-
Notifications
You must be signed in to change notification settings - Fork 0
/
World.h
executable file
·101 lines (68 loc) · 2.22 KB
/
World.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef __WORLD_H_
#define __WORLD_H_
#include "globals.h"
#include "events_core.hpp"
#include "managed_objects.hpp"
#include <list>
#include <string>
extern "C" {
#include <lua.h>
}
// Forward declarations
class SocketGeneral;
class PlayerConnection;
class QuestManager;
typedef tId<SocketGeneral> idSocket;
typedef std::list<idSocket>::iterator itorSocketId;
typedef std::list<idSocket>::reverse_iterator ritorSocketId;
class World
{
protected:
std::list<idSocket> PlayerConnections;
// Variable: luaState_
// The Lua universe object.
lua_State * luaState_;
////////////////////////
public:
World();
virtual ~World();
/////////////////////////////////
// Connection related commands //
/////////////////////////////////
// Connections list iterator accessors
itorSocketId GetBeginConnection(); // begin()
itorSocketId GetEndConnection(); // end()
ritorSocketId GetBeginReverseConnection(); // rbegin()
ritorSocketId GetEndReverseConnection(); // rend()
short ConnectionCount();
void AddConnection(PlayerConnection * connection);
void RemoveConnection(PlayerConnection * connection);
void RemoveConnection(idSocket id);
/////////////////////////////
// Miscellaneous functions //
/////////////////////////////
void TimeUnit(); // clock tick
///////////////////
// Lua Functions //
///////////////////
lua_State * getLuaState();
bool initializeLua();
///////////////////
// Event Handler //
///////////////////
tEvents EventQueue;
void ProcessEvents ();
void AddEvent (Event * e);
///////////////////
// Log functions //
///////////////////
void LogString(const char * text);
inline void LogString(const std::string & text) { LogString( text.c_str() ); }
void LogCommString(const char * text, short level = 0); // send a string to the comm log
inline void LogCommString(const std::string & text, short level = 0) { LogCommString(text.c_str(), level ); }
void LogBugString(const char * text);
inline void LogBugString(const std::string & text) { LogBugString(text.c_str()); }
void LogCodeString(const char * text, short level = 0);
inline void LogCodeString(const std::string & text, short level = 0) { LogCodeString(text.c_str(), level ); }
};
#endif