T3D 1.1 Beta3 - possible issue with sim::postevent
by Guy Allard · in Torque 3D Professional · 01/12/2011 (1:49 pm) · 3 replies
in consolesimManager.cpp, postEvent function starts:
note the checks for time == -1
also note that time is a U32 so the check time == -1 is garbage.
U32 postEvent(SimObject *destObject, SimEvent* event,U32 time)
{
AssertFatal(time == -1 || time >= getCurrentTime(),
"Sim::postEvent() - Event time must be greater than or equal to the current time." );
AssertFatal(destObject, "Sim::postEvent() - Destination object for event doesn't exist.");
Mutex::lockMutex(gEventQueueMutex);
if( time == -1 )
time = gCurrentTime;note the checks for time == -1
also note that time is a U32 so the check time == -1 is garbage.
About the author
Recent Threads
#2
01/12/2011 (5:53 pm)
I still think it's a bug, as in the header, it states that a value of 0 will be interpreted as current time, but then in the implementation, it's checking for -1
#3
As you can see further down -1 is tested again..
...so it looks like -1 is a test case.
02/22/2013 (8:03 pm)
It may not be a valid user case to send -1 but it is quite common to have internal states and flags startint at -1 and go down -2, -3 etc...As you can see further down -1 is tested again..
if( time == -1 ) time = gCurrentTime;
...so it looks like -1 is a test case.
Associate Tom Spilman
Sickhead Games
Now i'm unsure why specifically its checking for -1 there... maybe -1 is used as a magic number elsewhere in the event/time system and its there to be sure its not posted.
Anyway... its not a bug.