Skip to content

Commit

Permalink
Rename core-specific preprocessors
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Jul 25, 2024
1 parent 16908e7 commit e8c5792
Show file tree
Hide file tree
Showing 20 changed files with 107 additions and 107 deletions.
8 changes: 4 additions & 4 deletions ElunaConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Please see the included DOCS/LICENSE.md for more information
*/

#if defined TRINITY
#if defined ELUNA_TRINITY
#include "Config.h"
#else
#include "Config/Config.h"
Expand Down Expand Up @@ -45,7 +45,7 @@ void ElunaConfig::Initialize()

void ElunaConfig::SetConfig(ElunaConfigBoolValues index, char const* fieldname, bool defvalue)
{
#if defined TRINITY
#if defined ELUNA_TRINITY
SetConfig(index, sConfigMgr->GetBoolDefault(fieldname, defvalue));
#else
SetConfig(index, sConfig.GetBoolDefault(fieldname, defvalue));
Expand All @@ -54,9 +54,9 @@ void ElunaConfig::SetConfig(ElunaConfigBoolValues index, char const* fieldname,

void ElunaConfig::SetConfig(ElunaConfigStringValues index, char const* fieldname, std::string defvalue)
{
#if defined TRINITY
#if defined ELUNA_TRINITY
SetConfig(index, sConfigMgr->GetStringDefault(fieldname, defvalue));
#elif defined CMANGOS
#elif defined ELUNA_CMANGOS
SetConfig(index, sConfig.GetStringDefault(fieldname, defvalue));
#else
SetConfig(index, sConfig.GetStringDefault(fieldname, defvalue.c_str()));
Expand Down
36 changes: 18 additions & 18 deletions ElunaCreatureAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
#define _ELUNA_CREATURE_AI_H

#include "LuaEngine.h"
#if defined CMANGOS
#if defined ELUNA_CMANGOS
#include "AI/BaseAI/CreatureAI.h"
#endif

#if defined TRINITY
#if defined ELUNA_TRINITY
struct ScriptedAI;
typedef ScriptedAI NativeScriptedAI;
#elif defined CMANGOS
#elif defined ELUNA_CMANGOS
class CreatureAI;
typedef CreatureAI NativeScriptedAI;
#elif defined VMANGOS
#elif defined ELUNA_VMANGOS
class BasicAI;
typedef BasicAI NativeScriptedAI;
#endif
Expand All @@ -29,7 +29,7 @@ struct ElunaCreatureAI : NativeScriptedAI
bool justSpawned;
// used to delay movementinform hook (WP hook)
std::vector< std::pair<uint32, uint32> > movepoints;
#if !defined TRINITY
#if !defined ELUNA_TRINITY
#define me m_creature
#endif
ElunaCreatureAI(Creature* creature) : NativeScriptedAI(creature), justSpawned(true)
Expand All @@ -38,13 +38,13 @@ struct ElunaCreatureAI : NativeScriptedAI
~ElunaCreatureAI() { }

//Called at World update tick
#if !defined TRINITY
#if !defined ELUNA_TRINITY
void UpdateAI(const uint32 diff) override
#else
void UpdateAI(uint32 diff) override
#endif
{
#if !defined TRINITY
#if !defined ELUNA_TRINITY
if (justSpawned)
{
justSpawned = false;
Expand All @@ -69,7 +69,7 @@ struct ElunaCreatureAI : NativeScriptedAI
}
}

#if defined TRINITY
#if defined ELUNA_TRINITY
// Called for reaction when initially engaged - this will always happen _after_ JustEnteredCombat
// Called at creature aggro either by MoveInLOS or Attack Start
void JustEngagedWith(Unit* target) override
Expand All @@ -88,15 +88,15 @@ struct ElunaCreatureAI : NativeScriptedAI
#endif

// Called at any Damage from any attacker (before damage apply)
#if defined TRINITY || defined CMANGOS
#if defined ELUNA_TRINITY || defined ELUNA_CMANGOS
void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damageType, SpellInfo const* spellInfo) override
#else
void DamageTaken(Unit* attacker, uint32& damage) override
#endif
{
if (!me->GetEluna()->DamageTaken(me, attacker, damage))
{
#if defined TRINITY || defined CMANGOS
#if defined ELUNA_TRINITY || defined ELUNA_CMANGOS
NativeScriptedAI::DamageTaken(attacker, damage, damageType, spellInfo);
#else
NativeScriptedAI::DamageTaken(attacker, damage);
Expand Down Expand Up @@ -147,7 +147,7 @@ struct ElunaCreatureAI : NativeScriptedAI
NativeScriptedAI::AttackStart(target);
}

#if defined TRINITY
#if defined ELUNA_TRINITY
// Called for reaction at stopping attack at no attackers or targets
void EnterEvadeMode(EvadeReason /*why*/) override
#else
Expand All @@ -158,7 +158,7 @@ struct ElunaCreatureAI : NativeScriptedAI
NativeScriptedAI::EnterEvadeMode();
}

#if defined TRINITY
#if defined ELUNA_TRINITY
// Called when creature appears in the world (spawn, respawn, grid load etc...)
void JustAppeared() override
{
Expand Down Expand Up @@ -195,7 +195,7 @@ struct ElunaCreatureAI : NativeScriptedAI
NativeScriptedAI::CorpseRemoved(respawnDelay);
}

#if !defined TRINITY && !defined VMANGOS
#if !defined ELUNA_TRINITY && !defined ELUNA_VMANGOS
// Enables use of MoveInLineOfSight
bool IsVisible(Unit* who) const override
{
Expand All @@ -210,9 +210,9 @@ struct ElunaCreatureAI : NativeScriptedAI
}

// Called when hit by a spell
#if defined TRINITY
#if defined ELUNA_TRINITY
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
#elif defined VMANGOS
#elif defined ELUNA_VMANGOS
void SpellHit(Unit* caster, SpellInfo const* spell)
#else
void SpellHit(Unit* caster, SpellInfo const* spell) override
Expand All @@ -223,7 +223,7 @@ struct ElunaCreatureAI : NativeScriptedAI
}

// Called when spell hits a target
#if defined TRINITY
#if defined ELUNA_TRINITY
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
#else
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
Expand All @@ -233,7 +233,7 @@ struct ElunaCreatureAI : NativeScriptedAI
NativeScriptedAI::SpellHitTarget(target, spell);
}

