mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Followingd592bf9cb6, paths requested at turn N were set-up to be computed between the end of turn N and the start of turn N+1 (which would ultimately allow threading this computation), via calls to 'StartProcessingMoves' and 'FetchAsyncResultsAndSendMessages'. However, the call to UpdateGrid() remained at the start of turn N+1, between the 'start' and 'fetch' calls. Since all paths are currently computed on the 'start' call, this means all paths are computed on a (possibly) dirty pathfinder grid. In particular, this leads to OOS on rejoin since the rejoiner will recompute the grid before computing the outstanding paths. This would also obviously be buggy in a threaded environment, since some paths might be computed on the fresh and some on the dirty grid. Finally, MT_TurnStart was sent before the paths were computed, which might lead to further pathfinder grid changes (not a crashing problem without threading, but still conceptually odd). The 'fetch' call is thus moved before it. This thus fixes d592bf9cb6/D1918, after92ad6a61faalready fixed a first issue. Since the grid is now only updated at the end of a turn, we need to ensure that it is correct on Turn 0, thus the pathfinder recomputes it on InitGame. Refs D14 Reported by: Itms Fixes #5851 Differential Revision: https://code.wildfiregames.com/D3064 This was SVN commit r24142.
29 lines
1.2 KiB
C++
29 lines
1.2 KiB
C++
/* Copyright (C) 2017 Wildfire Games.
|
|
* This file is part of 0 A.D.
|
|
*
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "precompiled.h"
|
|
|
|
#include "ICmpPathfinder.h"
|
|
|
|
#include "simulation2/system/InterfaceScripted.h"
|
|
|
|
BEGIN_INTERFACE_WRAPPER(Pathfinder)
|
|
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpPathfinder, SetDebugOverlay, bool)
|
|
DEFINE_INTERFACE_METHOD_1("SetHierDebugOverlay", void, ICmpPathfinder, SetHierDebugOverlay, bool)
|
|
DEFINE_INTERFACE_METHOD_CONST_1("GetPassabilityClass", pass_class_t, ICmpPathfinder, GetPassabilityClass, std::string)
|
|
DEFINE_INTERFACE_METHOD_0("UpdateGrid", void, ICmpPathfinder, UpdateGrid)
|
|
END_INTERFACE_WRAPPER(Pathfinder)
|