On Tue, 30 Mar 1999, Patrick Dughi wrote:
> I'd just say, create one global time_t variable, set it to 0 on
> startup. If it's ever > than 0, then check and see if time(0) is greater
> than it, and if so, shutdown now. Your interface would be the most
> difficult part, and if it's a hardship, I recommend just doing something
> like allowing shutdown to have a minute argument.
Or just make circle_shutdown contain the number of seconds until the game
should go down, and change the main game loop to,
while (circle_shutdown != 0) {
and in heartbeat(),
if (circle_shutdown > 0 && !(pulse % PASSES_PER_SEC))
circle_shutdown--;
In do_shutdown(), we'd set circle_shutdown like,
circle_shutdown = atoi(second argument);
We may also want to extend our addition to heartbeat() to warn players
about the pending shutdown. Forgive the pseudo-code,
if (circle_shutdown > 0 && !(pulse % PASSES_PER_SEC)) {
circle_shutdown--;
if (circle_shutdown == 5 || circle_shutdown == 15)
send everyone circle_shutdown "seconds remaining until shutdown."
else if (circle_shutdown == 30)
send everyone "half a minute until shutdown remaining."
else if (circle_shutdown == 60 || circle_shutdown == 300 ||
circle_shutdown == 600 || circle_shutdown = 900)
send everyone circle_shutdown / 2 "minutes left until shutdown."
}
-dak
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST