Fix an assortment of compiler warnings.

A few potential bugs were removed in the process.  Much code cleanup
remains to be done.
This commit is contained in:
John "Elwin" Edwards 2019-11-22 21:18:27 -05:00
parent de95b19cee
commit 7d459d7d36
47 changed files with 608 additions and 591 deletions

View file

@ -696,12 +696,12 @@ eat_gold(struct object *obj)
if (purse == 50)
msg("%s.. Commands you to find more gold!! ", inv_name(obj, FALSE));
if (purse == 0) {
if (rnd(10) >= 7)
msg("You feel the artifact gnawing away... ");
if (rnd(10) >= 7)
msg("You feel the artifact gnawing away... ");
if (--pstats.s_hpt < 1) {
pstats.s_hpt = -1;
pstats.s_hpt = -1;
death(D_RELIC);
}
}
}
else
purse--;

View file

@ -160,143 +160,143 @@ static char *game_begin ="To be updated...";
/* help list */
static struct h_list helpstr[] = {
'?', " Print help",
'/', " Identify object",
'=', " Identify a screen character",
' ', "",
'h', " Move left",
'j', " Move down",
'k', " Move up",
'l', " Move right",
'y', " Move up and left",
'u', " Move up and right",
'b', " Move down and left",
'n', " Move down and 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",
' ', "",
'>', " Go down a staircase",
'<', " Go up a staircase",
'\\', " Game descriptions",
'.', " Rest for a while",
'*', " Count gold pieces",
'a', " Affect the undead",
'A', " Choose artifact (equipage)",
'c', " Chant a mantra",
'C', " Cast a spell",
'd', " Drop something",
'D', " Dip something (into a pool)",
'e', " Eat food or fruit",
'f', "<dir> Forward until find something",
'F', " Frighten a monster",
'g', " Give food to monster",
'G', " Sense for gold",
'i', " Inventory",
'I', " Inventory (single item)",
'm', " Mark an object (specific)",
'o', " Examine and/or set options",
'O', " Character type and quest item",
'p', " Pray to the powers that be",
'P', " Pick up object(s)",
'q', " Quaff a potion",
'Q', " Quit the game",
'r', " Read a scroll",
's', " Search for a trap/secret door",
'S', " Save your game",
't', "<dir> Throw something",
'T', " Take off something",
'v', " Print program version",
'w', " Wield a weapon",
'W', " Wear something",
'X', " Sense for traps",
'z', "<dir> Zap a wand or staff",
' ', "",
'^', " Set a trap",
'$', " Price an item (trading post)",
'#', " Buy an item (trading post)",
'%', " Sell an item (trading post)",
'!', " Shell escape",
ESC, " Cancel command (Esc)",
' ', "",
CTRL('B'), " Current score (if you win)",
CTRL('E'), " Current food level",
CTRL('L'), " Redraw the screen",
CTRL('N'), " Name an object or a monster",
CTRL('O'), " Character affect status",
CTRL('R'), " Repeat last message",
CTRL('T'), "<dir> Take (steal) from (direction)",
CTRL('U'), " Use a magic item",
0, 0
{ '?', " Print help" },
{ '/', " Identify object" },
{ '=', " Identify a screen character" },
{ ' ', "" },
{ 'h', " Move left" },
{ 'j', " Move down" },
{ 'k', " Move up" },
{ 'l', " Move right" },
{ 'y', " Move up and left" },
{ 'u', " Move up and right" },
{ 'b', " Move down and left" },
{ 'n', " Move down and 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" },
{ ' ', "" },
{ '>', " Go down a staircase" },
{ '<', " Go up a staircase" },
{ '\\', " Game descriptions" },
{ '.', " Rest for a while" },
{ '*', " Count gold pieces" },
{ 'a', " Affect the undead" },
{ 'A', " Choose artifact (equipage)" },
{ 'c', " Chant a mantra" },
{ 'C', " Cast a spell" },
{ 'd', " Drop something" },
{ 'D', " Dip something (into a pool)" },
{ 'e', " Eat food or fruit" },
{ 'f', "<dir> Forward until find something" },
{ 'F', " Frighten a monster" },
{ 'g', " Give food to monster" },
{ 'G', " Sense for gold" },
{ 'i', " Inventory" },
{ 'I', " Inventory (single item)" },
{ 'm', " Mark an object (specific)" },
{ 'o', " Examine and/or set options" },
{ 'O', " Character type and quest item" },
{ 'p', " Pray to the powers that be" },
{ 'P', " Pick up object(s)" },
{ 'q', " Quaff a potion" },
{ 'Q', " Quit the game" },
{ 'r', " Read a scroll" },
{ 's', " Search for a trap/secret door" },
{ 'S', " Save your game" },
{ 't', "<dir> Throw something" },
{ 'T', " Take off something" },
{ 'v', " Print program version" },
{ 'w', " Wield a weapon" },
{ 'W', " Wear something" },
{ 'X', " Sense for traps" },
{ 'z', "<dir> Zap a wand or staff" },
{ ' ', "" },
{ '^', " Set a trap" },
{ '$', " Price an item (trading post)" },
{ '#', " Buy an item (trading post)" },
{ '%', " Sell an item (trading post)" },
{ '!', " Shell escape" },
{ ESC, " Cancel command (Esc)" },
{ ' ', "" },
{ CTRL('B'), " Current score (if you win)" },
{ CTRL('E'), " Current food level" },
{ CTRL('L'), " Redraw the screen" },
{ CTRL('N'), " Name an object or a monster" },
{ CTRL('O'), " Character affect status" },
{ CTRL('R'), " Repeat last message" },
{ CTRL('T'), "<dir> Take (steal) from (direction)" },
{ CTRL('U'), " Use a magic item" },
{ 0, "" }
} ;
/* wizard help list */
static struct h_list wiz_help[] = {
' ', "",
'+', " Random fortunes",
'M', " Make an object",
'V', " Display vlevel and turns",
CTRL('A'), " System activity",
CTRL('C'), " Move to another dungeon level",
CTRL('D'), " Go down 1 dungeon level",
CTRL('F'), " Display the entire level",
CTRL('G'), " Charge wands and staffs",
CTRL('H'), " Jump 9 experience levels",
CTRL('I'), " Inventory of level",
CTRL('J'), " Teleport somewhere",
CTRL('K'), " Identify an object",
CTRL('M'), " Recharge wand or staff",
CTRL('P'), " Toggle wizard status",
CTRL('X'), " Detect monsters",
CTRL('Y'), " Display food levels",
0, 0
{ ' ', "" },
{ '+', " Random fortunes" },
{ 'M', " Make an object" },
{ 'V', " Display vlevel and turns" },
{ CTRL('A'), " System activity" },
{ CTRL('C'), " Move to another dungeon level" },
{ CTRL('D'), " Go down 1 dungeon level" },
{ CTRL('F'), " Display the entire level" },
{ CTRL('G'), " Charge wands and staffs" },
{ CTRL('H'), " Jump 9 experience levels" },
{ CTRL('I'), " Inventory of level" },
{ CTRL('J'), " Teleport somewhere" },
{ CTRL('K'), " Identify an object" },
{ CTRL('M'), " Recharge wand or staff" },
{ CTRL('P'), " Toggle wizard status" },
{ CTRL('X'), " Detect monsters" },
{ CTRL('Y'), " Display food levels" },
{ 0, "" }
};
/* item help list */
static struct item_list item_help[] = {
'@', " You (visible)",
'_', " You (invisible)",
' ', "",
':', " Food ration or fruit (eat)",
'!', " Potion (quaff)",
'?', " Scroll (read)",
'=', " Ring (wear)",
')', " Weapon (wield)",
']', " Armor (wear)",
'/', " Wand or staff (zap)",
';', " Magic item (use)",
',', " Artifact (quest item)",
'*', " Gold or zapped missile",
' ', "",
'$', " Magical item in room",
'>', " Blessed magical item",
'<', " Cursed magical item",
' ', " ",
'`', " Dart trap",
'{', " Arrow trap",
'}', " Bear trap",
'~', " Teleport trap",
'$', " Sleeping gas trap",
'>', " Trap door",
'<', " Outer region entrance",
'\'', " Maze entrance",
'^', " Trading post entrance",
'"', " Magic pool or lake",
' ', " Solid rock or mountain",
'.', " Floor of a room or meadow",
'%', " Stairs (up or down)",
'+', " Doorway",
'&', " Secret doorway",
'#', " Passage between rooms",
'\\', " Forest",
HORZWALL, " Horizontal wall of a room",
VERTWALL, " Vertical wall of a room",
0, 0
{ '@', " You (visible)" },
{ '_', " You (invisible)" },
{ ' ', "" },
{ ':', " Food ration or fruit (eat)" },
{ '!', " Potion (quaff)" },
{ '?', " Scroll (read)" },
{ '=', " Ring (wear)" },
{ ')', " Weapon (wield)" },
{ ']', " Armor (wear)" },
{ '/', " Wand or staff (zap)" },
{ ';', " Magic item (use)" },
{ ',', " Artifact (quest item)" },
{ '*', " Gold or zapped missile" },
{ ' ', "" },
{ '$', " Magical item in room" },
{ '>', " Blessed magical item" },
{ '<', " Cursed magical item" },
{ ' ', " " },
{ '`', " Dart trap" },
{ '{', " Arrow trap" },
{ '}', " Bear trap" },
{ '~', " Teleport trap" },
{ '$', " Sleeping gas trap" },
{ '>', " Trap door" },
{ '<', " Outer region entrance" },
{ '\'', " Maze entrance" },
{ '^', " Trading post entrance" },
{ '"', " Magic pool or lake" },
{ ' ', " Solid rock or mountain" },
{ '.', " Floor of a room or meadow" },
{ '%', " Stairs (up or down)" },
{ '+', " Doorway" },
{ '&', " Secret doorway" },
{ '#', " Passage between rooms" },
{ '\\', " Forest" },
{ HORZWALL, " Horizontal wall of a room" },
{ VERTWALL, " Vertical wall of a room" },
{ 0, "" }
};
void

