Spellforce-Spell-framework
Loading...
Searching...
No Matches
sf_ai_aoe_registry.cpp
Go to the documentation of this file.
2
3static std::map<uint16_t, ai_aoe_handler_ptr> s_ai_aoe_handler_map;
4
5void registerAiAOEHandler(uint16_t spell_line, ai_aoe_handler_ptr handler)
6{
7 auto check = s_ai_aoe_handler_map.find(spell_line);
8 if (check != s_ai_aoe_handler_map.end())
9 {
10 char message[256];
11 sprintf(message,
12 "%s (v%s) has replaced a AOE AI Handler [%d] (Was this on purpose?)",
14 log_warning(message);
15 }
16
17 s_ai_aoe_handler_map[spell_line] = handler;
18}
19
21{
22 auto it = s_ai_aoe_handler_map.find(spell_line);
23 if (it == s_ai_aoe_handler_map.end())
24 {
25 // Element doesn't exist, insert the default value
27 "Unknown spell ID for AOE ai handler, Assigning a default handler.");
28 it = s_ai_aoe_handler_map.emplace(spell_line,
30 }
31 return it->second;
32}
void log_warning(const char *message)
Definition sf_wrappers.c:81
uint32_t __thiscall area_pain_ai_handler(SF_CGdBattleDevelopment *_this, SF_Coord *cast_position, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
void registerAiAOEHandler(uint16_t spell_line, ai_aoe_handler_ptr handler)
ai_aoe_handler_ptr get_ai_aoe_handler(uint16_t spell_line)
SFMod * g_current_mod
uint32_t(__thiscall * ai_aoe_handler_ptr)(SF_CGdBattleDevelopment *_this, SF_Coord *position, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
char mod_id[64]
char mod_version[24]