Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/core_codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ permissions:

on:
push:
branches: [master, united, devel]
branches: ['**']
paths-ignore:
- '**.md'
- 'extra/doc/**'
- 'LICENSE'
pull_request:
branches: [master, united]

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/core_linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: Linux Build (GCC + Clang)

on:
push:
branches: [ master, united, devel ]
branches: [ '**' ]
paths-ignore:
- '**.md'
- 'extra/doc/**'
- 'LICENSE'
pull_request:
branches: [ master, united ]

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/core_windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: Windows Build (MSVC)

on:
push:
branches: [ master, united, devel ]
branches: [ '**' ]
paths-ignore:
- '**.md'
- 'extra/doc/**'
- 'LICENSE'
pull_request:
branches: [ master, united ]

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: Docker Build

on:
push:
branches: [ master, united, devel ]
branches: [ '**' ]
paths-ignore:
- '**.md'
- 'extra/doc/**'
- 'LICENSE'
pull_request:
branches: [ master, united ]

Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,8 @@ docs/superpowers/

# Generated by GenRevision; 02 writes it to the build tree instead.
src/shared/revision_data.h

# Unification staging area at the repo root. The shared sources live in their
# own tree; this checkout must not start tracking a copy of them. Anchored so
# that a "common" directory nested under src/ is unaffected.
/common/
10 changes: 6 additions & 4 deletions src/game/BattleGround/BattleGroundQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,13 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg,
plr->SetInviteForBattleGroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);

// create remind invite events
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetObjectGuid(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->RemoveInviteTime);
plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME));
plr->m_Events.AddEvent(
std::unique_ptr<BasicEvent>(new BGQueueInviteEvent(plr->GetObjectGuid(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->RemoveInviteTime)),
plr->m_Events.CalculateTime(INVITATION_REMIND_TIME));
// create automatic remove events
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetObjectGuid(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime);
plr->m_Events.AddEvent(removeEvent, plr->m_Events.CalculateTime(INVITE_ACCEPT_WAIT_TIME));
plr->m_Events.AddEvent(
std::unique_ptr<BasicEvent>(new BGQueueRemoveEvent(plr->GetObjectGuid(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime)),
plr->m_Events.CalculateTime(INVITE_ACCEPT_WAIT_TIME));

WorldPacket data;

Expand Down
4 changes: 3 additions & 1 deletion src/game/MotionGenerators/PointMovementGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ Motion::MoveIntent RoutedPointMovementGenerator::Intent(Unit& owner, Motion::Mov
{
// Arrival is latched here rather than refusal, and the proximity test rejects a mover that
// was frozen partway rather than actually arriving. See the header for both reasons.
if (status.arrived && owner.GetDistance(m_dest.x, m_dest.y, m_dest.z) < 10.0f)
// m_dest is in the mover's own frame, which is what Where() measures in, so this is a
// same-frame comparison and never composes one across a transport boundary.
if (status.arrived && owner.Where().DistanceTo(m_dest) < 10.0f)
{
m_arrived = true;
}
Expand Down
5 changes: 2 additions & 3 deletions src/game/Object/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2157,9 +2157,8 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn)
{
if (timeMSToDespawn)
{
ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this);

m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn));
m_Events.AddEvent(std::unique_ptr<BasicEvent>(new ForcedDespawnDelayEvent(*this)),
m_Events.CalculateTime(timeMSToDespawn));
return;
}

Expand Down
5 changes: 3 additions & 2 deletions src/game/Object/CreatureAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,9 @@ void CreatureAI::SendAIEventAround(AIEventType eventType, Unit* pInvoker, uint32

if (!receiverList.empty())
{
AiDelayEventAround* e = new AiDelayEventAround(eventType, pInvoker ? pInvoker->GetObjectGuid() : ObjectGuid(), *m_creature, receiverList, miscValue);
m_creature->m_Events.AddEvent(e, m_creature->m_Events.CalculateTime(uiDelay));
m_creature->m_Events.AddEvent(
std::unique_ptr<BasicEvent>(new AiDelayEventAround(eventType, pInvoker ? pInvoker->GetObjectGuid() : ObjectGuid(), *m_creature, receiverList, miscValue)),
m_creature->m_Events.CalculateTime(uiDelay));
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/game/Object/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6455,7 +6455,8 @@ void Unit::ScheduleAINotify(uint32 delay)
{
if (!IsAINotifyScheduled())
{
m_Events.AddEvent(new RelocationNotifyEvent(*this), m_Events.CalculateTime(delay));
m_Events.AddEvent(std::unique_ptr<BasicEvent>(new RelocationNotifyEvent(*this)),
m_Events.CalculateTime(delay));
}
}

Expand Down
32 changes: 23 additions & 9 deletions src/game/WorldHandlers/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,20 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, Aura* triggeredB
}

// create and add update event for this spell
SpellEvent* Event = new SpellEvent(this);
m_caster->m_Events.AddEvent(Event, m_caster->m_Events.CalculateTime(1));
if (!m_caster->m_Events.AddEvent(std::unique_ptr<BasicEvent>(new SpellEvent(this)),
m_caster->m_Events.CalculateTime(1)))
{
// Refused, which means the caster's processor is tearing down -- an aura
// removal or a cancellation can start a triggered cast from inside
// KillAllEvents. AddEvent then aborted and destroyed the event, and
// ~SpellEvent cancelled and deleted THIS Spell on the way out.
//
// So nothing below may run and no member may be touched, not even to
// report the failure: `this` is already freed. Every caller drops the
// pointer after prepare() and lets the event own the spell, which is why
// returning here is the whole of the cleanup.
return SPELL_FAILED_DONT_REPORT;
}

// Prevent casting at cast another spell (ServerSide check)
if (!m_IsTriggeredSpell && m_caster->IsNonMeleeSpellCasted(false, true, true))
Expand Down Expand Up @@ -1039,9 +1051,12 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
uint64 n_offset = m_Spell->handle_delayed(t_offset);
if (n_offset)
{
// re-add us to the queue
m_Spell->GetCaster()->m_Events.AddEvent(this, m_Spell->GetDelayStart() + n_offset, false);
return false; // event not complete
// re-add us to the queue; false means "not complete, the
// queue owns me again". A refused re-add means the
// caster's processor is tearing down and nobody adopted
// us, so we ask to be destroyed instead of leaking.
return !m_Spell->GetCaster()->m_Events.Reschedule(
this, m_Spell->GetDelayStart() + n_offset);
}
// event complete
// finish update event will be re-added automatically at the end of routine)
Expand All @@ -1052,8 +1067,8 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
// delaying had just started, record the moment
m_Spell->SetDelayStart(e_time);
// re-plan the event for the delay moment
m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + m_Spell->GetDelayMoment(), false);
return false; // event not complete
return !m_Spell->GetCaster()->m_Events.Reschedule(
this, e_time + m_Spell->GetDelayMoment());
}
break;
}
Expand All @@ -1066,8 +1081,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
}

