From 511f55fbad4153e94ae97d9015866b1793ef867b Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 16 Jun 2024 14:51:03 -0400 Subject: [PATCH] Break time... --- xerbia.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/xerbia.c b/xerbia.c index 0fdbc59..be00c95 100644 --- a/xerbia.c +++ b/xerbia.c @@ -121,12 +121,9 @@ static void build_construction (int index) { static int query (void) { char input [1024] = ""; + int index = reply_help; - int index; - - requery: - - for (index = 0; index < 1024; ++index) { + requery: for (index = 0; index < 1024; ++index) { in (& input [index], 1); if (input [index] == '\n') { @@ -142,7 +139,7 @@ static int query (void) { } } - print_help (); + print ("Incorrect /1reply/-, type '/3help/-' to list replies.\n"); goto requery; } @@ -164,22 +161,20 @@ int main (void) { construction [index] = random (1, 2); } - for (reply = replies; reply != reply_quit; reply = query ()) { + for (reply = reply_help; reply != reply_quit; reply = query ()) { separate (); - print_resources (); - print_constructions (); - - print_help (); - - build_construction (granary); - build_construction (mine); - build_construction (storehouse); - build_construction (quarry); - - print_statistics (); + switch (reply) { + case reply_help: print_help (); break; + case reply_report: print_resources (); break; + case reply_status: print_statistics (); break; + default: break; + } } + build_construction (granary); + print_constructions (); + separate (); print ("/0The end!/-\n");