forkserf / forkserf

a continuation of "FreeSerf"

Home Page:https://forkserf.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

a blockage and a settler that doesn't move (invisible lost serf with unreasonably high Counter)

zdechlak opened this issue · comments

a blockage and a settler that doesn't move

image
zator.zip

image
frozen man in the doorway

This is an odd one. The serf at the flag is not moving because the game says there is another Lost serf at the pos right in front of him, but he can't be seen because his animation frame counter has some outrageously high value that is out of range, which should never happen. To address this, I added a sanity check that will throw an error message if any serf has an unreasonably high animation counter, and also reset it to zero (which fixes the issue in this game save)

I don't see it detect any other serfs in your game with this condition, so I am not sure of the root cause, but I will keep an eye out for this error message to see if I can find a pattern (such as, is it always Lost serfs?) and eventually fix.

Serf::update() {
  //Log::Debug["serf.cc"] << "inside Serf::update, serf with index " << get_index() << " has type " << NameSerf[get_type()] << " and state name " << get_state_name(get_state());
  
  // corruption detection
  if (counter > 10000){
    Log::Error["serf.cc"] << "inside Serf::update, serf with excessively high counter detected!  with index " << get_index() << " at pos " << get_pos() << " with type " << NameSerf[get_type()] << " and state name " << get_state_name(get_state()) << " has counter " << counter << " and animation " << animation;
    Log::Error["serf.cc"] << "inside Serf::update, serf with excessively high counter detected!  setting this serf counter to 0";
    counter = 0;
  }

image
in addition, if I cut off the roads, the warehouse should collect resources from under the flag

Forkserf.2023-02-07.02-00-20.mp4