From fcee80c3699f658c200d27911472a248b7b22a9f Mon Sep 17 00:00:00 2001 From: TimePath Date: Tue, 6 Oct 2015 21:04:49 +1100 Subject: [PATCH] Monsters: rename registry globals --- qcsrc/common/monsters/all.qc | 9 --------- qcsrc/common/monsters/all.qh | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/qcsrc/common/monsters/all.qc b/qcsrc/common/monsters/all.qc index 232441e57..f4b2a4bf0 100644 --- a/qcsrc/common/monsters/all.qc +++ b/qcsrc/common/monsters/all.qc @@ -3,15 +3,6 @@ #include "all.qh" -entity get_monsterinfo(int id) -{ - if (id >= MON_FIRST && id <= MON_LAST) { - entity m = monster_info[id]; - if (m) return m; - } - return MON_Null; -} - #define IMPLEMENTATION #include "all.inc" #undef IMPLEMENTATION diff --git a/qcsrc/common/monsters/all.qh b/qcsrc/common/monsters/all.qh index 7c2f13ddf..f31e976d6 100644 --- a/qcsrc/common/monsters/all.qh +++ b/qcsrc/common/monsters/all.qh @@ -3,21 +3,24 @@ #include "monster.qh" -void RegisterMonsters(); -const int MON_MAXCOUNT = 24; -entity monster_info[MON_MAXCOUNT], monster_info_first, monster_info_last; -entity get_monsterinfo(float id); -int MON_COUNT; +REGISTRY(Monsters, 24) +REGISTER_REGISTRY(RegisterMonsters) const int MON_FIRST = 1; -#define MON_LAST (MON_FIRST + MON_COUNT - 1) +#define MON_LAST (Monsters_COUNT - 1) /** If you register a new monster, make sure to add it to all.inc */ -#define REGISTER_MONSTER(id, inst) REGISTER(RegisterMonsters, MON, monster_info, MON_COUNT, id, monsterid, inst) -REGISTER_REGISTRY(RegisterMonsters) - -entity get_monsterinfo(int id); +#define REGISTER_MONSTER(id, inst) REGISTER(RegisterMonsters, MON, Monsters, Monsters_COUNT, id, monsterid, inst) REGISTER_MONSTER(Null, NEW(Monster)); +Monster get_monsterinfo(int id) +{ + if (id >= MON_FIRST && id <= MON_LAST) { + Monster m = Monsters[id]; + if (m) return m; + } + return MON_Null; +} + #include "all.inc" #endif -- 2.39.2