diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-09-24 09:03:49 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-09-24 09:03:49 +0000 |
| commit | eb21e9d6bb772c6fba533bfe4b421dc7efe181b1 (patch) | |
| tree | 0d94fb38f7244e2495527d66d8e5ae2c9e155da2 /src/game/server/entities | |
| parent | d9d37b945ee5796553794ef33249c22490494391 (diff) | |
| download | zcatch-eb21e9d6bb772c6fba533bfe4b421dc7efe181b1.tar.gz zcatch-eb21e9d6bb772c6fba533bfe4b421dc7efe181b1.zip | |
cleaned up the code a bit more. pooling of character and player objects with reusable macros. fixed crashing when changing maps and a couple of other bugs
Diffstat (limited to 'src/game/server/entities')
| -rw-r--r-- | src/game/server/entities/character.cpp | 3 | ||||
| -rw-r--r-- | src/game/server/entities/character.hpp | 13 |
2 files changed, 4 insertions, 12 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 60acdca8..e79962c2 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -32,6 +32,9 @@ static INPUT_COUNT count_input(int prev, int cur) return c; } + +MACRO_ALLOC_POOL_ID_IMPL(CHARACTER, MAX_CLIENTS) + // player CHARACTER::CHARACTER() : ENTITY(NETOBJTYPE_CHARACTER) diff --git a/src/game/server/entities/character.hpp b/src/game/server/entities/character.hpp index 9bd441ba..c25b4b5f 100644 --- a/src/game/server/entities/character.hpp +++ b/src/game/server/entities/character.hpp @@ -11,19 +11,8 @@ class CHARACTER : public ENTITY { - /*static CHARACTER pool_data[MAX_CLIENTS]; - static int pool_used[MAX_CLIENTS];*/ + MACRO_ALLOC_POOL_ID() public: -/* - void operator delete(void *character) - { - (CHARACTER *)character - int id = (CHARACTER *)character - (CHARACTER *)pool_data; - dbg_assert(pool_used[id], ""); - pool_used[id] = 0; - mem_zero(&pool_data[id], sizeof(CHARACTER)); - }*/ - // player controlling this character class PLAYER *player; |