Skip to content

Commit

Permalink
Fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1arm committed Aug 21, 2024
1 parent dffcf01 commit a975c71
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/game/AuctionHouseBot/AuctionHouseBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,7 @@ void AuctionBotSeller::SetPricesOfItem(AHB_Seller_Config& config, uint32& buyp,

uint32 buypMin = (uint32)temp_buyp - (uint32)randrange;
uint32 buypMax = ((uint32)temp_buyp + (uint32)randrange) < temp_buyp ? std::numeric_limits<uint32>::max() : temp_buyp + randrange;

buyp = (urand(buypMin, buypMax) / 100) + 1;

double urandrange = buyp * 40;
Expand Down
14 changes: 11 additions & 3 deletions src/game/Object/CreatureEventAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: Event type %u (script %u) triggered for %s (invoked by %s)", \
pHolder.Event.event_type, pHolder.Event.event_id, m_creature->GetGuidStr().c_str(), pActionInvoker ? pActionInvoker->GetGuidStr().c_str() : "<no invoker>")

inline bool IsTimerBasedEvent(EventAI_Type type)
inline static bool IsTimerBasedEvent(EventAI_Type type)
{
switch (type)
{
Expand Down Expand Up @@ -1289,7 +1289,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
case ACTION_T_SUMMON_UNIQUE: //49
{
Creature* pCreature = NULL;
Creature* pCreature = nullptr;

MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_creature, action.summon_unique.creatureId, true, false, 100, true);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pCreature, u_check);
Expand Down Expand Up @@ -1362,6 +1362,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->HandleEmote(action.emoteTarget.emoteId);
break;
}
default:
break;
}
}

Expand Down Expand Up @@ -1660,13 +1662,19 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who)
void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell)
{
for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i)
{
if (i->Event.event_type == EVENT_T_SPELLHIT)
{
// If spell id matches (or no spell id) & if spell school matches (or no spell school)
if (!i->Event.spell_hit.spellId || pSpell->Id == i->Event.spell_hit.spellId)
{
if (pSpell->SchoolMask & i->Event.spell_hit.schoolMask)
{
ProcessEvent(*i, pUnit);
}
}
}
}
}

void CreatureEventAI::UpdateAI(const uint32 diff)
Expand Down Expand Up @@ -1889,7 +1897,7 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
}
}

#define HEALTH_STEPS 3
constexpr auto HEALTH_STEPS = 3;

void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage)
{
Expand Down
4 changes: 4 additions & 0 deletions src/game/Object/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,13 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
if (true)
{
if (!loot.empty())
{
m_despawnTimer = time(nullptr) + 5 * MINUTE; // TODO:: need to add a define?
}
else if (m_despawnTimer != 0 && m_despawnTimer <= time(nullptr))
{
m_lootState = GO_JUST_DEACTIVATED;
}

// TODO : Missing Loot::Update() method found in CMangos
}
Expand Down
2 changes: 2 additions & 0 deletions src/game/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,9 @@ void WorldObject::SetMap(Map* map)

#ifdef ENABLE_ELUNA
if (!elunaEvents)
{
elunaEvents = new ElunaEventProcessor(&Eluna::GEluna, this);
}
#endif
}

Expand Down
10 changes: 10 additions & 0 deletions src/game/Server/WorldSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ int WorldSocket::handle_output(ACE_HANDLE)
{
Guard.release();
if (reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
return -1;
}
return 0;
}

Expand All @@ -309,7 +311,9 @@ int WorldSocket::handle_output(ACE_HANDLE)
{
Guard.release();
if (reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
return -1;
}
return 0;
}
return -1;
Expand All @@ -323,7 +327,9 @@ int WorldSocket::handle_output(ACE_HANDLE)

Guard.release();
if (reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
return -1;
}
return 0;
}
else // now n == send_len
Expand All @@ -334,14 +340,18 @@ int WorldSocket::handle_output(ACE_HANDLE)
{
Guard.release();
if (reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
return -1;
}
return 0;
}
else
{
Guard.release();
if (reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
return -1;
}
return 0;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/shared/Utilities/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,9 @@ size_t utf8limit(std::string& utf8str, size_t bytes)

// Fix UTF8 if it was corrupted by bytes truncated
if (itr != end)
{
bytes = std::distance(utf8str.cbegin(), itr);
}

utf8str.resize(bytes);
utf8str.shrink_to_fit();
Expand Down
2 changes: 1 addition & 1 deletion src/tools/Extractor_Binaries/mmap_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def run(self):
cFlags = 0
binName = "./mmap-extractor"
if self.mapID == 0:
retcode = subprocess.call([binName, "%u" % (self.mapID), "--silent", "--offMeshInput", "offmesh.txt"], startupinfo=stInfo, creationflags=cFlags)
retcode = subprocess.call([binName, "%u" % (self.mapID), "--silent", "--offMeshInput", "offmesh.txt"], startupinfo=stInfo, creationflags=cFlags)
else:
retcode = subprocess.call([binName, "%u" % (self.mapID), "--silent"], startupinfo=stInfo, creationflags=cFlags)
print "-- %s" % (name)
Expand Down

0 comments on commit a975c71

Please sign in to comment.