View file

@ -37,67 +37,71 @@ enter a '\\' on any other screen.";
*/
struct words rainbow[NCOLORS] = {
"Amber", "Aquamarine", "Beige",
"Black", "Blue", "Brown",
"Clear", "Crimson", "Ecru",
"Gold", "Green", "Grey",
"Indigo", "Khaki", "Lavender",
"Magenta", "Orange", "Pink",
"Plaid", "Purple", "Red",
"Silver", "Saffron", "Scarlet",
"Tan", "Tangerine", "Topaz",
"Turquoise", "Vermilion", "Violet",
"White", "Yellow",
{ "Amber" }, { "Aquamarine" }, { "Beige" },
{ "Black" }, { "Blue" }, { "Brown" },
{ "Clear" }, { "Crimson" }, { "Ecru" },
{ "Gold" }, { "Green" }, { "Grey" },
{ "Indigo" }, { "Khaki" }, { "Lavender" },
{ "Magenta" }, { "Orange" }, { "Pink" },
{ "Plaid" }, { "Purple" }, { "Red" },
{ "Silver" }, { "Saffron" }, { "Scarlet" },
{ "Tan" }, { "Tangerine" }, { "Topaz" },
{ "Turquoise" }, { "Vermilion" }, { "Violet" },
{ "White" }, { "Yellow" }
};
struct words sylls[NSYLLS] = {
"a", "ae", "ak", "an", "ax", "ach", "ano", "ars", "bha", "bar", "bre",
"cha", "cre", "cum", "cow", "duh", "dha", "e", "ea", "em", "et", "ey",
"eck", "etk", "egg", "exl", "fu", "fen", "fid", "gan", "gle", "h", "ha",
"hr", "ht", "how", "hex", "hip", "hoc", "i", "ia", "ig", "it", "iz",
"ion", "ink", "ivi", "iss", "je", "jin", "jha", "jyr", "ka", "kho", "kal",
"kli", "lu", "lre", "lta", "lri", "m", "ma", "mh", "mi", "mr", "mar",
"myr", "moh", "mul", "nep", "nes", "o", "oc", "om", "oq", "ox", "orn",
"oxy", "olm", "ode", "po", "pie", "pod", "pot", "qar", "que", "ran", "rah",
"rok", "sa", "sat", "sha", "sol", "sri", "ti", "tem", "tar", "tki", "tch",
"tox", "u", "ub", "uh", "ur", "uv", "unk", "uwh", "ugh", "uyr", "va",
"vil", "vit", "vom", "vux", "wah", "wex", "xu", "xed", "xen", "ya", "yep",
"yih", "zef", "zen", "zil", "zym", "-"
{"a"}, {"ae"}, {"ak"}, {"an"}, {"ax"}, {"ach"}, {"ano"}, {"ars"},
{"bha"}, {"bar"}, {"bre"}, {"cha"}, {"cre"}, {"cum"}, {"cow"}, {"duh"},
{"dha"}, {"e"}, {"ea"}, {"em"}, {"et"}, {"ey"}, {"eck"}, {"etk"},
{"egg"}, {"exl"}, {"fu"}, {"fen"}, {"fid"}, {"gan"}, {"gle"}, {"h"},
{"ha"}, {"hr"}, {"ht"}, {"how"}, {"hex"}, {"hip"}, {"hoc"}, {"i"},
{"ia"}, {"ig"}, {"it"}, {"iz"}, {"ion"}, {"ink"}, {"ivi"}, {"iss"},
{"je"}, {"jin"}, {"jha"}, {"jyr"}, {"ka"}, {"kho"}, {"kal"}, {"kli"},
{"lu"}, {"lre"}, {"lta"}, {"lri"}, {"m"}, {"ma"}, {"mh"}, {"mi"},
{"mr"}, {"mar"}, {"myr"}, {"moh"}, {"mul"}, {"nep"}, {"nes"}, {"o"},
{"oc"}, {"om"}, {"oq"}, {"ox"}, {"orn"}, {"oxy"}, {"olm"}, {"ode"},
{"po"}, {"pie"}, {"pod"}, {"pot"}, {"qar"}, {"que"}, {"ran"}, {"rah"},
{"rok"}, {"sa"}, {"sat"}, {"sha"}, {"sol"}, {"sri"}, {"ti"}, {"tem"},
{"tar"}, {"tki"}, {"tch"}, {"tox"}, {"u"}, {"ub"}, {"uh"}, {"ur"},
{"uv"}, {"unk"}, {"uwh"}, {"ugh"}, {"uyr"}, {"va"}, {"vil"}, {"vit"},
{"vom"}, {"vux"}, {"wah"}, {"wex"}, {"xu"}, {"xed"}, {"xen"}, {"ya"},
{"yep"}, {"yih"}, {"zef"}, {"zen"}, {"zil"}, {"zym"}, {"-"}
};
struct words stones[NSTONES] = {
"Agate", "Alexandrite", "Amethyst",
"Azurite", "Bloodstone", "Cairngorm",
"Carnelian", "Chalcedony", "Chrysoberyl",
"Chrysolite", "Chrysoprase", "Citrine",
"Coral", "Diamond", "Emerald",
"Garnet", "Heliotrope", "Hematite",
"Hyacinth", "Jacinth", "Jade",
"Jargoon", "Jasper", "Kryptonite",
"Lapis lazuli", "Malachite", "Mocca stone",
"Moonstone", "Obsidian", "Olivine",
"Onyx", "Opal", "Pearl",
"Peridot", "Quartz", "Rhodochrosite",
"Rhodolite", "Ruby", "Sapphire",
"Sardonyx", "Serpentine", "Spinel",
"Tiger eye", "Topaz", "Tourmaline",
"Turquoise", "Zircon",
{ "Agate" }, { "Alexandrite" }, { "Amethyst" },
{ "Azurite" }, { "Bloodstone" }, { "Cairngorm" },
{ "Carnelian" }, { "Chalcedony" }, { "Chrysoberyl" },
{ "Chrysolite" }, { "Chrysoprase" }, { "Citrine" },
{ "Coral" }, { "Diamond" }, { "Emerald" },
{ "Garnet" }, { "Heliotrope" }, { "Hematite" },
{ "Hyacinth" }, { "Jacinth" }, { "Jade" },
{ "Jargoon" }, { "Jasper" }, { "Kryptonite" },
{ "Lapis lazuli" }, { "Malachite" }, { "Mocca stone" },
{ "Moonstone" }, { "Obsidian" }, { "Olivine" },
{ "Onyx" }, { "Opal" }, { "Pearl" },
{ "Peridot" }, { "Quartz" }, { "Rhodochrosite" },
{ "Rhodolite" }, { "Ruby" }, { "Sapphire" },
{ "Sardonyx" }, { "Serpentine" }, { "Spinel" },
{ "Tiger eye" }, { "Topaz" }, { "Tourmaline" },
{ "Turquoise" }, { "Zircon" }
};
struct words wood[NWOOD] = {
"Avocado wood", "Balsa", "Banyan", "Birch",
"Cedar", "Cherry", "Cinnabar", "Dogwood",
"Driftwood", "Ebony", "Eucalyptus", "Hemlock",
"Ironwood", "Mahogany", "Manzanita", "Maple",
"Oak", "Pine", "Redwood", "Rosewood",
"Teak", "Walnut", "Aloe", "Sandalwood",
{"Avocado wood"}, {"Balsa"}, {"Banyan"}, {"Birch"},
{"Cedar"}, {"Cherry"}, {"Cinnabar"}, {"Dogwood"},
{"Driftwood"}, {"Ebony"}, {"Eucalyptus"}, {"Hemlock"},
{"Ironwood"}, {"Mahogany"}, {"Manzanita"}, {"Maple"},
{"Oak"}, {"Pine"}, {"Redwood"}, {"Rosewood"},
{"Teak"}, {"Walnut"}, {"Aloe"}, {"Sandalwood"}
};
struct words metal[NMETAL] = {
"Aluminium", "Bone", "Brass", "Bronze",
"Copper", "Chromium", "Iron", "Lead",
"Magnesium", "Pewter", "Platinum", "Silver",
"Steel", "Tin", "Titanium", "Zinc",
{"Aluminium"}, {"Bone"}, {"Brass"}, {"Bronze"},
{"Copper"}, {"Chromium"}, {"Iron"}, {"Lead"},
{"Magnesium"}, {"Pewter"}, {"Platinum"}, {"Silver"},
{"Steel"}, {"Tin"}, {"Titanium"}, {"Zinc"}
};
/*

View file

@ -238,7 +238,7 @@ new(int size)
register char *space = ALLOC(size);
if (space == NULL) {
sprintf(prbuf,"Rogue ran out of memory (used = %d, wanted = %d).",
sprintf(prbuf,"Rogue ran out of memory (used = %ld, wanted = %d).",
md_memused(), size);
fatal(prbuf);
}

View file

@ -21,7 +21,7 @@ struct cell {
char x_pos;
};
struct b_cellscells {
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 */
} b_cells;

View file

@ -521,9 +521,10 @@ quaff(int which, int kind, int flags, bool is_potion)
fuse(sight, NULL, SEEDURATION, AFTER);
light(&hero);
}
else
else {
msg("The darkness around you thickens. ");
lengthen(sight, SEEDURATION);
}
}
else {
if (off(player, CANSEE)) {

View file

@ -180,7 +180,7 @@ writelog(unsigned long amount, int flags, short monst)
else
return;
/* Write the line */
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);

View file

@ -166,7 +166,8 @@ struct character_types char_class[NUM_CHARTYPES] = {
*/
struct words abilities[NUMABILITIES] = {
"Intelligence", "Strength", "Wisdom", "Dexterity", "Constitution", "Charisma"
{ "Intelligence" }, { "Strength" }, { "Wisdom" },
{ "Dexterity" }, { "Constitution" }, { "Charisma" }
};
/*