smcameron / space-nerds-in-space

Multi-player spaceship bridge simulator game. Captain your starship through adventures with your friends. See https://smcameron.github.io/space-nerds-in-space
GNU General Public License v2.0
724 stars 73 forks source link

NPC ships seem to get stuck in HANGOUT with very long TIME TO GO #328

Closed smcameron closed 1 year ago

smcameron commented 1 year ago

dumping them out on the console, time to go is e.g. -2000 and counting down. However, time_to_go is unsigned uint32_t. But dump prints it as %d, so it can show up negative. So either it's counting down right past zero somehow, or it's getting set to something very large somehow. It makes the ships just sit there doing nothing for way too long.

smcameron commented 1 year ago

This was caused by decrementing an unsigned int past zero.

Fixed by: 54eec89c589cac5af74b869c2fb593136b1d4dc1 Do not decrement hangout time_to_go when it is already zero

However this uncovered another issue, the cops never seemed to hangout at all, but just proceed from one patrol point to the next with no pause between them.

That was because the max_hangout_time for cops was never changed from zero.

Fixed by: 31ad902fec3bdb9a39b780cb087cb0801e66936c Initialize max hangout time in cop patrol routes