#if defined TRINITY
#if defined ELUNA_TRINITY
// Called when the creature is summoned successfully by other creature
void IsSummonedBy(WorldObject* summoner) override
{
Expand Down Expand Up @@ -262,7 +262,7 @@ struct ElunaCreatureAI : NativeScriptedAI
}
#endif

#if !defined TRINITY
#if !defined ELUNA_TRINITY
#undef me
#endif
};
Expand Down
2 changes: 1 addition & 1 deletion ElunaEventMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "ElunaEventMgr.h"
#include "LuaEngine.h"
#if !defined CMANGOS
#if !defined ELUNA_CMANGOS
#include "Object.h"
#else
#include "Entities/Object.h"
Expand Down
6 changes: 3 additions & 3 deletions ElunaEventMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

#include "ElunaUtility.h"
#include "Common.h"
#if defined TRINITY
#if defined ELUNA_TRINITY
#include "Random.h"
#elif defined CMANGOS
#elif defined ELUNA_CMANGOS
#include "Util/Util.h"
#else
#include "Util.h"
#endif
#include <map>

#if defined TRINITY
#if defined ELUNA_TRINITY
#include "Define.h"
#else
#include "Platform/Define.h"
Expand Down
26 changes: 13 additions & 13 deletions ElunaIncludes.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _ELUNA_INCLUDES_H

// Required
#if !defined CMANGOS
#if !defined ELUNA_CMANGOS
#include "AccountMgr.h"
#include "AuctionHouseMgr.h"
#include "Bag.h"
Expand Down Expand Up @@ -40,7 +40,7 @@
#include "TemporarySummon.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#if defined TRINITY
#if defined ELUNA_TRINITY
#include "Battleground.h"
#include "Config.h"
#include "DatabaseEnv.h"
Expand All @@ -52,10 +52,10 @@
#include "SpellHistory.h"
#include "SpellInfo.h"
#include "WeatherMgr.h"
#elif defined VMANGOS
#elif defined ELUNA_VMANGOS
#include "BasicAI.h"
#include "SQLStorages.h"
#endif // TRINITY
#endif // ELUNA_TRINITY
#if ELUNA_EXPANSION > CLASSIC
#include "ArenaTeam.h"
#endif
Expand Down Expand Up @@ -106,7 +106,7 @@
#endif
#endif

