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 log_debug(DEBUG_HIGH, "%s (v%s) has replaced a AOE AI Handler [%d] (Was this on purpose?)",
11 g_current_mod->mod_id, g_current_mod->mod_version, spell_line);
12 }
13
14 s_ai_aoe_handler_map[spell_line] = handler;
15}
16
18{
19 auto it = s_ai_aoe_handler_map.find(spell_line);
20 if (it == s_ai_aoe_handler_map.end())
21 {
22 // Element doesn't exist, insert the default value
23 log_debug(DEBUG_HIGH, "Unknown spell ID for AOE ai handler for [%d], Assigning a default handler.", spell_line);
24 it = s_ai_aoe_handler_map.emplace(spell_line, &area_pain_ai_handler).first;
25 }
26 return it->second;
27}
void log_debug(DebugLevel level, const char *format,...)
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)