HomeWildfire Games

Unit Motion - Face point when calling StopMoving()

Description

Unit Motion - Face point when calling StopMoving()

FacePointAfterMoving intends for the unit to face the destination once a move is done. Since rP22351, stopping is the responsibility of UnitAI (through a call to StopMoving()). Thus we should move that code in that function, as this ensures we don't forget to do it and removes duplications.

Differential Revision: https://code.wildfiregames.com/D1889

Event Timeline

elexis added a subscriber: elexis.Jul 10 2019, 1:50 AM

As reported in http://irclogs.wildfiregames.com/2019-07/2019-07-08-QuakeNet-%230ad-dev.log
Had this segfault on a Jebel Barkal match

#0  0x00007ffff61652e0 in __vfprintf_internal () from /usr/lib/libc.so.6
#1  0x00007ffff6178c5a in __vsnprintf_internal () from /usr/lib/libc.so.6
#2  0x0000555555831c83 in vsnprintf (__ap=0x7fffff7ff6d0, __fmt=0x555555c39d8b "%s", __n=255, __s=0x7fffff7ff684 "") at /usr/include/bits/stdio2.h:80
#3  CProfiler2::ThreadStorage::RecordAttribute (this=0x555555d907d0, fmt=fmt@entry=0x555555c39d8b "%s", argp=argp@entry=0x7fffff7ff7c0) at ../../../source/ps/Profiler2.cpp:398
#4  0x00005555556505dc in CProfiler2::RecordAttribute (this=<optimized out>, fmt=fmt@entry=0x555555c39d8b "%s") at ../../../source/ps/Profiler2.h:445
#5  0x0000555555668e49 in CComponentManager::PostMessage (this=0x555555ed52d8, ent=324, msg=...) at ../../../source/simulation2/system/ComponentManager.cpp:1021
#6  0x00005555556c71ce in CCmpPosition::AdvertisePositionChanges (this=0x555557971160) at ../../../source/simulation2/system/Entity.h:88
#7  CCmpPosition::TurnTo (this=0x555557971160, y=...) at ../../../source/simulation2/components/CCmpPosition.cpp:549
#8  0x000055555571415b in CCmpUnitMotion::FaceTowardsPointFromPos (z=..., x=..., pos=..., this=0x555557986000) at ../../../source/simulation2/components/CCmpUnitMotion.cpp:1242
#9  CCmpUnitMotion::StopMoving (this=0x555557986000) at ../../../source/simulation2/components/CCmpUnitMotion.cpp:495
#10 0x000055555573cfd1 in ScriptInterface_NativeMethodWrapper<void, ICmpUnitMotion>::call<void (ICmpUnitMotion::*)()> (fptr=&virtual ICmpUnitMotion::StopMoving(), c=<optimized out>)
    at ../../../source/scriptinterface/NativeWrapperDefns.h:106
#11 ScriptInterface::callMethod<void, &class_ICmpUnitMotion, ICmpUnitMotion, &ICmpUnitMotion::StopMoving> (cx=cx@entry=0x555555dd29e0, argc=<optimized out>, vp=0x7fffff7fff78) at ../../../source/scriptinterface/NativeWrapperDefns.h:145
#12 0x00007ffff77cbb12 in js::CallJSNative (args=..., native=0x55555573cec0 <ScriptInterface::callMethod<void, &class_ICmpUnitMotion, ICmpUnitMotion, &ICmpUnitMotion::StopMoving>(JSContext*, unsigned int, JS::Value*)>, 
    cx=0x555555dd29e0) at ../../dist/include/js/CallArgs.h:204
#13 js::Invoke (cx=cx@entry=0x555555dd29e0, args=..., construct=construct@entry=js::NO_CONSTRUCT) at /home/elexis/code/0ad-git-private/0ad/libraries/source/spidermonkey/mozjs-38.0.0/js/src/vm/Interpreter.cpp:498
#14 0x00007ffff77cc691 in js::Invoke (cx=cx@entry=0x555555dd29e0, thisv=..., fval=..., argc=argc@entry=0, argv=<optimized out>, rval=..., rval@entry=...)
    at /home/elexis/code/0ad-git-private/0ad/libraries/source/spidermonkey/mozjs-38.0.0/js/src/vm/Interpreter.cpp:554
#15 0x00007ffff7a9d954 in js::jit::InvokeFunction (cx=0x555555dd29e0, obj=..., argc=0, argv=<optimized out>, rval=0x7fffff8000e0) at ../../dist/include/js/Value.h:1475

But I could only reproduce it on a git branch with lost modifications, not on svn.