changeset 300:0250220d8cdd

Fix an assortment of compiler warnings. A few potential bugs were removed in the process. Much code cleanup remains to be done.
author John "Elwin" Edwards
date Fri, 22 Nov 2019 21:18:27 -0500
parents 74351bf23e5e
children acc3718f50ab
files arogue5/daemon.c arogue5/list.c arogue5/maze.c arogue5/rip.c arogue5/rogue.c arogue7/list.c arogue7/maze.c arogue7/pack.c arogue7/rip.c arogue7/rogue.c rogue3/init.c rogue3/list.c rogue3/rip.c rogue3/things.c rogue3/weapons.c rogue4/extern.c rogue4/misc.c rogue4/passages.c rogue4/rip.c rogue4/things.c rogue4/weapons.c rogue5/rip.c rogue5/save.c srogue/global.c srogue/list.c srogue/main.c srogue/rip.c srogue/things.c srogue/trader.c urogue/bag.c urogue/chase.c urogue/getplay.c urogue/io.c urogue/monsters.c urogue/options.c urogue/potions.c urogue/rip.c urogue/state.c urogue/trader.c xrogue/daemons.c xrogue/help.c xrogue/init.c xrogue/list.c xrogue/maze.c xrogue/potions.c xrogue/rip.c xrogue/rogue.c
diffstat 47 files changed, 606 insertions(+), 589 deletions(-) [+]
line wrap: on
line diff
--- a/arogue5/daemon.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue5/daemon.c	Fri Nov 22 21:18:27 2019 -0500
@@ -238,7 +238,7 @@
 void
 activity(void)
 {
-	sprintf(outstring,"Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d",
+	sprintf(outstring,"Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %ld",
 	    demoncnt,fusecnt,total,md_memused());
 	msg(outstring);
 }
--- a/arogue5/list.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue5/list.c	Fri Nov 22 21:18:27 2019 -0500
@@ -174,7 +174,7 @@
     static char errbuf[LINELEN];
 
     if (space == NULL) {
-	sprintf(errbuf,"Rogue ran out of memory (used = %d, wanted = %d).",
+	sprintf(errbuf,"Rogue ran out of memory (used = %ld, wanted = %d).",
 		md_memused(), size);
 	fatal(errbuf);
     }
--- a/arogue5/maze.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue5/maze.c	Fri Nov 22 21:18:27 2019 -0500
@@ -22,7 +22,7 @@
 };
 
 struct bordercells {
-	char num_pos;		/* number of frontier cells next to you */
+	unsigned char num_pos;	/* number of frontier cells next to you */
 	struct cell conn[4];	/* the y,x position of above cell */
 } border_cells;
 
--- a/arogue5/rip.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue5/rip.c	Fri Nov 22 21:18:27 2019 -0500
@@ -607,7 +607,7 @@
   else
     return;
 
-  fprintf(logfile, "%d %d %s %d %s %d %d %d %c %s\n", time(NULL), amount, 
+  fprintf(logfile, "%ld %ld %s %d %s %d %d %d %c %s\n", time(NULL), amount, 
           whoami, pstats.s_lvl, class, level, max_level, quest_item, had_quest, 
           fate);
   fclose(logfile);
--- a/arogue5/rogue.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue5/rogue.c	Fri Nov 22 21:18:27 2019 -0500
@@ -420,78 +420,78 @@
 } ;
 
 struct h_list helpstr[] = {
-    '?',	"	prints help",
-    '/',	"	identify object",
-    'h',	"	left",
-    'j',	"	down",
-    'k',	"	up",
-    'l',	"	right",
-    'y',	"	up & left",
-    'u',	"	up & right",
-    'b',	"	down & left",
-    'n',	"	down & right",
-    'H',	"	run left",
-    'J',	"	run down",
-    'K',	"	run up",
-    'L',	"	run right",
-    'Y',	"	run up & left",
-    'U',	"	run up & right",
-    'B',	"	run down & left",
-    'N',	"	run down & right",
-    't',	"<dir>	throw something",
-    'f',	"<dir>	forward until find something",
-    'z',	"<dir>	zap a wand or staff",
-    '>',	"	go down a staircase",
-    '<',	"	go up a staircase",
-    's',	"	search for trap/secret door",
-    '.',	"	rest for a while",
-    'i',	"	inventory",
-    'I',	"	inventory single item",
-    'q',	"	quaff potion",
-    'r',	"	read paper",
-    'e',	"	eat food",
-    'w',	"	wield a weapon",
-    'W',	"	wear something",
-    'T',	"	take off something",
-    'd',	"	drop object",
-    'P',	"	pick up object(s)",
-    'c',	"	call object (generic)",
-    'm',	"	mark object (specific)",
-    'o',	"	examine/set options",
-    'C',	"	cast a spell",
-    'p',	"	pray",
-    'a',	"	affect the undead",
-    '^',	"	set a trap",
-    'G',	"	sense gold",
-    'D',	"	dip something (into a pool)",
-    CTRL('T'),	"<dir>	take (steal) from (direction)",
-    CTRL('U'),	"	use miscellaneous magic item",
-    CTRL('L'),	"	redraw screen",
-    CTRL('R'),	"	repeat last message",
-    ESCAPE,	"	cancel command",
-    'v',	"	print program version number",
-    '!',	"	shell escape",
-    'S',	"	save game",
-    'Q',	"	quit",
-    0, 0
+    { '?',	"	prints help" },
+    { '/',	"	identify object" },
+    { 'h',	"	left" },
+    { 'j',	"	down" },
+    { 'k',	"	up" },
+    { 'l',	"	right" },
+    { 'y',	"	up & left" },
+    { 'u',	"	up & right" },
+    { 'b',	"	down & left" },
+    { 'n',	"	down & right" },
+    { 'H',	"	run left" },
+    { 'J',	"	run down" },
+    { 'K',	"	run up" },
+    { 'L',	"	run right" },
+    { 'Y',	"	run up & left" },
+    { 'U',	"	run up & right" },
+    { 'B',	"	run down & left" },
+    { 'N',	"	run down & right" },
+    { 't',	"<dir>	throw something" },
+    { 'f',	"<dir>	forward until find something" },
+    { 'z',	"<dir>	zap a wand or staff" },
+    { '>',	"	go down a staircase" },
+    { '<',	"	go up a staircase" },
+    { 's',	"	search for trap/secret door" },
+    { '.',	"	rest for a while" },
+    { 'i',	"	inventory" },
+    { 'I',	"	inventory single item" },
+    { 'q',	"	quaff potion" },
+    { 'r',	"	read paper" },
+    { 'e',	"	eat food" },
+    { 'w',	"	wield a weapon" },
+    { 'W',	"	wear something" },
+    { 'T',	"	take off something" },
+    { 'd',	"	drop object" },
+    { 'P',	"	pick up object(s)" },
+    { 'c',	"	call object (generic)" },
+    { 'm',	"	mark object (specific)" },
+    { 'o',	"	examine/set options" },
+    { 'C',	"	cast a spell" },
+    { 'p',	"	pray" },
+    { 'a',	"	affect the undead" },
+    { '^',	"	set a trap" },
+    { 'G',	"	sense gold" },
+    { 'D',	"	dip something (into a pool)" },
+    { CTRL('T'),	"<dir>	take (steal) from (direction)" },
+    { CTRL('U'),	"	use miscellaneous magic item" },
+    { CTRL('L'),	"	redraw screen" },
+    { CTRL('R'),	"	repeat last message" },
+    { ESCAPE,	"	cancel command" },
+    { 'v',	"	print program version number" },
+    { '!',	"	shell escape" },
+    { 'S',	"	save game" },
+    { 'Q',	"	quit" },
+    { 0, 0 }
 } ;
 
 struct h_list wiz_help[] = {
-    CTRL('A'),	"	system activity",
-    CTRL('C'),	"	move to	another	dungeon	level",
-    CTRL('D'),	"	down 1 dungeon level",
-    CTRL('E'),	"	food remaining",
-    CTRL('F'),	"	display entire level",
-    CTRL('H'),	"	jump 9 experience levels",
-    CTRL('I'),	"	inventory of level",
-    CTRL('J'),	"	teleport",
-    CTRL('N'),	"	recharge staff",
-    CTRL('P'),	"	toggle wizard status",
-    CTRL('U'),	"	up 1 dungeon level",
-    CTRL('X'),	"	detect monsters",
-    CTRL('Z'),	"	identify",
-    'M',	"	make object",
-    0, 0
+    { CTRL('A'),	"	system activity" },
+    { CTRL('C'),	"	move to	another	dungeon	level" },
+    { CTRL('D'),	"	down 1 dungeon level" },
+    { CTRL('E'),	"	food remaining" },
+    { CTRL('F'),	"	display entire level" },
+    { CTRL('H'),	"	jump 9 experience levels" },
+    { CTRL('I'),	"	inventory of level" },
+    { CTRL('J'),	"	teleport" },
+    { CTRL('N'),	"	recharge staff" },
+    { CTRL('P'),	"	toggle wizard status" },
+    { CTRL('U'),	"	up 1 dungeon level" },
+    { CTRL('X'),	"	detect monsters" },
+    { CTRL('Z'),	"	identify" },
+    { 'M',	"	make object" },
+    { 0, 0 }
 };
 
 
--- a/arogue7/list.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue7/list.c	Fri Nov 22 21:18:27 2019 -0500
@@ -218,7 +218,7 @@
     static char errbuf[LINELEN];
 
     if (space == NULL) {
-	sprintf(errbuf,"Rogue ran out of memory (used = %d, wanted = %d).",
+	sprintf(errbuf,"Rogue ran out of memory (used = %ld, wanted = %d).",
 		md_memused(), size);
 	fatal(errbuf);
     }
--- a/arogue7/maze.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue7/maze.c	Fri Nov 22 21:18:27 2019 -0500
@@ -21,7 +21,7 @@
 	char x_pos;
 };
 struct bordercells {
-	char num_pos;		/* number of frontier cells next to you */
+	unsigned char num_pos;	/* number of frontier cells next to you */
 	struct cell conn[4];	/* the y,x position of above cell */
 } border_cells;
 
--- a/arogue7/pack.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue7/pack.c	Fri Nov 22 21:18:27 2019 -0500
@@ -327,9 +327,10 @@
 		    start_daemon(eat_gold, obj, AFTER);
 		}
 		/* For the axe start a fuse to change player to a fighter. */
