Skip to content

Commit

Permalink
Merge pull request #4843 from LandSandBoat/rename_baseentity_getname
Browse files Browse the repository at this point in the history
[core] Rename CBaseEntity::GetName() -> getName()
  • Loading branch information
zach2good authored Dec 10, 2023
2 parents 4ae7165 + 412f9b5 commit f0d3b4d
Show file tree
Hide file tree
Showing 60 changed files with 706 additions and 690 deletions.
2 changes: 1 addition & 1 deletion modules/custom/cpp/ah_announcement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class AHAnnouncementModule : public CPPModule
ORDER BY price
LIMIT 1;
)",
PChar->GetName(), price, (uint32)time(nullptr), itemid, quantity == 0, price).c_str());
PChar->getName(), price, (uint32)time(nullptr), itemid, quantity == 0, price).c_str());
// clang-format on

if (ret != SQL_ERROR && sql->AffectedRows() != 0)
Expand Down
2 changes: 1 addition & 1 deletion modules/custom/cpp/ah_pagination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AHPaginationModule : public CPPModule

if (PChar->m_GMlevel == 0 && !PChar->loc.zone->CanUseMisc(MISC_AH))
{
ShowWarning("%s is trying to use the auction house in a disallowed zone [%s]", PChar->GetName(), PChar->loc.zone->GetName());
ShowWarning("%s is trying to use the auction house in a disallowed zone [%s]", PChar->getName(), PChar->loc.zone->getName());
return;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/renamer/cpp/renamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RenamerModule : public CPPModule
// Add a custom packet handler to the PacketParser array for id 0x01
PacketParser[0x01] = [&](map_session_data_t* const, CCharEntity* const PChar, CBasicPacket&)
{
ShowInfo(fmt::format("{} requested renamer list for {}", PChar->GetName(), PChar->loc.zone->GetName()));
ShowInfo(fmt::format("{} requested renamer list for {}", PChar->getName(), PChar->loc.zone->getName()));

auto zoneId = PChar->getZone();
auto renamerTable = lua["xi"]["renamerTable"].get<sol::table>();
Expand Down
12 changes: 12 additions & 0 deletions src/common/cbasetypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ struct PtrGreater
template <class T>
using MinHeapPtr = std::priority_queue<T, std::vector<T>, PtrGreater<T>>;

#define DISALLOW_COPY(TypeName) \
TypeName(const TypeName&) = delete; \
TypeName& operator=(const TypeName&) = delete;

#define DISALLOW_MOVE(TypeName) \
TypeName(TypeName&&) = delete; \
TypeName& operator=(TypeName&&) = delete;

#define DISALLOW_COPY_AND_MOVE(TypeName) \
DISALLOW_COPY(TypeName) \
DISALLOW_MOVE(TypeName)

#include "tracy.h"

#endif /* _CBASETYPES_H_ */
6 changes: 3 additions & 3 deletions src/map/ai/controllers/mob_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ CMobController::CMobController(CMobEntity* PEntity)
void CMobController::Tick(time_point tick)
{
TracyZoneScoped;
TracyZoneString(PMob->GetName());
TracyZoneString(PMob->getName());

m_Tick = tick;

Expand Down Expand Up @@ -1130,10 +1130,10 @@ bool CMobController::Engage(uint16 targid)
bool CMobController::CanAggroTarget(CBattleEntity* PTarget)
{
TracyZoneScoped;
TracyZoneString(PMob->GetName());
TracyZoneString(PMob->getName());
if (PTarget)
{
TracyZoneString(PTarget->GetName());
TracyZoneString(PTarget->getName());

if (PMob->getBattleID() != PTarget->getBattleID())
{
Expand Down
2 changes: 1 addition & 1 deletion src/map/ai/controllers/pet_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CPetController::CPetController(CPetEntity* _PPet)
void CPetController::Tick(time_point tick)
{
TracyZoneScoped;
TracyZoneString(PPet->GetName());
TracyZoneString(PPet->getName());

if (PPet->shouldDespawn(tick))
{
Expand Down
2 changes: 1 addition & 1 deletion src/map/ai/controllers/trust_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void CTrustController::Despawn()
void CTrustController::Tick(time_point tick)
{
TracyZoneScoped;
TracyZoneString(POwner->GetName());
TracyZoneString(POwner->getName());

m_Tick = tick;

Expand Down
4 changes: 2 additions & 2 deletions src/map/ai/helpers/gambits_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ namespace gambits
{
if (isValidMember(PMember) && CheckTrigger(PMember, predicate))
{
auto name = PMember->GetName();
auto name = PMember->getName();
if (strcmpi(name.c_str(), "curilla") == 0)
{
result = true;
Expand Down Expand Up @@ -393,7 +393,7 @@ namespace gambits
{
if (isValidMember(target, PMember) && CheckTrigger(PMember, gambit.predicates[0]))
{
auto name = PMember->GetName();
auto name = PMember->getName();
if (strcmpi(name.c_str(), "curilla") == 0)
{
target = PMember;
Expand Down
2 changes: 1 addition & 1 deletion src/map/ai/helpers/pathfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ bool CPathFind::FindPath(const position_t& start, const position_t& end)

if (m_points.empty())
{
DebugNavmesh("CPathFind::FindPath Entity (%s - %d) could not find path", m_POwner->GetName(), m_POwner->id);
DebugNavmesh("CPathFind::FindPath Entity (%s - %d) could not find path", m_POwner->getName(), m_POwner->id);
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/map/alliance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ CAlliance::CAlliance(CBattleEntity* PEntity)
{
if (PEntity->PParty == nullptr)
{
ShowError("Attempt to construct Alliance with a null Party (%s).", PEntity->GetName());
ShowError("Attempt to construct Alliance with a null Party (%s).", PEntity->getName());
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/map/battlefield_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ uint8 CBattlefieldHandler::RegisterBattlefield(CCharEntity* PChar, const Battlef
{
if (PChar->PBattlefield)
{
ShowDebug("%s tried to enter another battlefield", PChar->GetName());
ShowDebug("%s tried to enter another battlefield", PChar->getName());
return BATTLEFIELD_RETURN_CODE_WAIT;
}
// attempt to add to an existing battlefield
Expand Down
4 changes: 2 additions & 2 deletions src/map/entities/baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ void CBaseEntity::FadeOut()
updatemask |= UPDATE_HP;
}

const std::string& CBaseEntity::GetName()
const std::string& CBaseEntity::getName()
{
return name;
}

const std::string& CBaseEntity::GetPacketName()
const std::string& CBaseEntity::getPacketName()
{
return packetName;
}
Expand Down
6 changes: 3 additions & 3 deletions src/map/entities/baseentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ class CBaseEntity
virtual void Spawn();
virtual void FadeOut();

virtual const std::string& GetName(); // Internal name of entity
virtual const std::string& GetPacketName(); // Name of entity sent to the client
virtual const std::string& getName(); // Internal name of entity
virtual const std::string& getPacketName(); // Name of entity sent to the client

uint16 getZone() const; // Current zone
float GetXPos() const; // Position of co-ordinate X
Expand Down Expand Up @@ -330,4 +330,4 @@ class CBaseEntity
std::map<std::string, uint32> m_localVars;
};

#endif
#endif // _BASEENTITY_H
2 changes: 1 addition & 1 deletion src/map/entities/charentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void CCharEntity::clearPacketList()
void CCharEntity::pushPacket(CBasicPacket* packet)
{
TracyZoneScoped;
TracyZoneString(GetName());
TracyZoneString(getName());
TracyZoneHex16(packet->getType());

moduleutils::OnPushPacket(packet);
Expand Down
2 changes: 1 addition & 1 deletion src/map/instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void CInstance::LoadInstance()

// Add to Lua cache
// TODO: This will happen more often than needed, but not so often that it's a performance concern
auto zone = m_zone->GetName();
auto zone = m_zone->getName();
auto name = m_instanceName;
auto filename = fmt::format("./scripts/zones/{}/instances/{}.lua", zone, name);
luautils::CacheLuaObjectFromFile(filename);
Expand Down
8 changes: 4 additions & 4 deletions src/map/instance_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ CInstance* CInstanceLoader::LoadInstance()
// Add to cache
luautils::CacheLuaObjectFromFile(
fmt::format("./scripts/zones/{}/mobs/{}.lua",
PMob.second->loc.zone->GetName(),
PMob.second->GetName()));
PMob.second->loc.zone->getName(),
PMob.second->getName()));
}

// Finish setting up NPCs
Expand All @@ -302,8 +302,8 @@ CInstance* CInstanceLoader::LoadInstance()
// Add to cache
luautils::CacheLuaObjectFromFile(
fmt::format("./scripts/zones/{}/npcs/{}.lua",
PNpc.second->loc.zone->GetName(),
PNpc.second->GetName()));
PNpc.second->loc.zone->getName(),
PNpc.second->getName()));
}

// Cache Instance script (TODO: This will be done multiple times, don't do that)
Expand Down
8 changes: 4 additions & 4 deletions src/map/linkshell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void CLinkshell::AddMember(CCharEntity* PChar, int8 type, uint8 lsNum)

if (std::find(members.begin(), members.end(), PChar) != members.end())
{
ShowWarning("CLinkshell::AddMember attempted to add member '%s' who is already in the online member list.", PChar->GetName());
ShowWarning("CLinkshell::AddMember attempted to add member '%s' who is already in the online member list.", PChar->getName());
return;
}

Expand Down Expand Up @@ -162,7 +162,7 @@ void CLinkshell::ChangeMemberRank(const std::string& MemberName, uint8 toSack)
{
for (auto& member : members)
{
if (strcmpi(MemberName.c_str(), member->GetName().c_str()) == 0)
if (strcmpi(MemberName.c_str(), member->getName().c_str()) == 0)
{
CCharEntity* PMember = member;

Expand Down Expand Up @@ -232,7 +232,7 @@ void CLinkshell::RemoveMemberByName(const std::string& MemberName, uint8 kickerR
uint32 lsid = m_id;
for (auto& member : members)
{
if (strcmpi(MemberName.c_str(), member->GetName().c_str()) == 0)
if (strcmpi(MemberName.c_str(), member->getName().c_str()) == 0)
{
CCharEntity* PMember = member;

Expand Down Expand Up @@ -315,7 +315,7 @@ void CLinkshell::BreakLinkshell()
// break logged in and equipped members
while (!members.empty())
{
RemoveMemberByName(members.at(0)->GetName(), LSTYPE_LINKSHELL, true);
RemoveMemberByName(members.at(0)->getName(), LSTYPE_LINKSHELL, true);
}
// set the linkshell as broken
sql->Query("UPDATE linkshells SET broken = 1 WHERE linkshellid = %u LIMIT 1", lsid);
Expand Down
Loading

0 comments on commit f0d3b4d

Please sign in to comment.