// spell processing not complete, plan event on the next update interval
m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + 1, false);
return false; // event not complete
return !m_Spell->GetCaster()->m_Events.Reschedule(this, e_time + 1);
}

/**
Expand Down
38 changes: 20 additions & 18 deletions src/mangosd/Master.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@
#include <thread>
#endif

#ifdef _WIN32
#include "ServiceWin32.h"
extern int m_ServiceStatus;
#else
#include "PosixDaemon.h"
#endif
#include "Process/Process.h"

#include <chrono>
#include <string>
Expand Down Expand Up @@ -242,12 +237,13 @@ void Master::StartServices()
1000 * uint32(sConfig.GetIntDefault("MaxCoreStuckTime", 0)))));

// Console last, so its prompt lands after every other start-up line.
#ifdef _WIN32
//
// Never in the background, on either platform. A Windows service has no
// stdin; a POSIX daemon's stdin is /dev/null, where the first read returns
// end-of-file -- and CliService reads end-of-file as "the operator closed
// the console" and shuts the world down, seconds after a successful start.
const bool consoleWanted = sConfig.GetBoolDefault("Console.Enable", true)
&& m_ServiceStatus == -1; // no console in service mode
#else
const bool consoleWanted = sConfig.GetBoolDefault("Console.Enable", true);
#endif
&& !Process::IsRunningInBackground();
if (consoleWanted)
{
m_services.push_back(std::unique_ptr<IService>(
Expand Down Expand Up @@ -346,16 +342,20 @@ void Master::WorldLoop()
std::chrono::milliseconds(WORLD_SLEEP_CONST - spent));
}

#ifdef _WIN32
if (m_ServiceStatus == 0) // service stopped
// What the service manager asked for, if there is one. Both are false
// where there is not, so this needs no #ifdef: on POSIX a stop arrives
// as a signal and the handlers in mangosd.cpp already have it.
if (Process::StopRequested())
{
World::StopNow(SHUTDOWN_EXIT_CODE);
}
while (m_ServiceStatus == 2) // service paused

// Stalled, not spinning. A stop arriving while paused clears the pause
// flag as well, so this cannot swallow the shutdown.
while (Process::IsPaused())
{
std::this_thread::sleep_for(std::chrono::seconds(1));
}
#endif
}

sLog.outString("World updater stopped.");
Expand Down Expand Up @@ -396,9 +396,11 @@ int Master::Run()

sWorld.SetInitialWorldSettings();

#ifndef _WIN32
detachDaemon();
#endif
// The world is loaded and about to start serving. On POSIX this releases the
// parent that `-s run` left waiting, so the shell prompt comes back only
// once the server is genuinely up; a failure before this point is reported
// as a failed command instead. No-op in the foreground and on Windows.
Process::ReportReady();

// Publish this realm's flags and the client builds it accepts.
const uint8 recommendedOrNew =
Expand Down
Loading
Loading