Only in mangband-014: ChangeLog diff -w -r -c mangband-013/README mangband-014/README *** mangband-013/README Mon Mar 24 08:51:27 1997 --- mangband-014/README Sun Apr 20 17:00:07 1997 *************** *** 1,20 **** ! This is the README file for MAngband 0.1.1 (3/23/97) ! MAngband 0.1.0 is an unstable release that is meant for testing purposes ! only. Any bugs found in MAngband 0.1.1 will be fixed in MAngband 0.1.2, the next public release. ! Send all bug reports to keldon@umr.edu. Please remember to check the Bugs ! Page though, to avoid sending bug reports that I already know about. ! MAngband 0.1.1 isn't yet to a point where every feature that you've come to enjoy in Angband works. Things that don't work (that are hard to live without) are: * No targetting/looking * No stores ! * No mini-map (well, this might work, check the version you download) ! # No macros ! * A few other commands These are things that are new or that you should watch out for: * The ':' command sends a message to everyone else in the game --- 1,19 ---- ! This is the README file for MAngband 0.1.4 (4/20/97) ! MAngband 0.1.3 is an unstable release that is meant for testing purposes ! only. Any bugs found in MAngband 0.1.4 will be fixed in MAngband 0.2.0, the next public release. ! Send all bug reports to the mailing list at mangband@keldon.student.umr.edu. ! Please remember to check the Bugs Page though, to avoid sending bug reports ! that I already know about. ! MAngband 0.1.4 isn't yet to a point where every feature that you've come to enjoy in Angband works. Things that don't work (that are hard to live without) are: * No targetting/looking * No stores ! * A few other commands (fire, throw, inscribe, uninscribe...) These are things that are new or that you should watch out for: * The ':' command sends a message to everyone else in the game *************** *** 22,32 **** you can wait and watch your target as it moves. * The only key to stop a run is one of the walk direction keys. * If you are looking at your inven/equip, the screen isn't updated, ! so you could be getting attacked without you're knowledge. * I find it much easier to get somewhere with a warrior than with a mage/priest/etc. * Changing levels always puts you near an up staircase. * You cannot affect other players yet. I will keep a server running as much as possible on my machine. It's name --- 21,34 ---- you can wait and watch your target as it moves. * The only key to stop a run is one of the walk direction keys. * If you are looking at your inven/equip, the screen isn't updated, ! so you could be getting attacked without your knowledge. * I find it much easier to get somewhere with a warrior than with a mage/priest/etc. * Changing levels always puts you near an up staircase. * You cannot affect other players yet. + * Macros/keymaps/options/visual info can only be set using the "pref + files". After doing so, you must restart your client for the changes + to take effect. I will keep a server running as much as possible on my machine. It's name *************** *** 36,55 **** Every server reports to a metaserver running at MIT. To ask questions about it, send mail to hao@mit.edu. To see a list of servers running and the ! number of people playing on each of them, telnet to jello.mit.edu at port ! 8801 (for example, type "telnet jello.mit.edu 8801"). It should give you a list of servers with number of people on each. Visit the MAngband Home Page "http://www.umr.edu/~keldon/mangband" for more information about recent changes and improvements. Make sure to edit the .mangrc file to set your race/class/sex/name. If you don't, you'll default to a Male Human Warrior named My Name. Also, make sure that your .mangrc file is in your home directory. If you are only going to use the client, the "lib" directories do not need ! to be installed anywhere. The only auxiliary file the client uses is ! the ".mangrc" file, which must be present in the current directory. If you are going to run a server, the "lib" directories must be installed in the location pointed to in "config.h" and must be readable/writable by --- 38,61 ---- Every server reports to a metaserver running at MIT. To ask questions about it, send mail to hao@mit.edu. To see a list of servers running and the ! number of people playing on each of them, telnet to mangband.mit.edu at port ! 8801 (for example, type "telnet mangband.mit.edu 8801"). It should give you a list of servers with number of people on each. Visit the MAngband Home Page "http://www.umr.edu/~keldon/mangband" for more information about recent changes and improvements. + There are MAngband binaries of the server and client at mangband.mit.edu. + Make sure that you download everything you need (read the README's in the + correct directories). + Make sure to edit the .mangrc file to set your race/class/sex/name. If you don't, you'll default to a Male Human Warrior named My Name. Also, make sure that your .mangrc file is in your home directory. If you are only going to use the client, the "lib" directories do not need ! to be installed anywhere. However, to use the "pref files", you must install ! the "lib/user" directory correctly. If you are going to run a server, the "lib" directories must be installed in the location pointed to in "config.h" and must be readable/writable by *************** *** 56,62 **** the owner of the server process. By default, the Makefile will only build a client. If you want to build a ! server, remove the hash in the "install" target. --- 62,68 ---- the owner of the server process. By default, the Makefile will only build a client. If you want to build a ! server, remove the hashes in the "install" target. *************** *** 243,249 **** The savefiles should be portable between systems, assuming that the appropriate renaming is perfomed, and any file "type" information is ! specified (for the Macintosh). === Directory "lib/user" === --- 249,258 ---- The savefiles should be portable between systems, assuming that the appropriate renaming is perfomed, and any file "type" information is ! specified (for the Macintosh). However, I must really recommend ! against copying savefiles from one server to another, because this ! could cause problems about having multiple artifacts on one server, ! etc. Don't do it. === Directory "lib/user" === *************** *** 256,263 **** affect how the game will handle various situations), and specify visual mappings for various monsters, objects, or terrain features. ! Many of these files are not read by the server, and none are currently ! read by client, but they really should be. See "files.c" for more information on the proper "format" of these files. --- 265,272 ---- affect how the game will handle various situations), and specify visual mappings for various monsters, objects, or terrain features. ! Many of these files are not read by the server, but most are read by ! the client. See "files.c" for more information on the proper "format" of these files. Common subdirectories: mangband-013/lib and mangband-014/lib diff -w -r -c mangband-013/mangrc mangband-014/mangrc *** mangband-013/mangrc Sun Mar 23 15:58:20 1997 --- mangband-014/mangrc Fri Apr 11 21:35:50 1997 *************** *** 4,10 **** # These lines MUST begin on column one ! # Pick a name nick MY NAME --- 4,11 ---- # These lines MUST begin on column one ! # Pick a name. Spaces are allowed. The name should be no longer than 15 ! # characters and shouldn't contain any "special" characters. nick MY NAME Common subdirectories: mangband-013/src and mangband-014/src Common subdirectories: mangband-013/lib/apex and mangband-014/lib/apex Common subdirectories: mangband-013/lib/bone and mangband-014/lib/bone Common subdirectories: mangband-013/lib/data and mangband-014/lib/data Common subdirectories: mangband-013/lib/edit and mangband-014/lib/edit Common subdirectories: mangband-013/lib/file and mangband-014/lib/file Common subdirectories: mangband-013/lib/help and mangband-014/lib/help Common subdirectories: mangband-013/lib/info and mangband-014/lib/info Common subdirectories: mangband-013/lib/save and mangband-014/lib/save Common subdirectories: mangband-013/lib/user and mangband-014/lib/user Common subdirectories: mangband-013/lib/xtra and mangband-014/lib/xtra diff -w -r -c mangband-013/lib/edit/a_info.txt mangband-014/lib/edit/a_info.txt *** mangband-013/lib/edit/a_info.txt Mon Mar 24 08:51:56 1997 --- mangband-014/lib/edit/a_info.txt Wed Apr 16 22:48:03 1997 *************** *** 21,27 **** # Version stamp (required) ! V:0.1.1 --- 21,27 ---- # Version stamp (required) ! V:0.1.4 diff -w -r -c mangband-013/lib/edit/e_info.txt mangband-014/lib/edit/e_info.txt *** mangband-013/lib/edit/e_info.txt Mon Mar 24 08:52:01 1997 --- mangband-014/lib/edit/e_info.txt Wed Apr 16 22:48:08 1997 *************** *** 22,28 **** # Version stamp (required) ! V:0.1.1 ### Body Armor ### --- 22,28 ---- # Version stamp (required) ! V:0.1.4 ### Body Armor ### diff -w -r -c mangband-013/lib/edit/f_info.txt mangband-014/lib/edit/f_info.txt *** mangband-013/lib/edit/f_info.txt Mon Mar 24 08:52:05 1997 --- mangband-014/lib/edit/f_info.txt Wed Apr 16 22:48:13 1997 *************** *** 17,23 **** # Version stamp (required) ! V:0.1.1 # 0x00 --> nothing --- 17,23 ---- # Version stamp (required) ! V:0.1.4 # 0x00 --> nothing diff -w -r -c mangband-013/lib/edit/k_info.txt mangband-014/lib/edit/k_info.txt *** mangband-013/lib/edit/k_info.txt Mon Mar 24 08:52:11 1997 --- mangband-014/lib/edit/k_info.txt Wed Apr 16 22:48:18 1997 *************** *** 24,30 **** # Version stamp (required) ! V:0.1.1 ##### Something special ##### --- 24,30 ---- # Version stamp (required) ! V:0.1.4 ##### Something special ##### diff -w -r -c mangband-013/lib/edit/r_info.txt mangband-014/lib/edit/r_info.txt *** mangband-013/lib/edit/r_info.txt Mon Mar 24 08:52:19 1997 --- mangband-014/lib/edit/r_info.txt Wed Apr 16 22:48:26 1997 *************** *** 109,115 **** # Version stamp (required) ! V:0.1.1 ##### The Player ##### --- 109,115 ---- # Version stamp (required) ! V:0.1.4 ##### The Player ##### diff -w -r -c mangband-013/lib/edit/v_info.txt mangband-014/lib/edit/v_info.txt *** mangband-013/lib/edit/v_info.txt Mon Mar 24 08:52:28 1997 --- mangband-014/lib/edit/v_info.txt Wed Apr 16 22:48:32 1997 *************** *** 14,20 **** # Version stamp (required) ! V:0.1.1 ### Simple Vaults (type 7) -- maximum size 44x22 ### --- 14,20 ---- # Version stamp (required) ! V:0.1.4 ### Simple Vaults (type 7) -- maximum size 44x22 ### diff -w -r -c mangband-013/lib/file/news.txt mangband-014/lib/file/news.txt *** mangband-013/lib/file/news.txt Fri Mar 14 16:11:19 1997 --- mangband-014/lib/file/news.txt Wed Apr 16 22:49:53 1997 *************** *** 1,7 **** ********************** ! ** MAngband 0.1.0 ** ********************** Based on Moria: Copyright (c) 1985 Robert Alan Koeneke --- 1,7 ---- ********************** ! ** MAngband 0.1.4 ** ********************** Based on Moria: Copyright (c) 1985 Robert Alan Koeneke *************** *** 17,23 **** MAngband 0.1 - ??: Keldon Jones (keldon@umr.edu) ! MAngband 0.1.0 is only available for Unix/Linux and other Unix-ish machines. Visit the MAngband Home Page at "http://www.umr.edu/~keldon/mangband/". Send all comments, bug reports, patches, etc, to "keldon@umr.edu". --- 17,24 ---- MAngband 0.1 - ??: Keldon Jones (keldon@umr.edu) ! MAngband 0.1.4 is only available for Unix/Linux and other Unix-ish machines, ! though a DOS port is coming along and may be available very soon. Visit the MAngband Home Page at "http://www.umr.edu/~keldon/mangband/". Send all comments, bug reports, patches, etc, to "keldon@umr.edu". Only in mangband-013/lib/save: Rebyc Only in mangband-014/lib/user: options.prf diff -w -r -c mangband-013/lib/user/pref.prf mangband-014/lib/user/pref.prf *** mangband-013/lib/user/pref.prf Fri Mar 14 15:08:29 1997 --- mangband-014/lib/user/pref.prf Sun Apr 20 16:49:09 1997 *************** *** 25,32 **** --- 25,35 ---- # See "lib/help/command.txt" and "src/files.c" for more info. # + # Include the "option.prf" file, which sets all the options + %:options.prf + ## OPTION: Display "veins" (white "%") as "normal walls" (white "#") ## This replaces the old method of setting "notice_seams" to false, ## which no longer works as of Angband 2.7.9, for various reasons. *************** *** 43,46 **** --- 46,50 ---- A:w0 C:X + diff -w -r -c mangband-013/src/Makefile mangband-014/src/Makefile *** mangband-013/src/Makefile Sun Mar 23 17:32:33 1997 --- mangband-014/src/Makefile Thu Apr 3 17:56:19 1997 *************** *** 48,54 **** SERV_SRCS = \ common/z-util.c common/z-virt.c common/z-form.c common/z-rand.c \ ! common/socklib.c common/net.c \ server/variable.c server/tables.c server/util.c server/cave.c \ server/object1.c server/object2.c server/monster1.c server/monster2.c \ server/xtra1.c server/xtra2.c server/spells1.c server/spells2.c \ --- 48,54 ---- SERV_SRCS = \ common/z-util.c common/z-virt.c common/z-form.c common/z-rand.c \ ! common/net-unix.c common/sockbuf.c \ server/variable.c server/tables.c server/util.c server/cave.c \ server/object1.c server/object2.c server/monster1.c server/monster2.c \ server/xtra1.c server/xtra2.c server/spells1.c server/spells2.c \ *************** *** 60,66 **** SERV_OBJS = \ common/z-util.o common/z-virt.o common/z-form.o common/z-rand.o \ ! common/socklib.o common/net.o \ server/variable.o server/tables.o server/util.o server/cave.o \ server/object1.o server/object2.o server/monster1.o server/monster2.o \ server/xtra1.o server/xtra2.o server/spells1.o server/spells2.o \ --- 60,66 ---- SERV_OBJS = \ common/z-util.o common/z-virt.o common/z-form.o common/z-rand.o \ ! common/net-unix.o common/sockbuf.o \ server/variable.o server/tables.o server/util.o server/cave.o \ server/object1.o server/object2.o server/monster1.o server/monster2.o \ server/xtra1.o server/xtra2.o server/spells1.o server/spells2.o \ *************** *** 73,91 **** CLI_SRCS = \ common/z-util.c common/z-virt.c common/z-form.c common/z-rand.c \ ! common/socklib.c common/net.c \ client/z-term.c client/c-util.c client/c-cmd.c client/c-inven.c \ ! client/variable.c client/main-cap.c client/main-gcu.c \ client/main-x11.c client/main-xaw.c client/netclient.c \ ! client/c-xtra1.c client/c-spell.c client/client.c CLI_OBJS = \ common/z-util.o common/z-virt.o common/z-form.o common/z-rand.o \ ! common/socklib.o common/net.o \ client/z-term.o client/c-util.o client/c-cmd.o client/c-inven.o \ ! client/variable.o client/main-cap.o client/main-gcu.o \ client/main-x11.o client/main-xaw.o client/netclient.o \ ! client/c-xtra1.o client/c-spell.o client/client.o --- 73,93 ---- CLI_SRCS = \ common/z-util.c common/z-virt.c common/z-form.c common/z-rand.c \ ! common/net-unix.c common/sockbuf.c common/net-ibm.c \ client/z-term.c client/c-util.c client/c-cmd.c client/c-inven.c \ ! client/c-files.c client/c-tables.c \ ! client/variable.c client/main-ibm.c client/main-cap.c client/main-gcu.c \ client/main-x11.c client/main-xaw.c client/netclient.c \ ! client/c-xtra1.c client/c-xtra2.c client/c-spell.c client/client.c CLI_OBJS = \ common/z-util.o common/z-virt.o common/z-form.o common/z-rand.o \ ! common/net-unix.o common/sockbuf.o common/net-ibm.o \ client/z-term.o client/c-util.o client/c-cmd.o client/c-inven.o \ ! client/c-files.o client/c-tables.o \ ! client/variable.o client/main-ibm.o client/main-cap.o client/main-gcu.o \ client/main-x11.o client/main-xaw.o client/netclient.o \ ! client/c-xtra1.o client/c-xtra2.o client/c-spell.o client/client.o *************** *** 196,203 **** ## ## Variation -- compile for Solaris ## ! #CFLAGS = -Wall -O1 -pipe -g -D"USE_X11" -D"USE_GCU" -D"SOLARIS" ! #LIBS = -lX11 -lsocket -lcurses ## --- 198,205 ---- ## ## Variation -- compile for Solaris ## ! #CFLAGS = -Wall -O1 -pipe -g -D"USE_X11" -D"USE_GCU" -D"SOLARIS" -I/usr/openwin/include ! #LIBS = -L/usr/openwin/lib -lX11 -lsocket -lnsl -lcurses ## *************** *** 231,237 **** --- 233,245 ---- #LIBS = -lcurses -ltermcap + ## + ## Variation -- Support for DJGPP with TCPLIB + ## + #CFLAGS = -Wall -O2 -g -D"USE_IBM" -DMSDOS + #LIBS = -ltcp + # # Hack -- "install" as the base target # Common subdirectories: mangband-013/src/client and mangband-014/src/client Common subdirectories: mangband-013/src/common and mangband-014/src/common Common subdirectories: mangband-013/src/server and mangband-014/src/server Only in mangband-013/src/client: .mangrc diff -w -r -c mangband-013/src/client/c-cmd.c mangband-014/src/client/c-cmd.c *** mangband-013/src/client/c-cmd.c Sat Mar 22 18:37:26 1997 --- mangband-014/src/client/c-cmd.c Sat Apr 19 23:17:20 1997 *************** *** 2,7 **** --- 2,263 ---- /* Handle all commands */ + void process_command() + { + /* Parse the command */ + switch (command_cmd) + { + /* Ignore */ + case ESCAPE: + case ' ': + { + break; + } + + /* Ignore return */ + case '\r': + { + break; + } + + /*** Movement Commands ***/ + + /* Dig a tunnel*/ + case '+': + { + cmd_tunnel(); + break; + } + + /* Move */ + case ';': + { + cmd_walk(); + break; + } + + /*** Running, Staying ***/ + case '.': + { + cmd_run(); + break; + } + + case ',': + case 'g': + { + cmd_stay(); + break; + } + + /* Get the mini-map */ + case 'M': + { + cmd_map(); + break; + } + + /* Search */ + case 's': + { + cmd_search(); + break; + } + + /* Toggle Search Mode */ + case 'S': + { + cmd_toggle_search(); + break; + } + + /*** Stairs and doors and chests ***/ + + /* Go up */ + case '<': + { + cmd_go_up(); + break; + } + + /* Go down */ + case '>': + { + cmd_go_down(); + break; + } + + /* Open a door */ + case 'o': + { + cmd_open(); + break; + } + + /* Close a door */ + case 'c': + { + cmd_close(); + break; + } + + /* Bash a door */ + case 'B': + { + cmd_bash(); + break; + } + + /* Disarm a trap or chest */ + case 'D': + { + cmd_disarm(); + break; + } + + /*** Inventory commands ***/ + case 'i': + { + cmd_inven(); + break; + } + + case 'e': + { + cmd_equip(); + break; + } + + case 'd': + { + cmd_drop(); + break; + } + + case 'w': + { + cmd_wield(); + break; + } + + case 't': + { + cmd_take_off(); + break; + } + + case 'k': + { + cmd_destroy(); + break; + } + + /*** Inventory "usage" commands ***/ + case 'q': + { + cmd_quaff(); + break; + } + + case 'r': + { + cmd_read_scroll(); + break; + } + + case 'a': + { + cmd_aim_wand(); + break; + } + + case 'u': + { + cmd_use_staff(); + break; + } + + case 'z': + { + cmd_zap_rod(); + break; + } + + case 'F': + { + cmd_refill(); + break; + } + + case 'E': + { + cmd_eat(); + break; + } + + case 'A': + { + cmd_activate(); + break; + } + + /*** Spell casting ***/ + case 'b': + { + cmd_browse(); + break; + } + + case 'G': + { + cmd_study(); + break; + } + + case 'm': + { + cmd_cast(); + break; + } + + case 'p': + { + cmd_pray(); + break; + } + + /*** Miscellaneous ***/ + case ':': + { + cmd_message(); + break; + } + + case KTRL('P'): + { + do_cmd_messages(); + break; + } + + case KTRL('X'): + { + Net_cleanup(); + quit(NULL); + } + + default: + { + prt("That command is unsupported (for now).", 0, 0); + break; + } + } + } + + + + + + void cmd_tunnel(void) { int dir = command_dir; *************** *** 43,48 **** --- 299,331 ---- Send_stay(); } + void cmd_map(void) + { + /* Hack -- if the screen is already icky, ignore this command */ + if (screen_icky) return; + + /* The screen is icky */ + screen_icky = TRUE; + + /* Save the screen */ + Term_save(); + + /* Send the request */ + Send_map(); + + /* Wait */ + inkey(); + + /* Reload the screen */ + Term_load(); + + /* The screen is OK now */ + screen_icky = FALSE; + + /* Flush any queued events */ + Flush_queue(); + } + void cmd_search(void) { Send_search(); *************** *** 207,212 **** --- 490,523 ---- Send_take_off(item); } + + void cmd_destroy(void) + { + int item, amt; + char out_val[160]; + + if (!c_get_item(&item, "Destroy what? ", TRUE, TRUE, FALSE)) + { + return; + } + + /* Get an amount */ + if (inventory[item].number > 1) + { + amt = c_get_quantity("How many? ", inventory[item].number); + } + else amt = 1; + + /* Sanity check */ + sprintf(out_val, "Really destroy %s? ", inventory_name[item]); + if (!get_check(out_val)) return; + + /* Send it */ + Send_destroy(item, amt); + } + + + void cmd_quaff(void) { int item; *************** *** 309,315 **** } #endif - item_tester_tval = TV_LITE; p = "Refill with which light? "; if (!c_get_item(&item, p, FALSE, TRUE, FALSE)) --- 620,625 ---- *************** *** 336,341 **** --- 646,665 ---- Send_eat(item); } + void cmd_activate(void) + { + int item; + + if (!c_get_item(&item, "Activate what? ", TRUE, FALSE, FALSE)) + { + return; + } + + /* Send it */ + Send_activate(item); + } + + void cmd_message(void) { char buf[60]; Only in mangband-014/src/client: c-files.c Only in mangband-014/src/client: c-tables.c diff -w -r -c mangband-013/src/client/c-util.c mangband-014/src/client/c-util.c *** mangband-013/src/client/c-util.c Mon Mar 24 03:21:21 1997 --- mangband-014/src/client/c-util.c Thu Apr 3 21:01:21 1997 *************** *** 10,20 **** --- 10,27 ---- static bool parse_slash = FALSE; static bool strip_chars = FALSE; + static bool flush_later = FALSE; + static byte macro__use[256]; bool msg_flag; + void flush(void) + { + flush_later = TRUE; + } + /* * Check for possibly pending macros */ *************** *** 74,79 **** --- 81,143 ---- /* + * Hack -- add a macro definition (or redefinition). + * + * If "cmd_flag" is set then this macro is only active when + * the user is being asked for a command (see below). + */ + void macro_add(cptr pat, cptr act, bool cmd_flag) + { + int n; + + + /* Paranoia -- require data */ + if (!pat || !act) return; + + + /* Look for a re-usable slot */ + for (n = 0; n < macro__num; n++) + { + /* Notice macro redefinition */ + if (streq(macro__pat[n], pat)) + { + /* Free the old macro action */ + string_free(macro__act[n]); + + /* Save the macro action */ + macro__act[n] = string_make(act); + + /* Save the "cmd_flag" */ + macro__cmd[n] = cmd_flag; + + /* All done */ + return; + } + } + + + /* Save the pattern */ + macro__pat[macro__num] = string_make(pat); + + /* Save the macro action */ + macro__act[macro__num] = string_make(act); + + /* Save the "cmd_flag" */ + macro__cmd[macro__num] = cmd_flag; + + /* One more macro */ + macro__num++; + + + /* Hack -- Note the "trigger" char */ + macro__use[(byte)(pat[0])] |= MACRO_USE_STD; + + /* Hack -- Note the "trigger" char of command macros */ + if (cmd_flag) macro__use[(byte)(pat[0])] |= MACRO_USE_CMD; + } + + + /* * Helper function called only from "inkey()" * * This function does most of the "macro" processing. *************** *** 109,116 **** /* Wait for keypress, while also checking for net input */ do { ! struct timeval tv; ! int n, result, rfds; /* Look for a keypress */ (void)(Term_inkey(&ch, FALSE, TRUE)); --- 173,179 ---- /* Wait for keypress, while also checking for net input */ do { ! int result, net_fd; /* Look for a keypress */ (void)(Term_inkey(&ch, FALSE, TRUE)); *************** *** 119,144 **** if (ch) break; /* Wait for .01 sec, or until there is net input */ ! tv.tv_sec = 0; ! tv.tv_usec = 10000; ! /* Setup the file descriptor set */ ! rfds = (1 << Net_fd()); - /* Wait */ - if ((n = select(Net_fd() + 1, &rfds, NULL, NULL, &tv)) == -1) - { - if (errno == EINTR) - continue; - quit("Select failed"); - } - /* Parse net input if we got any */ ! if (rfds) { if ((result = Net_input()) == -1) { ! quit(""); } /* Flush the network output buffer */ --- 182,198 ---- if (ch) break; /* Wait for .01 sec, or until there is net input */ ! SetTimeout(0, 10000); ! /* Save the maximum file descriptor number */ ! net_fd = Net_fd(); /* Parse net input if we got any */ ! if (SocketReadable(net_fd)) { if ((result = Net_input()) == -1) { ! quit(NULL); } /* Flush the network output buffer */ *************** *** 356,361 **** --- 410,435 ---- int skipping = FALSE; + /* Hack -- handle delayed "flush()" */ + if (flush_later) + { + /* Done */ + flush_later = FALSE; + + /* Cancel "macro" info */ + parse_macro = after_macro = FALSE; + + /* Cancel "sequence" info */ + parse_under = parse_slash = FALSE; + + /* Cancel "strip" mode */ + strip_chars = FALSE; + + /* Forget old keypresses */ + /*Term_flush();*/ + } + + /* Access cursor state */ (void)Term_get_cursor(&v); *************** *** 562,568 **** --- 636,749 ---- static int hack_dir = 0; + /* + * Convert a "Rogue" keypress into an "Angband" keypress + * Pass extra information as needed via "hack_dir" + * + * Note that many "Rogue" keypresses encode a direction. + */ + static char roguelike_commands(char command) + { + /* Process the command */ + switch (command) + { + /* Movement (rogue keys) */ + case 'b': hack_dir = 1; return (';'); + case 'j': hack_dir = 2; return (';'); + case 'n': hack_dir = 3; return (';'); + case 'h': hack_dir = 4; return (';'); + case 'l': hack_dir = 6; return (';'); + case 'y': hack_dir = 7; return (';'); + case 'k': hack_dir = 8; return (';'); + case 'u': hack_dir = 9; return (';'); + /* Running (shift + rogue keys) */ + case 'B': hack_dir = 1; return ('.'); + case 'J': hack_dir = 2; return ('.'); + case 'N': hack_dir = 3; return ('.'); + case 'H': hack_dir = 4; return ('.'); + case 'L': hack_dir = 6; return ('.'); + case 'Y': hack_dir = 7; return ('.'); + case 'K': hack_dir = 8; return ('.'); + case 'U': hack_dir = 9; return ('.'); + + /* Tunnelling (control + rogue keys) */ + case KTRL('B'): hack_dir = 1; return ('+'); + case KTRL('J'): hack_dir = 2; return ('+'); + case KTRL('N'): hack_dir = 3; return ('+'); + case KTRL('H'): hack_dir = 4; return ('+'); + case KTRL('L'): hack_dir = 6; return ('+'); + case KTRL('Y'): hack_dir = 7; return ('+'); + case KTRL('K'): hack_dir = 8; return ('+'); + case KTRL('U'): hack_dir = 9; return ('+'); + + /* Hack -- White-space */ + case KTRL('M'): return ('\r'); + + /* Allow use of the "destroy" command */ + case KTRL('D'): return ('k'); + + /* Hack -- Commit suicide */ + case KTRL('C'): return ('Q'); + + /* Locate player on map */ + case 'W': return ('L'); + + /* Browse a book (Peruse) */ + case 'P': return ('b'); + + /* Jam a door (Spike) */ + case 'S': return ('j'); + /* Toggle search mode */ + case '#': return ('S'); + + /* Use a staff (Zap) */ + case 'Z': return ('u'); + + /* Take off equipment */ + case 'T': return ('t'); + + /* Fire an item */ + case 't': return ('f'); + + /* Bash a door (Force) */ + case 'f': return ('B'); + + /* Look around (examine) */ + case 'x': return ('l'); + + /* Aim a wand (Zap) */ + case 'z': return ('a'); + + /* Zap a rod (Activate) */ + case 'a': return ('z'); + + /* Run */ + case ',': return ('.'); + + /* Stay still (fake direction) */ + case '.': hack_dir = 5; return (','); + + /* Stay still (fake direction) */ + case '5': hack_dir = 5; return (','); + + /* Standard walking */ + case '1': hack_dir = 1; return (';'); + case '2': hack_dir = 2; return (';'); + case '3': hack_dir = 3; return (';'); + case '4': hack_dir = 4; return (';'); + case '6': hack_dir = 6; return (';'); + case '7': hack_dir = 7; return (';'); + case '8': hack_dir = 8; return (';'); + case '9': hack_dir = 9; return (';'); + } + + /* Default */ + return (command); + } + + + /* * Convert an "Original" keypress into an "Angband" keypress * Pass direction information back via "hack_dir". *************** *** 640,646 **** --- 821,834 ---- hack_dir = 0; /* Attempt to translate */ + if (rogue_like_commands) + { + k = roguelike_commands(i); + } + else + { k = original_commands(i); + } /* Save the keypress */ keymap_cmds[i] = k; *************** *** 658,663 **** --- 846,857 ---- { /* Mega-Hack -- Flush the output */ Term_fresh(); + + /* Make a bell noise (if allowed) */ + if (ring_bell) Term_xtra(TERM_XTRA_NOISE, 0); + + /* Flush the input (later!) */ + flush(); } /* *************** *** 874,879 **** --- 1068,1076 ---- char cmd; + /* Flush the input */ + flush(); + /* Get a keypress in "command" mode */ /* Activate "command mode" */ *************** *** 1008,1014 **** while (TRUE) { i = inkey(); ! break; } /* Erase the prompt */ --- 1205,1214 ---- while (TRUE) { i = inkey(); ! if (quick_messages) break; ! if (i == ESCAPE) break; ! if (strchr("YyNn", i)) break; ! bell(); } /* Erase the prompt */ *************** *** 1023,1028 **** --- 1223,1254 ---- /* + * Recall the "text" of a saved message + */ + cptr message_str(s16b age) + { + s16b x; + s16b o; + cptr s; + + /* Forgotten messages have no text */ + if ((age < 0) || (age >= message_num())) return (""); + + /* Acquire the "logical" index */ + x = (message__next + MESSAGE_MAX - (age + 1)) % MESSAGE_MAX; + + /* Get the "offset" for the message */ + o = message__ptr[x]; + + /* Access the message text */ + s = &message__buf[o]; + + /* Return the message text */ + return (s); + } + + + /* * How many messages are "available"? */ s16b message_num(void) *************** *** 1211,1216 **** --- 1437,1445 ---- /* Advance the "head" pointer */ message__head += n + 1; + + /* Fix the message recall window */ + fix_message(); } *************** *** 1231,1238 **** /* Get an acceptable keypress */ while (1) { ! inkey(); ! break; } /* Clear the line */ --- 1460,1470 ---- /* Get an acceptable keypress */ while (1) { ! int cmd = inkey(); ! if (quick_messages) break; ! if ((cmd == ESCAPE) || (cmd == ' ')) break; ! if ((cmd == '\n') || (cmd == '\r')) break; ! bell(); } /* Clear the line */ *************** *** 1418,1423 **** --- 1650,1705 ---- return (amt); } + + /* + * Create a new path by appending a file (or directory) to a path + * + * This requires no special processing on simple machines, except + * for verifying the size of the filename, but note the ability to + * bypass the given "path" with certain special file-names. + * + * Note that the "file" may actually be a "sub-path", including + * a path and a file. + * + * Note that this function yields a path which must be "parsed" + * using the "parse" function above. + */ + errr path_build(char *buf, int max, cptr path, cptr file) + { + /* Special file */ + if (file[0] == '~') + { + /* Use the file itself */ + strnfmt(buf, max, "%s", file); + } + + /* Absolute file, on "normal" systems */ + else if (prefix(file, PATH_SEP) && !streq(PATH_SEP, "")) + { + /* Use the file itself */ + strnfmt(buf, max, "%s", file); + } + + /* No path given */ + else if (!path[0]) + { + /* Use the file itself */ + strnfmt(buf, max, "%s", file); + } + + /* Path and File */ + else + { + /* Build the new path */ + strnfmt(buf, max, "%s%s%s", path, PATH_SEP, file); + } + + /* Success */ + return (0); + } + + + #ifdef SET_UID # ifndef HAS_USLEEP diff -w -r -c mangband-013/src/client/c-xtra1.c mangband-014/src/client/c-xtra1.c *** mangband-013/src/client/c-xtra1.c Wed Mar 19 19:12:47 1997 --- mangband-014/src/client/c-xtra1.c Thu Apr 3 22:17:49 1997 *************** *** 220,230 **** { (void)strcpy(depths, "Town"); } ! else { (void)sprintf(depths, "%d ft", depth * 50); } prt(format("%7s", depths), 23, COL_DEPTH); } --- 220,235 ---- { (void)strcpy(depths, "Town"); } ! else if (depth_in_feet) { (void)sprintf(depths, "%d ft", depth * 50); } + else + { + (void)sprintf(depths, "Lev %d", depth); + } + /* Right-Adjust the "depth" and clear old values */ prt(format("%7s", depths), 23, COL_DEPTH); } *************** *** 589,599 **** /* Display the entry itself */ c_put_str(out_color[j], out_desc[j], j + 1, col + 3); ! /* Display the weight */ wgt = o_ptr->weight; (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10); put_str(tmp_val, j + 1, 71); } /* Make a "shadow" below the list (only if needed) */ if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col); --- 594,607 ---- /* Display the entry itself */ c_put_str(out_color[j], out_desc[j], j + 1, col + 3); ! /* Display the weight if needed */ ! if (show_weights && o_ptr->weight) ! { wgt = o_ptr->weight; (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10); put_str(tmp_val, j + 1, 71); } + } /* Make a "shadow" below the list (only if needed) */ if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col); *************** *** 691,701 **** /* Display the entry itself */ c_put_str(out_color[j], out_desc[j], j + 1, col + 3); ! /* Display the weight */ wgt = o_ptr->weight * o_ptr->number; (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10); put_str(tmp_val, j + 1, 71); } /* Make a "shadow" below the list (only if needed) */ if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col); --- 699,712 ---- /* Display the entry itself */ c_put_str(out_color[j], out_desc[j], j + 1, col + 3); ! /* Display the weight if needed */ ! if (show_weights && o_ptr->weight) ! { wgt = o_ptr->weight * o_ptr->number; (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10); put_str(tmp_val, j + 1, 71); } + } /* Make a "shadow" below the list (only if needed) */ if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col); *************** *** 704,706 **** --- 715,767 ---- command_gap = col; } + + /* + * Hack -- display recent messages in sub-windows + * + * XXX XXX XXX Adjust for width and split messages + */ + void fix_message(void) + { + int j, i; + int w, h; + int x, y; + + /* Scan windows */ + for (j = 0; j < 8; j++) + { + term *old = Term; + + /* No window */ + if (!ang_term[j]) continue; + + /* No relevant flags */ + if (!(window_flag[j] & PW_MESSAGE)) continue; + + /* Activate */ + Term_activate(ang_term[j]); + + /* Get size */ + Term_get_size(&w, &h); + + /* Dump messages */ + for (i = 0; i < h; i++) + { + /* Dump the message on the appropriate line */ + Term_putstr(0, (h - 1) - i, -1, TERM_WHITE, message_str(i)); + + /* Cursor */ + Term_locate(&x, &y); + + /* Clear to end of line */ + Term_erase(x, y, 255); + } + + /* Fresh */ + Term_fresh(); + + /* Restore */ + Term_activate(old); + } + } + Only in mangband-014/src/client: c-xtra2.c diff -w -r -c mangband-013/src/client/client.c mangband-014/src/client/client.c *** mangband-013/src/client/client.c Sun Mar 23 15:09:13 1997 --- mangband-014/src/client/client.c Mon Apr 7 21:11:12 1997 *************** *** 2,248 **** static int Socket; ! static void process_command() { ! /* Parse the command */ ! switch (command_cmd) ! { ! /* Ignore */ ! case ESCAPE: ! case ' ': ! { ! break; ! } ! /* Ignore return */ ! case '\r': ! { ! break; ! } ! /*** Movement Commands ***/ ! /* Dig a tunnel*/ ! case '+': ! { ! cmd_tunnel(); ! break; } ! /* Move */ ! case ';': { ! cmd_walk(); ! break; ! } ! /*** Running, Staying ***/ ! case '.': ! { ! cmd_run(); ! break; ! } ! case ',': ! case 'g': ! { ! cmd_stay(); ! break; ! } ! /* Search */ ! case 's': ! { ! cmd_search(); ! break; ! } ! /* Toggle Search Mode */ ! case 'S': ! { ! cmd_toggle_search(); ! break; ! } ! /*** Stairs and doors and chests ***/ ! /* Go up */ ! case '<': ! { ! cmd_go_up(); ! break; ! } ! /* Go down */ ! case '>': ! { ! cmd_go_down(); ! break; ! } ! /* Open a door */ ! case 'o': ! { ! cmd_open(); ! break; ! } ! /* Close a door */ ! case 'c': ! { ! cmd_close(); ! break; } - /* Bash a door */ - case 'B': - { - cmd_bash(); - break; - } - /* Disarm a trap or chest */ - case 'D': - { - cmd_disarm(); - break; - } - /*** Inventory commands ***/ - case 'i': - { - cmd_inven(); - break; - } ! case 'e': { ! cmd_equip(); ! break; ! } - case 'd': - { - cmd_drop(); - break; - } ! case 'w': ! { ! cmd_wield(); ! break; ! } ! case 't': ! { ! cmd_take_off(); ! break; ! } ! /*** Inventory "usage" commands ***/ ! case 'q': ! { ! cmd_quaff(); ! break; ! } ! case 'r': ! { ! cmd_read_scroll(); ! break; ! } - case 'a': - { - cmd_aim_wand(); - break; - } - case 'u': - { - cmd_use_staff(); - break; - } ! case 'z': ! { ! cmd_zap_rod(); ! break; ! } ! case 'F': ! { ! cmd_refill(); ! break; ! } ! case 'E': ! { ! cmd_eat(); ! break; ! } ! /*** Spell casting ***/ ! case 'b': ! { ! cmd_browse(); ! break; ! } ! case 'G': ! { ! cmd_study(); ! break; ! } ! case 'm': ! { ! cmd_cast(); ! break; ! } - case 'p': - { - cmd_pray(); - break; - } ! /*** Miscellaneous ***/ ! case ':': ! { ! cmd_message(); ! break; ! } ! case KTRL('X'): ! { ! Net_cleanup(); ! exit(0); ! } ! default: ! { ! prt("That command is unsupported (for now).", 0, 0); ! break; ! } ! } ! } ! static void init_arrays(void) ! { ! /* Message variables */ ! C_MAKE(message__ptr, MESSAGE_MAX, u16b); ! C_MAKE(message__buf, MESSAGE_BUF, char); ! /* Hack -- No messages yet */ ! message__tail = MESSAGE_BUF; } static void Input_loop(void) { ! int rfds, tfds, max, n, netfd, result; ! struct timeval tv; int last_sent; /* Initialize the last_sent variable */ --- 2,138 ---- static int Socket; ! static void init_arrays(void) { ! /* Macro variables */ ! C_MAKE(macro__pat, MACRO_MAX, cptr); ! C_MAKE(macro__act, MACRO_MAX, cptr); ! C_MAKE(macro__cmd, MACRO_MAX, bool); ! /* Macro action buffer */ ! C_MAKE(macro__buf, 1024, char); ! /* Message variables */ ! C_MAKE(message__ptr, MESSAGE_MAX, u16b); ! C_MAKE(message__buf, MESSAGE_BUF, char); ! /* Hack -- No messages yet */ ! message__tail = MESSAGE_BUF; } ! /* ! * Initialize and verify the file paths, and the score file. ! * ! * Use the ANGBAND_PATH environment var if possible, else use ! * DEFAULT_PATH, and in either case, branch off appropriately. ! * ! * First, we'll look for the ANGBAND_PATH environment variable, ! * and then look for the files in there. If that doesn't work, ! * we'll try the DEFAULT_PATH constant. So be sure that one of ! * these two things works... ! * ! * We must ensure that the path ends with "PATH_SEP" if needed, ! * since the "init_file_paths()" function will simply append the ! * relevant "sub-directory names" to the given path. ! * ! * Note that the "path" must be "Angband:" for the Amiga, and it ! * is ignored for "VM/ESA", so I just combined the two. ! */ ! static void init_stuff(void) { ! char path[1024]; ! #if defined(AMIGA) || defined(VM) ! /* Hack -- prepare "path" */ ! strcpy(path, "Angband:"); ! #else /* AMIGA / VM */ ! cptr tail; ! /* Get the environment variable */ ! tail = getenv("ANGBAND_PATH"); ! /* Use the angband_path, or a default */ ! strcpy(path, tail ? tail : DEFAULT_PATH); ! /* Hack -- Add a path separator (only if needed) */ ! if (!suffix(path, PATH_SEP)) strcat(path, PATH_SEP); ! #endif /* AMIGA / VM */ ! /* Initialize */ ! init_file_paths(path); } ! static void initalize_all_pref_files(void) { ! char buf[1024]; ! /* Access the "basic" pref file */ ! strcpy(buf, "pref.prf"); ! /* Process that file */ ! process_pref_file(buf); ! /* Access the "user" pref file */ ! sprintf(buf, "user.prf"); ! /* Process that file */ ! process_pref_file(buf); ! /* Access the "basic" system pref file */ ! sprintf(buf, "pref-%s.prf", ANGBAND_SYS); ! /* Process that file */ ! process_pref_file(buf); ! /* Access the "visual" system pref file (if any) */ ! sprintf(buf, "%s-%s.prf", (use_graphics ? "graf" : "font"), ANGBAND_SYS); ! /* Process that file */ ! process_pref_file(buf); ! /* Access the "user" system pref file */ ! sprintf(buf, "user-%s.prf", ANGBAND_SYS); ! /* Process that file */ ! process_pref_file(buf); ! /* Access the "race" pref file */ ! sprintf(buf, "%s.prf", race_title[race]); ! buf[0] = tolower(buf[0]); ! /* Process that file */ ! process_pref_file(buf); ! /* Access the "class" pref file */ ! sprintf(buf, "%s.prf", class_title[class]); ! buf[0] = tolower(buf[0]); ! /* Process that file */ ! process_pref_file(buf); ! /* Access the "character" pref file */ ! sprintf(buf, "%s.prf", nick); ! buf[0] = tolower(buf[0]); ! ! /* Process that file */ ! process_pref_file(buf); } static void Input_loop(void) { ! int netfd, result; int last_sent; /* Initialize the last_sent variable */ *************** *** 262,295 **** plog("Bad socket filedescriptor"); return; } - rfds = 0; - rfds |= (1 << netfd); - max = netfd; ! for (tfds = rfds; ; rfds = tfds) { ! tv.tv_sec = 0; ! tv.tv_usec = 100000; ! ! if ((n = select(max + 1, &rfds, NULL, NULL, &tv)) == -1) { ! if (errno == EINTR) ! continue; ! plog("Select failed"); return; } ! #if 0 ! if (n == 0) { ! if (result <= 1) { ! errno = 0; ! plog("No response from server"); ! continue; } } - #endif request_command(FALSE); if (command_cmd) --- 152,180 ---- plog("Bad socket filedescriptor"); return; } ! for (;;) { ! if (Net_flush() == -1) { ! plog("Bad net flush"); return; } ! ! /* Set the timeout on the network socket */ ! SetTimeout(0, 100000); ! ! /* Only take input if we got some */ ! if (SocketReadable(netfd)) { ! if ((result = Net_input()) == -1) { ! /*plog("Bad net input");*/ ! return; } } + /* See if we have a command waiting */ request_command(FALSE); if (command_cmd) *************** *** 300,325 **** /* Clear the previous command */ command_cmd = 0; ! if (Net_flush() == -1) { ! plog("Bad net flush"); ! return; ! } ! if ((rfds & (1 << netfd)) != 0 || result > 1) { ! if ((result = Net_input()) == -1) ! { ! /*plog("Bad net input");*/ ! return; ! } ! } ! Term_flush(); ! Term_fresh(); } } int main(int argc, char **argv) { sockbuf_t ibuf; --- 185,215 ---- /* Clear the previous command */ command_cmd = 0; + Term_flush(); + Term_fresh(); + } + } ! /* ! * A hook for "quit()". ! * ! * Close down, then fall back into "quit()". ! */ ! static void quit_hook(cptr s) { ! int j; ! ! for (j = 8 - 1; j >= 0; j--) { ! /* Unused */ ! if (!ang_term[j]) continue; ! /* Nuke it */ ! term_nuke(ang_term[j]); } } + int main(int argc, char **argv) { sockbuf_t ibuf; *************** *** 331,343 **** struct passwd *pw; int player_uid; char real_name[17]; ! char host_name[80]; char buf[1024]; - char nick[80]; char pass[20]; char config_name[100]; FILE *config; unsigned int version = MY_VERSION; if (argc != 2) { --- 221,233 ---- struct passwd *pw; int player_uid; char real_name[17]; ! char host_name[80], server_name[80]; char buf[1024]; char pass[20]; char config_name[100]; FILE *config; unsigned int version = MY_VERSION; + s32b temp; if (argc != 2) { *************** *** 348,353 **** --- 238,247 ---- /* Save the program name */ argv0 = argv[0]; + /* Setup the file paths */ + init_stuff(); + + player_uid = getuid(); if ((pw = getpwuid(player_uid))) *************** *** 361,367 **** GetLocalHostName(host_name, 80); /* Try to find the home directory */ ! strcpy(config_name, getenv("HOME")); /* If we failed, use the current directory */ if (!strlen(config_name)) --- 255,261 ---- GetLocalHostName(host_name, 80); /* Try to find the home directory */ ! if (getenv("HOME")) strcpy(config_name, getenv("HOME")); /* If we failed, use the current directory */ if (!strlen(config_name)) *************** *** 368,375 **** --- 262,274 ---- strcpy(config_name, "."); /* Append the filename */ + #ifdef USE_IBM + strcat(config_name, "\\mang.cfg"); + #else strcat(config_name, "/.mangrc"); + #endif + if ((config = fopen(config_name, "r"))) { while (!feof(config)) *************** *** 393,403 **** pass[strlen(pass) - 1] = '\0'; } if (!strncmp(buf, "race", 4)) ! sscanf(buf, "race %d", &race); if (!strncmp(buf, "class", 5)) ! sscanf(buf, "class %d", &class); if (!strncmp(buf, "sex", 3)) ! sscanf(buf, "sex %d", &sex); } fclose(config); --- 292,302 ---- pass[strlen(pass) - 1] = '\0'; } if (!strncmp(buf, "race", 4)) ! sscanf(buf, "race %hd", &race); if (!strncmp(buf, "class", 5)) ! sscanf(buf, "class %hd", &class); if (!strncmp(buf, "sex", 3)) ! sscanf(buf, "sex %hd", &sex); } fclose(config); *************** *** 418,423 **** --- 317,329 ---- /* Capitalize the name */ nick[0] = toupper(nick[0]); + /* Set the server's name */ + strcpy(server_name, argv[1]); + + /* Fix "localhost" */ + if (!strcmp(server_name, "localhost")) + strcpy(server_name, host_name); + if ((Socket = CreateDgramSocket(0)) == -1) { printf("Could not create Dgram socket\n"); *************** *** 445,477 **** Packet_printf(&ibuf, "%s%s%hd%hd%hd%hu", nick, host_name, race, class, sex, version); ! if ((bytes = DgramSend(Socket, argv[1], 18346, ibuf.buf, ibuf.len) == -1)) { ! printf("Couldn't send contact information\n"); printf("The server either isn't up, or you mistyped the host name.\n"); exit(1); } do { ! if(DgramReceiveAny(Socket, ibuf.buf, ibuf.size) < 0) { /* printf("DgramReceiveAny failed\n");*/ continue; } ! Packet_scanf(&ibuf, "%c%c%d", &reply_to, &status, &login_port); break; } while (1); /* printf("Server sent login port as %d\n", login_port); printf("Server sent status %u\n", status); */ /* Connect to the server on the port it sent */ if (Net_init(argv[1], login_port) == -1) { printf("Network initialization failed!\n"); ! return -1; } if (Net_verify(real_name, nick, pass) == -1) --- 351,403 ---- Packet_printf(&ibuf, "%s%s%hd%hd%hd%hu", nick, host_name, race, class, sex, version); ! if ((DgramConnect(Socket, argv[1], 18346)) == -1) { ! printf("Couldn't connect to server.\n"); printf("The server either isn't up, or you mistyped the host name.\n"); exit(1); } + if ((bytes = DgramWrite(Socket, ibuf.buf, ibuf.len) == -1)) + { + printf("Couldn't send contact information\n"); + exit(1); + } + do { ! if(DgramRead(Socket, ibuf.buf, ibuf.size) <= 0) { /* printf("DgramReceiveAny failed\n");*/ continue; } ! Packet_scanf(&ibuf, "%c%c%d", &reply_to, &status, &temp); ! ! /* Hack -- set the login port correctly */ ! login_port = (int) temp; ! break; } while (1); + if (status) + { + plog(format("Connection failed with status %d.", status)); + Net_cleanup(); + exit (1); + } + /* printf("Server sent login port as %d\n", login_port); printf("Server sent status %u\n", status); */ + /* Close our current connection */ + DgramClose(Socket); + /* Connect to the server on the port it sent */ if (Net_init(argv[1], login_port) == -1) { printf("Network initialization failed!\n"); ! exit (1); } if (Net_verify(real_name, nick, pass) == -1) *************** *** 478,484 **** { Net_cleanup(); printf("Network verify failed!\n"); ! return -1; } if (Net_setup() == -1) --- 404,410 ---- { Net_cleanup(); printf("Network verify failed!\n"); ! exit (1); } if (Net_setup() == -1) *************** *** 485,491 **** { Net_cleanup(); printf("Network setup failed!\n"); ! return -1; } if (Net_start() == -1) --- 411,417 ---- { Net_cleanup(); printf("Network setup failed!\n"); ! exit (1); } if (Net_start() == -1) *************** *** 492,498 **** { Net_cleanup(); printf("Network start failed!\n"); ! return -1; } /* Attempt to initialize a visual module */ --- 418,424 ---- { Net_cleanup(); printf("Network start failed!\n"); ! exit (1); } /* Attempt to initialize a visual module */ *************** *** 526,546 **** } #endif if (!done) { Net_cleanup(); printf("Unable to initialize a display module!\n"); ! return -1; } - keymap_init(); /* Initialize some client arrays */ init_arrays(); Input_loop(); Net_cleanup(); ! return 0; } --- 452,493 ---- } #endif + #ifdef USE_IBM + /* Attempt to use the "main_ibm.c" support */ if (!done) { + extern errr init_ibm(void); + if (0 == init_ibm()) done = TRUE; + if (done) ANGBAND_SYS = "ibm"; + } + #endif + + if (!done) + { Net_cleanup(); printf("Unable to initialize a display module!\n"); ! exit (1); } /* Initialize some client arrays */ init_arrays(); + /* Initialize the pref files */ + initalize_all_pref_files(); + + /* Setup the key mappings */ + keymap_init(); + + /* Set the "quit hook" */ + quit_aux = quit_hook; + + /* Hack -- Default window usage */ + window_flag[1] = PW_MESSAGE; + Input_loop(); Net_cleanup(); ! exit (0); } diff -w -r -c mangband-013/src/client/externs.h mangband-014/src/client/externs.h *** mangband-013/src/client/externs.h Mon Mar 24 08:36:07 1997 --- mangband-014/src/client/externs.h Thu Apr 3 20:25:31 1997 *************** *** 12,18 **** --- 12,30 ---- * Not-so-Automatically generated "variable" declarations */ + /* tables.c */ + extern char hexsym[16]; + extern owner_type owners[MAX_STORES][MAX_OWNERS]; + extern player_race race_info[MAX_RACES]; + extern player_class class_info[MAX_CLASS]; + extern option_type option_info[]; + + + + /* variable.c */ + extern char nick[80]; + extern object_type inventory[INVEN_TOTAL]; extern char inventory_name[INVEN_TOTAL][80]; *************** *** 49,54 **** --- 61,70 ---- extern bool msg_flag; extern term *ang_term[8]; + extern u32b window_flag[8]; + + extern byte color_table[256][4]; + extern cptr ANGBAND_SYS; extern byte keymap_cmds[128]; *************** *** 57,79 **** extern s16b command_cmd; extern s16b command_dir; ! extern int race; ! extern int class; ! extern int sex; extern bool topline_icky; extern bool screen_icky; /* * Not-so-Automatically generated "function declarations" */ /* c-cmd.c */ extern void cmd_tunnel(void); extern void cmd_walk(void); extern void cmd_run(void); extern void cmd_stay(void); extern void cmd_search(void); extern void cmd_toggle_search(void); extern void cmd_go_up(void); --- 73,180 ---- extern s16b command_cmd; extern s16b command_dir; ! extern s16b race; ! extern s16b class; ! extern s16b sex; extern bool topline_icky; extern bool screen_icky; + extern cptr race_title[]; + extern cptr class_title[]; + + extern cptr ANGBAND_DIR; + extern cptr ANGBAND_DIR_APEX; + extern cptr ANGBAND_DIR_BONE; + extern cptr ANGBAND_DIR_DATA; + extern cptr ANGBAND_DIR_EDIT; + extern cptr ANGBAND_DIR_FILE; + extern cptr ANGBAND_DIR_HELP; + extern cptr ANGBAND_DIR_INFO; + extern cptr ANGBAND_DIR_SAVE; + extern cptr ANGBAND_DIR_USER; + extern cptr ANGBAND_DIR_XTRA; + + extern bool use_graphics; + + extern bool rogue_like_commands; + extern bool quick_messages; + extern bool other_query_flag; + extern bool carry_query_flag; + extern bool use_old_target; + extern bool always_pickup; + extern bool always_repeat; + extern bool depth_in_feet; + extern bool stack_force_notes; + extern bool stack_force_costs; + extern bool show_labels; + extern bool show_weights; + extern bool show_choices; + extern bool show_details; + extern bool ring_bell; + extern bool use_color; + + extern bool find_ignore_stairs; + extern bool find_ignore_doors; + extern bool find_cut; + extern bool find_examine; + extern bool disturb_move; + extern bool disturb_near; + extern bool disturb_panel; + extern bool disturb_state; + extern bool disturb_minor; + extern bool disturb_other; + extern bool alert_hitpoint; + extern bool alert_failure; + + extern bool auto_haggle; + extern bool auto_scum; + extern bool stack_allow_items; + extern bool stack_allow_wands; + extern bool expand_look; + extern bool expand_list; + extern bool view_perma_grids; + extern bool view_torch_grids; + extern bool dungeon_align; + extern bool dungeon_stair; + extern bool flow_by_sound; + extern bool flow_by_smell; + extern bool track_follow; + extern bool track_target; + extern bool smart_learn; + extern bool smart_cheat; + + extern bool view_reduce_lite; + extern bool view_reduce_view; + extern bool avoid_abort; + extern bool avoid_other; + extern bool flush_failure; + extern bool flush_disturb; + extern bool flush_command; + extern bool fresh_before; + extern bool fresh_after; + extern bool fresh_message; + extern bool compress_savefile; + extern bool hilite_player; + extern bool view_yellow_lite; + extern bool view_bright_lite; + extern bool view_granite_lite; + extern bool view_special_lite; + + + /* * Not-so-Automatically generated "function declarations" */ /* c-cmd.c */ + extern void process_command(void); extern void cmd_tunnel(void); extern void cmd_walk(void); extern void cmd_run(void); extern void cmd_stay(void); + extern void cmd_map(void); extern void cmd_search(void); extern void cmd_toggle_search(void); extern void cmd_go_up(void); *************** *** 87,92 **** --- 188,194 ---- extern void cmd_drop(void); extern void cmd_wield(void); extern void cmd_take_off(void); + extern void cmd_destroy(void); extern void cmd_quaff(void); extern void cmd_read_scroll(void); extern void cmd_aim_wand(void); *************** *** 94,99 **** --- 196,202 ---- extern void cmd_zap_rod(void); extern void cmd_refill(void); extern void cmd_eat(void); + extern void cmd_activate(void); extern void cmd_message(void); extern void cmd_browse(void); extern void cmd_study(void); *************** *** 100,105 **** --- 203,211 ---- extern void cmd_cast(void); extern void cmd_pray(void); + /* c-files.c */ + extern void init_file_paths(char *path); + extern errr process_pref_file(cptr buf); /* c-inven.c */ extern s16b index_to_label(int i); *************** *** 107,112 **** --- 213,220 ---- extern bool c_get_item(int *cp, cptr pmt, bool equip, bool inven, bool floor); /* c-util.c */ + extern void flush (void); + extern void macro_add(cptr pat, cptr act, bool cmd_flag); extern char inkey(void); extern void keymap_init(void); extern void bell(void); *************** *** 119,124 **** --- 227,234 ---- extern void c_put_str(byte attr, cptr str, int row, int col); extern void put_str(cptr str, int row, int col); extern bool get_check(cptr prompt); + extern s16b message_num(void); + extern cptr message_str(s16b age); extern void c_msg_print(cptr msg); extern s16b c_get_quantity(cptr prompt, int max); *************** *** 150,156 **** --- 260,270 ---- extern void prt_basic(void); extern void show_inven(void); extern void show_equip(void); + extern void fix_message(void); + /* c-xtra2.c */ + extern void do_cmd_messages(void); + /* client.c */ /* netclient.c */ *************** *** 179,184 **** --- 293,299 ---- extern int Send_disarm(int dir); extern int Send_wield(int item); extern int Send_take_off(int item); + extern int Send_destroy(int item, int amt); extern int Send_quaff(int item); extern int Send_read(int item); extern int Send_aim(int item, int dir); *************** *** 186,196 **** --- 301,313 ---- extern int Send_zap(int item); extern int Send_fill(int item); extern int Send_eat(int item); + extern int Send_activate(int item); extern int Send_msg(cptr message); extern int Send_item(int item); extern int Send_gain(int book, int spell); extern int Send_cast(int book, int spell); extern int Send_pray(int book, int spell); + extern int Send_map(void); diff -w -r -c mangband-013/src/client/netclient.c mangband-014/src/client/netclient.c *** mangband-013/src/client/netclient.c Mon Mar 24 08:42:45 1997 --- mangband-014/src/client/netclient.c Tue Apr 22 11:28:11 1997 *************** *** 10,25 **** #include "angband.h" #include "netclient.h" - typedef struct { - long loops; - sockbuf_t sbuf; - } frame_buf_t; - - static int receive_window_size = 2; static long last_turns; static sockbuf_t rbuf, cbuf, wbuf, qbuf; - static frame_buf_t *Frames; static int (*receive_tbl[256])(void), (*reliable_tbl[256])(void); static unsigned magic; --- 10,18 ---- *************** *** 26,34 **** static long last_send_anything, last_keyboard_change, last_keyboard_ack, ! reliable_offset; - /* * Initialize the function dispatch tables. * There are two tables. One for the semi-important unreliable --- 19,27 ---- static long last_send_anything, last_keyboard_change, last_keyboard_ack, ! reliable_offset, ! reliable_full_len; /* * Initialize the function dispatch tables. * There are two tables. One for the semi-important unreliable *************** *** 85,90 **** --- 78,85 ---- reliable_tbl[PKT_SPELL_INFO] = Receive_spell_info; reliable_tbl[PKT_DIRECTION] = Receive_direction; reliable_tbl[PKT_FLUSH] = Receive_flush; + reliable_tbl[PKT_LINE_INFO] = Receive_line_info; + reliable_tbl[PKT_FLOOR] = Receive_floor; } int Net_setup(void) *************** *** 209,217 **** */ int Net_init(char *server, int port) { ! int i, ! sock; ! unsigned size; /*signal(SIGPIPE, SIG_IGN);*/ --- 204,210 ---- */ int Net_init(char *server, int port) { ! int sock; /*signal(SIGPIPE, SIG_IGN);*/ *************** *** 235,264 **** return -1; } if (SetSocketSendBufferSize(sock, CLIENT_SEND_SIZE + 256) == -1) ! plog(format("Can't set send buffer size to %d", CLIENT_SEND_SIZE + 256)); if (SetSocketReceiveBufferSize(sock, CLIENT_RECV_SIZE + 256) == -1) ! plog(format("Can't set receive bufer size to %d", CLIENT_RECV_SIZE + 256)); - size = receive_window_size * sizeof(frame_buf_t); - if ((Frames = (frame_buf_t *) malloc(size)) == NULL) - { - plog(format("No memory (%u)", size)); - return -1; - } - for (i = 0; i < receive_window_size; i++) - { - Frames[i].loops = 0; - if (Sockbuf_init(&Frames[i].sbuf, sock, CLIENT_RECV_SIZE, - SOCKBUF_READ | SOCKBUF_DGRAM) == -1) - { - plog(format("No memory for read buffer (%u)", CLIENT_RECV_SIZE)); - return -1; - } - } - - - /* reliable data buffer, not a valid socket filedescriptor needed */ if (Sockbuf_init(&cbuf, -1, CLIENT_RECV_SIZE, SOCKBUF_WRITE | SOCKBUF_READ | SOCKBUF_LOCK) == -1) --- 228,238 ---- return -1; } if (SetSocketSendBufferSize(sock, CLIENT_SEND_SIZE + 256) == -1) ! plog(format("Can't set send buffer size to %d: error %d", CLIENT_SEND_SIZE + 256, errno)); if (SetSocketReceiveBufferSize(sock, CLIENT_RECV_SIZE + 256) == -1) ! plog(format("Can't set receive buffer size to %d", CLIENT_RECV_SIZE + 256)); /* reliable data buffer, not a valid socket filedescriptor needed */ if (Sockbuf_init(&cbuf, -1, CLIENT_RECV_SIZE, SOCKBUF_WRITE | SOCKBUF_READ | SOCKBUF_LOCK) == -1) *************** *** 275,280 **** --- 249,262 ---- return -1; } + /* read buffer */ + if (Sockbuf_init(&rbuf, sock, CLIENT_RECV_SIZE, + SOCKBUF_READ | SOCKBUF_DGRAM) == -1) + { + plog(format("No memory for read buffer (%u)", CLIENT_RECV_SIZE)); + return -1; + } + /* write buffer */ if (Sockbuf_init(&wbuf, sock, CLIENT_SEND_SIZE, SOCKBUF_WRITE | SOCKBUF_DGRAM) == -1) *************** *** 283,291 **** return -1; } - /* read buffer */ - rbuf = Frames[0].sbuf; - /* reliable data byte stream offset */ reliable_offset = 0; --- 265,270 ---- *************** *** 423,428 **** --- 402,412 ---- plog(&rbuf.ptr[1]); return -1; } + else if (rbuf.ptr[0] == PKT_END) + { + Sockbuf_clear(&rbuf); + continue; + } else { printf("strange packet type while starting (%d)\n", rbuf.ptr[0]); *************** *** 511,518 **** } prev_type = type; } ! while (cbuf.buf + cbuf.len > cbuf.ptr) { type = (*cbuf.ptr & 0xFF); if (type == PKT_REPLY) { --- 495,505 ---- } prev_type = type; } ! while (cbuf.buf + cbuf.len > cbuf.ptr && cbuf.len >= reliable_full_len) { + /* Reset full length */ + reliable_full_len = 0; + type = (*cbuf.ptr & 0xFF); if (type == PKT_REPLY) { *************** *** 528,533 **** --- 515,521 ---- else if (reliable_tbl[type] == NULL) { int i; + errno = 0; plog(format("Receive unknown reliable data packet type (%d, %d, %d)", type, cbuf.ptr - cbuf.buf, cbuf.len)); *************** *** 540,545 **** --- 528,537 ---- else printf(" "); } printf("\n"); + + /* Die hideously */ + core("Buffer dump"); + return -1; } else if ((result = (*reliable_tbl[type])()) <= 0) *************** *** 561,615 **** * we retry to read a packet once more. * It's a non-blocking read. */ ! static int Net_read(frame_buf_t *frame) { int n; - long loop; - byte ch; - frame->loops = 0; for (;;) { ! Sockbuf_clear(&frame->sbuf); ! if (Sockbuf_read(&frame->sbuf) == -1) { plog("Net input error"); return -1; } ! if (frame->sbuf.len <= 0) { ! Sockbuf_clear(&frame->sbuf); return 0; } ! if (frame->sbuf.ptr[0] != PKT_START) return 1; - n = Packet_scanf(&frame->sbuf, "%c%ld", &ch, &loop); - frame->sbuf.ptr = frame->sbuf.buf; - if (n <= 0) - { - if (n == -1) - { - Sockbuf_clear(&frame->sbuf); - return -1; } - continue; } - else if (loop > last_turns) - { - frame->loops = loop; - return 2; - } - else - { - /* - * Packet out of order. Drop it. - * We may have already drawn it if it is duplicate. - * Perhaps we should try to extract any reliable data - * from it before dropping it. - */ - } - } - } /* --- 553,580 ---- * we retry to read a packet once more. * It's a non-blocking read. */ ! static int Net_read(void) { int n; for (;;) { ! if ((n = Sockbuf_read(&rbuf)) == -1) { plog("Net input error"); return -1; } ! if (rbuf.len <= 0) { ! Sockbuf_clear(&rbuf); return 0; } ! ! /* If this is the end of a chunk of info, quit reading stuff */ ! if (rbuf.ptr[rbuf.len - 1] == PKT_END) return 1; } } /* *************** *** 621,729 **** */ int Net_input(void) { ! int i, j, n; ! frame_buf_t *frame, *last_frame, *oldest_frame = &Frames[0], tmpframe; ! for (i = 0; i < receive_window_size; i++) ! { ! frame = &Frames[i]; ! if (frame->loops != 0) ! { ! if (frame->loops < oldest_frame->loops ! || oldest_frame->loops == 0) ! oldest_frame = frame; ! } ! else if (frame->sbuf.len > 0 && frame->sbuf.ptr == frame->sbuf.buf) ! break; ! else ! { ! if ((n = Net_read(frame)) <= 0) ! { ! if (n == 0) ! { ! if (i == 0) ! return 0; ! break; ! } ! else return n; ! } ! else if (n == 1) ! break; ! else ! { ! for (j = i - 1; j >= 0; j--) ! if (frame->loops == Frames[j].loops) ! break; ! if (j >= 0) ! { ! Sockbuf_clear(&frame->sbuf); ! frame->loops = 0; ! i--; ! continue; ! } ! if (frame->loops < oldest_frame->loops) ! oldest_frame = frame; ! } ! } ! if (i == receive_window_size - 1 && i > 0) ! { ! if (oldest_frame->loops < frame->loops) ! { ! tmpframe = *oldest_frame; ! *oldest_frame = *frame; ! *frame = tmpframe; ! } ! Sockbuf_clear(&frame->sbuf); ! frame->loops = 0; ! oldest_frame = &Frames[0]; ! i = -1; ! continue; ! } ! } ! last_frame = oldest_frame = &Frames[0]; ! for (i = 1; i < receive_window_size; i++, last_frame++) { ! frame = &Frames[i]; ! if (frame->loops == 0) ! { ! if (frame->sbuf.len > 0) ! continue; ! else break; } - else if (frame->loops < oldest_frame->loops - || oldest_frame->loops == 0) - oldest_frame = frame; - } - if (oldest_frame->sbuf.len <= 0) - { - if (oldest_frame->loops > 0) - { - errno = 0; - plog(format("bug %s,%d", __FILE__, __LINE__)); - oldest_frame->loops = 0; - } - return 0; - } - rbuf = oldest_frame->sbuf; - n = Net_packet(); ! if (last_frame > oldest_frame) ! { ! tmpframe = *oldest_frame; ! *oldest_frame = *last_frame; ! *last_frame = tmpframe; ! } ! Sockbuf_clear(&last_frame->sbuf); ! last_frame->loops = 0; ! rbuf = last_frame->sbuf; if (n == -1) return -1; ! return 1 + (last_frame > oldest_frame); } int Flush_queue(void) --- 586,609 ---- */ int Net_input(void) { ! int n; ! /* First, clear the buffer */ ! Sockbuf_clear(&rbuf); ! if ((n = Net_read()) <= 0) { ! return n; } n = Net_packet(); ! Sockbuf_clear(&rbuf); if (n == -1) return -1; ! return 1; } int Flush_queue(void) *************** *** 732,737 **** --- 612,619 ---- len = qbuf.len; + Net_packet(); + if (cbuf.ptr > cbuf.buf) Sockbuf_advance(&cbuf, cbuf.ptr - cbuf.buf); if (Sockbuf_write(&cbuf, qbuf.ptr, len) != len) *************** *** 746,751 **** --- 628,635 ---- qbuf.ptr += len; Sockbuf_advance(&qbuf, qbuf.ptr - qbuf.buf); + Sockbuf_clear(&qbuf); + return 1; } *************** *** 796,805 **** int Receive_end(void) { int n; - long loops; byte ch; ! if ((n = Packet_scanf(&rbuf, "%c%ld", &ch, &loops)) <= 0) return n; #if 0 --- 680,688 ---- int Receive_end(void) { int n; byte ch; ! if ((n = Packet_scanf(&rbuf, "%c", &ch)) <= 0) return n; #if 0 *************** *** 842,850 **** int n; short len; byte ch; ! long rel, rel_loops; ! if ((n = Packet_scanf(&rbuf, "%c%hd%ld%ld", &ch, &len, &rel, &rel_loops)) == -1) return -1; if (n == 0) --- 725,733 ---- int n; short len; byte ch; ! long rel, rel_loops, full_len; ! if ((n = Packet_scanf(&rbuf, "%c%hd%ld%ld%ld", &ch, &len, &rel, &rel_loops, &full_len)) == -1) return -1; if (n == 0) *************** *** 860,865 **** --- 743,760 ---- plog(format("Bad reliable data length (%d)", len)); return -1; } + + if (full_len <= 0) + { + errno = 0; + plog(format("Bad reliable data full length (%d)", reliable_full_len)); + return -1; + } + + /* Track maximum full length */ + if (full_len > reliable_full_len) + reliable_full_len = full_len; + if (rbuf.ptr + len > rbuf.buf + rbuf.len) { errno = 0; *************** *** 1074,1080 **** /* Clear any old info */ race = class = sex = 0; ! if ((n = Packet_scanf(&cbuf, "%c%hu%hu%hu", &ch, &race, &class, &sex)) <= 0) { return n; } --- 969,975 ---- /* Clear any old info */ race = class = sex = 0; ! if ((n = Packet_scanf(&cbuf, "%c%hd%hd%hd", &ch, &race, &class, &sex)) <= 0) { return n; } *************** *** 1082,1088 **** if (!screen_icky) prt_basic(); else ! if ((n = Packet_printf(&qbuf, "%c%hu%hu%hu", ch, race, class, sex)) <= 0) { return n; } --- 977,983 ---- if (!screen_icky) prt_basic(); else ! if ((n = Packet_printf(&qbuf, "%c%hd%hd%hd", ch, race, class, sex)) <= 0) { return n; } *************** *** 1219,1225 **** --- 1114,1125 ---- } if (!screen_icky) + { Term_draw(x, y, a, c); + + /* Put the cursor there */ + Term_gotoxy(x, y); + } else if ((n = Packet_printf(&qbuf, "%c%c%c%c%c", ch, x, y, a, c)) <= 0) { *************** *** 1615,1627 **** Term_flush(); Term_fresh(); ! Term_xtra(TERM_XTRA_DELAY, 1); return 1; } int Send_search(void) { int n; --- 1515,1569 ---- Term_flush(); Term_fresh(); ! Term_xtra(TERM_XTRA_DELAY, 2); return 1; } + /* + * Note that this function does not honor the "screen_icky" + * flag, as it is only used for displaying the mini-map, + * and the screen should be icky during that time. + */ + int Receive_line_info(void) + { + char ch, c; + int n, x; + s16b y; + byte a; + if ((n = Packet_scanf(&cbuf, "%c%hd", &ch, &y)) <= 0) + { + return n; + } + + for (x = 0; x < 80; x++) + { + Packet_scanf(&cbuf, "%c%c", &c, &a); + + /* Don't draw anything if "char" is zero */ + if (c) + Term_draw(x, y, a, c); + } + + return 1; + } + + int Receive_floor(void) + { + int n; + char ch; + + if ((n = Packet_scanf(&cbuf, "%c", &ch)) <= 0) + { + return n; + } + + return 1; + } + + int Send_search(void) { int n; *************** *** 1802,1807 **** --- 1744,1761 ---- return 1; } + int Send_destroy(int item, int amt) + { + int n; + + if ((n = Packet_printf(&wbuf, "%c%hd%hd", PKT_DESTROY, item, amt)) <= 0) + { + return n; + } + + return 1; + } + int Send_quaff(int item) { int n; *************** *** 1886,1891 **** --- 1840,1857 ---- return 1; } + int Send_activate(int item) + { + int n; + + if ((n = Packet_printf(&wbuf, "%c%hd", PKT_ACTIVATE, item)) <= 0) + { + return n; + } + + return 1; + } + int Send_msg(cptr message) { int n; *************** *** 1941,1946 **** --- 1907,1924 ---- if ((n = Packet_printf(&wbuf, "%c%hd%hd", PKT_PRAY, book, spell)) <= 0) { return n; + } + + return 1; + } + + int Send_map(void) + { + int n; + + if ((n = Packet_printf(&wbuf, "%c", PKT_MAP)) <= 0) + { + return n; } return 1; diff -w -r -c mangband-013/src/client/netclient.h mangband-014/src/client/netclient.h *** mangband-013/src/client/netclient.h Sun Mar 23 14:36:29 1997 --- mangband-014/src/client/netclient.h Sun Apr 20 16:28:41 1997 *************** *** 50,53 **** --- 50,55 ---- int Receive_spell_info(void); int Receive_direction(void); int Receive_flush(void); + int Receive_line_info(void); + int Receive_floor(void); diff -w -r -c mangband-013/src/client/variable.c mangband-014/src/client/variable.c *** mangband-013/src/client/variable.c Mon Mar 24 08:35:49 1997 --- mangband-014/src/client/variable.c Thu Apr 3 20:26:47 1997 *************** *** 2,7 **** --- 2,9 ---- /* Client global variables */ + char nick[80]; + object_type inventory[INVEN_TOTAL]; /* The client-side copy of the inventory */ char inventory_name[INVEN_TOTAL][80]; /* The client-side copy of the inventory names */ *************** *** 37,42 **** --- 39,48 ---- term *ang_term[8]; + u32b window_flag[8]; + + byte color_table[256][4]; + cptr ANGBAND_SYS; byte keymap_cmds[128]; *************** *** 46,55 **** s16b command_dir; ! int race; ! int class; ! int sex; bool topline_icky; bool screen_icky; --- 52,155 ---- s16b command_dir; ! s16b race; ! s16b class; ! s16b sex; bool topline_icky; bool screen_icky; + + cptr race_title[] = { + "Human", "Half-elf", "Elf", "Hobbit", + "Gnome", "Dwarf", "Half-Orc", "Half-Troll", + "Dunadan", "High-elf" + }; + + cptr class_title[] = { + "Warrior", "Mage", "Priest", "Rogue", + "Ranger", "Paladin" + }; + + cptr ANGBAND_DIR; + cptr ANGBAND_DIR_APEX; + cptr ANGBAND_DIR_BONE; + cptr ANGBAND_DIR_DATA; + cptr ANGBAND_DIR_EDIT; + cptr ANGBAND_DIR_FILE; + cptr ANGBAND_DIR_HELP; + cptr ANGBAND_DIR_INFO; + cptr ANGBAND_DIR_SAVE; + cptr ANGBAND_DIR_USER; + cptr ANGBAND_DIR_XTRA; + + + bool use_graphics; + + + + bool rogue_like_commands; + bool quick_messages; + bool other_query_flag; + bool carry_query_flag; + bool use_old_target; + bool always_pickup; + bool always_repeat; + bool depth_in_feet; + bool stack_force_notes; + bool stack_force_costs; + bool show_labels; + bool show_weights; + bool show_choices; + bool show_details; + bool ring_bell; + bool use_color; + + bool find_ignore_stairs; + bool find_ignore_doors; + bool find_cut; + bool find_examine; + bool disturb_move; + bool disturb_near; + bool disturb_panel; + bool disturb_state; + bool disturb_minor; + bool disturb_other; + bool alert_hitpoint; + bool alert_failure; + + bool auto_haggle; + bool auto_scum; + bool stack_allow_items; + bool stack_allow_wands; + bool expand_look; + bool expand_list; + bool view_perma_grids; + bool view_torch_grids; + bool dungeon_align; + bool dungeon_stair; + bool flow_by_sound; + bool flow_by_smell; + bool track_follow; + bool track_target; + bool smart_learn; + bool smart_cheat; + + bool view_reduce_lite; + bool view_reduce_view; + bool avoid_abort; + bool avoid_other; + bool flush_failure; + bool flush_disturb; + bool flush_command; + bool fresh_before; + bool fresh_after; + bool fresh_message; + bool compress_savefile; + bool hilite_player; + bool view_yellow_lite; + bool view_bright_lite; + bool view_granite_lite; + bool view_special_lite; + + diff -w -r -c mangband-013/src/common/defines.h mangband-014/src/common/defines.h *** mangband-013/src/common/defines.h Mon Mar 24 08:53:01 1997 --- mangband-014/src/common/defines.h Sun Apr 20 16:50:59 1997 *************** *** 33,46 **** /* ! * Current version number of MAngband: 0.1.1 */ #define VERSION_MAJOR 0 #define VERSION_MINOR 1 ! #define VERSION_PATCH 1 /* ! * This value is not currently used */ #define VERSION_EXTRA 0 --- 33,50 ---- /* ! * Current version number of MAngband: 0.1.4 */ #define VERSION_MAJOR 0 #define VERSION_MINOR 1 ! #define VERSION_PATCH 4 /* ! * This value specifys the suffix to the version info sent to the metaserver. ! * ! * 0 - nothing ! * 1 - "alpha" ! * 2 - "beta" */ #define VERSION_EXTRA 0 diff -w -r -c mangband-013/src/common/h-net.h mangband-014/src/common/h-net.h *** mangband-013/src/common/h-net.h Fri Mar 14 15:08:31 1997 --- mangband-014/src/common/h-net.h Tue Mar 25 15:48:56 1997 *************** *** 1,10 **** /* This file includes all the needed networking stuff */ /* Include the socket buffer library */ ! #include "net.h" ! /* Include the socket library */ ! #include "socklib.h" /* Include the various packet types and error codes */ #include "pack.h" --- 1,10 ---- /* This file includes all the needed networking stuff */ /* Include the socket buffer library */ ! #include "sockbuf.h" ! /* Include the socket library for UNIX */ ! #include "net-unix.h" /* Include the various packet types and error codes */ #include "pack.h" diff -w -r -c mangband-013/src/common/h-system.h mangband-014/src/common/h-system.h *** mangband-013/src/common/h-system.h Fri Mar 14 15:08:31 1997 --- mangband-014/src/common/h-system.h Thu Apr 3 16:47:51 1997 *************** *** 55,60 **** --- 55,62 ---- #if defined(WINDOWS) || defined(MSDOS) || defined(USE_EMX) # include + # include + # include #endif #if !defined(MACINTOSH) && !defined(AMIGA) && \ Only in mangband-014/src/common: net-ibm.c Only in mangband-014/src/common: net-ibm.h Only in mangband-014/src/common: net-unix.c Only in mangband-014/src/common: net-unix.h Only in mangband-014/src/common: net-xxx.c Only in mangband-014/src/common: net-xxx.h Only in mangband-013/src/common: net.c Only in mangband-013/src/common: net.h diff -w -r -c mangband-013/src/common/pack.h mangband-014/src/common/pack.h *** mangband-013/src/common/pack.h Sun Mar 16 23:04:14 1997 --- mangband-014/src/common/pack.h Sun Apr 20 16:26:34 1997 *************** *** 42,47 **** --- 42,48 ---- #define PKT_POISON 39 #define PKT_STATE 40 + #define PKT_LINE_INFO 41 #define PKT_SPEED 42 #define PKT_STUDY 43 #define PKT_CUT 44 *************** *** 49,54 **** --- 50,56 ---- #define PKT_MESSAGE 46 #define PKT_CHAR 47 #define PKT_SPELL_INFO 48 + #define PKT_FLOOR 49 /* Packet types 60-61 are sent from either the client or server */ Only in mangband-014/src/common: sockbuf.c Only in mangband-014/src/common: sockbuf.h Only in mangband-013/src/common: socklib.c Only in mangband-013/src/common: socklib.h diff -w -r -c mangband-013/src/common/types.h mangband-014/src/common/types.h *** mangband-013/src/common/types.h Sun Mar 23 14:28:15 1997 --- mangband-014/src/common/types.h Fri Apr 18 23:08:01 1997 *************** *** 997,1002 **** --- 997,1004 ---- u16b noscore; /* Has he cheated in some way (hopefully not) */ s16b command_rep; /* Command repetition */ + byte last_dir; /* Last direction moved (used for swapping places) */ + s16b running; /* Are we running */ byte find_current; /* These are used for the running code */ byte find_prevdir; diff -w -r -c mangband-013/src/common/z-util.c mangband-014/src/common/z-util.c *** mangband-013/src/common/z-util.c Fri Mar 14 15:08:31 1997 --- mangband-014/src/common/z-util.c Mon Mar 24 15:56:54 1997 *************** *** 131,137 **** --- 131,155 ---- } + #ifdef ultrix + /* + * A copy of "strdup" + * + * This code contributed by Hao Chen + */ + char *strdup(cptr s) + { + char *dup; + dup = (char *)malloc(sizeof(char) * (strlen(s) + 1)); + strcpy(dup, s); + return dup; + } + + #endif /* ultrix */ + + + /* * Determine if string "t" is a suffix of string "s" */ bool suffix(cptr s, cptr t) diff -w -r -c mangband-013/src/common/z-util.h mangband-014/src/common/z-util.h *** mangband-013/src/common/z-util.h Fri Mar 14 15:08:31 1997 --- mangband-014/src/common/z-util.h Mon Mar 24 15:57:38 1997 *************** *** 63,74 **** extern bool func_false(void); ! /* Test equality, prefix, suffix */ extern bool streq(cptr s, cptr t); extern bool prefix(cptr s, cptr t); extern bool suffix(cptr s, cptr t); /* Print an error message */ extern void plog(cptr str); --- 63,79 ---- extern bool func_false(void); ! /* Test equality, prefix, suffix, and do "strdup" */ extern bool streq(cptr s, cptr t); extern bool prefix(cptr s, cptr t); extern bool suffix(cptr s, cptr t); + #ifdef ultrix + extern char *strdup(cptr s); + #endif + + /* Print an error message */ extern void plog(cptr str); diff -w -r -c mangband-013/src/server/birth.c mangband-014/src/server/birth.c *** mangband-013/src/server/birth.c Sun Mar 23 16:52:58 1997 --- mangband-014/src/server/birth.c Sat Mar 29 15:20:10 1997 *************** *** 1818,1821 **** --- 1818,1840 ---- } + /* + * We are starting a "brand new" server. We need to initialze the unique + * info, so that they will be created. This function is only called if the + * server state savefile could not be loaded. + */ + void server_birth(void) + { + int i; + + for (i = 0; i < MAX_R_IDX; i++) + { + /* Make sure we have a unique */ + if (!(r_info[i].flags1 & RF1_UNIQUE)) + continue; + + /* Set his maximum creation number */ + r_info[i].max_num = 1; + } + } diff -w -r -c mangband-013/src/server/cave.c mangband-014/src/server/cave.c *** mangband-013/src/server/cave.c Sun Mar 23 18:02:23 1997 --- mangband-014/src/server/cave.c Sun Apr 20 00:29:31 1997 *************** *** 1213,1218 **** --- 1213,1227 ---- /* Dump the map */ for (y = p_ptr->panel_row_min; y <= p_ptr->panel_row_max; y++) { + dispy = y - p_ptr->panel_row_prt; + + /* First clear the old stuff */ + for (x = 0; x < 80; x++) + { + p_ptr->scr_info[dispy][x].c = 0; + p_ptr->scr_info[dispy][x].a = 0; + } + /* Scan the columns of row "y" */ for (x = p_ptr->panel_col_min; x <= p_ptr->panel_col_max; x++) { *************** *** 1226,1232 **** if (!use_color) a = TERM_WHITE; dispx = x - p_ptr->panel_col_prt; - dispy = y - p_ptr->panel_row_prt; /* Efficiency -- Redraw that grid of the map */ if (p_ptr->scr_info[dispy][dispx].c != c || p_ptr->scr_info[dispy][dispx].a != a) --- 1235,1240 ---- *************** *** 1233,1242 **** { p_ptr->scr_info[dispy][dispx].c = c; p_ptr->scr_info[dispy][dispx].a = a; - - (void)Send_char(Ind, dispx, dispy, a, c); } } } /* Display player */ --- 1241,1251 ---- { p_ptr->scr_info[dispy][dispx].c = c; p_ptr->scr_info[dispy][dispx].a = a; } } + + /* Send that line of info */ + Send_line_info(Ind, dispy); } /* Display player */ *************** *** 1462,1471 **** { p_ptr->scr_info[y][x].c = tc; p_ptr->scr_info[y][x].a = ta; - - (void)Send_char(Ind, x, y, ta, tc); } } } --- 1471,1481 ---- { p_ptr->scr_info[y][x].c = tc; p_ptr->scr_info[y][x].a = ta; } } + + /* Send that line of info */ + Send_line_info(Ind, y); } *************** *** 1484,1489 **** --- 1494,1501 ---- * Display a "small-scale" map of the dungeon for the player * * Currently, the "player" is displayed on the map. XXX XXX XXX + * + * Actually, the "player" is NOT displayed on the map. XXX XXX XXX */ void do_cmd_view_map(int Ind) { *************** *** 1511,1516 **** --- 1523,1529 ---- /* Wait for it */ /*put_str("Hit any key to continue", 23, 23);*/ + #if 0 /* Player */ if (TRUE) { *************** *** 1538,1543 **** --- 1551,1557 ---- (void)Send_char(Ind, cx, cy, a, c); } } + #endif /* Hilite the player */ /*move_cursor(cy, cx);*/ diff -w -r -c mangband-013/src/server/cmd1.c mangband-014/src/server/cmd1.c *** mangband-013/src/server/cmd1.c Sun Mar 23 04:37:28 1997 --- mangband-014/src/server/cmd1.c Fri Apr 18 23:35:35 1997 *************** *** 1074,1090 **** /* Get the monster */ m_ptr = &m_list[c_ptr->m_idx]; /* Bump into other players */ if (c_ptr->p_idx) { ! msg_format(Ind, "You bump into %s.", Players[c_ptr->p_idx]->name); ! msg_format(c_ptr->p_idx, "%s bumps into you.", p_ptr->name); /* Disturb both parties */ disturb(Ind, 1, 0); ! disturb(c_ptr->p_idx, 1, 0); } /* Hack -- attack monsters */ else if (c_ptr->m_idx) --- 1074,1124 ---- /* Get the monster */ m_ptr = &m_list[c_ptr->m_idx]; + /* Save "last direction moved" */ + p_ptr->last_dir = dir; /* Bump into other players */ if (c_ptr->p_idx) { ! player_type *q_ptr = Players[c_ptr->p_idx]; ! int Ind2 = c_ptr->p_idx; + /* If both want to switch, do it */ + if ((ddy[q_ptr->last_dir] == -(ddy[dir])) && (ddx[q_ptr->last_dir] == (-ddx[dir]))) + { + c_ptr->p_idx = Ind; + cave[Depth][p_ptr->py][p_ptr->px].p_idx = Ind2; + + q_ptr->py = p_ptr->py; + q_ptr->px = p_ptr->px; + + p_ptr->py = y; + p_ptr->px = x; + + /* Tell both of them */ + msg_format(Ind, "You switch places with %s.", q_ptr->name); + msg_format(Ind2, "You switch places with %s.", p_ptr->name); + + /* Disturb both of them */ + disturb(Ind, 1, 0); + disturb(Ind2, 1, 0); + + /* Re-show both grids */ + everyone_lite_spot(Depth, p_ptr->py, p_ptr->px); + everyone_lite_spot(Depth, q_ptr->py, q_ptr->px); + } + + else + { + /* Tell both about it */ + msg_format(Ind, "You bump into %s.", q_ptr->name); + msg_format(Ind2, "%s bumps into you.", p_ptr->name); + /* Disturb both parties */ disturb(Ind, 1, 0); ! disturb(Ind2, 1, 0); } + } /* Hack -- attack monsters */ else if (c_ptr->m_idx) diff -w -r -c mangband-013/src/server/cmd5.c mangband-014/src/server/cmd5.c *** mangband-013/src/server/cmd5.c Sun Mar 23 04:39:50 1997 --- mangband-014/src/server/cmd5.c Thu Mar 27 12:26:16 1997 *************** *** 690,695 **** --- 690,701 ---- /* Access the spell */ s_ptr = &p_ptr->mp_ptr->info[j]; + /* Check mana */ + if (s_ptr->smana > p_ptr->csp) + { + msg_print(Ind, "You do not have enough mana."); + return; + } /* Spell failure chance */ chance = spell_chance(Ind, j); *************** *** 1137,1142 **** --- 1143,1151 ---- /* Gain experience */ gain_exp(Ind, e * s_ptr->slevel); + + /* Fix the spell info */ + p_ptr->window |= PW_SPELL; } } *************** *** 1351,1356 **** --- 1360,1368 ---- } gain_exp(Ind, e * s_ptr->slevel); + + /* Fix the spell info */ + p_ptr->window |= PW_SPELL; } p_ptr->energy_use = 100; *************** *** 1540,1545 **** --- 1552,1563 ---- /* Access the spell */ s_ptr = &p_ptr->mp_ptr->info[j]; + /* Check mana */ + if (s_ptr->smana > p_ptr->csp) + { + msg_print(Ind, "You do not have enough mana."); + return; + } /* Spell failure chance */ chance = spell_chance(Ind, j); *************** *** 1964,1969 **** --- 1982,1990 ---- /* Gain experience */ gain_exp(Ind, e * s_ptr->slevel); + + /* Fix the spell info */ + p_ptr->window |= PW_SPELL; } } *************** *** 2073,2078 **** --- 2094,2102 ---- } gain_exp(Ind, e * s_ptr->slevel); + + /* Fix the spell info */ + p_ptr->window |= PW_SPELL; } p_ptr->energy_use = 100; diff -w -r -c mangband-013/src/server/cmd6.c mangband-014/src/server/cmd6.c *** mangband-013/src/server/cmd6.c Sun Mar 23 04:42:57 1997 --- mangband-014/src/server/cmd6.c Wed Apr 16 12:14:22 1997 *************** *** 2760,2765 **** --- 2760,2884 ---- break; } + /* All of the following are needed if we tried zapping one of */ + /* these but we didn't know what it was. */ + case SV_ROD_DETECT_TRAP: + { + if (detect_trap(Ind)) ident = TRUE; + o_ptr->pval = 50; + break; + } + + case SV_ROD_DETECT_DOOR: + { + if (detect_sdoor(Ind)) ident = TRUE; + o_ptr->pval = 70; + break; + } + + case SV_ROD_IDENTIFY: + { + ident = TRUE; + if (!ident_spell(Ind)) use_charge = FALSE; + o_ptr->pval = 10; + break; + } + + case SV_ROD_RECALL: + { + if (p_ptr->word_recall == 0) + { + msg_print(Ind, "The air about you becomes charged..."); + p_ptr->word_recall = 15 + randint(20); + } + else + { + msg_print(Ind, "A tension leaves the air around you..."); + p_ptr->word_recall = 0; + } + ident = TRUE; + o_ptr->pval = 60; + break; + } + + case SV_ROD_ILLUMINATION: + { + if (lite_area(Ind, damroll(2, 8), 2)) ident = TRUE; + o_ptr->pval = 30; + break; + } + + case SV_ROD_MAPPING: + { + map_area(Ind); + ident = TRUE; + o_ptr->pval = 99; + break; + } + + case SV_ROD_DETECTION: + { + detection(Ind); + ident = TRUE; + o_ptr->pval = 99; + break; + } + + case SV_ROD_PROBING: + { + probing(Ind); + ident = TRUE; + o_ptr->pval = 50; + break; + } + + case SV_ROD_CURING: + { + if (set_blind(Ind, 0)) ident = TRUE; + if (set_poisoned(Ind, 0)) ident = TRUE; + if (set_confused(Ind, 0)) ident = TRUE; + if (set_stun(Ind, 0)) ident = TRUE; + if (set_cut(Ind, 0)) ident = TRUE; + o_ptr->pval = 999; + break; + } + + case SV_ROD_HEALING: + { + if (hp_player(Ind, 500)) ident = TRUE; + if (set_stun(Ind, 0)) ident = TRUE; + if (set_cut(Ind, 0)) ident = TRUE; + o_ptr->pval = 999; + break; + } + + case SV_ROD_RESTORATION: + { + if (restore_level(Ind)) ident = TRUE; + if (do_res_stat(Ind, A_STR)) ident = TRUE; + if (do_res_stat(Ind, A_INT)) ident = TRUE; + if (do_res_stat(Ind, A_WIS)) ident = TRUE; + if (do_res_stat(Ind, A_DEX)) ident = TRUE; + if (do_res_stat(Ind, A_CON)) ident = TRUE; + if (do_res_stat(Ind, A_CHR)) ident = TRUE; + o_ptr->pval = 999; + break; + } + + case SV_ROD_SPEED: + { + if (!p_ptr->fast) + { + if (set_fast(Ind, randint(30) + 15)) ident = TRUE; + } + else + { + (void)set_fast(Ind, p_ptr->fast + 5); + } + o_ptr->pval = 99; + break; + } + default: { msg_print(Ind, "SERVER ERROR: Tried to zap non-directional rod in directional function!"); *************** *** 3532,3538 **** /* Mistake */ ! msg_print(Ind, "SERVER ERROR: Oops. That object cannot be activated."); } --- 3651,3657 ---- /* Mistake */ ! msg_print(Ind, "That object cannot be activated."); } diff -w -r -c mangband-013/src/server/dungeon.c mangband-014/src/server/dungeon.c *** mangband-013/src/server/dungeon.c Sun Mar 23 19:30:44 1997 --- mangband-014/src/server/dungeon.c Sat Apr 19 20:38:22 1997 *************** *** 545,550 **** --- 545,561 ---- /*** Process the monsters ***/ + /* Check for creature generation */ + if (rand_int(MAX_M_ALLOC_CHANCE) == 0) + { + /* Set the monster generation depth */ + monster_level = p_ptr->dun_depth; + + /* Make a new monster */ + (void)alloc_monster(p_ptr->dun_depth, MAX_SIGHT + 5, FALSE); + } + + /*** Damage over Time ***/ /* Take damage from poison */ *************** *** 1469,1510 **** /* Everybody has left a level that is still generated */ if (players_on_depth[j] == 0 && cave[j]) { ! int k; ! ! /* Delete any monsters on that level */ ! wipe_m_list(j); ! ! /* Delete any objects on that level */ ! wipe_o_list(j); ! ! /* Free up the space taken up by that level */ ! for (k = 0; k < MAX_HGT; k++) ! { ! /* Deallocate that row */ ! C_FREE(cave[j][k], MAX_WID, cave_type); } - - /* Deallocate the base level */ - C_FREE(cave[j], MAX_HGT, cave_type *); - - /* Set that level to "ungenerated" */ - cave[j] = NULL; } - } /* Somebody has entered an ungenerated level */ if (players_on_depth[Depth] && !cave[Depth]) { ! /* Allocate the base level */ ! C_MAKE(cave[Depth], MAX_HGT, cave_type *); - for (j = 0; j < MAX_HGT; j++) - { - /* Allocate one row of that level */ - C_MAKE(cave[Depth][j], MAX_WID, cave_type); - } - /* Generate a dungeon level there */ generate_cave(Depth); } --- 1480,1497 ---- /* Everybody has left a level that is still generated */ if (players_on_depth[j] == 0 && cave[j]) { ! /* Destroy the level */ ! dealloc_dungeon_level(j); } } /* Somebody has entered an ungenerated level */ if (players_on_depth[Depth] && !cave[Depth]) { ! /* Allocate space for it */ ! alloc_dungeon_level(Depth); /* Generate a dungeon level there */ generate_cave(Depth); } *************** *** 1601,1606 **** --- 1588,1594 ---- forget_view(i); forget_lite(i); update_view(i); + update_lite(i); /* Clear the flag */ p_ptr->new_level_flag = FALSE; *************** *** 1721,1727 **** if (!load_server_info()) { /* Oops */ ! quit("broken savefile(s)"); } /* Nothing loaded */ --- 1709,1715 ---- if (!load_server_info()) { /* Oops */ ! quit("broken server savefile(s)"); } /* Nothing loaded */ *************** *** 1805,1811 **** /* Initialize server state information */ /*player_birth();*/ ! /*server_birth();*/ /* Hack -- enter the world */ turn = 1; --- 1793,1799 ---- /* Initialize server state information */ /*player_birth();*/ ! server_birth(); /* Hack -- enter the world */ turn = 1; *************** *** 1859,1873 **** /* Make a town if necessary */ if (!server_dungeon) { ! /* But first we need some memory for it */ ! C_MAKE(cave[0], MAX_HGT, cave_type *); - for (i = 0; i < MAX_HGT; i++) - { - /* Allocate one row of the town level */ - C_MAKE(cave[0][i], MAX_WID, cave_type); - } - /* Actually generate the town */ generate_cave(0); } --- 1847,1855 ---- /* Make a town if necessary */ if (!server_dungeon) { ! /* Allocate space for it */ ! alloc_dungeon_level(0); /* Actually generate the town */ generate_cave(0); } diff -w -r -c mangband-013/src/server/externs.h mangband-014/src/server/externs.h *** mangband-013/src/server/externs.h Sun Mar 23 14:33:04 1997 --- mangband-014/src/server/externs.h Sat Apr 19 21:30:40 1997 *************** *** 361,366 **** --- 361,367 ---- /* birth.c */ extern bool player_birth(int Ind, cptr name, cptr pass, int conn, int race, int class, int sex); + extern void server_birth(void); /* cave.c */ extern int distance(int y1, int x1, int y2, int x2); *************** *** 510,515 **** --- 511,518 ---- extern void signals_init(void); /* generate.c */ + extern void alloc_dungeon_level(int Depth); + extern void dealloc_dungeon_level(int Depth); extern void generate_cave(int Depth); /* init-txt.c */ *************** *** 602,607 **** --- 605,611 ---- extern int Send_item_request(int Ind); extern int Send_state(int Ind, bool paralyzed, bool searching); extern int Send_flush(int Ind); + extern int Send_line_info(int Ind, int y); extern void Handle_direction(int Ind, int dir); *************** *** 866,871 **** --- 870,876 ---- extern void gain_exp(int Ind, s32b amount); extern void lose_exp(int Ind, s32b amount); extern void monster_death(int Ind, int m_idx); + extern void player_death(int Ind); extern bool mon_take_hit(int Ind, int m_idx, int dam, bool *fear, cptr note); extern void panel_bounds(int Ind); extern void verify_panel(int Ind); *************** *** 874,879 **** --- 879,886 ---- extern void ang_sort(int Ind, vptr u, vptr v, int n); extern void ang_sort_swap_distance(int Ind, vptr u, vptr v, int a, int b); extern bool ang_sort_comp_distance(int Ind, vptr u, vptr v, int a, int b); + extern bool ang_sort_comp_value(int Ind, vptr u, vptr v, int a, int b); + extern void ang_sort_swap_value(int Ind, vptr u, vptr v, int a, int b); extern bool target_able(int Ind, int m_idx); extern bool target_okay(int Ind); extern s16b target_pick(int Ind, int y1, int x1, int dy, int dx); diff -w -r -c mangband-013/src/server/generate.c mangband-014/src/server/generate.c *** mangband-013/src/server/generate.c Sun Mar 23 14:51:45 1997 --- mangband-014/src/server/generate.c Sat Apr 19 20:40:10 1997 *************** *** 3698,3705 **** --- 3698,3751 ---- } } + /* + * Allocate the space needed for a dungeon level + */ + void alloc_dungeon_level(int Depth) + { + int i; + /* Allocate the array of rows */ + C_MAKE(cave[Depth], MAX_HGT, cave_type *); + /* Allocate each row */ + for (i = 0; i < MAX_HGT; i++) + { + /* Allocate it */ + C_MAKE(cave[Depth][i], MAX_WID, cave_type); + } + } + + /* + * Deallocate the space needed for a dungeon level + */ + void dealloc_dungeon_level(int Depth) + { + int i; + + /* Delete any monsters on that level */ + wipe_m_list(Depth); + + /* Delete any objects on that level */ + wipe_o_list(Depth); + + /* Free up the space taken by each row */ + for (i = 0; i < MAX_HGT; i++) + { + /* Dealloc that row */ + C_FREE(cave[Depth][i], MAX_WID, cave_type); + } + + /* Deallocate the array of rows */ + C_FREE(cave[Depth], MAX_HGT, cave_type *); + + /* Set that level to "ungenerated" */ + cave[Depth] = NULL; + } + + + + /* * Generates a random dungeon level -RAK- * diff -w -r -c mangband-013/src/server/monster2.c mangband-014/src/server/monster2.c *** mangband-013/src/server/monster2.c Mon Mar 24 05:45:52 1997 --- mangband-014/src/server/monster2.c Tue Mar 25 20:47:46 1997 *************** *** 289,294 **** --- 289,297 ---- if (m_ptr->dun_depth == Depth) delete_monster_idx(i); } + + /* Compact the monster list */ + compact_monsters(0); } *************** *** 1613,1623 **** */ bool alloc_monster(int Depth, int dis, int slp) { ! int y, x; /* Find a legal, distant, unoccupied, space */ ! while (1) { /* Pick a location */ y = rand_int(Depth ? MAX_HGT : SCREEN_HGT); x = rand_int(Depth ? MAX_WID : SCREEN_WID); --- 1616,1631 ---- */ bool alloc_monster(int Depth, int dis, int slp) { ! int y, x, i, d, min_dis = 999; ! int tries = 0; ! player_type *p_ptr; /* Find a legal, distant, unoccupied, space */ ! while (tries < 50) { + /* Increase the counter */ + tries++; + /* Pick a location */ y = rand_int(Depth ? MAX_HGT : SCREEN_HGT); x = rand_int(Depth ? MAX_WID : SCREEN_WID); *************** *** 1624,1638 **** /* Require "naked" floor grid */ if (!cave_naked_bold(Depth, y, x)) continue; - else break; - /* Accept far away grids */ ! /* FIXME: This needs to be fixed so that it is far away */ ! /* from every player */ ! /*if (distance(y, x, py, px) > dis) break;*/ } /*printf("Trying to place a monster at %d, %d.\n", y, x);*/ /* Attempt to place the monster, allow groups */ --- 1632,1663 ---- /* Require "naked" floor grid */ if (!cave_naked_bold(Depth, y, x)) continue; /* Accept far away grids */ ! for (i = 1; i < NumPlayers + 1; i++) ! { ! p_ptr = Players[i]; ! ! /* Skip him if he's not playing */ ! if (p_ptr->conn == NOT_CONNECTED) ! continue; ! ! /* Skip him if he's not on this depth */ ! if (p_ptr->dun_depth != Depth) ! continue; ! ! if ((d = distance(y, x, p_ptr->py, p_ptr->px)) < min_dis) ! min_dis = d; } + if (min_dis >= dis) + break; + } + + /* Abort */ + if (tries >= 50) + return (FALSE); + /*printf("Trying to place a monster at %d, %d.\n", y, x);*/ /* Attempt to place the monster, allow groups */ Only in mangband-013/src/server: net.c diff -w -r -c mangband-013/src/server/netserver.c mangband-014/src/server/netserver.c *** mangband-013/src/server/netserver.c Sun Mar 23 14:55:40 1997 --- mangband-014/src/server/netserver.c Sun Apr 20 16:35:01 1997 *************** *** 252,257 **** --- 252,264 ---- /* Append the version number */ sprintf(temp, "Version: %d.%d.%d ", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); + + /* Append the additional version info */ + if (VERSION_EXTRA == 1) + strcat(temp, "alpha"); + if (VERSION_EXTRA == 2) + strcat(temp, "beta"); + strcat(buf, temp); /* If we haven't setup the meta connection yet, abort */ *************** *** 262,268 **** Packet_printf(&meta_buf, "%s", buf); ! if ((bytes = DgramSend(MetaSocket, "jello.mit.edu", 8800, meta_buf.buf, meta_buf.len) == -1)) { printf("Couldn't send info to meta-server!\n"); return FALSE; --- 269,275 ---- Packet_printf(&meta_buf, "%s", buf); ! if ((bytes = DgramSend(MetaSocket, "mangband.mit.edu", 8800, meta_buf.buf, meta_buf.len) == -1)) { printf("Couldn't send info to meta-server!\n"); return FALSE; *************** *** 428,437 **** --- 435,449 ---- nick_name[sizeof(nick_name) - 1] = '\0'; host_name[sizeof(host_name) - 1] = '\0'; + /*printf("Received contact from %s:%d.\n", host_name, port);*/ + status = Enter_player(real_name, nick_name, host_addr, host_name, race, class, sex, version, port, &login_port); Sockbuf_clear(&ibuf); + + /*printf("Sending login port %d, status %d.\n", login_port, status);*/ + Packet_printf(&ibuf, "%c%c%d", reply_to, status, login_port); Reply(host_addr, port); *************** *** 502,511 **** } ! /* Delete a player's information and save his game */ static void Delete_player(int Ind) { player_type *p_ptr = Players[Ind]; /* There's nobody on this space anymore */ cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px].p_idx = 0; --- 514,526 ---- } ! /* ! * Delete a player's information and save his game ! */ static void Delete_player(int Ind) { player_type *p_ptr = Players[Ind]; + int i; /* There's nobody on this space anymore */ cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px].p_idx = 0; *************** *** 520,528 **** --- 535,583 ---- /* Show everyone his disappearance */ everyone_lite_spot(p_ptr->dun_depth, p_ptr->py, p_ptr->px); + /* If he was the last one on his level, delete that level */ + if (players_on_depth[p_ptr->dun_depth] == 0 && p_ptr->dun_depth > 0) + dealloc_dungeon_level(p_ptr->dun_depth); + /* Try to save his character */ save_player(Ind); + /* If he was actively playing, tell everyone that he's left */ + if (p_ptr->alive && !p_ptr->death) + { + for (i = 1; i < NumPlayers + 1; i++) + { + if (Players[i]->conn == NOT_CONNECTED) + continue; + + /* Don't tell him about himself */ + if (i == Ind) continue; + + /* Send a little message */ + msg_format(i, "%s has left the game.", p_ptr->name); + } + } + + if (p_ptr->death) + { + for (i = 1; i < NumPlayers + 1; i++) + { + if (Players[i]->conn == NOT_CONNECTED) + continue; + + /* Don't tell him about himself */ + if (i == Ind) continue; + + /* Send a message */ + msg_format(i, "%s has died.", p_ptr->name); + } + + /* Drop his stuff */ + player_death(Ind); + } + + + /* Swap entry number 'Ind' with the last one */ p_ptr = Players[NumPlayers]; Players[NumPlayers] = Players[Ind]; *************** *** 908,913 **** --- 963,977 ---- num_logins++; + /* Tell everyone about our new player */ + for (i = 1; i < NumPlayers; i++) + { + if (Players[i]->conn == NOT_CONNECTED) + continue; + + msg_format(i, "%s has entered the game.", p_ptr->name); + } + /* Tell the meta server about the new player */ Report_to_meta(META_UPDATE); *************** *** 1053,1066 **** /* Update the player's lit area */ update_lite(i); /* Flush the output buffers */ if (connp->w.len > 0) { if (Sockbuf_flush(&connp->w) == -1) return -1; Sockbuf_clear(&connp->w); } - } /* Every fifteen seconds, update the info sent to the metaserver */ if (!(turn % (15 * FPS))) --- 1117,1146 ---- /* Update the player's lit area */ update_lite(i); + if (connp->c.len > 0 && connp->w.len < MAX_RELIABLE_DATA_PACKET_SIZE) + { + if (Send_reliable(Players[i]->conn) == -1) + return -1; + /* if (connp->w.len == 0) + return 1; */ + } + + /* Tell the client that this is the end */ + if (Packet_printf(&connp->w, "%c", PKT_END) <= 0) + { + Destroy_connection(Players[i]->conn, "write error"); + continue; + } + /* Flush the output buffers */ if (connp->w.len > 0) { if (Sockbuf_flush(&connp->w) == -1) return -1; + } + Sockbuf_clear(&connp->w); } /* Every fifteen seconds, update the info sent to the metaserver */ if (!(turn % (15 * FPS))) *************** *** 1196,1206 **** connp->acks >>= 1; todo = max_todo; ! for (i = 0; i <= connp->acks && todo > 0; i++) { len = (todo > max_packet_size) ? max_packet_size : todo; ! if (Packet_printf(&connp->w, "%c%hd%ld%ld", PKT_RELIABLE, ! len, rel_off, turn) <= 0 || Sockbuf_write(&connp->w, read_buf, len) != len) { plog("Cannot write reliable data"); --- 1276,1287 ---- connp->acks >>= 1; todo = max_todo; ! ! for (i = 0; /*i <= connp->acks &&*/ todo > 0; i++) { len = (todo > max_packet_size) ? max_packet_size : todo; ! if (Packet_printf(&connp->w, "%c%hd%ld%ld%ld", PKT_RELIABLE, ! len, rel_off, turn, max_todo) <= 0 || Sockbuf_write(&connp->w, read_buf, len) != len) { plog("Cannot write reliable data"); *************** *** 1207,1212 **** --- 1288,1294 ---- Destroy_connection(ind, "write error"); return -1; } + if ((n = Sockbuf_flush(&connp->w)) < len) { if (n == 0 && (errno == EWOULDBLOCK *************** *** 1446,1452 **** ind, connp->state, connp->id)); return 0; } ! return Packet_printf(&connp->c, "%c%hu%hu%hu", PKT_CHAR_INFO, race, class, sex); } int Send_various(int ind, int hgt, int wgt, int age, int sc) --- 1528,1534 ---- ind, connp->state, connp->id)); return 0; } ! return Packet_printf(&connp->c, "%c%hd%hd%hd", PKT_CHAR_INFO, race, class, sex); } int Send_various(int ind, int hgt, int wgt, int age, int sc) *************** *** 1722,1729 **** } /* Clip end of msg if too long */ ! strncpy(buf, msg, 79); ! buf[79] = '\0'; return Packet_printf(&connp->c, "%c%s", PKT_MESSAGE, buf); } --- 1804,1811 ---- } /* Clip end of msg if too long */ ! strncpy(buf, msg, 78); ! buf[78] = '\0'; return Packet_printf(&connp->c, "%c%s", PKT_MESSAGE, buf); } *************** *** 1779,1785 **** --- 1861,1894 ---- return Packet_printf(&connp->c, "%c", PKT_FLUSH); } + int Send_line_info(int ind, int y) + { + connection_t *connp = &Conn[Players[ind]->conn]; + int x; + if (!BIT(connp->state, CONN_PLAYING | CONN_READY)) + { + errno = 0; + plog(format("Connection not ready for line info (%d.%d.%d)", + ind, connp->state, connp->id)); + return 0; + } + + Packet_printf(&connp->c, "%c%hd", PKT_LINE_INFO, y); + + for (x = 0; x < 80; x++) + { + Packet_printf(&connp->c, "%c%c", Players[ind]->scr_info[y][x].c, + Players[ind]->scr_info[y][x].a); + } + + /* Hack -- Prevent buffer overruns by flushing after each line sent */ + Send_reliable(Players[ind]->conn); + + return 1; + } + + static int Receive_walk(int ind) { connection_t *connp = &Conn[ind]; *************** *** 1803,1809 **** --- 1912,1924 ---- /* Hack -- handle confusion */ if (Players[player]->confused) + { + dir = 5; + + /* Prevent walking nowhere */ + while (dir == 5) dir = rand_int(9) + 1; + } if (connp->id != -1 && Players[GetInd[connp->id]]->energy >= 100) do_cmd_walk(GetInd[connp->id], dir, TRUE); *************** *** 1965,1972 **** char ch; ! int n, player, item, amt; if (connp->id != -1) player = GetInd[connp->id]; if ((n = Packet_scanf(&connp->r, "%c%hd%hd", &ch, &item, &amt)) <= 0) --- 2080,2089 ---- char ch; ! s16b item, amt; + int n, player; + if (connp->id != -1) player = GetInd[connp->id]; if ((n = Packet_scanf(&connp->r, "%c%hd%hd", &ch, &item, &amt)) <= 0) *************** *** 2347,2354 **** char ch; ! int n, player, item; if (connp->id != -1) player = GetInd[connp->id]; if ((n = Packet_scanf(&connp->r, "%c%hd", &ch, &item)) <= 0) --- 2464,2473 ---- char ch; ! s16b item; + int n, player; + if (connp->id != -1) player = GetInd[connp->id]; if ((n = Packet_scanf(&connp->r, "%c%hd", &ch, &item)) <= 0) *************** *** 2500,2506 **** } if (connp->id != -1) ! prt_map(GetInd[connp->id]); return 1; } --- 2619,2625 ---- } if (connp->id != -1) ! do_cmd_view_map(GetInd[connp->id]); return 1; } *************** *** 2724,2730 **** { connection_t *connp = &Conn[ind]; ! char ch, buf[1024]; int i, n, player; --- 2843,2849 ---- { connection_t *connp = &Conn[ind]; ! char ch, buf[1024], player_name[80], *ptr; int i, n, player; *************** *** 2740,2747 **** --- 2859,2889 ---- if (connp->id != -1 && buf[0]) { + + /* Message to a single player */ for (i = 1; i < NumPlayers + 1; i++) { + if (Players[i]->conn == NOT_CONNECTED) + continue; + if (i == player) + continue; + + strcpy(player_name, Players[i]->name); + strcat(player_name, ":"); + + /* Check if "name:" exists in the string */ + if ((ptr = strstr(buf, player_name))) + { + msg_format(i, "[%s:%s] %s", Players[player]->name, Players[i]->name, ptr + strlen(player_name) + 1); + + /* Leave the function */ + return (TRUE); + } + } + + /* Otherwise, send it to everyone */ + for (i = 1; i < NumPlayers + 1; i++) + { if (Players[i]->conn == NOT_CONNECTED) continue; if (i == player) diff -w -r -c mangband-013/src/server/object2.c mangband-014/src/server/object2.c *** mangband-013/src/server/object2.c Sun Mar 23 04:31:04 1997 --- mangband-014/src/server/object2.c Thu Mar 27 20:57:12 1997 *************** *** 22,27 **** --- 22,28 ---- void delete_object_idx(int o_idx) { object_type *o_ptr = &o_list[o_idx]; + int i; int y = o_ptr->iy; int x = o_ptr->ix; *************** *** 37,42 **** --- 38,49 ---- /* Object is gone */ c_ptr->o_idx = 0; + /* No one can see it anymore */ + for (i = 1; i < NumPlayers + 1; i++) + { + Players[i]->obj_vis[o_idx] = FALSE; + } + /* Visual update */ everyone_lite_spot(Depth, y, x); } *************** *** 75,81 **** */ void compact_objects(int size) { ! int i, y, x, num, cnt; int cur_lev, cur_dis, chance; --- 82,88 ---- */ void compact_objects(int size) { ! int i, y, x, num, cnt, Ind; int cur_lev, cur_dis, chance; *************** *** 166,171 **** --- 173,186 ---- /* Structure copy */ o_list[i] = o_list[o_max]; + /* Copy the visiblity flags for each player */ + for (Ind = 1; Ind < NumPlayers + 1; Ind++) + { + if (Players[Ind]->conn == NOT_CONNECTED) continue; + + Players[Ind]->obj_vis[i] = Players[Ind]->obj_vis[o_max]; + } + /* Wipe the hole */ WIPE(&o_list[o_max], object_type); } *************** *** 222,227 **** --- 237,245 ---- /* Delete it */ delete_object_idx(i); } + + /* Compact the object list */ + compact_objects(0); } *************** *** 3149,3154 **** --- 3167,3173 ---- { cave_type *c_ptr; object_type *o_ptr; + int i; o_ptr = &o_list[o_idx]; *************** *** 3171,3177 **** --- 3190,3206 ---- /* Cheat -- peek at items */ /*if (cheat_peek) object_mention(o_ptr);*/ } + + /* Make sure no one sees it at first */ + for (i = 1; i < NumPlayers + 1; i++) + { + if (Players[i]->conn == NOT_CONNECTED) + continue; + + /* He can't see it */ + Players[i]->obj_vis[o_idx] = FALSE; } + } } diff -w -r -c mangband-013/src/server/save.c mangband-014/src/server/save.c *** mangband-013/src/server/save.c Sun Mar 23 14:28:43 1997 --- mangband-014/src/server/save.c Mon Mar 24 21:52:56 1997 *************** *** 2488,2496 **** (version_patch != sf_patch)) { /* Message */ ! msg_format(Ind, "Converted a %d.%d.%d savefile.", sf_major, sf_minor, sf_patch); - msg_print(Ind, NULL); } /* Player is dead */ --- 2488,2495 ---- (version_patch != sf_patch)) { /* Message */ ! printf("Converted a %d.%d.%d savefile.\n", sf_major, sf_minor, sf_patch); } /* Player is dead */ Only in mangband-013/src/server: socklib.c diff -w -r -c mangband-013/src/server/spells1.c mangband-014/src/server/spells1.c *** mangband-013/src/server/spells1.c Mon Mar 24 04:41:32 1997 --- mangband-014/src/server/spells1.c Sat Apr 19 12:37:15 1997 *************** *** 301,306 **** --- 301,312 ---- p_ptr->py = y; p_ptr->px = x; + /* The player isn't here anymore */ + cave[Depth][oy][ox].p_idx = 0; + + /* The player is now here */ + cave[Depth][y][x].p_idx = Ind; + /* Redraw the old spot */ everyone_lite_spot(Depth, oy, ox); *************** *** 4274,4279 **** --- 4280,4287 ---- player_type *p_ptr = Players[j]; int dispy, dispx; byte attr; + int k; + bool flag = TRUE; if (p_ptr->conn == NOT_CONNECTED) continue; *************** *** 4302,4307 **** --- 4310,4322 ---- drawn = TRUE; + for (k = 0; k <= num_can_see; k++) + { + if (who_can_see[k] == j) + flag = FALSE; + } + + if (flag) who_can_see[num_can_see++] = j; } } diff -w -r -c mangband-013/src/server/spells2.c mangband-014/src/server/spells2.c *** mangband-013/src/server/spells2.c Sun Mar 23 04:34:48 1997 --- mangband-014/src/server/spells2.c Wed Apr 16 22:49:04 1997 *************** *** 942,948 **** *w_ptr |= CAVE_MARK; /* Redraw */ ! everyone_lite_spot(Depth, y, x); } } --- 942,948 ---- *w_ptr |= CAVE_MARK; /* Redraw */ ! lite_spot(Ind, y, x); } } *************** *** 960,966 **** *w_ptr |= CAVE_MARK; /* Redraw */ ! everyone_lite_spot(Depth, y, x); } /* Notice gold */ --- 960,966 ---- *w_ptr |= CAVE_MARK; /* Redraw */ ! lite_spot(Ind, y, x); } /* Notice gold */ *************** *** 976,982 **** p_ptr->obj_vis[c_ptr->o_idx] = TRUE; /* Redraw */ ! everyone_lite_spot(Depth, y, x); } } } --- 976,982 ---- p_ptr->obj_vis[c_ptr->o_idx] = TRUE; /* Redraw */ ! lite_spot(Ind, y, x); } } } diff -w -r -c mangband-013/src/server/tables.c mangband-014/src/server/tables.c *** mangband-013/src/server/tables.c Fri Mar 14 15:08:52 1997 --- mangband-014/src/server/tables.c Thu Apr 3 17:54:11 1997 *************** *** 10,17 **** * included in all such copies. */ - #define SERVER - #include "angband.h" --- 10,15 ---- diff -w -r -c mangband-013/src/server/xtra1.c mangband-014/src/server/xtra1.c *** mangband-013/src/server/xtra1.c Sun Mar 23 04:32:01 1997 --- mangband-014/src/server/xtra1.c Fri Mar 28 10:03:52 1997 *************** *** 2361,2366 **** --- 2361,2368 ---- /* Character is in "icky" mode, no screen updates */ /*if (character_icky) return;*/ + /* Character has changed depth very recently, no screen updates */ + if (p_ptr->new_level_flag) return; if (p_ptr->update & PU_UN_LITE) { diff -w -r -c mangband-013/src/server/xtra2.c mangband-014/src/server/xtra2.c *** mangband-013/src/server/xtra2.c Sat Mar 22 23:50:55 1997 --- mangband-014/src/server/xtra2.c Fri Mar 28 22:47:26 1997 *************** *** 2054,2061 **** --- 2054,2088 ---- } + /* + * Handle the death of a player and drop their stuff. + */ + void player_death(int Ind) + { + player_type *p_ptr = Players[Ind]; + int i; + /* Setup the sorter */ + ang_sort_comp = ang_sort_comp_value; + ang_sort_swap = ang_sort_swap_value; + /* Sort the player's inventory according to value */ + ang_sort(Ind, p_ptr->inventory, NULL, INVEN_TOTAL); + + /* Starting with the most valuable, drop things one by one */ + for (i = 0; i < INVEN_TOTAL; i++) + { + /* Make sure we have an object */ + if (p_ptr->inventory[i].tval == 0) + continue; + + /* Drop this one */ + drop_near(&p_ptr->inventory[i], 0, p_ptr->dun_depth, p_ptr->py, p_ptr->px); + } + } + + + /* * Decreases monsters hit points, handling monster death. * *************** *** 2502,2508 **** --- 2529,2570 ---- + /* + * Compare the values of two objects. + * + * Pointer "v" should not point to anything (it isn't used, anyway). + */ + bool ang_sort_comp_value(int Ind, vptr u, vptr v, int a, int b) + { + object_type *inven = (object_type *)u; + s32b va, vb; + if (inven[a].tval && inven[b].tval) + { + va = object_value(Ind, &inven[a]); + vb = object_value(Ind, &inven[b]); + + return (va >= vb); + } + + if (inven[a].tval) + return FALSE; + + return TRUE; + } + + + void ang_sort_swap_value(int Ind, vptr u, vptr v, int a, int b) + { + object_type *x = (object_type *)u; + object_type temp; + + temp = x[a]; + x[a] = x[b]; + x[b] = temp; + } + + /*** Targetting Code ***/