CAiFuncMap: Replace map indexing with emplace in the constructor

Provides the same behavior, but without default initializing a map entry
that immediately gets overridden in the assignment.
This commit is contained in:
Lioncash 2019-09-08 17:49:24 -04:00
parent 4a4781de76
commit 1cfe83d8d1
1 changed files with 123 additions and 123 deletions

View File

@ -5,131 +5,131 @@
namespace urde { namespace urde {
CAiFuncMap::CAiFuncMap() { CAiFuncMap::CAiFuncMap() {
/* Ai States */ /* Ai States */
x0_stateFuncs["Patrol"] = &CAi::Patrol; x0_stateFuncs.emplace("Patrol", &CAi::Patrol);
x0_stateFuncs["FollowPattern"] = &CAi::FollowPattern; x0_stateFuncs.emplace("FollowPattern", &CAi::FollowPattern);
x0_stateFuncs["Dead"] = &CAi::Dead; x0_stateFuncs.emplace("Dead", &CAi::Dead);
x0_stateFuncs["PathFind"] = &CAi::PathFind; x0_stateFuncs.emplace("PathFind", &CAi::PathFind);
x0_stateFuncs["Start"] = &CAi::Start; x0_stateFuncs.emplace("Start", &CAi::Start);
x0_stateFuncs["SelectTarget"] = &CAi::SelectTarget; x0_stateFuncs.emplace("SelectTarget", &CAi::SelectTarget);
x0_stateFuncs["TargetPatrol"] = &CAi::TargetPatrol; x0_stateFuncs.emplace("TargetPatrol", &CAi::TargetPatrol);
x0_stateFuncs["TargetPlayer"] = &CAi::TargetPlayer; x0_stateFuncs.emplace("TargetPlayer", &CAi::TargetPlayer);
x0_stateFuncs["TargetCover"] = &CAi::TargetCover; x0_stateFuncs.emplace("TargetCover", &CAi::TargetCover);
x0_stateFuncs["Halt"] = &CAi::Halt; x0_stateFuncs.emplace("Halt", &CAi::Halt);
x0_stateFuncs["Walk"] = &CAi::Walk; x0_stateFuncs.emplace("Walk", &CAi::Walk);
x0_stateFuncs["Run"] = &CAi::Run; x0_stateFuncs.emplace("Run", &CAi::Run);
x0_stateFuncs["Generate"] = &CAi::Generate; x0_stateFuncs.emplace("Generate", &CAi::Generate);
x0_stateFuncs["Deactivate"] = &CAi::Deactivate; x0_stateFuncs.emplace("Deactivate", &CAi::Deactivate);
x0_stateFuncs["Attack"] = &CAi::Attack; x0_stateFuncs.emplace("Attack", &CAi::Attack);
x0_stateFuncs["LoopedAttack"] = &CAi::LoopedAttack; x0_stateFuncs.emplace("LoopedAttack", &CAi::LoopedAttack);
x0_stateFuncs["JumpBack"] = &CAi::JumpBack; x0_stateFuncs.emplace("JumpBack", &CAi::JumpBack);
x0_stateFuncs["DoubleSnap"] = &CAi::DoubleSnap; x0_stateFuncs.emplace("DoubleSnap", &CAi::DoubleSnap);
x0_stateFuncs["Shuffle"] = &CAi::Shuffle; x0_stateFuncs.emplace("Shuffle", &CAi::Shuffle);
x0_stateFuncs["TurnAround"] = &CAi::TurnAround; x0_stateFuncs.emplace("TurnAround", &CAi::TurnAround);
x0_stateFuncs["Skid"] = &CAi::Skid; x0_stateFuncs.emplace("Skid", &CAi::Skid);
x0_stateFuncs["Active"] = &CAi::Active; x0_stateFuncs.emplace("Active", &CAi::Active);
x0_stateFuncs["InActive"] = &CAi::InActive; x0_stateFuncs.emplace("InActive", &CAi::InActive);
x0_stateFuncs["CoverAttack"] = &CAi::CoverAttack; x0_stateFuncs.emplace("CoverAttack", &CAi::CoverAttack);
x0_stateFuncs["Crouch"] = &CAi::Crouch; x0_stateFuncs.emplace("Crouch", &CAi::Crouch);
x0_stateFuncs["FadeIn"] = &CAi::FadeIn; x0_stateFuncs.emplace("FadeIn", &CAi::FadeIn);
x0_stateFuncs["FadeOut"] = &CAi::FadeOut; x0_stateFuncs.emplace("FadeOut", &CAi::FadeOut);
x0_stateFuncs["GetUp"] = &CAi::GetUp; x0_stateFuncs.emplace("GetUp", &CAi::GetUp);
x0_stateFuncs["Taunt"] = &CAi::Taunt; x0_stateFuncs.emplace("Taunt", &CAi::Taunt);
x0_stateFuncs["Suck"] = &CAi::Suck; x0_stateFuncs.emplace("Suck", &CAi::Suck);
x0_stateFuncs["Flee"] = &CAi::Flee; x0_stateFuncs.emplace("Flee", &CAi::Flee);
x0_stateFuncs["Lurk"] = &CAi::Lurk; x0_stateFuncs.emplace("Lurk", &CAi::Lurk);
x0_stateFuncs["ProjectileAttack"] = &CAi::ProjectileAttack; x0_stateFuncs.emplace("ProjectileAttack", &CAi::ProjectileAttack);
x0_stateFuncs["Flinch"] = &CAi::Flinch; x0_stateFuncs.emplace("Flinch", &CAi::Flinch);
x0_stateFuncs["Hurled"] = &CAi::Hurled; x0_stateFuncs.emplace("Hurled", &CAi::Hurled);
x0_stateFuncs["TelegraphAttack"] = &CAi::TelegraphAttack; x0_stateFuncs.emplace("TelegraphAttack", &CAi::TelegraphAttack);
x0_stateFuncs["Jump"] = &CAi::Jump; x0_stateFuncs.emplace("Jump", &CAi::Jump);
x0_stateFuncs["Explode"] = &CAi::Explode; x0_stateFuncs.emplace("Explode", &CAi::Explode);
x0_stateFuncs["Dodge"] = &CAi::Dodge; x0_stateFuncs.emplace("Dodge", &CAi::Dodge);
x0_stateFuncs["Retreat"] = &CAi::Retreat; x0_stateFuncs.emplace("Retreat", &CAi::Retreat);
x0_stateFuncs["Cover"] = &CAi::Cover; x0_stateFuncs.emplace("Cover", &CAi::Cover);
x0_stateFuncs["Approach"] = &CAi::Approach; x0_stateFuncs.emplace("Approach", &CAi::Approach);
x0_stateFuncs["WallHang"] = &CAi::WallHang; x0_stateFuncs.emplace("WallHang", &CAi::WallHang);
x0_stateFuncs["WallDetach"] = &CAi::WallDetach; x0_stateFuncs.emplace("WallDetach", &CAi::WallDetach);
x0_stateFuncs["Enraged"] = &CAi::Enraged; x0_stateFuncs.emplace("Enraged", &CAi::Enraged);
x0_stateFuncs["SpecialAttack"] = &CAi::SpecialAttack; x0_stateFuncs.emplace("SpecialAttack", &CAi::SpecialAttack);
x0_stateFuncs["Growth"] = &CAi::Growth; x0_stateFuncs.emplace("Growth", &CAi::Growth);
x0_stateFuncs["Faint"] = &CAi::Faint; x0_stateFuncs.emplace("Faint", &CAi::Faint);
x0_stateFuncs["Land"] = &CAi::Land; x0_stateFuncs.emplace("Land", &CAi::Land);
x0_stateFuncs["Bounce"] = &CAi::Bounce; x0_stateFuncs.emplace("Bounce", &CAi::Bounce);
x0_stateFuncs["PathFindEx"] = &CAi::PathFindEx; x0_stateFuncs.emplace("PathFindEx", &CAi::PathFindEx);
x0_stateFuncs["Dizzy"] = &CAi::Dizzy; x0_stateFuncs.emplace("Dizzy", &CAi::Dizzy);
x0_stateFuncs["CallForBackup"] = &CAi::CallForBackup; x0_stateFuncs.emplace("CallForBackup", &CAi::CallForBackup);
x0_stateFuncs["BulbAttack"] = &CAi::BulbAttack; x0_stateFuncs.emplace("BulbAttack", &CAi::BulbAttack);
x0_stateFuncs["PodAttack"] = &CAi::PodAttack; x0_stateFuncs.emplace("PodAttack", &CAi::PodAttack);
/* Ai Triggers */ /* Ai Triggers */
x10_triggerFuncs["InAttackPosition"] = &CAi::InAttackPosition; x10_triggerFuncs.emplace("InAttackPosition", &CAi::InAttackPosition);
x10_triggerFuncs["Leash"] = &CAi::Leash; x10_triggerFuncs.emplace("Leash", &CAi::Leash);
x10_triggerFuncs["OffLine"] = &CAi::OffLine; x10_triggerFuncs.emplace("OffLine", &CAi::OffLine);
x10_triggerFuncs["Attacked"] = &CAi::Attacked; x10_triggerFuncs.emplace("Attacked", &CAi::Attacked);
x10_triggerFuncs["PathShagged"] = &CAi::PathShagged; x10_triggerFuncs.emplace("PathShagged", &CAi::PathShagged);
x10_triggerFuncs["PathOver"] = &CAi::PathOver; x10_triggerFuncs.emplace("PathOver", &CAi::PathOver);
x10_triggerFuncs["PathFound"] = &CAi::PathFound; x10_triggerFuncs.emplace("PathFound", &CAi::PathFound);
x10_triggerFuncs["TooClose"] = &CAi::TooClose; x10_triggerFuncs.emplace("TooClose", &CAi::TooClose);
x10_triggerFuncs["InRange"] = &CAi::InRange; x10_triggerFuncs.emplace("InRange", &CAi::InRange);
x10_triggerFuncs["InMaxRange"] = &CAi::InMaxRange; x10_triggerFuncs.emplace("InMaxRange", &CAi::InMaxRange);
x10_triggerFuncs["InDetectionRange"] = &CAi::InDetectionRange; x10_triggerFuncs.emplace("InDetectionRange", &CAi::InDetectionRange);
x10_triggerFuncs["SpotPlayer"] = &CAi::SpotPlayer; x10_triggerFuncs.emplace("SpotPlayer", &CAi::SpotPlayer);
x10_triggerFuncs["PlayerSpot"] = &CAi::PlayerSpot; x10_triggerFuncs.emplace("PlayerSpot", &CAi::PlayerSpot);
x10_triggerFuncs["PatternOver"] = &CAi::PatternOver; x10_triggerFuncs.emplace("PatternOver", &CAi::PatternOver);
x10_triggerFuncs["PatternShagged"] = &CAi::PatternShagged; x10_triggerFuncs.emplace("PatternShagged", &CAi::PatternShagged);
x10_triggerFuncs["HasAttackPattern"] = &CAi::HasAttackPattern; x10_triggerFuncs.emplace("HasAttackPattern", &CAi::HasAttackPattern);
x10_triggerFuncs["HasPatrolPath"] = &CAi::HasPatrolPath; x10_triggerFuncs.emplace("HasPatrolPath", &CAi::HasPatrolPath);
x10_triggerFuncs["HasRetreatPattern"] = &CAi::HasRetreatPattern; x10_triggerFuncs.emplace("HasRetreatPattern", &CAi::HasRetreatPattern);
x10_triggerFuncs["Delay"] = &CAi::Delay; x10_triggerFuncs.emplace("Delay", &CAi::Delay);
x10_triggerFuncs["RandomDelay"] = &CAi::RandomDelay; x10_triggerFuncs.emplace("RandomDelay", &CAi::RandomDelay);
x10_triggerFuncs["FixedDelay"] = &CAi::FixedDelay; x10_triggerFuncs.emplace("FixedDelay", &CAi::FixedDelay);
x10_triggerFuncs["Default"] = &CAi::Default; x10_triggerFuncs.emplace("Default", &CAi::Default);
x10_triggerFuncs["AnimOver"] = &CAi::AnimOver; x10_triggerFuncs.emplace("AnimOver", &CAi::AnimOver);
x10_triggerFuncs["ShouldAttack"] = &CAi::ShouldAttack; x10_triggerFuncs.emplace("ShouldAttack", &CAi::ShouldAttack);
x10_triggerFuncs["ShouldDoubleSnap"] = &CAi::ShouldDoubleSnap; x10_triggerFuncs.emplace("ShouldDoubleSnap", &CAi::ShouldDoubleSnap);
x10_triggerFuncs["InPosition"] = &CAi::InPosition; x10_triggerFuncs.emplace("InPosition", &CAi::InPosition);
x10_triggerFuncs["ShouldTurn"] = &CAi::ShouldTurn; x10_triggerFuncs.emplace("ShouldTurn", &CAi::ShouldTurn);
x10_triggerFuncs["HitSomething"] = &CAi::HitSomething; x10_triggerFuncs.emplace("HitSomething", &CAi::HitSomething);
x10_triggerFuncs["ShouldJumpBack"] = &CAi::ShouldJumpBack; x10_triggerFuncs.emplace("ShouldJumpBack", &CAi::ShouldJumpBack);
x10_triggerFuncs["Stuck"] = &CAi::Stuck; x10_triggerFuncs.emplace("Stuck", &CAi::Stuck);
x10_triggerFuncs["NoPathNodes"] = &CAi::NoPathNodes; x10_triggerFuncs.emplace("NoPathNodes", &CAi::NoPathNodes);
x10_triggerFuncs["Landed"] = &CAi::Landed; x10_triggerFuncs.emplace("Landed", &CAi::Landed);
x10_triggerFuncs["HearShot"] = &CAi::HearShot; x10_triggerFuncs.emplace("HearShot", &CAi::HearShot);
x10_triggerFuncs["HearPlayer"] = &CAi::HearPlayer; x10_triggerFuncs.emplace("HearPlayer", &CAi::HearPlayer);
x10_triggerFuncs["CoverCheck"] = &CAi::CoverCheck; x10_triggerFuncs.emplace("CoverCheck", &CAi::CoverCheck);
x10_triggerFuncs["CoverFind"] = &CAi::CoverFind; x10_triggerFuncs.emplace("CoverFind", &CAi::CoverFind);
x10_triggerFuncs["CoverBlown"] = &CAi::CoverBlown; x10_triggerFuncs.emplace("CoverBlown", &CAi::CoverBlown);
x10_triggerFuncs["CoverNearlyBlown"] = &CAi::CoverNearlyBlown; x10_triggerFuncs.emplace("CoverNearlyBlown", &CAi::CoverNearlyBlown);
x10_triggerFuncs["CoveringFire"] = &CAi::CoveringFire; x10_triggerFuncs.emplace("CoveringFire", &CAi::CoveringFire);
x10_triggerFuncs["GotUp"] = &CAi::GotUp; x10_triggerFuncs.emplace("GotUp", &CAi::GotUp);
x10_triggerFuncs["LineOfSight"] = &CAi::LineOfSight; x10_triggerFuncs.emplace("LineOfSight", &CAi::LineOfSight);
x10_triggerFuncs["AggressionCheck"] = &CAi::AggressionCheck; x10_triggerFuncs.emplace("AggressionCheck", &CAi::AggressionCheck);
x10_triggerFuncs["AttackOver"] = &CAi::AttackOver; x10_triggerFuncs.emplace("AttackOver", &CAi::AttackOver);
x10_triggerFuncs["ShouldTaunt"] = &CAi::ShouldTaunt; x10_triggerFuncs.emplace("ShouldTaunt", &CAi::ShouldTaunt);
x10_triggerFuncs["Inside"] = &CAi::Inside; x10_triggerFuncs.emplace("Inside", &CAi::Inside);
x10_triggerFuncs["ShouldFire"] = &CAi::ShouldFire; x10_triggerFuncs.emplace("ShouldFire", &CAi::ShouldFire);
x10_triggerFuncs["ShouldFlinch"] = &CAi::ShouldFlinch; x10_triggerFuncs.emplace("ShouldFlinch", &CAi::ShouldFlinch);
x10_triggerFuncs["PatrolPathOver"] = &CAi::PatrolPathOver; x10_triggerFuncs.emplace("PatrolPathOver", &CAi::PatrolPathOver);
x10_triggerFuncs["ShouldDodge"] = &CAi::ShouldDodge; x10_triggerFuncs.emplace("ShouldDodge", &CAi::ShouldDodge);
x10_triggerFuncs["ShouldRetreat"] = &CAi::ShouldRetreat; x10_triggerFuncs.emplace("ShouldRetreat", &CAi::ShouldRetreat);
x10_triggerFuncs["ShouldCrouch"] = &CAi::ShouldCrouch; x10_triggerFuncs.emplace("ShouldCrouch", &CAi::ShouldCrouch);
x10_triggerFuncs["ShouldMove"] = &CAi::ShouldMove; x10_triggerFuncs.emplace("ShouldMove", &CAi::ShouldMove);
x10_triggerFuncs["ShotAt"] = &CAi::ShotAt; x10_triggerFuncs.emplace("ShotAt", &CAi::ShotAt);
x10_triggerFuncs["HasTargetingPoint"] = &CAi::HasTargetingPoint; x10_triggerFuncs.emplace("HasTargetingPoint", &CAi::HasTargetingPoint);
x10_triggerFuncs["ShouldWallHang"] = &CAi::ShouldWallHang; x10_triggerFuncs.emplace("ShouldWallHang", &CAi::ShouldWallHang);
x10_triggerFuncs["SetAIStage"] = &CAi::SetAIStage; x10_triggerFuncs.emplace("SetAIStage", &CAi::SetAIStage);
x10_triggerFuncs["AIStage"] = &CAi::AIStage; x10_triggerFuncs.emplace("AIStage", &CAi::AIStage);
x10_triggerFuncs["StartAttack"] = &CAi::StartAttack; x10_triggerFuncs.emplace("StartAttack", &CAi::StartAttack);
x10_triggerFuncs["BreakAttack"] = &CAi::BreakAttack; x10_triggerFuncs.emplace("BreakAttack", &CAi::BreakAttack);
x10_triggerFuncs["ShouldStrafe"] = &CAi::ShouldStrafe; x10_triggerFuncs.emplace("ShouldStrafe", &CAi::ShouldStrafe);
x10_triggerFuncs["ShouldSpecialAttack"] = &CAi::ShouldSpecialAttack; x10_triggerFuncs.emplace("ShouldSpecialAttack", &CAi::ShouldSpecialAttack);
x10_triggerFuncs["LostInterest"] = &CAi::LostInterest; x10_triggerFuncs.emplace("LostInterest", &CAi::LostInterest);
x10_triggerFuncs["CodeTrigger"] = &CAi::CodeTrigger; x10_triggerFuncs.emplace("CodeTrigger", &CAi::CodeTrigger);
x10_triggerFuncs["BounceFind"] = &CAi::BounceFind; x10_triggerFuncs.emplace("BounceFind", &CAi::BounceFind);
x10_triggerFuncs["Random"] = &CAi::Random; x10_triggerFuncs.emplace("Random", &CAi::Random);
x10_triggerFuncs["FixedRandom"] = &CAi::FixedRandom; x10_triggerFuncs.emplace("FixedRandom", &CAi::FixedRandom);
x10_triggerFuncs["IsDizzy"] = &CAi::IsDizzy; x10_triggerFuncs.emplace("IsDizzy", &CAi::IsDizzy);
x10_triggerFuncs["ShouldCallForBackup"] = &CAi::ShouldCallForBackup; x10_triggerFuncs.emplace("ShouldCallForBackup", &CAi::ShouldCallForBackup);
CAi::CreateFuncLookup(this); CAi::CreateFuncLookup(this);
} }