Spellforce-Spell-framework
Toggle main menu visibility
Loading...
Searching...
No Matches
sf_ai_aoe_registry.cpp
Go to the documentation of this file.
1
#include "
sf_ai_aoe_registry.h
"
2
3
static
std::map<uint16_t, ai_aoe_handler_ptr> s_ai_aoe_handler_map;
4
5
void
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
17
ai_aoe_handler_ptr
get_ai_aoe_handler
(uint16_t spell_line)
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
}
log_debug
void log_debug(DebugLevel level, const char *format,...)
Definition
sf_wrappers.c:182
area_pain_ai_handler
uint32_t __thiscall area_pain_ai_handler(SF_CGdBattleDevelopment *_this, SF_Coord *cast_position, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
Definition
sf_ai_aoe_handlers.cpp:231
registerAiAOEHandler
void registerAiAOEHandler(uint16_t spell_line, ai_aoe_handler_ptr handler)
Definition
sf_ai_aoe_registry.cpp:5
get_ai_aoe_handler
ai_aoe_handler_ptr get_ai_aoe_handler(uint16_t spell_line)
Definition
sf_ai_aoe_registry.cpp:17
sf_ai_aoe_registry.h
DEBUG_HIGH
@ DEBUG_HIGH
Definition
sf_general_structures.h:40
g_current_mod
SFMod * g_current_mod
Definition
sf_registry.cpp:45
ai_aoe_handler_ptr
uint32_t(__thiscall * ai_aoe_handler_ptr)(SF_CGdBattleDevelopment *_this, SF_Coord *position, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
Definition
sf_registration_structures.h:11
src
internal
registry
ai_data_registries
sf_ai_aoe_registry.cpp
Generated by
1.17.0