home · contact · privacy
Dead shoggoths corpse to "magic meat" that can now be "used" i.e. consumed for hitpoi...
[plomrogue] / src / main.c
index 88264072da69f3673bda0b27e2e84b01a11e8ae3..88d90d2844dc1e51b48205101933a1791b974bc4 100644 (file)
@@ -26,7 +26,9 @@
 #include "rrand.h" /* for rrand(), rrand_seed() */
 #include "rexit.h" /* for exit_game(), exit_err() */
 #include "command_db.h" /* for init_command_db(), is_command_id_shortdsc() */
-#include "control.h" /* for *_control(), get_available_keycode_to_action() */
+#include "control.h" /* for control_by_id(), player_control(),
+                      * get_available_keycode_to_action()
+                      */
 
 
 
@@ -150,12 +152,10 @@ int main(int argc, char *argv[])
     curs_set(0);
     keypad(screen, TRUE);
     raw();
-    char * err_winmem = "Trouble with init_win_meta() in main ().";
-    exit_err(init_win_meta(screen, &world.wmeta), err_winmem);
+    init_win_meta(screen);
     set_cleanup_flag(CLEANUP_WIN_META);
-    load_interface_conf(/*&world*/);
+    load_interface_conf();
     set_cleanup_flag(CLEANUP_INTERFACE_CONF);
-    err_winmem = "Trouble with draw_all_wins() in main().";
 
     /* Focus map on player. */
     struct MapObj * player = get_player();
@@ -180,16 +180,17 @@ int main(int argc, char *argv[])
                 {
                     break;
                 }
-                if (is_command_id_shortdsc(action, "drop"))
+                if (   is_command_id_shortdsc(action, "drop")
+                    || is_command_id_shortdsc(action, "use"))
                 {
                     world.inventory_select = getc(file);
                 }
-                record_control(action);
+                player_control_by_id(action);
             }
         }
         while (1)
         {
-            draw_all_wins(world.wmeta);
+            draw_all_wins();
             key = getch();
             wc = get_winconf_by_win(world.wmeta->active);
             if  (   (1 == wc->view && wingeom_control(key))
@@ -203,11 +204,12 @@ int main(int argc, char *argv[])
                 action = getc(file);
                 if (EOF != action)
                 {
-                    if (is_command_id_shortdsc(action, "drop"))
+                    if (   is_command_id_shortdsc(action, "drop")
+                        || is_command_id_shortdsc(action, "use"))
                     {
                         world.inventory_select = getc(file);
                     }
-                    record_control(action);
+                    player_control_by_id(action);
                 }
             }
             else if (meta_control(key))
@@ -224,25 +226,15 @@ int main(int argc, char *argv[])
         while (1)
         {
             save_game();
-            draw_all_wins(world.wmeta);
+            draw_all_wins();
             key = getch();
             wc = get_winconf_by_win(world.wmeta->active);
-            if      (1 == wc->view && wingeom_control(key))
-            {
-                continue;
-            }
-            else if (2 == wc->view && winkeyb_control(key))
-            {
-                continue;
-            }
-
             if  (   (1 == wc->view && wingeom_control(key))
                  || (2 == wc->view && winkeyb_control(key))
-                 || (0 != player->lifepoints && player_control(key)))
+                 || (0 != player->lifepoints && player_control_by_key(key)))
             {
                 continue;
             }
-
             if (meta_control(key))
             {
                 exit_game();