-/* $NetBSD: hit.c,v 1.8 2007/12/27 23:52:59 dholland Exp $ */
+/* $NetBSD: hit.c,v 1.9 2008/01/14 00:23:51 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)hit.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: hit.c,v 1.8 2007/12/27 23:52:59 dholland Exp $");
+__RCSID("$NetBSD: hit.c,v 1.9 2008/01/14 00:23:51 dholland Exp $");
#endif
#endif /* not lint */
if (!(monster->m_flags & STATIONARY)) {
damage = get_damage(monster->m_damage, 1);
if (cur_level >= (AMULET_LEVEL * 2)) {
- minus = (float) ((AMULET_LEVEL * 2) - cur_level);
+ minus = (float)((AMULET_LEVEL * 2) - cur_level);
} else {
- minus = (float) get_armor_class(rogue.armor) * 3.00;
- minus = minus/100.00 * (float) damage;
+ minus = (float)get_armor_class(rogue.armor) * 3.00;
+ minus = minus/100.00 * (float)damage;
}
- damage -= (short) minus;
+ damage -= (short)minus;
} else {
damage = monster->stationary_damage++;
}
}
if (!rand_percent(hit_chance)) {
if (!fight_monster) {
- (void) strlcpy(hit_message, "you miss ",
+ (void)strlcpy(hit_message, "you miss ",
sizeof(hit_message));
}
goto RET;
}
if (mon_damage(monster, damage)) { /* still alive? */
if (!fight_monster) {
- (void) strlcpy(hit_message, "you hit ",
+ (void)strlcpy(hit_message, "you hit ",
sizeof(hit_message));
}
}
}
tmp_damage = get_number(obj->damage + i) + obj->d_enchant;
- snprintf(new_damage, sizeof(new_damage), "%dd%d",
+ snprintf(new_damage, sizeof(new_damage), "%dd%d",
tmp_to_hit, tmp_damage);
return(get_damage(new_damage, 1));
row = monster->row;
col = monster->col;
dungeon[row][col] &= ~MONSTER;
- mvaddch(row, col, (int) get_dungeon_char(row, col));
+ mvaddch(row, col, (int)get_dungeon_char(row, col));
fight_monster = 0;
cough_up(monster);
possible_damage = fight_monster->stationary_damage - 1;
}
while (fight_monster) {
- (void) one_move_rogue(ch, 0);
+ (void)one_move_rogue(ch, 0);
if (((!to_the_death) && (rogue.hp_current <= possible_damage)) ||
interrupted || (!(dungeon[row][col] & MONSTER))) {
fight_monster = 0;
-/* $NetBSD: init.c,v 1.15 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: init.c,v 1.16 2008/01/14 00:23:51 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: init.c,v 1.15 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: init.c,v 1.16 2008/01/14 00:23:51 dholland Exp $");
#endif
#endif /* not lint */
#include "rogue.h"
char login_name[MAX_OPT_LEN];
-char *nick_name = (char *) 0;
+char *nick_name = (char *)0;
char *rest_file = 0;
boolean cant_int = 0;
boolean did_int = 0;
clean_up("Hey! Who are you?");
}
/* LOGIN_NAME_SIZE == MAX_OPT_LEN now, but just in case... */
- (void) strlcpy(login_name, pn, sizeof(login_name));
+ (void)strlcpy(login_name, pn, sizeof(login_name));
do_args(argc, argv);
do_opts();
md_heed_signals();
if (score_only) {
- put_scores((object *) 0, 0);
+ put_scores((object *)0, 0);
}
seed = md_gseed();
- (void) srrandom(seed);
+ (void)srrandom(seed);
if (rest_file) {
restore(rest_file);
return(1);
get_wand_and_ring_materials();
make_scroll_titles();
- level_objects.next_object = (object *) 0;
- level_monsters.next_monster = (object *) 0;
+ level_objects.next_object = (object *)0;
+ level_monsters.next_monster = (object *)0;
player_init();
ring_stats(0);
return(0);
{
object *obj;
- rogue.pack.next_object = (object *) 0;
+ rogue.pack.next_object = (object *)0;
obj = alloc_object();
get_food(obj, 1);
- (void) add_to_pack(obj, &rogue.pack, 1);
+ (void)add_to_pack(obj, &rogue.pack, 1);
obj = alloc_object(); /* initial armor */
obj->what_is = ARMOR;
obj->class = RINGMAIL+2;
obj->is_protected = 0;
obj->d_enchant = 1;
- (void) add_to_pack(obj, &rogue.pack, 1);
+ (void)add_to_pack(obj, &rogue.pack, 1);
do_wear(obj);
obj = alloc_object(); /* initial weapons */
obj->damage = "2d3";
obj->hit_enchant = obj->d_enchant = 1;
obj->identified = 1;
- (void) add_to_pack(obj, &rogue.pack, 1);
+ (void)add_to_pack(obj, &rogue.pack, 1);
do_wield(obj);
obj = alloc_object();
obj->hit_enchant = 1;
obj->d_enchant = 0;
obj->identified = 1;
- (void) add_to_pack(obj, &rogue.pack, 1);
+ (void)add_to_pack(obj, &rogue.pack, 1);
obj = alloc_object();
obj->what_is = WEAPON;
obj->hit_enchant = 0;
obj->d_enchant = 0;
obj->identified = 1;
- (void) add_to_pack(obj, &rogue.pack, 1);
+ (void)add_to_pack(obj, &rogue.pack, 1);
}
void
*s = md_malloc(MAX_OPT_LEN + 2);
if (*s == NULL)
clean_up("out of memory");
- (void) strncpy(*s, t, i);
+ (void)strncpy(*s, t, i);
if (add_blank) {
(*s)[i++] = ' ';
}
*str = md_malloc(MAX_OPT_LEN + 2);
if (*str == NULL)
clean_up("out of memory");
- (void) strlcpy(*str, dflt, MAX_OPT_LEN + 2);
+ (void)strlcpy(*str, dflt, MAX_OPT_LEN + 2);
}
}
-/* $NetBSD: inventory.c,v 1.11 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: inventory.c,v 1.12 2008/01/14 00:23:51 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)inventory.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: inventory.c,v 1.11 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: inventory.c,v 1.12 2008/01/14 00:23:51 dholland Exp $");
#endif
#endif /* not lint */
short letter;
short sepchar;
char desc[DCOLS];
- char savebuf[DCOLS+8];
+ char savebuf[DCOLS+8];
} descs[MAX_PACK_COUNT+1];
}
descs[row].savebuf[j-col] = 0;
if (row < i) {
- mvprintw(row, col, " %c%c %s",
- descs[row].letter, descs[row].sepchar,
+ mvprintw(row, col, " %c%c %s",
+ descs[row].letter, descs[row].sepchar,
descs[row].desc);
}
else {
ch += 32;
until = "";
}
- (void) get_com_id(&n, ch);
+ (void)get_com_id(&n, ch);
check_message();
messagef(0, "run %s%s", com_id_tab[n].com_desc + 8, until);
return(1);
for (i = 0; i < SCROLS; i++) {
sylls = get_rand(2, 5);
- (void) strlcpy(id_scrolls[i].title, "'", maxlen);
+ (void)strlcpy(id_scrolls[i].title, "'", maxlen);
for (j = 0; j < sylls; j++) {
s = get_rand(1, (MAXSYLLABLES-1));
- (void) strlcat(id_scrolls[i].title, syllables[s],
+ (void)strlcat(id_scrolls[i].title, syllables[s],
maxlen);
}
/* trim trailing space */
n = strlen(id_scrolls[i].title);
id_scrolls[i].title[n-1] = 0;
- (void) strlcat(id_scrolls[i].title, "' ", maxlen);
+ (void)strlcat(id_scrolls[i].title, "' ", maxlen);
}
}
unsigned short objtype_id_status;
if (obj->what_is == AMULET) {
- (void) strlcpy(desc, "the amulet of Yendor ", desclen);
+ (void)strlcpy(desc, "the amulet of Yendor ", desclen);
return;
}
j = get_rand(0, WAND_MATERIALS-1);
} while (used[j]);
used[j] = 1;
- (void) strlcpy(id_wands[i].title, wand_materials[j],
+ (void)strlcpy(id_wands[i].title, wand_materials[j],
sizeof(id_wands[i].title));
is_wood[i] = (j > MAX_METAL);
}
j = get_rand(0, GEMS-1);
} while (used[j]);
used[j] = 1;
- (void) strlcpy(id_rings[i].title, gems[j],
+ (void)strlcpy(id_rings[i].title, gems[j],
sizeof(id_rings[i].title));
}
}
case ARMOR:
return(id_armors);
}
- return((struct id *) 0);
+ return((struct id *)0);
}
void
-/* $NetBSD: level.c,v 1.8 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: level.c,v 1.9 2008/01/14 00:23:51 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)level.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: level.c,v 1.8 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: level.c,v 1.9 2008/01/14 00:23:51 dholland Exp $");
#endif
#endif /* not lint */
i = random_rooms[j];
if (i < (MAXROOMS-1)) {
- (void) connect_rooms(i, i+1);
+ (void)connect_rooms(i, i+1);
}
if (i < (MAXROOMS-3)) {
- (void) connect_rooms(i, i+3);
+ (void)connect_rooms(i, i+3);
}
if (i < (MAXROOMS-2)) {
if (rooms[i+1].is_room & R_NOTHING) {
} else {
real_average = (float)
((rogue.hp_max - extra_hp - INIT_HP) + less_hp) / (rogue.exp - 1);
- effective_average = (float) (rogue.hp_max - INIT_HP) / (rogue.exp - 1);
+ effective_average = (float)(rogue.hp_max - INIT_HP) / (rogue.exp - 1);
}
messagef(0, "R-Hp: %.2f, E-Hp: %.2f (!: %d, V: %d)", real_average,
-/* $NetBSD: machdep.c,v 1.15 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: machdep.c,v 1.16 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)machdep.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: machdep.c,v 1.15 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: machdep.c,v 1.16 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
*
* All UNIX code should be included between the single "#ifdef UNIX" at the
* top of this file, and the "#endif" at the bottom.
- *
+ *
* To change a routine to include a new UNIX system, simply #ifdef the
* existing routine, as in the following example:
*
if (stat(fname, &sbuf)) {
return(-1);
}
- return((int) sbuf.st_ino);
+ return((int)sbuf.st_ino);
}
/* md_link_count():
struct stat sbuf;
stat(fname, &sbuf);
- return((int) sbuf.st_nlink);
+ return((int)sbuf.st_nlink);
}
/* md_gct(): (Get Current Time)
* system doesn't provide all of the time units requested here, then you
* can provide only those that it does, and return zeros for the others.
* If you cannot provide good time values, then users may be able to copy
- * saved-game files and play them.
+ * saved-game files and play them.
*/
void
* exactly the same here.
* Or if md_gct() is implemented correctly, but your system does not provide
* file modification dates, you may return some date far in the past so
- * that the program will never know that a saved-game file being modified.
+ * that the program will never know that a saved-game file being modified.
* You may also do this if you wish to be able to restore games from
* saved-games that have been modified.
*/
struct tm *t;
stat(fname, &sbuf);
- seconds = (long) sbuf.st_mtime;
+ seconds = (long)sbuf.st_mtime;
t = localtime(&seconds);
rt_buf->year = t->tm_year;
md_sleep(nsecs)
int nsecs;
{
- (void) sleep(nsecs);
+ (void)sleep(nsecs);
}
/* md_getenv()
* You need to find some single random integer, such as:
* process id.
* current time (minutes + seconds) returned from md_gct(), if implemented.
- *
+ *
* It will not help to return "get_rand()" or "rand()" or the return value of
* any pseudo-RNG. If you don't have a random number, you can just return 1,
* but this means your games will ALWAYS start the same way, and will play
time_t seconds;
time(&seconds);
- return((int) seconds);
+ return((int)seconds);
}
/* md_exit():
case -1:
break;
case 0:
- execl(shell, shell, (char *) 0);
+ execl(shell, shell, (char *)0);
_exit(255);
default:
waitpid(pid, &w, 0);
-/* $NetBSD: main.c,v 1.6 2004/01/27 20:30:30 jsm Exp $ */
+/* $NetBSD: main.c,v 1.7 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: main.c,v 1.6 2004/01/27 20:30:30 jsm Exp $");
+__RCSID("$NetBSD: main.c,v 1.7 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
put_mons();
put_player(party_room);
print_stats(STAT_ALL);
-PL:
+PL:
play_level();
free_stuff(&level_objects);
free_stuff(&level_monsters);
-/* $NetBSD: message.c,v 1.11 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: message.c,v 1.12 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: message.c,v 1.11 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: message.c,v 1.12 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
}
if (!rmsg) {
imsg = (imsg + 1) % NMESSAGES;
- (void) strlcpy(msgs[imsg], msg, sizeof(msgs[imsg]));
+ (void)strlcpy(msgs[imsg], msg, sizeof(msgs[imsg]));
}
mvaddstr(MIN_ROW-1, 0, msg);
addch(' ');
if (insert[0]) {
mvaddstr(0, n + 1, insert);
- (void) strlcpy(buf, insert, buflen);
+ (void)strlcpy(buf, insert, buflen);
i = strlen(buf);
move(0, (n + i + 1));
refresh();
-/* $NetBSD: monster.c,v 1.12 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: monster.c,v 1.13 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)monster.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: monster.c,v 1.12 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: monster.c,v 1.13 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
n = get_rand(4, 6);
for (i = 0; i < n; i++) {
- monster = gr_monster((object *) 0, 0);
+ monster = gr_monster((object *)0, 0);
if ((monster->m_flags & WANDERS) && coin_toss()) {
wake_up(monster);
}
}
}
if (found) {
- monster = gr_monster((object *) 0, 0);
+ monster = gr_monster((object *)0, 0);
if (!(monster->m_flags & IMITATES)) {
monster->m_flags |= WAKENS;
}
monster = NULL; /* XXXGCC -Wuninitialized [powerpc] */
for (i = 0; ((i < 15) && (!found)); i++) {
- monster = gr_monster((object *) 0, 0);
+ monster = gr_monster((object *)0, 0);
if (!(monster->m_flags & (WAKENS | WANDERS))) {
free_object(monster);
} else {
}
}
if (found) {
- monster = gr_monster((object *) 0, 0);
+ monster = gr_monster((object *)0, 0);
put_m_at(row, col, monster);
mvaddch(row, col, gmc(monster));
if (monster->m_flags & (WANDERS | WAKENS)) {
monster->col = col;
dungeon[row][col] |= MONSTER;
monster->trail_char = mvinch(row, col);
- (void) add_to_pack(monster, &level_monsters, 0);
+ (void)add_to_pack(monster, &level_monsters, 0);
aim_monster(monster);
}
-/* $NetBSD: move.c,v 1.9 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: move.c,v 1.10 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: move.c,v 1.9 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: move.c,v 1.10 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
if (confused) {
dirch = gr_dir();
}
- (void) is_direction(dirch, &d);
+ (void)is_direction(dirch, &d);
get_dir_rc(d, &row, &col, 1);
if (!can_move(rogue.row, rogue.col, row, col)) {
messagef(1, "you are being held");
} else {
messagef(0, "you are still stuck in the bear trap");
- (void) reg_move();
+ (void)reg_move();
}
return(MOVE_FAILED);
}
}
if (dungeon[row][col] & MONSTER) {
rogue_hit(object_at(&level_monsters, row, col), 0);
- (void) reg_move();
+ (void)reg_move();
return(MOVE_FAILED);
}
if (dungeon[row][col] & DOOR) {
}
messagef(1, "%s(%c)", desc, obj->ichar);
NOT_IN_PACK:
- (void) reg_move();
+ (void)reg_move();
return(STOPPED_ON_SOMETHING);
}
if (dungeon[row][col] & (DOOR | STAIRS | TRAP)) {
if ((!levitate) && (dungeon[row][col] & TRAP)) {
trap_player(row, col);
}
- (void) reg_move();
+ (void)reg_move();
return(STOPPED_ON_SOMETHING);
}
MVED: if (reg_move()) { /* fainted from hunger */
case 'Y':
case 'U':
case 'N':
- while ((!interrupted) && (one_move_rogue((dirch + 32), 1) == MOVED)) ;
+ while ((!interrupted) && (one_move_rogue((dirch + 32), 1) == MOVED))
+ ;
if ( (!interrupted) && passgo &&
(dungeon[rogue.row][rogue.col] & TUNNEL)) {
}
boolean
-can_move(row1, col1, row2, col2)
+can_move(row1, col1, row2, col2)
int row1, col1, row2, col2;
{
if (!is_passable(row2, col2)) {
}
check_message();
if (ch != CANCEL) {
- (void) one_move_rogue(ch, 0);
+ (void)one_move_rogue(ch, 0);
}
}
boolean fainted = 0;
if (rogue.moves_left == HUNGRY) {
- (void) strlcpy(hunger_str, "hungry", sizeof(hunger_str));
+ (void)strlcpy(hunger_str, "hungry", sizeof(hunger_str));
messagef(0, "%s", hunger_str);
print_stats(STAT_HUNGER);
}
if (rogue.moves_left == WEAK) {
- (void) strlcpy(hunger_str, "weak", sizeof(hunger_str));
+ (void)strlcpy(hunger_str, "weak", sizeof(hunger_str));
messagef(1, "%s", hunger_str);
print_stats(STAT_HUNGER);
}
if (rogue.moves_left <= FAINT) {
if (rogue.moves_left == FAINT) {
- (void) strlcpy(hunger_str, "faint", sizeof(hunger_str));
+ (void)strlcpy(hunger_str, "faint", sizeof(hunger_str));
messagef(1, "%s", hunger_str);
print_stats(STAT_HUNGER);
}
return(fainted);
}
if (rogue.moves_left <= STARVE) {
- killed_by((object *) 0, STARVATION);
+ killed_by((object *)0, STARVATION);
}
switch(e_rings) {
break;
case 1:
rogue.moves_left--;
- (void) check_hunger(1);
+ (void)check_hunger(1);
rogue.moves_left -= (rogue.moves_left % 2);
break;
case 2:
rogue.moves_left--;
- (void) check_hunger(1);
+ (void)check_hunger(1);
rogue.moves_left--;
break;
}
if (interrupted) {
break;
}
- (void) reg_move();
+ (void)reg_move();
}
}
-/* $NetBSD: object.c,v 1.11 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: object.c,v 1.12 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)object.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: object.c,v 1.11 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: object.c,v 1.12 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
object level_objects;
unsigned short dungeon[DROWS][DCOLS];
short foods = 0;
-object *free_list = (object *) 0;
-char *fruit = (char *) 0;
+object *free_list = (object *)0;
+char *fruit = (char *)0;
fighter rogue = {
INIT_AW, /* armor */
obj->quantity += obj->quantity / 2;
}
dungeon[row][col] |= OBJECT;
- (void) add_to_pack(obj, &level_objects, 0);
+ (void)add_to_pack(obj, &level_objects, 0);
}
void
obj->row = row;
obj->col = col;
dungeon[row][col] |= OBJECT;
- (void) add_to_pack(obj, &level_objects, 0);
+ (void)add_to_pack(obj, &level_objects, 0);
}
object *
object *pack;
short row, col;
{
- object *obj = (object *) 0;
+ object *obj = (object *)0;
if (dungeon[row][col] & (MONSTER | OBJECT)) {
obj = pack->next_object;
if (free_list) {
obj = free_list;
free_list = free_list->next_object;
- } else if (!(obj = (object *) md_malloc(sizeof(object)))) {
+ } else if (!(obj = (object *)md_malloc(sizeof(object)))) {
messagef(0, "cannot allocate object, saving game");
save_into_file(error_file);
clean_up("alloc_object: save failed");
while (monster) {
if (monster->m_flags & IMITATES) {
- mvaddch(monster->row, monster->col, (int) monster->disguise);
+ mvaddch(monster->row, monster->col, (int)monster->disguise);
}
monster = monster->next_monster;
}
char buf[80];
max = 0;
- if (pack_count((object *) 0) >= MAX_PACK_COUNT) {
+ if (pack_count((object *)0) >= MAX_PACK_COUNT) {
messagef(0, "pack full");
return;
}
if (get_input_line("which kind?", "", buf, sizeof(buf), "", 0, 1)) {
wk = get_number(buf);
if ((wk >= 0) && (wk <= max)) {
- obj->which_kind = (unsigned short) wk;
+ obj->which_kind = (unsigned short)wk;
if (obj->what_is == RING) {
gr_ring(obj, 0);
}
}
get_desc(obj, buf, sizeof(buf));
messagef(0, "%s", buf);
- (void) add_to_pack(obj, &rogue.pack, 1);
+ (void)add_to_pack(obj, &rogue.pack, 1);
}
-/* $NetBSD: pack.c,v 1.8 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: pack.c,v 1.9 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pack.c,v 1.8 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: pack.c,v 1.9 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
if (levitate) {
messagef(0, "you're floating in the air!");
- return((object *) 0);
+ return((object *)0);
}
obj = object_at(&level_objects, row, col);
if (!obj) {
if (id_scrolls[SCARE_MONSTER].id_status == UNIDENTIFIED) {
id_scrolls[SCARE_MONSTER].id_status = IDENTIFIED;
}
- return((object *) 0);
+ return((object *)0);
}
if (obj->what_is == GOLD) {
rogue.gold += obj->quantity;
}
if (pack_count(obj) >= MAX_PACK_COUNT) {
messagef(1, "pack too full");
- return((object *) 0);
+ return((object *)0);
}
dungeon[row][col] &= ~(OBJECT);
take_from_pack(obj, &level_objects);
place_at(obj, rogue.row, rogue.col);
get_desc(obj, desc, sizeof(desc));
messagef(0, "dropped %s", desc);
- (void) reg_move();
+ (void)reg_move();
}
object *
op = pack->next_object;
while (op) {
- if ((op->what_is == obj->what_is) &&
+ if ((op->what_is == obj->what_is) &&
(op->which_kind == obj->which_kind)) {
if ((obj->what_is != WEAPON) ||
void
wait_for_ack()
{
- while (rgetchar() != ' ') ;
+ while (rgetchar() != ' ')
+ ;
}
short
get_desc(obj, desc, sizeof(desc));
messagef(0, "was wearing %s", desc);
print_stats(STAT_ARMOR);
- (void) reg_move();
+ (void)reg_move();
}
} else {
messagef(0, "not wearing any");
messagef(0, "wearing %s", desc);
do_wear(obj);
print_stats(STAT_ARMOR);
- (void) reg_move();
+ (void)reg_move();
}
void
if (obj) {
obj->in_use_flags &= (~BEING_WORN);
}
- rogue.armor = (object *) 0;
+ rogue.armor = (object *)0;
}
void
get_desc(obj, desc, sizeof(desc));
messagef(0, "wielding %s", desc);
do_wield(obj);
- (void) reg_move();
+ (void)reg_move();
}
}
if (obj) {
obj->in_use_flags &= (~BEING_WIELDED);
}
- rogue.weapon = (object *) 0;
+ rogue.weapon = (object *)0;
}
void
if (get_input_line("call it:", "", buf, sizeof(buf),
id_table[obj->which_kind].title, 1, 1)) {
id_table[obj->which_kind].id_status = CALLED;
- (void) strlcpy(id_table[obj->which_kind].title, buf,
+ (void)strlcpy(id_table[obj->which_kind].title, buf,
sizeof(id_table[obj->which_kind].title));
}
}
}
}
if (obj || (!stat)) {
- (void) reg_move();
+ (void)reg_move();
}
}
}
-/* $NetBSD: play.c,v 1.7 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: play.c,v 1.8 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: play.c,v 1.7 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: play.c,v 1.8 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
case 'u':
case 'n':
case 'b':
- (void) one_move_rogue(ch, 1);
+ (void)one_move_rogue(ch, 1);
break;
case 'H':
case 'J':
-/* $NetBSD: random.c,v 1.5 2003/08/07 09:37:39 agc Exp $ */
+/* $NetBSD: random.c,v 1.6 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: random.c,v 1.5 2003/08/07 09:37:39 agc Exp $");
+__RCSID("$NetBSD: random.c,v 1.6 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
*/
static long rntb[32] = {
- 3, 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342,
+ 3, 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342,
0xde3b81e0, 0xdf0a6fb5, 0xf103bc02, 0x48f340fb, 0x7449e56b,
0xbeb1dbb0, 0xab5c5918, 0x946554fd, 0x8c2e680f, 0xeb3d799f,
0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88, 0xe369735d,
- 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
+ 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, 0xf5ad9d0e,
0x8999220b, 0x27fb47b9
};
{
int i;
- state[0] = (long) x;
+ state[0] = (long)x;
if (rand_type != 0) {
for (i = 1; i < rand_deg; i++) {
state[i] = 1103515245 * state[i - 1] + 12345;
fptr = &state[rand_sep];
rptr = &state[0];
for (i = 0; i < 10 * rand_deg; i++) {
- (void) rrandom();
+ (void)rrandom();
}
}
}
rrandom()
{
long i;
-
+
if (rand_type == 0) {
i = state[0] = (state[0]*1103515245 + 12345) & 0x7fffffff;
} else {
x = t;
}
lr = rrandom();
- lr &= (long) 0x00003fff;
- r = (int) lr;
+ lr &= (long)0x00003fff;
+ r = (int)lr;
r = (r % ((y - x) + 1)) + x;
return(r);
}
-/* $NetBSD: ring.c,v 1.7 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: ring.c,v 1.8 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)ring.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: ring.c,v 1.7 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: ring.c,v 1.8 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
check_message();
get_desc(ring, desc, sizeof(desc));
messagef(0, "%s", desc);
- (void) reg_move();
+ (void)reg_move();
}
/*
un_put_on(ring);
get_desc(ring, buf, sizeof(buf));
messagef(0, "removed %s", buf);
- (void) reg_move();
+ (void)reg_move();
}
}
}
break;
case ADD_STRENGTH:
case DEXTERITY:
- while ((ring->class = (get_rand(0, 4) - 2)) == 0) ;
+ while ((ring->class = (get_rand(0, 4) - 2)) == 0)
+ ;
ring->is_cursed = (ring->class < 0);
break;
case ADORNMENT:
-/* $NetBSD: room.c,v 1.10 2007/12/27 23:53:01 dholland Exp $ */
+/* $NetBSD: room.c,v 1.11 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: room.c,v 1.10 2007/12/27 23:53:01 dholland Exp $");
+__RCSID("$NetBSD: room.c,v 1.11 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
} options[NOPTS] = {
{
"Show position only at end of run (\"jump\"): ",
- 1, (char **) 0, &jump
+ 1, (char **)0, &jump
},
{
"Follow turnings in passageways (\"passgo\"): ",
- 1, (char **) 0, &passgo
+ 1, (char **)0, &passgo
},
{
"Don't print skull when killed (\"noskull\" or \"notombstone\"): ",
- 1, (char **) 0, &no_skull
+ 1, (char **)0, &no_skull
},
{
"Ask player before saying 'Okay, bye-bye!' (\"askquit\"): ",
- 1, (char **) 0, &ask_quit
+ 1, (char **)0, &ask_quit
},
{
"Name (\"name\"): ",
- 0, &nick_name, (boolean *) 0
+ 0, &nick_name, (boolean *)0
},
{
"Fruit (\"fruit\"): ",
- 0, &fruit, (boolean *) 0
+ 0, &fruit, (boolean *)0
},
{
"Save file (\"file\"): ",
- 0, &save_file, (boolean *) 0
+ 0, &save_file, (boolean *)0
}
};
if (j != 0) {
/*
* We rely on the option string being
- * allocated to hold MAX_OPT_LEN+2
+ * allocated to hold MAX_OPT_LEN+2
* bytes. This is arranged in init.c.
*/
- (void) strcpy(*(options[i].strval), buf);
+ (void)strcpy(*(options[i].strval), buf);
}
opt_show(i);
goto CH;
-/* $NetBSD: save.c,v 1.11 2007/12/27 23:53:01 dholland Exp $ */
+/* $NetBSD: save.c,v 1.12 2008/01/14 00:23:52 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: save.c,v 1.11 2007/12/27 23:53:01 dholland Exp $");
+__RCSID("$NetBSD: save.c,v 1.12 2008/01/14 00:23:52 dholland Exp $");
#endif
#endif /* not lint */
#include "rogue.h"
short write_failed = 0;
-char *save_file = (char *) 0;
+char *save_file = (char *)0;
void
save_game()
"out of memory for save file name");
sfile = error_file;
} else {
- (void) strcpy(name_buffer, hptr);
- (void) strcat(name_buffer, sfile+1);
+ (void)strcpy(name_buffer, hptr);
+ (void)strcat(name_buffer, sfile+1);
sfile = name_buffer;
}
- /*
+ /*
* Note: name_buffer gets leaked. But it's small,
* and in the common case we're about to exit.
*/
}
md_ignore_signals();
write_failed = 0;
- (void) xxx(1);
+ (void)xxx(1);
r_write(fp, (char *) &detect_monster, sizeof(detect_monster));
r_write(fp, (char *) &cur_level, sizeof(cur_level));
r_write(fp, (char *) &max_level, sizeof(max_level));
fclose(fp);
if (write_failed) {
- (void) md_df(sfile); /* delete file */
+ (void)md_df(sfile); /* delete file */
} else {
clean_up("");
}
if (md_link_count(fname) > 1) {
clean_up("file has link");
}
- (void) xxx(1);
+ (void)xxx(1);
r_read(fp, (char *) &detect_monster, sizeof(detect_monster));
r_read(fp, (char *) &cur_level, sizeof(cur_level));
r_read(fp, (char *) &max_level, sizeof(max_level));
read_string(hunger_str, fp, sizeof hunger_str);
- (void) strlcpy(tbuf, login_name, sizeof tbuf);
+ (void)strlcpy(tbuf, login_name, sizeof tbuf);
read_string(login_name, fp, sizeof login_name);
if (strcmp(tbuf, login_name)) {
clean_up("you're not the original player");
for (;;) {
r_read(fp, (char *) &read_obj, sizeof(object));
if (read_obj.ichar == 0) {
- pack->next_object = (object *) 0;
+ pack->next_object = (object *)0;
break;
}
new_obj = alloc_object();
-/* $NetBSD: score.c,v 1.12 2007/12/27 23:53:01 dholland Exp $ */
+/* $NetBSD: score.c,v 1.13 2008/01/14 00:23:53 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: score.c,v 1.12 2007/12/27 23:53:01 dholland Exp $");
+__RCSID("$NetBSD: score.c,v 1.13 2008/01/14 00:23:53 dholland Exp $");
#endif
#endif /* not lint */
messagef(0, "%s", ""); /* gcc objects to just "" */
id_all();
sell_pack();
- put_scores((object *) 0, WIN);
+ put_scores((object *)0, WIN);
}
void
clean_up(byebye_string);
}
check_message();
- killed_by((object *) 0, QUIT);
+ killed_by((object *)0, QUIT);
}
/*
}
setegid(gid);
rewind(fp);
- (void) xxx(1);
+ (void)xxx(1);
for (numscores = 0; numscores < NUM_SCORE_ENTRIES; numscores++) {
if (read_score_entry(&scores[numscores], fp) == 0) {
md_ignore_signals();
rewind(fp);
- (void) xxx(1);
+ (void)xxx(1);
for (i = 0; i < numscores; i++) {
write_score_entry(&scores[i], i, fp);
} else {
article = "a";
}
-
+
snprintf(deathbuf, sizeof(deathbuf),
"killed by %s %s", article, mn);
death = deathbuf;
for (i = 0; i < n; i++) {
/* It does not matter if accuracy is lost during this assignment */
- c = (unsigned char) xxx(0);
+ c = (unsigned char)xxx(0);
buf[i] ^= c;
}
-/* $NetBSD: spec_hit.c,v 1.6 2007/12/27 23:53:01 dholland Exp $ */
+/* $NetBSD: spec_hit.c,v 1.7 2008/01/14 00:23:53 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)spec_hit.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: spec_hit.c,v 1.6 2007/12/27 23:53:01 dholland Exp $");
+__RCSID("$NetBSD: spec_hit.c,v 1.7 2008/01/14 00:23:53 dholland Exp $");
#endif
#endif /* not lint */
obj->what_is = GOLD;
obj->quantity = get_rand((cur_level * 15), (cur_level * 30));
} else {
- if (!rand_percent((int) monster->drop_percent)) {
+ if (!rand_percent((int)monster->drop_percent)) {
return;
}
obj = gr_object();
}
if (rand_percent(55)) {
monster->m_flags &= (~CONFUSES);
- messagef(1, "the gaze of the %s has confused you",
+ messagef(1, "the gaze of the %s has confused you",
mon_name(monster));
cnfs();
return(1);
-/* $NetBSD: throw.c,v 1.8 2007/12/27 23:53:01 dholland Exp $ */
+/* $NetBSD: throw.c,v 1.9 2008/01/14 00:23:53 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)throw.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: throw.c,v 1.8 2007/12/27 23:53:01 dholland Exp $");
+__RCSID("$NetBSD: throw.c,v 1.9 2008/01/14 00:23:53 dholland Exp $");
#endif
#endif /* not lint */
weapon->quantity = t;
if (!rand_percent(hit_chance)) {
- (void) strlcat(hit_message, "misses ", HIT_MESSAGE_SIZE);
+ (void)strlcat(hit_message, "misses ", HIT_MESSAGE_SIZE);
return(0);
}
s_con_mon(monster);
- (void) strlcat(hit_message, "hit ", HIT_MESSAGE_SIZE);
- (void) mon_damage(monster, damage);
+ (void)strlcat(hit_message, "hit ", HIT_MESSAGE_SIZE);
+ (void)mon_damage(monster, damage);
return(1);
}
-/* $NetBSD: trap.c,v 1.7 2007/12/27 23:53:01 dholland Exp $ */
+/* $NetBSD: trap.c,v 1.8 2008/01/14 00:23:53 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)trap.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: trap.c,v 1.7 2007/12/27 23:53:01 dholland Exp $");
+__RCSID("$NetBSD: trap.c,v 1.8 2008/01/14 00:23:53 dholland Exp $");
#endif
#endif /* not lint */
}
print_stats(STAT_HP | STAT_STRENGTH);
if (rogue.hp_current <= 0) {
- killed_by((object *) 0, POISON_DART);
+ killed_by((object *)0, POISON_DART);
}
break;
case SLEEPING_GAS_TRAP:
break;
case RUST_TRAP:
messagef(1, "%s", trap_strings[(t*2)+1]);
- rust((object *) 0);
+ rust((object *)0);
break;
}
}
}
}
if ((!is_auto) && (reg_search = !reg_search)) {
- (void) reg_move();
+ (void)reg_move();
}
}
}
-/* $NetBSD: use.c,v 1.7 2007/12/27 23:53:01 dholland Exp $ */
+/* $NetBSD: use.c,v 1.8 2008/01/14 00:23:53 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)use.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: use.c,v 1.7 2007/12/27 23:53:01 dholland Exp $");
+__RCSID("$NetBSD: use.c,v 1.8 2008/01/14 00:23:53 dholland Exp $");
#endif
#endif /* not lint */
}
break;
case SEE_INVISIBLE:
- messagef(0, "hmm, this potion tastes like %sjuice",
+ messagef(0, "hmm, this potion tastes like %sjuice",
fruit);
if (blind) {
unblind();
break;
case CON_MON:
con_mon = 1;
- messagef(0, "your hands glow %sfor a moment",
+ messagef(0, "your hands glow %sfor a moment",
get_ench_color());
break;
}
free_object(obj);
}
if (rm) {
- (void) reg_move();
+ (void)reg_move();
}
}
return(id_potions[get_rand(0, POTIONS-1)].title);
} else if (con_mon) {
return("red ");
- }
+ }
return("blue ");
}
-/* $NetBSD: zap.c,v 1.7 2007/12/27 23:53:01 dholland Exp $ */
+/* $NetBSD: zap.c,v 1.8 2008/01/14 00:23:53 dholland Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)zap.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: zap.c,v 1.7 2007/12/27 23:53:01 dholland Exp $");
+__RCSID("$NetBSD: zap.c,v 1.8 2008/01/14 00:23:53 dholland Exp $");
#endif
#endif /* not lint */
wand->class--;
row = rogue.row; col = rogue.col;
if ((wand->which_kind == COLD) || (wand->which_kind == FIRE)) {
- bounce((short) wand->which_kind, d, row, col, 0);
+ bounce((short)wand->which_kind, d, row, col, 0);
} else {
monster = get_zapped_monster(d, &row, &col);
if (wand->which_kind == DRAIN_LIFE) {
}
}
}
- (void) reg_move();
+ (void)reg_move();
}
object *
}
nm = monster->next_monster;
tc = monster->trail_char;
- (void) gr_monster(monster, get_rand(0, MONSTERS-1));
+ (void)gr_monster(monster, get_rand(0, MONSTERS-1));
monster->row = row;
monster->col = col;
monster->next_monster = nm;
} else {
if (get_input_line("wizard's password:", "", buf, sizeof(buf),
"", 0, 0)) {
- (void) xxx(1);
+ (void)xxx(1);
xxxx(buf, strlen(buf));
if (!strncmp(buf, "\247\104\126\272\115\243\027", 7)) {
wizard = 1;
nm = lmon->next_monster;
if (get_room_number(lmon->row, lmon->col) == cur_room) {
wake_up(lmon);
- (void) mon_damage(lmon, hp);
+ (void)mon_damage(lmon, hp);
}
lmon = nm;
}
} else {
if (monster) {
wake_up(monster);
- (void) mon_damage(monster, hp);
+ (void)mon_damage(monster, hp);
}
}
print_stats(STAT_HP);
wake_up(monster);
if (rand_percent(33)) {
- messagef(0, "the %s misses the %s", s,
+ messagef(0, "the %s misses the %s", s,
mon_name(monster));
goto ND;
}
}
messagef(0, "the %s hits the %s", s,
mon_name(monster));
- (void) mon_damage(monster, damage);
+ (void)mon_damage(monster, damage);
} else {
damage = -1;
if (!(monster->m_flags & FREEZES)) {
damage = -2;
}
if (damage != -1) {
- messagef(0, "the %s hits the %s", s,
+ messagef(0, "the %s hits the %s", s,
mon_name(monster));
- (void) mon_damage(monster, damage);
+ (void)mon_damage(monster, damage);
}
}
} else if ((row == rogue.row) && (col == rogue.col)) {
damage = (damage * 3) / 2;
damage -= get_armor_class(rogue.armor);
}
- rogue_damage(damage, (object *) 0,
+ rogue_damage(damage, (object *)0,
((ball == FIRE) ? KFIRE : HYPOTHERMIA));
messagef(0, "the %s hits", s);
}