fix: complete logical clock wall-time isolation
This commit is contained in:
@@ -6,15 +6,20 @@ use sammo\Enums\EventTarget;
|
||||
use sammo\Enums\InheritanceKey;
|
||||
use \Symfony\Component\Lock;
|
||||
|
||||
class TurnExecutionHelper
|
||||
{
|
||||
class TurnExecutionHelper
|
||||
{
|
||||
/** @var General*/
|
||||
protected $generalObj;
|
||||
|
||||
public function __construct(General $general)
|
||||
public function __construct(General $general)
|
||||
{
|
||||
$this->generalObj = $general;
|
||||
}
|
||||
}
|
||||
|
||||
public static function monotonicCompletionTick(int $completedTick, int $candidateTick): int
|
||||
{
|
||||
return max($completedTick, $candidateTick);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
@@ -450,9 +455,12 @@ class TurnExecutionHelper
|
||||
updateTraffic();
|
||||
|
||||
if ($executionOver) {
|
||||
if ($currentTurn !== null) {
|
||||
$executed = true;
|
||||
$gameStor->turntime = $currentTurn;
|
||||
if ($currentTurn !== null) {
|
||||
$executed = true;
|
||||
$gameStor->turntime = self::monotonicCompletionTick(
|
||||
Util::toInt($gameStor->turntime),
|
||||
$currentTurn,
|
||||
);
|
||||
}
|
||||
unlock();
|
||||
return $gameStor->turntime;
|
||||
@@ -497,10 +505,16 @@ class TurnExecutionHelper
|
||||
$gameStor->month
|
||||
);
|
||||
|
||||
if ($currentTurn !== null) {
|
||||
$executed = true;
|
||||
$gameStor->turntime = $currentTurn;
|
||||
}
|
||||
if ($currentTurn !== null) {
|
||||
$executed = true;
|
||||
// A general's sub-tick can be just before the monthly boundary that
|
||||
// was completed above. Never move the global completion cursor back
|
||||
// behind an already-applied monthly event.
|
||||
$gameStor->turntime = self::monotonicCompletionTick(
|
||||
Util::toInt($gameStor->turntime),
|
||||
$currentTurn,
|
||||
);
|
||||
}
|
||||
|
||||
//토너먼트 처리
|
||||
processTournament();
|
||||
|
||||
Reference in New Issue
Block a user