Wow. SCCS cookies! There's a blast from the past.
[vms-empire.git] / usermove.c
index dcc7c4e..5fcb788 100644 (file)
@@ -1,5 +1,3 @@
-/* %W% %G% %U% - (c) Copyright 1987, 1988 Chuck Simmons */
-
 /*
  *    Copyright (C) 1987, 1988 Chuck Simmons
  * 
 usermove.c -- Let the user move her troops.
 */
 
-#include <curses.h>
+#include <stdio.h>
 #include <ctype.h>
+#include <string.h>
 #include "empire.h"
 #include "extern.h"
 
-void fatal();
-void move_to_dest();
-void move_army_to_city();
+void fatal(piece_info_t *obj,long loc,char *message,char *response);
+void move_to_dest(piece_info_t *obj,long dest);
+void move_army_to_city(piece_info_t *obj,long city_loc);
+int awake(piece_info_t *obj);
+extern int get_piece_name(void);
 
 void
-user_move () {
+user_move (void) {
        void piece_move();
 
        int i, j, sec, sec_start;
@@ -51,8 +52,10 @@ user_move () {
                        set_prod (&(city[i])); /* ask user what to produce */
                }
                else if (city[i].work++ >= (long)piece_attr[prod].build_time) {
-                       comment ("City at %d has completed %s.",
-                               city[i].loc, piece_attr[prod].article);
+                               /* kermyt begin */
+                       ksend1("%s has been completed at city %d.\n", piece_attr[prod].article,loc_disp(city[i].loc),0,0,0,0,0,0);
+                               /* kermyt end */
+                       comment1 ("%s has been completed at city %d.\n", piece_attr[prod].article,loc_disp(city[i].loc),0,0,0,0,0,0);
 
                        produce (&city[i]);
                        /* produce should set object.moved to 0 */
@@ -176,11 +179,10 @@ piece_info_t *obj;
                                obj->range = piece_attr[FIGHTER].range;
                                obj->moved = speed;
                                obj->func = NOFUNC;
-                               comment ("Landing confirmed.");
+                               comment ("Landing confirmed.",0,0,0,0,0,0,0,0);
                        }
                        else if (obj->range == 0) {
-                               comment ("Fighter at %d crashed and burned.",
-                                       obj->loc);
+                               comment ("Fighter at %d crashed and burned.",loc_disp(obj->loc),0,0,0,0,0,0,0);
                                kill_obj (obj, obj->loc);
                        }
                }
@@ -624,11 +626,11 @@ Print out help information.
 */
 
 void
-user_help () {
+user_help (void) {
        char c;
 
        help (help_user, user_lines);
-       prompt ("Press any key to continue: ");
+       prompt ("Press any key to continue: ",0,0,0,0,0,0,0,0);
        c = get_chx ();
        c = c; /* keep lint happy */
 }
@@ -847,7 +849,7 @@ int dir;
                return;
        }
        if (!map[loc].on_board) {
-               error ("You cannot move to the edge of the world.");
+               error ("You cannot move to the edge of the world.",0,0,0,0,0,0,0,0);
                delay ();
                return;
        }
@@ -887,17 +889,24 @@ long loc;
                return;
 
                if (user_map[obj->loc].contents == 'T')
-                       comment ("Your army jumped into the briny and drowned.");
-
+               {
+                       comment ("Your army jumped into the briny and drowned.",0,0,0,0,0,0,0,0);
+                       ksend ("Your army jumped into the briny and drowned.\n",0,0,0,0,0,0,0,0);
+               }
                else if (user_map[loc].contents == '.')
-                       comment ("Your army marched dutifully into the sea and drowned.");
-
+               {
+                       comment ("Your army marched dutifully into the sea and drowned.",0,0,0,0,0,0,0,0);
+                       ksend ("Your army marched dutifully into the sea and drowned.\n",0,0,0,0,0,0,0,0);
+               }
                else { /* attack something at sea */
                        enemy_killed = islower (user_map[loc].contents);
                        attack (obj, loc);
        
                        if (obj->hits > 0) /* ship won? */
-                       comment ("Your army regretfully drowns after its successful assault.");
+                       {
+                               comment ("Your army regretfully drowns after its successful assault.",0,0,0,0,0,0,0,0);
+                               ksend ("Your army regretfully drowns after it's successful assault.",0,0,0,0,0,0,0,0);
+                       }
                }
                if (obj->hits > 0) {
                        kill_obj (obj, loc);
@@ -968,21 +977,22 @@ long loc;
        }
 
        else if (map[loc].contents == '+') { /* moving ashore? */
-               if (!getyn (
-       "Ships need sea to float, sir.  Do you really want to go ashore? "))
-               return;
+               if (!getyn ("Ships need sea to float, sir.  Do you really want to go ashore? ")) return;
 
                if (user_map[loc].contents == '+')
-                       comment ("Your %s broke up on shore.",
-                                piece_attr[obj->type].name);
-
+               {
+                       comment1 ("Your %s broke up on shore.", piece_attr[obj->type].name,0,0,0,0,0,0,0);
+                       ksend1 ("Your %s broke up on shore.", piece_attr[obj->type].name,0,0,0,0,0,0,0);
+               }
                else { /* attack something on shore */
                        enemy_killed = islower (user_map[loc].contents);
                        attack (obj, loc);
 
                        if (obj->hits > 0) /* ship won? */
-                               comment ("Your %s breaks up after its successful assault.",
-                                        piece_attr[obj->type].name);
+                       {
+                               comment1 ("Your %s breaks up after its successful assault.", piece_attr[obj->type].name,0,0,0,0,0,0,0);
+                               ksend1 ("Your %s breaks up after its successful assault.", piece_attr[obj->type].name,0,0,0,0,0,0,0);
+                       }
                }
                if (obj->hits > 0) {
                        kill_obj (obj, loc);
@@ -1028,12 +1038,12 @@ Cancel automove mode.
 */
 
 void
-user_cancel_auto () {
+user_cancel_auto (void) {
        if (!automove)
-               comment ("Not in auto mode!");
+               comment ("Not in auto mode!",0,0,0,0,0,0,0,0);
        else {
                automove = FALSE;
-               comment ("Auto mode cancelled.");
+               comment ("Auto mode cancelled.",0,0,0,0,0,0,0,0);
        }
 }
 
@@ -1042,7 +1052,7 @@ Redraw the screen.
 */
 
 void
-user_redraw () {
+user_redraw (void) {
        redraw ();
 }
 
@@ -1100,7 +1110,7 @@ char *message;
 char *response;
 {
        if (getyn (message)) {
-               comment (response);
+               comment (response,0,0,0,0,0,0,0,0);
                kill_obj (obj, loc);
        }
 }