-		if (obj->o_which == AXE_AKLAD)
+		if (obj->o_which == AXE_AKLAD) {
 		    newclass = C_FIGHTER;
 		    fuse(changeclass, &newclass, roll(20, 20), AFTER);
+		}
 		if (cur_weapon != NULL) {
 		    msg("The artifact insists you release your current weapon.");
 		    if (!dropcheck(cur_weapon)) {
--- a/arogue7/rip.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue7/rip.c	Fri Nov 22 21:18:27 2019 -0500
@@ -233,7 +233,7 @@
     else
         return;
     /* Write */
-    fprintf(logfile, "%d %d %s %d %s %d %d %d %c %s\n", time(NULL), amount,
+    fprintf(logfile, "%ld %ld %s %d %s %d %d %d %c %s\n", time(NULL), amount,
             whoami, pstats.s_lvl, char_class[char_type].name, level, max_level,
             quest_item, had_quest, fate);
     fclose(logfile);
--- a/arogue7/rogue.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/arogue7/rogue.c	Fri Nov 22 21:18:27 2019 -0500
@@ -625,81 +625,81 @@
 } ;
 
 struct h_list helpstr[] = {
-    '?',	"	prints help",
-    '/',	"	identify object",
-    '=',	"	identify screen character",
-    'h',	"	left",
-    'j',	"	down",
-    'k',	"	up",
-    'l',	"	right",
-    'y',	"	up & left",
-    'u',	"	up & right",
-    'b',	"	down & left",
-    'n',	"	down & right",
-    'H',	"	run left",
-    'J',	"	run down",
-    'K',	"	run up",
-    'L',	"	run right",
-    'Y',	"	run up & left",
-    'U',	"	run up & right",
-    'B',	"	run down & left",
-    'N',	"	run down & right",
-    't',	"<dir>	throw something",
-    'f',	"<dir>	forward until find something",
-    'z',	"<dir>	zap a wand or staff",
-    '>',	"	go down a staircase",
-    '<',	"	go up a staircase",
-    's',	"	search for trap/secret door",
-    '.',	"	rest for a while",
-    'i',	"	inventory",
-    'I',	"	inventory single item",
-    'q',	"	quaff potion",
-    'r',	"	read paper",
-    'e',	"	eat food",
-    'w',	"	wield a weapon",
-    'W',	"	wear something",
-    'T',	"	take off something",
-    'd',	"	drop object",
-    'P',	"	pick up object(s)",
-    CTRL('N'),	"	name object or monster",
-    'm',	"	mark object (specific)",
-    'o',	"	examine/set options",
-    'c',	"	chant",
-    'C',	"	cast a spell",
-    'p',	"	pray",
-    'a',	"	affect the undead",
-    '^',	"	set a trap",
-    'G',	"	sense gold",
-    'D',	"	dip something (into a pool)",
-    '*',	"	count up gold pieces",
-    CTRL('T'),	"<dir>	take (steal) from (direction)",
-    CTRL('U'),	"	use miscellaneous magic item",
-    CTRL('L'),	"	redraw screen",
-    CTRL('R'),	"	repeat last message",
-    ESCAPE,	"	cancel command",
-    'v',	"	print program version number",
-    '!',	"	shell escape",
-    'S',	"	save game",
-    'Q',	"	quit",
-    0, 0
+    { '?',	"	prints help" },
+    { '/',	"	identify object" },
+    { '=',	"	identify screen character" },
+    { 'h',	"	left" },
+    { 'j',	"	down" },
+    { 'k',	"	up" },
+    { 'l',	"	right" },
+    { 'y',	"	up & left" },
+    { 'u',	"	up & right" },
+    { 'b',	"	down & left" },
+    { 'n',	"	down & right" },
+    { 'H',	"	run left" },
+    { 'J',	"	run down" },
+    { 'K',	"	run up" },
+    { 'L',	"	run right" },
+    { 'Y',	"	run up & left" },
+    { 'U',	"	run up & right" },
+    { 'B',	"	run down & left" },
+    { 'N',	"	run down & right" },
+    { 't',	"<dir>	throw something" },
+    { 'f',	"<dir>	forward until find something" },
+    { 'z',	"<dir>	zap a wand or staff" },
+    { '>',	"	go down a staircase" },
+    { '<',	"	go up a staircase" },
+    { 's',	"	search for trap/secret door" },
+    { '.',	"	rest for a while" },
+    { 'i',	"	inventory" },
+    { 'I',	"	inventory single item" },
+    { 'q',	"	quaff potion" },
+    { 'r',	"	read paper" },
+    { 'e',	"	eat food" },
+    { 'w',	"	wield a weapon" },
+    { 'W',	"	wear something" },
+    { 'T',	"	take off something" },
+    { 'd',	"	drop object" },
+    { 'P',	"	pick up object(s)" },
+    { CTRL('N'),	"	name object or monster" },
+    { 'm',	"	mark object (specific)" },
+    { 'o',	"	examine/set options" },
+    { 'c',	"	chant" },
+    { 'C',	"	cast a spell" },
+    { 'p',	"	pray" },
+    { 'a',	"	affect the undead" },
+    { '^',	"	set a trap" },
+    { 'G',	"	sense gold" },
+    { 'D',	"	dip something (into a pool)" },
+    { '*',	"	count up gold pieces" },
+    { CTRL('T'),	"<dir>	take (steal) from (direction)" },
+    { CTRL('U'),	"	use miscellaneous magic item" },
+    { CTRL('L'),	"	redraw screen" },
+    { CTRL('R'),	"	repeat last message" },
+    { ESCAPE,	"	cancel command" },
+    { 'v',	"	print program version number" },
+    { '!',	"	shell escape" },
+    { 'S',	"	save game" },
+    { 'Q',	"	quit" },
+    { 0, 0 }
 } ;
 
 struct h_list wiz_help[] = {
-    CTRL('A'),	"	system activity",
-    CTRL('C'),	"	move to	another	dungeon	level",
-    CTRL('D'),	"	down 1 dungeon level",
-    CTRL('E'),	"	food remaining",
-    CTRL('F'),	"	display entire level",
-    CTRL('H'),	"	jump 9 experience levels",
-    CTRL('I'),	"	inventory of level",
-    CTRL('J'),	"	teleport",
-    CTRL('M'),	"	recharge staff",
-    CTRL('P'),	"	toggle wizard status",
-    CTRL('U'),	"	up 1 dungeon level",
-    CTRL('X'),	"	detect monsters",
-    CTRL('Z'),	"	identify",
-    'M',	"	make object",
-    0, 0
+    { CTRL('A'),	"	system activity" },
+    { CTRL('C'),	"	move to	another	dungeon	level" },
+    { CTRL('D'),	"	down 1 dungeon level" },
+    { CTRL('E'),	"	food remaining" },
+    { CTRL('F'),	"	display entire level" },
+    { CTRL('H'),	"	jump 9 experience levels" },
+    { CTRL('I'),	"	inventory of level" },
+    { CTRL('J'),	"	teleport" },
+    { CTRL('M'),	"	recharge staff" },
+    { CTRL('P'),	"	toggle wizard status" },
+    { CTRL('U'),	"	up 1 dungeon level" },
+    { CTRL('X'),	"	detect monsters" },
+    { CTRL('Z'),	"	identify" },
+    { 'M',	"	make object" },
+    { 0, 0 }
 };
 
 
--- a/rogue3/init.c	Sun Feb 11 15:37:33 2018 -0500
+++ b/rogue3/init.c	Fri Nov 22 21:18:27 2019 -0500
@@ -548,50 +548,50 @@
 }
 
 struct h_list helpstr[] = {
-    '?',	"	prints help",
-    '/',	"	identify object",