diff xrogue/move.c @ 225:4f6e056438eb

Merge the GCC5 and build fix branches.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:28:34 -0500
parents f54901b9c39b
children e52a8a7ad4c5
line wrap: on
line diff
--- a/xrogue/move.c	Fri Feb 26 17:30:30 2016 -0500
+++ b/xrogue/move.c	Wed Mar 02 21:28:34 2016 -0500
@@ -18,6 +18,7 @@
 
 #include <curses.h>
 #include <ctype.h>
+#include <string.h>
 #include "rogue.h"
 
 /*
@@ -37,9 +38,8 @@
  *      The guy stepped on a trap.... Make him pay.
  */
 
-be_trapped(th, tc)
-register struct thing *th;
-register coord *tc;
+char
+be_trapped(struct thing *th, coord *tc)
 {
     register struct trap *tp;
     register char ch, *mname = NULL;
@@ -504,8 +504,7 @@
  */
 
 bool
-blue_light(blessed, cursed)
-bool blessed, cursed;
+blue_light(bool blessed, bool cursed)
 {
     register struct room *rp;
     bool ret_val=FALSE; /* Whether or not affect is known */
@@ -563,8 +562,8 @@
  *      If not, if player came from a legal place, then try to turn him.
  */
 
-corr_move(dy, dx)
-int dy, dx;
+void
+corr_move(int dy, int dx)
 {
     int legal=0;                /* Number of legal alternatives */
     register int y, x,          /* Indexes though possible positions */
@@ -642,7 +641,8 @@
  *      Dip an object into a magic pool
  */
 
-dip_it()
+void
+dip_it(void)
 {
         reg struct linked_list *what;
         reg struct object *ob;
@@ -839,8 +839,8 @@
  * consequences (fighting, picking up, etc.)
  */
 
-do_move(dy, dx)
-int dy, dx;
+void
+do_move(int dy, int dx)
 {
     register struct room *rp, *orp;
     register unsigned char ch;
@@ -1189,8 +1189,8 @@
  *      Start the hero running
  */
 
-do_run(ch)
-char ch;
+void
+do_run(char ch)
 {
     firstmove = TRUE;
     running = TRUE;
@@ -1206,9 +1206,7 @@
  */
 
 bool
-getdelta(match, dy, dx)
-char match;
-int *dy, *dx;
+getdelta(char match, int *dy, int *dx)
 {
     register int y, x;
 
@@ -1228,8 +1226,8 @@
  *      Returns TRUE if this character is some kind of trap
  */
 
-isatrap(ch)
-reg char ch;
+bool
+isatrap(char ch)
 {
         switch(ch) {
                 case WORMHOLE:
@@ -1250,8 +1248,8 @@
  * If it is dark, remove anything that might move.
  */
 
-light(cp)
-coord *cp;
+void
+light(coord *cp)
 {
     register struct room *rp;
     register int j, k, x, y;
@@ -1428,8 +1426,7 @@
  */
 
 bool
-lit_room(rp)
-register struct room *rp;
+lit_room(struct room *rp)
 {
     register struct linked_list *fire_item;
     register struct thing *fire_creature;
@@ -1466,8 +1463,7 @@
  */
 
 short
-movement(tp)
-register struct thing *tp;
+movement(struct thing *tp)
 {
     register int result;
     register int carry;         /* Percentage carried */
@@ -1531,8 +1527,7 @@
  */
 
 coord 
-rndmove(who)
-struct thing *who;
+rndmove(struct thing *who)
 {
     register int x, y;
     register int ex, ey, nopen = 0;
@@ -1586,9 +1581,8 @@
  *      set a trap at (y, x) on screen.
  */
 
-set_trap(tp, y, x)
-register struct thing *tp;
-register int y, x;
+void
+set_trap(struct thing *tp, int y, int x)
 {
     register bool is_player = (tp == &player);
     register int selection = rnd(TRAPTYPES-WIZARDTRAPS) + '1';
@@ -1645,7 +1639,7 @@
                              * Put out the selection.  The longest line is
                              * the prompt line (39 characters long).
                              */
-                            over_win(cw, hw, num_traps + 3, 41, 0, 39, NULL);
+                            over_win(cw, hw, num_traps + 3, 41, 0, 39, '\0');
                         else
                             draw(hw);
                         state = 1;      /* Now in prompt window */
@@ -1705,7 +1699,7 @@
                                  * Put out the selection.  The longest line is
                                  * the prompt line (43 characters long).
                                  */
-                                over_win(cw, hw, num_traps+3, 45, 0, 43, NULL);
+                                over_win(cw, hw, num_traps+3, 45, 0, 43, '\0');
                             else 
                                 draw(hw);
                         }
@@ -1778,8 +1772,8 @@
  *      returns what a certain thing will display as to the un-initiated
  */
 
-show(y, x)
-register int y, x;
+char
+show(int y, int x)
 {
     register unsigned char ch = winat(y, x);
     register struct linked_list *it;
@@ -1819,8 +1813,7 @@
  */
 
 struct trap *
-trap_at(y, x)
-register int y, x;
+trap_at(int y, int x)
 {
     register struct trap *tp, *ep;
 
@@ -1838,11 +1831,12 @@
  *      Calculate how many segments it will take to swing the given
  *      weapon (note that the weapon may actually be a stick or
  *      even something else).
+ * wielder: Who's wielding the weapon
+ * weap: The weapon
  */
 
-weap_move(wielder, weap)
-register struct thing *wielder; /* Who's wielding the weapon */
-register struct object *weap;   /* The weapon */
+int
+weap_move(struct thing *wielder, struct object *weap)
 {
     register int weap_rate;
     int          dexterity;