From decwrl!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!rice!uw-beaver!zephyr.ens.tek.com!tekred!saab!billr Sat Mar 3 17:30:36 PST 1990 Article 816 of comp.sources.games: Path: decwrl!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!rice!uw-beaver!zephyr.ens.tek.com!tekred!saab!billr From: billr@saab.CNA.TEK.COM (Bill Randle) Newsgroups: comp.sources.games Subject: v08i097: castle - adventure game with character graphics, Part04/04, Part04/04 (REPOST) Message-ID: <5208@tekred.CNA.TEK.COM> Date: 23 Feb 90 17:02:44 GMT Sender: news@tekred.CNA.TEK.COM Lines: 950 Approved: billr@saab.CNA.TEK.COM Submitted-by: Ted Wisniewski Posting-number: Volume 8, Issue 96 Archive-name: castle/Part04 [The first posting of Part04 (v08i096) tried to include the file FILES/score, which was a binary file, thus screwing up the archive. Sorry 'bout that. -br] #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'FILES/cas_hours' <<'END_OF_FILE' X########################################################################## X# 1 AM 1 PM 1 <-- Operating Hours. # X# 2123456789012123456789012 # X#SUN:XXXXXXXXXXXXXXXXXXXXXXXX # X#MON:XXXXXXXXXXXXXXXXXXXXXXXX Game operating hours will be adjusted # X#TUE:XXXXXXXXXXXXXXXXXXXXXXXX during the semester, depending upon # X#WED:XXXXXXXXXXXXXXXXXXXXXXXX system usage. # X#THU:XXXXXXXXXXXXXXXXXXXXXXXX # X#FRI:XXXXXXXXXXXXXXXXXXXXXXXX # X#SAT:XXXXXXXXXXXXXXXXXXXXXXXX # X# (X==Open; .==Closed) # X########################################################################## X X X X X X X X X X END_OF_FILE if test 910 -ne `wc -c <'FILES/cas_hours'`; then echo shar: \"'FILES/cas_hours'\" unpacked with wrong size! fi # end of 'FILES/cas_hours' fi if test -f 'FILES/level_2' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'FILES/level_2'\" else echo shar: Extracting \"'FILES/level_2'\" \(1748 characters\) sed "s/^X//" >'FILES/level_2' <<'END_OF_FILE' X########################################################################### X# # # # # # # # # # # # X# ######### # # # # # # # # ###### # # # ### # # # # # ####### # X# # # ##### #### # #### ##### ## # # # # # # ## # X# ############# # # ! # # # # ### ########## # ## # X# # # # # # ##### ## ######### ##### # ### # # # #### ## # X# # # # # # # # ### # # # # # # ## ## # X############################^############ ####### ########## # ### ## ## # X# #% # - # ### # # # # # ## ## # X# ##### ### # # ^ -# ## # # ####### ### ### ####### # # #$# ## ## # X# # @ # # # ### # # ^ # #? $ ?# $=# # # # ## # X# < #$#=## ######## # # # ### ### ####### ####### ##### ###### # X##### ###/? # # ###### # # ^ # ## X# =# @ #- # # # # # ### ############ ######## ##### ###### # X## ## ########### ############### # # # ^ - # #!!!!! # # # # ### # X# #!## # # # =# #^>^$ !!!!!! # # # # # # # X# ###?# # ##### ######## ###### ######################### # # # # # ### X# ## ### # # # # # # # # # # # X# ##### # ## # # ## # ##### ####### ##### ########### ### # ## ## X### ####### # # # # # # # # # # # # # X# # # # # ### # ## # #### # ##### ####### ## ## ########### # # ### # X# ; ?# # # # # # # # # # X########################################################################### END_OF_FILE if test 1748 -ne `wc -c <'FILES/level_2'`; then echo shar: \"'FILES/level_2'\" unpacked with wrong size! fi # end of 'FILES/level_2' fi if test -f 'FILES/level_3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'FILES/level_3'\" else echo shar: Extracting \"'FILES/level_3'\" \(1748 characters\) sed "s/^X//" >'FILES/level_3' <<'END_OF_FILE' X########################################################################### X# ##### ########## # # ## # # ####$# X# # # # # # # # # # # ##### ### ###### ##### # # X# ### ### # ### #### # # ### ### ## # *# #### # X####### ##### #$ ######### # # # ## # # ### ####### ### # X## ####=#### # ## ? ## #### ## #### ### # # ### ## X#$ # #### & # ####### # # # ## # ## # # ## ### # X## # ####~#### ## # # ### # ## ## $ #### ###### ###### #### # # X#### ##### #$# ## @# # ## ## ### # # # ## ## @ # # # # # X# % ## ### ### # # ##### ## ## #### ####### ### # @ # X####? # 2### ### ########## ###### # # ### # # # ## ##### X# ###### ## ## ## ### # ###### # # ### #####> # *# X# ### ## ## ##### #######^# # #### # ### = ### # ## X# # # ## # ## # ### # # # # # ## ###### # ~ - #@# # X#=# # #<=# # # # -########## ###### # #### ###### # ####&#### ## # X########## ########### # # # # ## # ### # ## #$# ## @# X# # # # # # # ########## #### #*# # ## ### ### X#### #### #### ## ################# # ### ### ## X# *# #$ # # # ### # # ######### ######## ### ## ## ## X# ## ## # # ## ##### ######## # # # # # ## ## X# # # # # ##### # # # # # # # ### #### ##### ### #### # ## # ### X# # # ## # ##### ## # # # # # #$ # %# X########################################################################### END_OF_FILE if test 1748 -ne `wc -c <'FILES/level_3'`; then echo shar: \"'FILES/level_3'\" unpacked with wrong size! fi # end of 'FILES/level_3' fi if test -f 'FILES/level_4' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'FILES/level_4'\" else echo shar: Extracting \"'FILES/level_4'\" \(1748 characters\) sed "s/^X//" >'FILES/level_4' <<'END_OF_FILE' X########################################################################### X# # #=== -- - - - - !! ! ! # X# # ########### ### # ## #=== ^^^^ ^ ^^^^^! ! !!! ! # !# # # X# # # ################################# ! # # # X# ##### ################ # # ! # / /# X### ################################# # # # # # X# # ### ############### # # ! #% $ # # X# ####|# # # ############################# # # # # # # X# # =#^# # #### #### # # # # $ *# # ################## X# # ### # # # # # # ################ # % # # # X# #< # #/###### ## # #$# # #* $ ^# # ### ##### ###### # X# ## # # # # # # # ########################### # # # # # <# # X# - ###### #### # # # # # # # # # # ## # # X# ## # $ $ # # # # ############################### #?# ### # # # # X# # # ###### #### # # # # # # # # # X# #? # # # ################################### # # ### # ### # X# ##=#### ##### ## # # # # # # # # # X# ##### # # # # #########$####### ########## ##### # # ### # # ### # X# #=# # ###### # # # ########## #># # # # # # # # # X# # # # # #; $######### # # % # ? # # # #?# # ### # ># # X### ##### # ######## # # # # # ########## ### # # # # -# ##### # X# # # # #$# # ? # # $ # # X########################################################################### END_OF_FILE if test 1748 -ne `wc -c <'FILES/level_4'`; then echo shar: \"'FILES/level_4'\" unpacked with wrong size! fi # end of 'FILES/level_4' fi if test -f 'FILES/level_6' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'FILES/level_6'\" else echo shar: Extracting \"'FILES/level_6'\" \(1748 characters\) sed "s/^X//" >'FILES/level_6' <<'END_OF_FILE' X########################################################################### X########################################################################### X########################################################################### X########################################################################### X########################################################################### X########################################################################### X########################################################################### X########################################################################### X########################################################################### X########################################################################### X##############################% ? ? ? ? ###################### X############################## $ $ $ ###################### X############################## ###################### X######################################## ###################### X############################## ^ ^ ^ ###################### X######################################## ######## ######################### X############################## - ; # #$$$$$$# $###################### X############################## < $$$$$# #$$###################### X########################################################################### X########################################################################### X########################################################################### X########################################################################### X########################################################################### END_OF_FILE if test 1748 -ne `wc -c <'FILES/level_6'`; then echo shar: \"'FILES/level_6'\" unpacked with wrong size! fi # end of 'FILES/level_6' fi if test -f 'INCLUDE/windows.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'INCLUDE/windows.h'\" else echo shar: Extracting \"'INCLUDE/windows.h'\" \(95 characters\) sed "s/^X//" >'INCLUDE/windows.h' <<'END_OF_FILE' XWINDOW *view_win,*message_win,*stat_win,*debug_win; XWINDOW *compass_win,*inv_win,*command_win; END_OF_FILE if test 95 -ne `wc -c <'INCLUDE/windows.h'`; then echo shar: \"'INCLUDE/windows.h'\" unpacked with wrong size! fi # end of 'INCLUDE/windows.h' fi if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(878 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# Makefile for castle XFLAGS = -O XBIN = /usr/games XFILES = /usr/games/lib/castle X# X# define RANDOM if you have the bsd random() routines. Define LRAND48 X# if you have the SysV lrand48() X# X# This may look funny with a single " in the line below, but that's X# the way it must be. The closing " is part of the text in castle.h. X# XDEFINES = -DGAME_HOURS -DFILES=\"$(FILES) -DRANDOM XCFLAGS = ${FLAGS} ${DEFINES} X# Change this as necessary for SysV, etc. (e.g. -ltermlib) XLIBS = -lcurses -ltermcap XSOURCES = castle.c magic.c monster.c files.c store.c XOBJS = castle.o magic.o monster.o files.o store.o screens.o X Xcastle: $(OBJS) X ${CC} ${CFLAGS} -o castle ${OBJS} ${LIBS} X Xclean: X /bin/rm -f castle $(OBJS) X Xinstall: castle X /bin/strip castle X -mkdir $(FILES) X cp FILES/* $(FILES) X /bin/mv castle $(BIN) X /bin/chmod 4111 $(BIN)/castle X cp /dev/null $(FILES)/scores X END_OF_FILE if test 878 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'files.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'files.c'\" else echo shar: Extracting \"'files.c'\" \(15886 characters\) sed "s/^X//" >'files.c' <<'END_OF_FILE' X# include X# include X# include X# include X# include /* include for the time routines */ X# include /* include screen routines */ X X# include "INCLUDE/items.h" X# include "INCLUDE/castle.h" X X# define LF '\012' X/* X+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ X+ + X+ Included are The file routines: + X+ + X+ get_levels() Coordinates read of the dungeon levels. + X+ read_level() Reads the individual levels. + X+ help_me() Reads the help file and displays it on the screen. + X+ game_stat() Reads the hours file and determines if the game + X+ is open depending on the time. + X+ dis_open_scr() Displays the opening credits screen. + X+ score_list() Coordinates the score file routines. + X+ write_it() Writes updated information to the score file. + X+ read_it() Reads the old information from the score file. + X+ configure() Configures the information that is to be written + X+ to the score file, (Puts your name in the proper + X+ place in the score list). + X+ print_scores() Prints the scores if you just died or quit, after + X+ a game run. + X+ prn_scores() Prints score list if -s option is given at command line.+ X+ + X+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ X*/ X X/* X X This is a public domain program, I have no objection to modifications Xmade on it or use for some other reason so long as this notice remains intact. X X X Part of: castle Ted Wisniewski X Author: Plymouth State College X Plymouth NH, X 03264 X Copyright() PSC X*/ X Xchar files[20]; Xchar f_nam[80]; X Xget_levels() X{ X int lvl = 1; X X strcpy(files,D_LVL_1); X read_level(lvl); X lvl++; X strcpy(files,D_LVL_2); X read_level(lvl); X lvl++; X strcpy(files,D_LVL_3); X read_level(lvl); X lvl++; X strcpy(files,D_LVL_4); X read_level(lvl); X lvl++; X strcpy(files,D_LVL_5); X read_level(lvl); X lvl++; X strcpy(files,D_LVL_6); X read_level(lvl); X X} X Xread_level(lvl) Xint lvl; X{ X char buffer[2048]; X int filedes,numread,row,col,count; X X filedes = open(files,O_RDONLY); X numread = read(filedes,buffer,2048); X close(filedes); X X count = 0; X for(row=0;row<=23;row++){ X for(col=0;col<=75;col++){ X levels[lvl][row][col] = buffer[count]; X count++; X } X } X} X X Xhelp_me() X{ X int fd,nread; X int ctr,lines = 0; X char text[8192]; X X sprintf(f_nam,"%s",HELP); X fd = open(f_nam, O_RDONLY); X nread = read(fd,text,8192); X close(fd); X savetty(); X initscr(); X clear(); X for(ctr=0;ctrtm_hour; /* set variable to local->tm_hour*/ X day = local->tm_wday; /* set variable to local->tm_wday*/ X X (void) strcpy(f_nam,HOURS); X if((filedes = open(f_nam,O_RDONLY)) < 0){ X printf("Aborted Due to No Hours File <%s>.\n", f_nam); X exit(1); X } X X numread = read(filedes,buffer,2048); X close(filedes); X X X for(i=0;i<=numread;i++){ X if(buffer[i] == 10 || buffer[i] == 13){ X matrix[row][col] = buffer[i]; X row++; X col = 1; X } X else{ X matrix[row][col] = buffer[i]; X col++; X } X } X X if(matrix[day + 4][hour + 6] == 'X') X ; X else{ X savetty(); X initscr(); /* initialize screen */ X refresh(); X clear(); /* Clear the screen */ X for(i=0;i<=numread;i++) X printf("%c",buffer[i]); X endwin(); X resetty(); X exit(0); X } X} X Xdis_open_scr() X{ X char scr[2048]; X char screen[23][80]; X int fd,nr,ind; X X (void) strcpy(f_nam,OPEN_SCR); X if((fd = open(f_nam,O_RDONLY)) < 0){ X printf("No Opening screen file, Aborting."); X end_game(); X } X else X if((nr = read(fd,scr,2048)) < 1){ X printf("Nothing in Opening credit file."); X end_game(); X } X else{ X move(0,0); X for(ind=0;ind= in[inloc].score){ X out[outloc].score = tmp.score; X out[outloc].level = tmp.level; X strcpy(out[outloc].name, tmp.name); X strcpy(out[outloc].death_by,tmp.death_by); X outloc++; X out[outloc].score = in[inloc].score; X out[outloc].level = in[inloc].level; X strcpy(out[outloc].name,in[inloc].name); X strcpy(out[outloc].death_by,in[inloc].death_by); X outloc++; X inloc++; X tmp.score = -1; X } X else X if(tmp.score < in[inloc].score){ X out[outloc].score = in[inloc].score; X out[outloc].level = in[inloc].level; X strcpy(out[outloc].name,in[inloc].name); X strcpy(out[outloc].death_by,in[inloc].death_by); X outloc++; X inloc++; X } X else{ X out[outloc].score = tmp.score; X out[outloc].level = tmp.level; X strcpy(out[outloc].name, tmp.name); X strcpy(out[outloc].death_by,tmp.death_by); X outloc++; X } X } X while(outloc <= 19); X} X Xprint_scores() X{ X int ind = 0,finished = FALSE; X int start = 2; X X clear(); X move(0,0); X printw("Rank"); X move(0,5); X printw("Name"); X move(0,20); X printw("Score"); X move(0,30); X printw("Level"); X move(0,40); X printw("Killed by"); X move(1,0); X printw("-------------------------------------------------"); X do X { X if(out[ind].level == 0) X finished = TRUE; X else{ X move(start + ind,0); X printw("%d)",ind + 1); X move(start + ind,5); X printw("%s",out[ind].name); X move(start + ind,20); X printw("%d",out[ind].score); X move(start + ind,30); X printw("%d",out[ind].level); X move(start + ind,40); X printw("%s",out[ind].death_by); X ind++; X } X } X while(ind <= 19 && !finished); X move(23,0); X printw("Press any key to Continue."); X refresh(); X getch(); X move(23,0); X clrtoeol(); X} X Xprn_scores() X{ X int ind = 0,finished = FALSE; X int start = 2; X X initscr(); X clear(); X if(read_it() > 0){ X move(0,0); X printw("Rank"); X move(0,5); X printw("Name"); X move(0,20); X printw("Score"); X move(0,30); X printw("Level"); X move(0,40); X printw("Killed by"); X move(1,0); X printw("-------------------------------------------------"); X do X { X if(in[ind].level == 0) X finished = TRUE; X else{ X move(start + ind,0); X printw("%d)",ind + 1); X move(start + ind,5); X printw("%s",in[ind].name); X move(start + ind,20); X printw("%d",in[ind].score); X move(start + ind,30); X printw("%d",in[ind].level); X move(start + ind,40); X printw("%s",in[ind].death_by); X ind++; X } X } X while(ind <= 19 && !finished); X move(23,0); X printw("Press any key to Continue."); X refresh(); X getch(); X clear(); X } X end_game(); X} X X Xsave() X{ X FILE *fp; X int nwrite,ct,fd,i; X char savfil[50]; X int inv_rec[16]; X X for(i=0;i<=15;i++) X inv_rec[i] = -1; X posi.row = p->row; X posi.col = p->col; X posi.level = p->level; X posi.face = p->face; X posi.screen = p->screen; X posi.compass_on = p->compass_on; X posi.move_count = p->move_count; X temp = firstnode; X i = 1; X do X { X inv_rec[i] = temp->item_no; X i++; X temp = temp->next; X } X while(temp->next != NULL); X inv_rec[0] = i; X if(temp->next == NULL) X inv_rec[i] = temp->item_no; X save_inven(); X X sprintf(savfil,"%s%s",SAVE_DIR,user.acct); X if((fp = fopen(savfil,"w")) == (FILE *)NULL){ X fprintf(stderr,"Cannot open a savefile for you.\n"); X if((fd = creat(savfil,0777)) < 0){ X printw("Cannot create the Save file."); X refresh(); X } X } X clear(); X refresh(); X if(fwrite((char *)&char_stats, sizeof(char_stats),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)&posi, sizeof(posi),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)levels, sizeof(levels),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)&ct_compass, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)&ct_dtrap, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)&showit, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)&detect, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)&d_val, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)&d_mod, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)&which_one, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)&mon_faced, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)known, sizeof(known),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)lvl_att, sizeof(lvl_att),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)inv_rec, sizeof(inv_rec),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fwrite((char *)s_inven, sizeof(s_inven),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X X fclose(fp); X printw("Saving!"); X refresh(); X sleep(2); X end_game(); X} X Xrecover() X{ X FILE *fp; X int nwrite,ct,fd,i; X char savfil[50]; X int inv_rec[16]; X struct stat st_buff; X X sprintf(savfil,"%s%s",SAVE_DIR,user.acct); X if((fp = fopen(savfil,"r")) == (FILE *)NULL){ X fprintf(stderr,"Sorry you don\'t have a saved game.\n"); X end_game(); X } X if(fread((char *)&char_stats, sizeof(char_stats),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)&posi, sizeof(posi),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)levels, sizeof(levels),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)&ct_compass, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)&ct_dtrap, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)&showit, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)&detect, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)&d_val, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)&d_mod, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)&which_one, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)&mon_faced, sizeof(int),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)known, sizeof(known),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)lvl_att, sizeof(lvl_att),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)inv_rec, sizeof(inv_rec),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X if(fread((char *)s_inven, sizeof(s_inven),1,fp) != 1){ X fprintf(stderr,"Cannot write to file."); X } X X fclose(fp); X if(stat(savfil,&st_buff) < 0) X fprintf(stderr,"ERROR: Could not stat file.\n"); X else X if(unlink(savfil) < 0) X fprintf(stderr,"ERROR: %s Not Removed.\n",savfil); X X p->row = posi.row; X p->col = posi.col; X p->level = posi.level; X p->face = posi.face; X p->screen = posi.screen; X p->compass_on = posi.compass_on; X p->move_count = posi.move_count; X char_stats.ac = 0; X d_val = 3; X d_mod = 1; X X/* oldnode = (list *) malloc(sizeof(list)); X firstnode = oldnode; */ X init_list(); X X for(i=1;i<=inv_rec[0];i++) X add_item(inv_rec[i]); X oldnode = firstnode; X firstnode = oldnode->next; X oldnode->next->prev = NULL; X oldnode->next = NULL; X temp = firstnode; X X i = 0; X do{ X temp->item_type = s_inven[i].item_type; X temp->armor_val = s_inven[i].armor_val; X temp->dam_val = s_inven[i].dam_val; X temp->dam_mod = s_inven[i].dam_mod; X temp->item_no = s_inven[i].item_no; X temp->special = s_inven[i].special; X temp->used = s_inven[i].used; X if(temp->used == TRUE) X switch (temp->item_type){ X case 1: char_stats.ac += temp->armor_val; X break; X case 2: char_stats.ac += temp->armor_val; X break; X case 3: char_stats.ac += temp->armor_val; X break; X case 4: char_stats.ac += temp->armor_val; X break; X case 5: char_stats.ac += temp->armor_val; X break; X case 6: d_val = temp->dam_val; X d_mod = temp->dam_mod; X break; X default : break; X } X i++; X temp = temp->next; X if(temp->next == NULL){ X temp->item_type = s_inven[i].item_type; X temp->armor_val = s_inven[i].armor_val; X temp->dam_val = s_inven[i].dam_val; X temp->dam_mod = s_inven[i].dam_mod; X temp->item_no = s_inven[i].item_no; X temp->special = s_inven[i].special; X temp->used = s_inven[i].used; X if(temp->used == TRUE) X switch (temp->item_type){ X case 1: char_stats.ac += temp->armor_val; X break; X case 2: char_stats.ac += temp->armor_val; X break; X case 3: char_stats.ac += temp->armor_val; X break; X case 4: char_stats.ac += temp->armor_val; X break; X case 5: char_stats.ac += temp->armor_val; X break; X case 6: d_val = temp->dam_val; X d_mod = temp->dam_mod; X break; X default : break; X } X } X }while(temp->next != NULL); X} X Xsave_inven() X{ X int i = 0; X temp = firstnode; X X do{ X (void) strcpy(s_inven[i].item,temp->item); X s_inven[i].item_type = temp->item_type; X s_inven[i].armor_val = temp->armor_val; X s_inven[i].dam_val = temp->dam_val; X s_inven[i].dam_mod = temp->dam_mod; X s_inven[i].item_no = temp->item_no; X s_inven[i].special = temp->special; X s_inven[i].used = temp->used; X i++; X temp = temp->next; X if(temp->next == NULL){ X (void) strcpy(s_inven[i].item,temp->item); X s_inven[i].item_type = temp->item_type; X s_inven[i].armor_val = temp->armor_val; X s_inven[i].dam_val = temp->dam_val; X s_inven[i].dam_mod = temp->dam_mod; X s_inven[i].item_no = temp->item_no; X s_inven[i].special = temp->special; X s_inven[i].used = temp->used; X } X }while(temp->next != NULL && i != 15); X} X X Xmail_help() X{ X} END_OF_FILE if test 15886 -ne `wc -c <'files.c'`; then echo shar: \"'files.c'\" unpacked with wrong size! fi # end of 'files.c' fi echo shar: End of archive 4 \(of 4\). cp /dev/null ark4isdone MISSING="" for I in 1 2 3 4 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 4 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0