#if !defined TRINITY
#if !defined ELUNA_TRINITY
#include "Config/Config.h"
#include "BattleGroundMgr.h"
#include "revision.h"
Expand All @@ -120,26 +120,26 @@ typedef Opcodes OpcodesList;
* Note: if you add or change a CORE_NAME or CORE_VERSION #define,
* please update LuaGlobalFunctions::GetCoreName or LuaGlobalFunctions::GetCoreVersion documentation example string.
*/
#if defined CMANGOS
#if defined ELUNA_CMANGOS
#define CORE_NAME "cMaNGOS"
#define CORE_VERSION REVISION_DATE " " REVISION_ID
#if ELUNA_EXPANSION == CATA
#define NUM_MSG_TYPES MAX_OPCODE_TABLE_SIZE
#endif
#endif

#if defined VMANGOS
#if defined ELUNA_VMANGOS
#define CORE_NAME "vMaNGOS"
#define CORE_VERSION REVISION_HASH
#define DEFAULT_LOCALE LOCALE_enUS
#endif

#if defined TRINITY
#if defined ELUNA_TRINITY
#define CORE_NAME "TrinityCore"
#define REGEN_TIME_FULL
#endif

#if defined TRINITY
#if defined ELUNA_TRINITY
#define CORE_VERSION (GitRevision::GetFullVersion())
#define eWorld (sWorld)
#define eMapMgr (sMapMgr)
Expand All @@ -163,12 +163,12 @@ typedef Opcodes OpcodesList;
#define TOTAL_LOCALES MAX_LOCALE
#define TARGETICONCOUNT TARGET_ICON_COUNT
#define MAX_TALENT_SPECS MAX_TALENT_SPEC_COUNT
#if !defined VMANGOS
#if !defined ELUNA_VMANGOS
#define TEAM_NEUTRAL TEAM_INDEX_NEUTRAL
#endif


#if ELUNA_EXPANSION >= CATA || defined VMANGOS
#if ELUNA_EXPANSION >= CATA || defined ELUNA_VMANGOS
#define PLAYER_FIELD_LIFETIME_HONORABLE_KILLS PLAYER_FIELD_LIFETIME_HONORBALE_KILLS
#endif

Expand All @@ -180,12 +180,12 @@ typedef Opcodes OpcodesList;
#define UNIT_BYTE2_FLAG_SANCTUARY UNIT_BYTE2_FLAG_SUPPORTABLE
#endif

#if !defined CMANGOS
#if !defined ELUNA_CMANGOS
typedef TemporarySummon TempSummon;
#else
typedef TemporarySpawn TempSummon;
#endif
typedef SpellEntry SpellInfo;
#endif // TRINITY
#endif // ELUNA_TRINITY

#endif // _ELUNA_INCLUDES_H
8 changes: 4 additions & 4 deletions ElunaInstanceAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "lmarshal.h"


#if !defined TRINITY
#if !defined ELUNA_TRINITY
void ElunaInstanceAI::Initialize()
{
ASSERT(!instance->GetEluna()->HasInstanceData(instance));
Expand Down Expand Up @@ -80,7 +80,7 @@ void ElunaInstanceAI::Load(const char* data)
lua_pop(L, 1);
// Stack: (empty)

#if !defined TRINITY
#if !defined ELUNA_TRINITY
Initialize();
#endif
}
Expand All @@ -92,7 +92,7 @@ void ElunaInstanceAI::Load(const char* data)
lua_pop(L, 1);
// Stack: (empty)

#if !defined TRINITY
#if !defined ELUNA_TRINITY
Initialize();
#endif
}
Expand All @@ -103,7 +103,7 @@ void ElunaInstanceAI::Load(const char* data)
{
ELUNA_LOG_ERROR("Error while decoding instance data: Data is not valid base-64");

#if !defined TRINITY
#if !defined ELUNA_TRINITY
Initialize();
#endif
}
Expand Down
Loading

0 comments on commit e8c5792

Please sign in to comment.