Guarantee order of checkpoint/finish-callback-triggers, so finish triggers after CPs

This commit is contained in:
Alexander Nell 2020-05-21 15:26:50 +02:00
parent 705b1de132
commit f6a2c179af
2 changed files with 10 additions and 3 deletions

View File

@ -12,6 +12,9 @@
#Bug Fixes
- deactivate Plugins if they cause uncaught exceptions
- finish callbacks got triggered before corresponding checkpoint callback
-- some CPs of your local records might be messed up
-- you can fix them by either deleting the record "//delrec <rank>", or simply drive a better time
- fixed typo in actions panel of players list
- fixed crashing GameMode-Settings table on other languages than english

View File

@ -22,7 +22,7 @@ use ManiaControl\ManiaControl;
* @copyright 2014-2020 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class TrackManiaCallbacks implements CallbackListener {
class TrackManiaCallbacks implements CallbackListener, CallQueueListener {
/*
* Private properties
*/
@ -106,9 +106,13 @@ class TrackManiaCallbacks implements CallbackListener {
*/
public function handleWayPointCallback(OnWayPointEventStructure $structure) {
if ($structure->getIsEndRace()) {
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::TM_ONFINISHLINE, $structure);
$this->maniaControl->getCallQueueManager()->registerListening($this, function () use ($structure) {
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::TM_ONFINISHLINE, $structure);
});
} else if ($structure->getIsEndLap()) {
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::TM_ONLAPFINISH, $structure);
$this->maniaControl->getCallQueueManager()->registerListening($this, function () use ($structure) {
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::TM_ONLAPFINISH, $structure);
});
}
}
}