Author Topic: Critter::WaitEndTick and Critter::PrevHexTick  (Read 2416 times)

Critter::WaitEndTick and Critter::PrevHexTick
« on: February 15, 2014, 10:26:51 pm »
Do you know what are Critter::WaitEndTick and Critter::PrevHexTick?
Looks like the are undocumented

I'm trying to understand the InitWalkProcessing and Critter_IsRunning functions on 2238
Why call InitWalkProcessing on critter_init? Shouldn't be more logical to call it on start?

Offline Wipe

  • Rotator
  • Random is god
Re: Critter::WaitEndTick and Critter::PrevHexTick
« Reply #1 on: February 18, 2014, 03:02:48 am »
Critter::WaitEndTick saves tick when critter should be unblocked after performing action which shouldn't be overriden by next action in queue. or after "manually" calling Critter::Wait() in scripts.
Critter::PrevHexTick is set to time when moving Critter from one hex to another has started.
Games are meant to be created, not played...

Offline Atom

  • Rotator
Re: Critter::WaitEndTick and Critter::PrevHexTick
« Reply #2 on: March 21, 2014, 07:33:57 pm »
InitWalkProcessing was a dirty walkaround to get the equivalent of GameOptions::GetTick() available in DLLs. This was done before GameOptions::GetTick() was added, for some trivial reasons.

InitWalkProcessing was called from critter_init so it could be processed soon after the server started and referred to the critter's "tick" fields to retrieve the time offset between FOnline's internal time counter and Windows' time counter. This made it possible to calculate on demand (what would be) the result of GameOptions::GetTick() in order to compare it with Critter::PrevHexTick, to determine whether the critter has recently moved.

Presently this method is obsolete and the whole thing can be replaced with GameOptions::GetTick() calls at the appropriate places.
« Last Edit: March 21, 2014, 07:36:14 pm by Atom »