sprintf (buf,
"You gain %d hit point%s, %d mana, %d move, and %d practice%s.\n\r",
add_hp+1, add_hp == 1 ? "" : "s", add_mana+1, add_move+1,
add_prac+1, add_prac == 1 ? "" : "s");
send_to_char (buf, ch);
}
# $Id $
# Makefile for Rom24. Works fine on my Debian system.
# You may need to use 'gmake' on BSD systems.
CC = gcc
RM = rm
EXE = rom
PROF = -O -ggdb
CYGWIN = -DCYGWIN
# Use these two lines to use crypt(), ie on Linux systems.
# C_FLAGS = $(PROF) -Wall
# L_FLAGS = $(PROF) -lcrypt
# Uncomment these two lines to use plaintext passwords.
# This is how you fix the 'crypt' linking errors!
C_FLAGS = -Wall $(PROF) -DNOCRYPT -DQMFIXES
L_FLAGS = $(PROF)
# Source Files
SRC_FILES := $(wildcard *.c)
# Object Files
OBJ_DIR = obj
OBJ_FILES := $(patsubst %.c,$(OBJ_DIR)/%.o,$(SRC_FILES))
rom: $(OBJ_FILES)
$(RM) -f $(EXE)
$(CC) $(L_FLAGS) -o $(EXE) $(OBJ_FILES)
$(OBJ_DIR)/%.o: %.c
$(CC) $(C_FLAGS) -c -o $@ $<
clean:
$(RM) -f $(OBJ_FILES) $(EXE) *~ *.bak *.orig *.rej
Wed Oct 29 05:42:27 2008 :: Loading Newtest.
Wed Oct 29 05:42:30 2008 :: Newtest@Comcrap has connected.
Wed Oct 29 05:44:01 2008 :: Newtest gained level 4!
Program received signal SIGSEGV, Segmentation fault.
room_is_dark (pRoomIndex=0x0) at handler.c:2540
2540 if (pRoomIndex->light > 0)
(gdb)
/*
* True if room is dark.
*/
bool room_is_dark (ROOM_INDEX_DATA * pRoomIndex)
{
if (pRoomIndex->light > 0)<<<<<——-this is the line it points to.
return FALSE;
if (IS_SET (pRoomIndex->room_flags, ROOM_DARK))
return TRUE;
if (pRoomIndex->sector_type == SECT_INSIDE
|| pRoomIndex->sector_type == SECT_CITY) return FALSE;
if (weather_info.sunlight == SUN_SET || weather_info.sunlight == SUN_DARK)
return TRUE;
return FALSE;
}
2636 return TRUE;
2637
2638 if (IS_AFFECTED (ch, AFF_BLIND))
2639 return FALSE;
2640
2641 if (room_is_dark (ch->in_room) && !IS_AFFECTED (ch, AFF_INFRARED))
2642 return FALSE;
2643
2644 if (IS_AFFECTED (victim, AFF_INVISIBLE)
2645 && !IS_AFFECTED (ch, AFF_DETECT_INVIS))
(gdb)
#2 0x00437562 in violence_update () at fight.c:102
102 if (can_see (victim, ch))
(gdb) list
97 chance = get_skill (ch, gsn_sword) / 15;
98
99 /*
100 * Penalty if the opponent can see.
101 */
102 if (can_see (victim, ch))
103 chance = chance * 3 / 5;
104
105 for (vch = ch->in_room->people; vch != N
ULL;
106 vch = vch->next_in_room)
#0 room_is_dark (pRoomIndex=0x0) at handler.c:2540
#1 0x0044307d in can_see (ch=0x12f41b8, victim=0x1386404) at handler.c:2641
#2 0x00437562 in violence_update () at fight.c:102
#3 0x00478537 in update_handler () at update.c:1199
#4 0x0042c332 in game_loop_unix (control=5) at comm.c:844
#5 0x0042bdc8 in main (argc=2, argv=0x11a19a0) at comm.c:448
(gdb)
(gdb) tb
Note: breakpoint 1 also set at pc 0x44307d.
Breakpoint 2 at 0x44307d: file handler.c, line 2641.
# 102 if (can_see (victim, ch))
# 103 chance = chance * 3 / 5;
if (rch != NULL && can_see (victim, ch))
the advance_level function is below
please help