JimViebke / IslandMUD

A C++ MUD
MIT License
9 stars 3 forks source link

Implement passive health regeneration #179

Open JimViebke opened 8 years ago

JimViebke commented 8 years ago

Store the user’s health and a timestamp.

Every time the user's health is observed or modified, update the health and the timestamp before returning the results of the observation or applying the modification.

To prevent possible issues caused by the server’s time being reset, don’t store the health timestamp in the save file. Instead, during saving, update the health using the timestamp, and then save just the health. Set the timestamp again at load.