Fix race condition in pathfinding caused by -Wdeclaration-after-statement. Pathfinding jobs should no longer get lost.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9788 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
5d772d4b6f
commit
12c488c70d
|
@ -102,3 +102,4 @@ EXTRA_DIST= \
|
|||
all: fixdeps
|
||||
fixdeps:
|
||||
cd "$(top_srcdir)/src" ; mkdir -p "$(abs_top_builddir)/src/.deps" ; for ext in c cpp ; do for a in *.$$ext ; do grep -q "\b$$a\b" "$(abs_top_builddir)/src/.deps/`echo "$$a" | sed s/\.$$ext/.Po/`" 2> /dev/null || echo "`echo "$$a" | sed s/\.$$ext/.o/`: ../$(top_srcdir)/src/$$a" | tee "$(abs_top_builddir)/src/.deps/`echo "$$a" | sed s/\.$$ext/.Po/`" ; done ; done
|
||||
cd "$(top_srcdir)/lib/netplay" ; mkdir -p "$(abs_top_builddir)/lib/netplay/.deps" ; for ext in c cpp ; do for a in *.$$ext ; do grep -q "\b$$a\b" "$(abs_top_builddir)/lib/netplay/.deps/`echo "$$a" | sed s/\.$$ext/.Po/`" 2> /dev/null || echo "`echo "$$a" | sed s/\.$$ext/.o/`: ../$(top_srcdir)/lib/netplay/$$a" | tee "$(abs_top_builddir)/lib/netplay/.deps/`echo "$$a" | sed s/\.$$ext/.Po/`" ; done ; done
|
||||
|
|
|
@ -420,11 +420,14 @@ static FPATH_RETVAL fpathRoute(MOVE_CONTROL *psMove, int id, int startX, int sta
|
|||
// Check if waiting for a result
|
||||
if (psMove->Status == MOVEWAITROUTE)
|
||||
{
|
||||
PATHRESULT *psPrev = NULL, *psNext = firstResult;
|
||||
PATHRESULT *psPrev = NULL, *psNext;
|
||||
|
||||
objTrace(id, "Checking if we have a path yet");
|
||||
SDL_SemWait(fpathSemaphore);
|
||||
|
||||
// psNext should be _declared_ here, after the mutex lock! Used to be a race condition, thanks to -Wdeclaration-after-statement style pseudocompiler compatibility.
|
||||
psNext = firstResult;
|
||||
|
||||
while (psNext)
|
||||
{
|
||||
if (psNext->droidID == id && psNext->done)
|
||||
|
|
Loading…
Reference in New Issue