mirror of
https://github.com/tbamud/tbamud.git
synced 2026-01-30 12:55:16 +01:00
Merge remote-tracking branch 'origin/master' into bugfix/remove-warnings-before-2021-release
This commit is contained in:
commit
463dd52438
44 changed files with 1320 additions and 554 deletions
19
.github/workflows/build.yml
vendored
Normal file
19
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
name: C/C++ CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: configure
|
||||
run: ./configure
|
||||
- name: build
|
||||
run: cd src && touch .accepted && make
|
||||
85
.gitignore
vendored
85
.gitignore
vendored
|
|
@ -10,3 +10,88 @@ src/util/Makefile
|
|||
src/.accepted
|
||||
src/depend
|
||||
src/util/depend
|
||||
build/*
|
||||
!build/create_solution.bat
|
||||
!build/README.md
|
||||
|
||||
# Do not commit files from players
|
||||
lib/plrfiles/A-E/*
|
||||
lib/plrfiles/F-J/*
|
||||
lib/plrfiles/K-O/*
|
||||
lib/plrfiles/P-T/*
|
||||
lib/plrfiles/U-Z/*
|
||||
lib/plrfiles/ZZZ/*
|
||||
lib/plrfiles/index
|
||||
|
||||
# but do commit the placeholders
|
||||
!lib/plrfiles/A-E/00
|
||||
!lib/plrfiles/F-J/00
|
||||
!lib/plrfiles/K-O/00
|
||||
!lib/plrfiles/P-T/00
|
||||
!lib/plrfiles/U-Z/00
|
||||
!lib/plrfiles/ZZZ/00
|
||||
|
||||
# or vars
|
||||
lib/plrvars/A-E/*
|
||||
lib/plrvars/F-J/*
|
||||
lib/plrvars/K-O/*
|
||||
lib/plrvars/P-T/*
|
||||
lib/plrvars/U-Z/*
|
||||
lib/plrvars/ZZZ/*
|
||||
lib/plrvars/index
|
||||
|
||||
# except the placeholders
|
||||
!lib/plrvars/A-E/00
|
||||
!lib/plrvars/F-J/00
|
||||
!lib/plrvars/K-O/00
|
||||
!lib/plrvars/P-T/00
|
||||
!lib/plrvars/U-Z/00
|
||||
!lib/plrvars/ZZZ/00
|
||||
|
||||
# or objects
|
||||
lib/plrobjs/A-E/*
|
||||
lib/plrobjs/F-J/*
|
||||
lib/plrobjs/K-O/*
|
||||
lib/plrobjs/P-T/*
|
||||
lib/plrobjs/U-Z/*
|
||||
lib/plrobjs/ZZZ/*
|
||||
lib/plrobjs/index
|
||||
|
||||
# except the placeholders
|
||||
!lib/plrobjs/A-E/00
|
||||
!lib/plrobjs/F-J/00
|
||||
!lib/plrobjs/K-O/00
|
||||
!lib/plrobjs/P-T/00
|
||||
!lib/plrobjs/U-Z/00
|
||||
!lib/plrobjs/ZZZ/00
|
||||
|
||||
# also not autogenerated config file
|
||||
/lib/etc/config
|
||||
# or the list of last logins
|
||||
/lib/etc/last
|
||||
# or mail
|
||||
lib/etc/plrmail
|
||||
#or time
|
||||
lib/etc/time
|
||||
|
||||
# test object files, etc
|
||||
src/test/depend
|
||||
src/test/*.o
|
||||
src/test/testfile
|
||||
|
||||
|
||||
# ide etc.
|
||||
.vscode
|
||||
.project
|
||||
.settings
|
||||
.idea
|
||||
.cproject
|
||||
|
||||
# macOS generated files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
|
|
|||
15
build/README.md
Normal file
15
build/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
### Overview
|
||||
This guide describes how to build TbaMUD in the Visual Studio through the new experimental CMake environment.
|
||||
|
||||
### Prerequisites
|
||||
* [Visual Studio 2022+](https://visualstudio.microsoft.com/ru/vs/)
|
||||
* [CMake 3.27+](https://cmake.org/)
|
||||
|
||||
### Build Steps
|
||||
1. Goto the folder `src` and copy `conf.h.win` to `conf.h`.
|
||||
|
||||
2. Goto the folder `build` and execute `create_solution.bat`.
|
||||
|
||||
3. Open `build/circle.sln` in Visual Studio.
|
||||
|
||||
4. Compile and run.
|
||||
1
build/create_solution.bat
Normal file
1
build/create_solution.bat
Normal file
|
|
@ -0,0 +1 @@
|
|||
cmake -B . -S ..\src -G "Visual Studio 17 2022"
|
||||
71
configure
vendored
71
configure
vendored
|
|
@ -1227,18 +1227,28 @@ if eval "test \"`echo '$ac_cv_func_'crypt`\" = yes"; then
|
|||
cat >> confdefs.h <<\EOF
|
||||
#define CIRCLE_CRYPT 1
|
||||
EOF
|
||||
CRYPTLIB="-lcrypt"
|
||||
echo "CRYPTLIB set to: $CRYPTLIB" 1>&6
|
||||
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
|
||||
echo "configure:1235: checking for crypt in -lcrypt" >&5
|
||||
ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lcrypt $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
|
||||
echo "configure:1235: checking for crypt in -lcrypt" >&5
|
||||
|
||||
OS_NAME=$(uname)
|
||||
if [ "$OS_NAME" = "Darwin" ]; then
|
||||
# macOS: No need for -lcrypt
|
||||
CRYPTLIB=""
|
||||
echo "CRYPTLIB not needed on macOS" 1>&6
|
||||
else
|
||||
# Other systems (Linux): Use -lcrypt
|
||||
ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lcrypt $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1243 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
|
|
@ -1250,30 +1260,29 @@ int main() {
|
|||
crypt()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
LIBS="$ac_save_LIBS"
|
||||
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
cat >> confdefs.h <<\EOF
|
||||
if { (eval echo configure:1254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=no"
|
||||
fi
|
||||
rm -f conftest*
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
echo "$ac_t""yes" 1>&6
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define CIRCLE_CRYPT 1
|
||||
EOF
|
||||
CRYPTLIB="-lcrypt"
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
|
||||
CRYPTLIB="-lcrypt"
|
||||
echo "CRYPTLIB set to: $CRYPTLIB on Linux" 1>&6
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -257,6 +257,9 @@ http://tbamud.com
|
|||
All donated areas have been added to the latest version of tbaMUD. If you
|
||||
wish to donate some of your own work stop by the Builder Academy.
|
||||
|
||||
https://github.com/rds1983 has generated maps of all the existing areas,
|
||||
and they can be found here: https://mudmapbuilder.github.io/
|
||||
|
||||
2.3. I have questions about tbaMUD. Where should I go?
|
||||
|
||||
Stop by The Builder Academy at tbamud.com 9091 or the website at:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Updated: Apr 2007
|
||||
tbaMUD README
|
||||
-------------
|
||||
All requests for help or bugs should be reported to: builderacademy.net 9091.
|
||||
All requests for help or bugs should be reported to: tbamud.com 9091.
|
||||
|
||||
Information about CircleMUD can be found at the CircleMUD Home Page and FTP:
|
||||
http://www.circlemud.org
|
||||
|
|
|
|||
30
doc/act.txt
30
doc/act.txt
|
|
@ -24,7 +24,7 @@ Contents
|
|||
1.1 Overview
|
||||
The act() function is used to process and send strings of text to characters
|
||||
in a room. It can be used to send the same basic string to a number of
|
||||
characters filling in certain segments – designated by control characters –
|
||||
characters filling in certain segments – designated by control characters –
|
||||
in different ways, dependant on what each character can see and who each
|
||||
character is. Once the text string passed to the function has been parsed, it
|
||||
is capitalized and a newline is added to its tail.
|
||||
|
|
@ -38,17 +38,17 @@ struct obj_data *obj, const void *vict_obj, int type)
|
|||
These pieces are used as follows:
|
||||
|
||||
str: This is the basic string, a null terminated character array, including
|
||||
control characters (see section 1.4 on ‘Control Characters’), to be sent to
|
||||
control characters (see section 1.4 on ‘Control Characters’), to be sent to
|
||||
characters designated by the targets.
|
||||
|
||||
hide_invisible: A TRUE or FALSE value indicating whether or not to hide the
|
||||
entire output from any characters that cannot see the “performing character”.
|
||||
entire output from any characters that cannot see the “performing character”.
|
||||
|
||||
ch: The “performing character”. This is the character that the output string
|
||||
ch: The “performing character”. This is the character that the output string
|
||||
is associated with. The character is used to determine the room for the output
|
||||
of the action in question.
|
||||
|
||||
obj: An object (an actual item – obj_data) used in the course of the action.
|
||||
obj: An object (an actual item – obj_data) used in the course of the action.
|
||||
|
||||
vict_obj: This can be either a character involved in the action, another
|
||||
object, or even a predefined string of text.
|
||||
|
|
@ -73,7 +73,7 @@ The next parameter vict_objcan be a number of things ranging from a game object
|
|||
null terminated character array (char *).
|
||||
|
||||
Do note, however, that obj and vict_obj are both ignored if there is no control
|
||||
character reference (see section 1.4 ‘Control Characters’) to them and the type
|
||||
character reference (see section 1.4 ‘Control Characters’) to them and the type
|
||||
is set to TO_ROOM or TO_CHAR. In these cases, NULL should be supplied as the
|
||||
input to the function.
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ TO_CHAR: Finally, this option sends the output to the ch.
|
|||
|
||||
TO_SLEEP: This is a special option that must be combined with one of the above
|
||||
options. It tells act() that the output is to be sent even to characters that
|
||||
are sleeping. It is combined with a bitwise ‘or’. i.e. TO_VICT | TO_SLEEP.
|
||||
are sleeping. It is combined with a bitwise ‘or’. i.e. TO_VICT | TO_SLEEP.
|
||||
|
||||
When the string has been parsed, it is capitalized and a newline is added.
|
||||
|
||||
|
|
@ -105,20 +105,20 @@ In a manner similar to the printf() family of functions, act() uses control
|
|||
characters. However, instead of using the % symbol, act() uses the $ character
|
||||
to indicate control characters.
|
||||
|
||||
$n Write name, short description, or “someone”, for ch, depending on whether
|
||||
$n Write name, short description, or “someone”, for ch, depending on whether
|
||||
ch is a PC, a NPC, or an invisible PC/NPC.
|
||||
$N Like $n, except insert the text for vict_obj.*
|
||||
$m “him,” “her,” or “it,” depending on the gender of ch.
|
||||
$m “him,” “her,” or “it,” depending on the gender of ch.
|
||||
$M Like $m, for vict_obj.*
|
||||
$s “his,” “her,”or “it,” depending on the gender of ch.
|
||||
$s “his,” “her,”or “it,” depending on the gender of ch.
|
||||
$S Like $s, for vict_obj.*
|
||||
$e “he,” “she,” “it,” depending on the gender of ch.
|
||||
$e “he,” “she,” “it,” depending on the gender of ch.
|
||||
$E Like $e, for vict_obj.*
|
||||
$o Name or “something” for obj, depending on visibility.
|
||||
$o Name or “something” for obj, depending on visibility.
|
||||
$O Like $o, for vict_obj.*
|
||||
$p Short description or “something” for obj.
|
||||
$p Short description or “something” for obj.
|
||||
$P Like $p for vict_obj.*
|
||||
$a “an” or“a”, depending on the first character of obj’s name.
|
||||
$a “an” or“a”, depending on the first character of obj’s name.
|
||||
$A Like $a, for vict_obj.*
|
||||
$T Prints the string pointed to by vict_obj.*
|
||||
$F Processes the string pointed to by vict_obj with the fname() function prior
|
||||
|
|
@ -129,7 +129,7 @@ no action is taken.
|
|||
$U Processes the buffer and uppercases the first letter of the following word
|
||||
(the word immediately after to the control code). If there is no following
|
||||
word, no action is taken.
|
||||
$$ Print the character ‘$’.
|
||||
$$ Print the character ‘$’.
|
||||
|
||||
NOTE*: vict_obj must be a pointer of type struct char_data *.
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ to players in color in the tbaMUD game engine. Its intended audience is for
|
|||
Coders of tbaMUD.
|
||||
|
||||
tbaMUD allows you to create colorful messages by using ANSI control sequences.
|
||||
Each player may select what “level” of color he/she desires from the four
|
||||
levels “off,” “brief,” “normal,” and “complete.” Each player can select his/her
|
||||
Each player may select what “level” of color he/she desires from the four
|
||||
levels “off,” “brief,” “normal,” and “complete.” Each player can select his/her
|
||||
color level by using the TOGGLE COLOR command from within the MUD; you as the
|
||||
programmer must decide which messages will be colored for each of the color
|
||||
levels.
|
||||
|
|
@ -21,17 +21,17 @@ All files in which you wish to use color must have the line:
|
|||
|
||||
This should be put in after all other includes in the beginning of the file.
|
||||
|
||||
There are 8 colors available – “normal,” red, green, yellow, blue, magenta,
|
||||
There are 8 colors available – “normal,” red, green, yellow, blue, magenta,
|
||||
cyan and white. They are accessible by sending control sequences as part of
|
||||
another string, for example:
|
||||
|
||||
sprintf(buf, "If you’re %shappy%s and you know it clap "
|
||||
sprintf(buf, "If you’re %shappy%s and you know it clap "
|
||||
"%d of your hands.\n\r", x, y, num_of_hands);
|
||||
send_to_char(ch, buf);
|
||||
|
||||
In this example, x and y are the “on” and “off” sequences for the color you
|
||||
want. There are 2 main series of color macros available for you to use (don’t
|
||||
actually use “x” and “y,” of course!): the K series and the CC series. The CC
|
||||
In this example, x and y are the “on” and “off” sequences for the color you
|
||||
want. There are 2 main series of color macros available for you to use (don’t
|
||||
actually use “x” and “y,” of course!): the K series and the CC series. The CC
|
||||
(Conditional Color) series is recommended for most general use.
|
||||
|
||||
The name of the actual sequence starts with the name of its series, plus a
|
||||
|
|
@ -51,21 +51,21 @@ CCBLU() (arguments defined below).
|
|||
|
||||
The K series requires no arguments, and is simply a macro to the ANSI color
|
||||
code. Therefore, if you use a K-series color code, the color will ALWAYS be
|
||||
sent, even if the person you’re sending it to has color off. This can very bad.
|
||||
sent, even if the person you’re sending it to has color off. This can very bad.
|
||||
Some people who do not have ANSI-compatible terminals will see garbage
|
||||
characters instead of colors. If the terminal correctly ignores ANSI color
|
||||
codes, then nothing will show up on their screen at all. The K series is mainly
|
||||
used to print colors to a string if the player’s color level will later be
|
||||
used to print colors to a string if the player’s color level will later be
|
||||
tested manually (for an example, see do_gen_com in act.comm.c).
|
||||
|
||||
The recommended series is the CC series (i.e. CCNRM(), CCRED(), etc.) The CC
|
||||
series macros require two arguments – a pointer to the character to whom the
|
||||
series macros require two arguments – a pointer to the character to whom the
|
||||
string is being sent, and the minimum color level the player must be set to in
|
||||
order to see the color. Color sent as 'brief' (formerly known as sparse it was
|
||||
changed for consistency with the syslog command) (C_SPR) will be seen by people
|
||||
with color set to sparse, normal, or complete; color sent as ‘normal’ (C_NRM)
|
||||
with color set to sparse, normal, or complete; color sent as ‘normal’ (C_NRM)
|
||||
will be seen only by people with color set to normal or complete; color sent as
|
||||
‘complete’ (C_CMP) will be seen only by people with color set to complete.
|
||||
‘complete’ (C_CMP) will be seen only by people with color set to complete.
|
||||
|
||||
To illustrate the above, an example is in order:
|
||||
|
||||
|
|
@ -76,29 +76,29 @@ ACMD(do_showcolor)
|
|||
{
|
||||
char buf[300];
|
||||
|
||||
sprintf(buf, "Don’t you just love %scolor%s, %scolor%s, " "%sCOLOR%s!\n\r",
|
||||
sprintf(buf, "Don’t you just love %scolor%s, %scolor%s, " "%sCOLOR%s!\n\r",
|
||||
CCBLU(ch, C_CMP), CCNRM(ch, C_CMP), CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
|
||||
CCRED(ch, C_SPR), CCNRM(ch, C_SPR));
|
||||
send_to_char(ch, buf);
|
||||
}
|
||||
|
||||
What does this do? For people with color set to Complete, it prints:
|
||||
Don’t you just love color, color, COLOR! (blue) (yellow) (red)
|
||||
Don’t you just love color, color, COLOR! (blue) (yellow) (red)
|
||||
|
||||
People who have color set to Normal will see:
|
||||
Don’t you just love color, color, COLOR! (yellow) (red)
|
||||
Don’t you just love color, color, COLOR! (yellow) (red)
|
||||
|
||||
People who have color set to Sparse will see:
|
||||
Don’t you just love color, color, COLOR! (red)
|
||||
Don’t you just love color, color, COLOR! (red)
|
||||
|
||||
People who have color set to Off will see:
|
||||
Don’t you just love color, color, COLOR! (no color, as you’d expect)
|
||||
Don’t you just love color, color, COLOR! (no color, as you’d expect)
|
||||
|
||||
There are several common pitfalls with using the CC series of color macros:
|
||||
|
||||
Do not confuse CCNRM with C_NRM. CCNRM() is a macro to turn the color back to
|
||||
normal; C_NRMis a color level of “normal.” Always make sure that every pair of
|
||||
“on” and “off” codes are at the same color level. For example:
|
||||
normal; C_NRMis a color level of “normal.” Always make sure that every pair of
|
||||
“on” and “off” codes are at the same color level. For example:
|
||||
|
||||
WRONG: sprintf(buf, "%sCOLOR%s\n\r", CCBLU(ch, C_NRM), CCNRM(ch, C_CMP));
|
||||
|
||||
|
|
@ -110,14 +110,14 @@ WRONG: sprintf(buf, "%sCOLOR%s\n\r", CCBLU(ch, C_CMP), CCNRM(ch, C_NRM));
|
|||
|
||||
The above statement is also wrong, although not as bad. In this case, someone
|
||||
with color set to Normal will (correctly) not get the CCBLU code, but will then
|
||||
unnecessarily get the CCNRM code. Never send a color code if you don’t have to.
|
||||
unnecessarily get the CCNRM code. Never send a color code if you don’t have to.
|
||||
The codes are several bytes long, and cause a noticeable pause at 2400 baud.
|
||||
|
||||
This should go without saying, but don’t ever send color at the C_OFF level.
|
||||
This should go without saying, but don’t ever send color at the C_OFF level.
|
||||
|
||||
Special precautions must be taken when sending a colored string to a large
|
||||
group of people. You can’t use the color level of “ch” (the person sending the
|
||||
string) – each person receiving the string must get a string appropriately
|
||||
group of people. You can’t use the color level of “ch” (the person sending the
|
||||
string) – each person receiving the string must get a string appropriately
|
||||
colored for his/her level. In such cases, it is usually best to set up two
|
||||
strings (one colored and one not), and test each player’s color level
|
||||
strings (one colored and one not), and test each player’s color level
|
||||
individually (see do_gen_comin act.comm.c for an example).
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ Builder Academy at telnet://tbamud.com:9091 or email rumble@tbamud.com -- Rumble
|
|||
The Art of Debugging
|
||||
Originally by Michael Chastain and Sammy
|
||||
|
||||
The following documentation is excerpted from Merc 2.0’s hacker.txt file. It
|
||||
The following documentation is excerpted from Merc 2.0’s hacker.txt file. It
|
||||
was written by Furey of MERC Industries and is included here with his
|
||||
permission. We have packaged it with tbaMUD (changed in a couple of places,
|
||||
such as specific filenames) because it offers good advice and insight into the
|
||||
art and science of software engineering. More information about tbaMUD,
|
||||
can be found at the tbaMUD home page http://tbamud.com.
|
||||
|
||||
1 “I’m running a Mud so I can learn C programming!”
|
||||
1 “I’m running a Mud so I can learn C programming!”
|
||||
|
||||
Yeah, right. The purpose of this document is to record some of our knowledge,
|
||||
experience and philosophy. No matter what your level, we hope that this
|
||||
|
|
@ -31,11 +31,11 @@ Play with it some more.
|
|||
Read documentation again.
|
||||
Get the idea?
|
||||
|
||||
The idea is that your mind can accept only so much “new data” in a single
|
||||
session. Playing with something doesn’t introduce very much new data, but it
|
||||
does transform data in your head from the “new” category to the “familiar”
|
||||
category. Reading documentation doesn’t make anything “familiar,” but it
|
||||
refills your “new” hopper.
|
||||
The idea is that your mind can accept only so much “new data” in a single
|
||||
session. Playing with something doesn’t introduce very much new data, but it
|
||||
does transform data in your head from the “new” category to the “familiar”
|
||||
category. Reading documentation doesn’t make anything “familiar,” but it
|
||||
refills your “new” hopper.
|
||||
|
||||
Most people, if they even read documentation in the first place, never return
|
||||
to it. They come to a certain minimum level of proficiency and then never
|
||||
|
|
@ -47,17 +47,17 @@ through the two-step learning cycle many times to master it.
|
|||
|
||||
man gives you online manual pages.
|
||||
|
||||
grep stands for “global regular expression print;” searches for strings in text
|
||||
grep stands for “global regular expression print;” searches for strings in text
|
||||
files.
|
||||
|
||||
vi, emacs, jove use whatever editor floats your boat, but learn the hell out
|
||||
of it; you should know every command in your editor.
|
||||
|
||||
ctags mags “tags” for your editor which allows you to go to functions by name
|
||||
ctags mags “tags” for your editor which allows you to go to functions by name
|
||||
in any source file.
|
||||
|
||||
>, >>, <, | input and output redirection at the command line; get someone to
|
||||
show you, or dig it out of “man csh”
|
||||
show you, or dig it out of “man csh”
|
||||
|
||||
These are the basic day-in day-out development tools. Developing without
|
||||
knowing how to use all of these well is like driving a car without knowing
|
||||
|
|
@ -70,21 +70,21 @@ the hypothesis, run the program and provide it experimental input, observe its
|
|||
behavior, and confirm or refute the hypothesis.
|
||||
|
||||
A good hypothesis is one which makes surprising predictions which then come
|
||||
true; predictions that other hypotheses don’t make.
|
||||
true; predictions that other hypotheses don’t make.
|
||||
|
||||
The first step in debugging is not to write bugs in the first place. This
|
||||
sounds obvious, but sadly, is all too often ignored.
|
||||
|
||||
If you build a program, and you get any errors or any warnings, you should fix
|
||||
them before continuing. C was designed so that many buggy ways of writing code
|
||||
are legal, but will draw warnings from a suitably smart compiler (such as “gcc”
|
||||
are legal, but will draw warnings from a suitably smart compiler (such as “gcc”
|
||||
with the -Wall flag enabled). It takes only minutes to check your warnings and
|
||||
to fix the code that generates them, but it takes hours to find bugs otherwise.
|
||||
|
||||
“Desk checking” (proof reading) is almost a lost art these days. Too bad. You
|
||||
“Desk checking” (proof reading) is almost a lost art these days. Too bad. You
|
||||
should desk check your code before even compiling it, and desk-check it again
|
||||
periodically to keep it fresh in mind and find new errors. If you have someone
|
||||
in your group whose only job it is to desk-check other people’s code, that
|
||||
in your group whose only job it is to desk-check other people’s code, that
|
||||
person will find and fix more bugs than everyone else combined.
|
||||
|
||||
One can desk-check several hundred lines of code per hour. A top-flight
|
||||
|
|
@ -95,20 +95,20 @@ fixing technique. Compare that to all the hours you spend screwing around with
|
|||
broken programs trying to find one bug at a time.
|
||||
|
||||
The next technique beyond desk-checking is the time-honored technique of
|
||||
inserting “print” statements into the code, and then watching the logged
|
||||
inserting “print” statements into the code, and then watching the logged
|
||||
values. Within tbaMUD code, you can call printf(), fprintf(), or log()to dump
|
||||
interesting values at interesting times. Where and when to dump these values
|
||||
is an art, which you will learn only with practice.
|
||||
|
||||
If you don’t already know how to redirect output in your operating system, now
|
||||
is the time to learn. On Unix, type the command “man csh”, and read the part
|
||||
about the “>” operator. You should also learn the difference between “standard
|
||||
output” (for example, output from “printf”) and “standard error” (for example,
|
||||
output from “fprintf(stderr, ...)”).
|
||||
If you don’t already know how to redirect output in your operating system, now
|
||||
is the time to learn. On Unix, type the command “man csh”, and read the part
|
||||
about the “>” operator. You should also learn the difference between “standard
|
||||
output” (for example, output from “printf”) and “standard error” (for example,
|
||||
output from “fprintf(stderr, ...)”).
|
||||
|
||||
Ultimately, you cannot fix a program unless you understand how it is operating
|
||||
in the first place. Powerful debugging tools will help you collect data, but
|
||||
they can’t interpret it, and they can’t fix the underlying problems. Only you
|
||||
they can’t interpret it, and they can’t fix the underlying problems. Only you
|
||||
can do that.
|
||||
|
||||
When you find a bug... your first impulse will be to change the code, kill the
|
||||
|
|
@ -117,9 +117,9 @@ observe is often just the symptom of a deeper bug. You should keep pursuing the
|
|||
bug, all the way down. You should grok the bug and cherish it in fullness
|
||||
before causing its discorporation.
|
||||
|
||||
Also, when finding a bug, ask yourself two questions: “What design and
|
||||
programming habits led to the introduction of the bug in the first place?” And:
|
||||
“What habits would systematically prevent the introduction of bugs like this?”
|
||||
Also, when finding a bug, ask yourself two questions: “What design and
|
||||
programming habits led to the introduction of the bug in the first place?” And:
|
||||
“What habits would systematically prevent the introduction of bugs like this?”
|
||||
|
||||
5 Debugging: Tools
|
||||
|
||||
|
|
@ -127,20 +127,20 @@ When a Unix process accesses an invalid memory location, or (more rarely)
|
|||
executes an illegal instruction, or (even more rarely) something else goes
|
||||
wrong, the Unix operating system takes control. The process is incapable of
|
||||
further execution and must be killed. Before killing the process, however, the
|
||||
operating system does something for you: it opens a file named “core” and
|
||||
operating system does something for you: it opens a file named “core” and
|
||||
writes the entire data space of the process into it.
|
||||
|
||||
Thus, “dumping core” is not a cause of problems, or even an effect of problems.
|
||||
It’s something the operating system does to help you find fatal problems which
|
||||
Thus, “dumping core” is not a cause of problems, or even an effect of problems.
|
||||
It’s something the operating system does to help you find fatal problems which
|
||||
have rendered your process unable to continue.
|
||||
|
||||
One reads a “core” file with a debugger. The two most popular debuggers on Unix
|
||||
One reads a “core” file with a debugger. The two most popular debuggers on Unix
|
||||
are adb and gdb, although occasionally one finds dbx. Typically one starts a
|
||||
debugger like this: “gdb bin/circle” or “gdb bin/circle lib/core”.
|
||||
debugger like this: “gdb bin/circle” or “gdb bin/circle lib/core”.
|
||||
|
||||
The first thing, and often the only thing, you need to do inside the debugger
|
||||
is take a stack trace. In adb, the command for this is “$c”. In gdb, the
|
||||
command is “backtrace”. In dbx, the command is “where”. The stack trace will
|
||||
is take a stack trace. In adb, the command for this is “$c”. In gdb, the
|
||||
command is “backtrace”. In dbx, the command is “where”. The stack trace will
|
||||
tell you what function your program was in when it crashed, and what functions
|
||||
were calling it. The debugger will also list the arguments to these functions.
|
||||
Interpreting these arguments, and using more advanced debugger features,
|
||||
|
|
@ -343,12 +343,12 @@ new tools.
|
|||
|
||||
7 Profiling
|
||||
|
||||
Another useful technique is “profiling,” to find out where your program is
|
||||
Another useful technique is “profiling,” to find out where your program is
|
||||
spending most of its time. This can help you to make a program more efficient.
|
||||
|
||||
Here is how to profile a program:
|
||||
|
||||
1. Remove all the .o files and the “circle” executable:
|
||||
1. Remove all the .o files and the “circle” executable:
|
||||
make clean
|
||||
|
||||
2. Edit your Makefile, and change the PROFILE=line:
|
||||
|
|
@ -359,25 +359,25 @@ make
|
|||
|
||||
4. Run circle as usual. Shutdown the game with the shutdown command when you
|
||||
have run long enough to get a good profiling base under normal usage
|
||||
conditions. If you crash the game, or kill the process externally, you won’t
|
||||
conditions. If you crash the game, or kill the process externally, you won’t
|
||||
get profiling information.
|
||||
|
||||
5. Run the profcommand:
|
||||
prof bin/circle > prof.out
|
||||
|
||||
6. Read prof.out. Run “man prof” to understand the format of the output. For
|
||||
advanced profiling, you can use “PROFILE = -pg” in step 2, and use the “gprof”
|
||||
command in step 5. The “gprof” form of profiling gives you a report which lists
|
||||
6. Read prof.out. Run “man prof” to understand the format of the output. For
|
||||
advanced profiling, you can use “PROFILE = -pg” in step 2, and use the “gprof”
|
||||
command in step 5. The “gprof” form of profiling gives you a report which lists
|
||||
exactly how many times any function calls any other function. This information
|
||||
is valuable for debugging as well as performance analysis.
|
||||
|
||||
Availability of “prof” and “gprof” varies from system to system. Almost every
|
||||
Unix system has “prof”. Only some systems have “gprof”.
|
||||
Availability of “prof” and “gprof” varies from system to system. Almost every
|
||||
Unix system has “prof”. Only some systems have “gprof”.
|
||||
|
||||
7 Books for Serious Programmers
|
||||
|
||||
Out of all the thousands of books out there, three stand out:
|
||||
|
||||
Kernighan and Plaugher, “The Elements of Programming Style”
|
||||
Kernighan and Ritchie, “The C Programming Language”
|
||||
Brooks, “The Mythical Man Month”
|
||||
Kernighan and Plaugher, “The Elements of Programming Style”
|
||||
Kernighan and Ritchie, “The C Programming Language”
|
||||
Brooks, “The Mythical Man Month”
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Builder Academy at telnet://tbamud.com:9091 or email rumble@tbamud.com -- Rumble
|
|||
|
||||
tbaMUD File Manifest
|
||||
|
||||
The main ‘tbaMUD/’ directory has the following subdirectories and files:
|
||||
The main ‘tbaMUD/’ directory has the following subdirectories and files:
|
||||
|
||||
autorun - Shell script to run the MUD (./autorun &).
|
||||
FAQ - Frequently Aske Questions with answers.
|
||||
|
|
@ -16,7 +16,7 @@ lib/ - MUD data.
|
|||
log/ - System logs.
|
||||
src/ - Source code.
|
||||
|
||||
The bin/directory contains only binaries: ‘circle’ (the main MUD) and its
|
||||
The bin/directory contains only binaries: ‘circle’ (the main MUD) and its
|
||||
utilities, which are described in utils.txt.
|
||||
|
||||
The doc/ directory has its own README file, describing the contents of each
|
||||
|
|
@ -51,12 +51,12 @@ time - Where the MUD time is saved.
|
|||
|
||||
The lib/misc/ directory contains the following files:
|
||||
|
||||
bugs - Bugs reported by players with the ’bug’ command.
|
||||
ideas - Ideas from players from ’idea’ command.
|
||||
bugs - Bugs reported by players with the ’bug’ command.
|
||||
ideas - Ideas from players from ’idea’ command.
|
||||
messages - Spell and skill damage messages.
|
||||
socials - Text file with text of the socials.
|
||||
socials.new - New format of socials you can edit via AEDIT.
|
||||
typos - Typos reported by players with the ’typo’ command.
|
||||
typos - Typos reported by players with the ’typo’ command.
|
||||
xnames - Text file of invalid names.
|
||||
|
||||
The lib/plrobjs/ contains the following files and directories:
|
||||
|
|
@ -80,18 +80,18 @@ zzz/
|
|||
The lib/text/ directory contains the following files:
|
||||
|
||||
background - Background story (for option 3 from main menu).
|
||||
credits - Text for ’credits’ command.
|
||||
credits - Text for ’credits’ command.
|
||||
greetings - Greeting message.
|
||||
handbook - Text for Immortal Handbook (’handbook’ command).
|
||||
immlist - Text for ’immlist’ command.
|
||||
handbook - Text for Immortal Handbook (’handbook’ command).
|
||||
immlist - Text for ’immlist’ command.
|
||||
imotd - Immortal MOTD --seen by immortals on login.
|
||||
info - Text for ’info’ command.
|
||||
info - Text for ’info’ command.
|
||||
motd - MOTD --seen by mortals on login.
|
||||
news - Text for ’news’ command.
|
||||
policies - Text for ’policy’ command.
|
||||
wizlist - Text for ’wizlist’ command.
|
||||
/help/screen - Text for ’help’ command as a mortal with no arguments.
|
||||
/help/iscreen - Text for ’help’ command an an immortal with no arguments.
|
||||
news - Text for ’news’ command.
|
||||
policies - Text for ’policy’ command.
|
||||
wizlist - Text for ’wizlist’ command.
|
||||
/help/screen - Text for ’help’ command as a mortal with no arguments.
|
||||
/help/iscreen - Text for ’help’ command an an immortal with no arguments.
|
||||
|
||||
The lib/world/directory contains the following subdirectories:
|
||||
|
||||
|
|
@ -103,8 +103,8 @@ wld - Contains *.wld files (world files)
|
|||
zon - Contains *.zon files (zone files)
|
||||
|
||||
Each of the 6 subdirectories in the lib/world/ directory also contains two
|
||||
additional files – one called ‘index’, which specifies which files in that
|
||||
directory should be loaded when the MUD boots, and ‘index.mini’, which
|
||||
additional files – one called ‘index’, which specifies which files in that
|
||||
directory should be loaded when the MUD boots, and ‘index.mini’, which
|
||||
specifies which files should be loaded if the MUD is booted with the -m
|
||||
(mini-mud) option.
|
||||
|
||||
|
|
@ -128,6 +128,6 @@ trigger - Trigedit log messages.
|
|||
usage - Mud system usage (player load & memory usage info).
|
||||
|
||||
The src/ directory contains all of the C and header files for the MUD, along
|
||||
with a Makefile. The src/util/ directory contains source for tbaMUD’s utility
|
||||
with a Makefile. The src/util/ directory contains source for tbaMUD’s utility
|
||||
programs. See admin.txt for more information on how to compile the MUD. See
|
||||
utils.txt for more information on how to use tbaMUD’s utilities.
|
||||
utils.txt for more information on how to use tbaMUD’s utilities.
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@ every platform that exists. This document is for experienced programmers
|
|||
trying to make tbaMUD work on their platform.
|
||||
|
||||
tbaMUD should work on most UNIX platforms without any modifications; simply run
|
||||
the “configure” script and it should automatically detect what type of system
|
||||
the “configure” script and it should automatically detect what type of system
|
||||
you have and anything that may be strange about it. These findings are all
|
||||
stored in a header file called conf.h which is created in the src directory
|
||||
from a template called conf.h.in. A Makefile is also created from the template
|
||||
Makefile.in.
|
||||
|
||||
Non-UNIX platforms are a problem. Some can’t run tbaMUD at all. However, any
|
||||
Non-UNIX platforms are a problem. Some can’t run tbaMUD at all. However, any
|
||||
multitasking OS that has an ANSI C compiler, and supports non-blocking I/O and
|
||||
socket-based TCP/IP networking, should theoretically be able to run tbaMUD; for
|
||||
example, OS/2, AmigaOS, Mac OS (Classic versions; Mac OS X supports tbaMUD’s
|
||||
example, OS/2, AmigaOS, Mac OS (Classic versions; Mac OS X supports tbaMUD’s
|
||||
configure script from the command line), and all versions of Windows.
|
||||
|
||||
The port can be very easy or very difficult, depending mainly on whether or nor
|
||||
|
|
@ -26,7 +26,7 @@ your OS supports the Berkeley socket API.
|
|||
|
||||
The general steps for porting tbaMUD to a non-UNIX platform are listed below. A
|
||||
number of tips for porting can be found after the porting steps. Note that we
|
||||
have already ported tba to Windows, so if you’re confused as to how to perform
|
||||
have already ported tba to Windows, so if you’re confused as to how to perform
|
||||
some of these steps, you can look at what we have done as an example (see the
|
||||
files README.CYGWIN).
|
||||
|
||||
|
|
@ -36,11 +36,11 @@ trying to port the code.
|
|||
|
||||
Porting the Code
|
||||
|
||||
Step 1. Create a “conf.h” file for your system. Copy the template “conf.h.in”
|
||||
to “conf.h”, and then define or undefine each item as directed by the comments
|
||||
Step 1. Create a “conf.h” file for your system. Copy the template “conf.h.in”
|
||||
to “conf.h”, and then define or undefine each item as directed by the comments
|
||||
and based on the characteristics of your system. To write the conf.h file,
|
||||
you’ll need to know which header files are included with your system, the
|
||||
return type of signals, whether or not your compiler supports the ‘const’
|
||||
you’ll need to know which header files are included with your system, the
|
||||
return type of signals, whether or not your compiler supports the ‘const’
|
||||
keyword, and whether or not you have various functions such as crypt()and
|
||||
random(). Also, you can ignore the HAVE_LIBxxx and HAVE_xxx_PROTO constants at
|
||||
the end of conf.h.in; they are not used in the code (they are part of UNIX
|
||||
|
|
@ -58,12 +58,12 @@ be in the source file comm.c.
|
|||
|
||||
Step 4. Test your changes! Make sure that multiple people can log in
|
||||
simultaneously and that they can all type commands at the same time. No player
|
||||
should ever have a “frozen” screen just because another is waiting at a prompt.
|
||||
should ever have a “frozen” screen just because another is waiting at a prompt.
|
||||
Leave the MUD up for at least 24 hours, preferably with people playing it, to
|
||||
make sure that your changes are stable. Make sure that automatic events such as
|
||||
zone resets, point regeneration, and corpse decomposition are being timed
|
||||
correctly (a tick should be about 75 seconds). Try resetting all the zones
|
||||
repeatedly by typing “zr *” many times. Play the MUD and make sure that the
|
||||
repeatedly by typing “zr *” many times. Play the MUD and make sure that the
|
||||
basic commands (killing mobs as a mortal, casting spells, etc.) work correctly.
|
||||
|
||||
Step 5. If you are satisfied that your changes work correctly, you are
|
||||
|
|
@ -71,20 +71,20 @@ encouraged to submit them to be included as part of the tbaMUD distribution so
|
|||
that future releases of tbaMUD will support your platform. This prevents you
|
||||
from re-porting the code every time a new version is released and allows other
|
||||
people who use your platform to enjoy tbaMUD as well. To submit your changes
|
||||
you must make a patch file using the GNU ‘diff’ program. diff will create a
|
||||
patch file which can be later used with the ‘patch’ utility to incorporate
|
||||
you must make a patch file using the GNU ‘diff’ program. diff will create a
|
||||
patch file which can be later used with the ‘patch’ utility to incorporate
|
||||
your changes into the stock tbaMUD distribution. For example, if you have a
|
||||
copy of tbaMUD in the “stock-tba” directory, and your changes are in “my-tba”,
|
||||
copy of tbaMUD in the “stock-tba” directory, and your changes are in “my-tba”,
|
||||
you can create a patch file like this:
|
||||
|
||||
diff -u --new-file --recursive stock-tba/src my-tba/src > patch
|
||||
|
||||
This will create a file called ‘patch’ with your patches. You should then try
|
||||
to use the ‘patch’ program (the inverse of ‘diff’) on a copy of tbaMUD to make
|
||||
This will create a file called ‘patch’ with your patches. You should then try
|
||||
to use the ‘patch’ program (the inverse of ‘diff’) on a copy of tbaMUD to make
|
||||
sure that tbaMUD is correctly changed to incorporate your patches. This step is
|
||||
very important: if you don’t create these patches correctly, your work will be
|
||||
very important: if you don’t create these patches correctly, your work will be
|
||||
useless because no one will be able to figure out what you did! Make sure to
|
||||
read the documentation to ‘diff’ and ‘patch’ if you don’t understand how to use
|
||||
read the documentation to ‘diff’ and ‘patch’ if you don’t understand how to use
|
||||
them. If your patches work, CELEBRATE!!
|
||||
|
||||
Step 6. Write a README file for your operating system that describes everything
|
||||
|
|
@ -107,7 +107,7 @@ Each system to which tba is already ported has a CIRCLE_xx constant associated
|
|||
with it: CIRCLE_UNIX for plain vanilla UNIX tbaMUD, CIRCLE_WINDOWS for MS
|
||||
Windows, CIRCLE_OS2 for IBM OS/2, and CIRCLE_AMIGA for the Amiga. You must use
|
||||
a similar constant for your system. At the top of your conf.h, make sure to
|
||||
comment out “#define CIRCLE_UNIX” and add “#define CIRCLE_YOUR_SYSTEM”.
|
||||
comment out “#define CIRCLE_UNIX” and add “#define CIRCLE_YOUR_SYSTEM”.
|
||||
|
||||
3.2 ANSI C and GCC
|
||||
As long as your system has an ANSI C compiler, all of the code (except for
|
||||
|
|
@ -122,22 +122,22 @@ you use gcc.
|
|||
Make absolutely sure to use non-blocking I/O; i.e. make sure to enable the
|
||||
option so that the read() system call will immediately return with an error if
|
||||
there is no data available. If you do not use non-blocking I/O, read() will
|
||||
“block,” meaning it will wait infinitely for one particular player to type
|
||||
“block,” meaning it will wait infinitely for one particular player to type
|
||||
something even if other players are trying to enter commands. If your system
|
||||
does not implement non-blocking I/O correctly, try using the
|
||||
POSIX_NONBLOCK_BROKEN constant in sysdep.h.
|
||||
|
||||
3.4 Timing
|
||||
tbaMUD needs a fairly precise (on the order of 5 or 10 ms) timer in order to
|
||||
correctly schedule events such as zone resets, point regeneration (“ticks”),
|
||||
correctly schedule events such as zone resets, point regeneration (“ticks”),
|
||||
corpse decomposition, and other automatic tasks. If your system supports the
|
||||
select() system call with sufficient precision, the default timing code should
|
||||
work correctly. If not, you’ll have to find out which system calls your system
|
||||
work correctly. If not, you’ll have to find out which system calls your system
|
||||
supports for determining how much time has passed and replace the select()
|
||||
timing method.
|
||||
|
||||
3.5 Signals and Signal Handlers
|
||||
A note about signals: Most systems don’t support the concept of signals in the
|
||||
A note about signals: Most systems don’t support the concept of signals in the
|
||||
same way that UNIX does. Since signals are not a critical part of how tbaMUD
|
||||
works anyway (they are only used for updating the wizlist and some other
|
||||
trivial things), all signal handling is turned off by default when compiling
|
||||
|
|
@ -147,7 +147,7 @@ conf.h file and all signal code will be ignored automatically.
|
|||
|
||||
4 Final Note
|
||||
IMPORTANT: Remember to keep any changes you make surrounded by #ifdef
|
||||
statements (i.e. “#ifdef CIRCLE_WINDOWS ... #endif”). If you make absolutely
|
||||
statements (i.e. “#ifdef CIRCLE_WINDOWS ... #endif”). If you make absolutely
|
||||
sure to mark all of your changes with #ifdef statements, then your patches
|
||||
(once you get them to work) will be suitable for incorporation into the
|
||||
tbaMUD distribution, meaning that tbaMUD will officially support your platform.
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ to rec.games.mud.diku which originally announced CircleMUD as a publicly
|
|||
available MUD source code.
|
||||
|
||||
tbaMUD Release history:
|
||||
Version 2025 release: January, 2025
|
||||
Version 2023 release: January, 2023
|
||||
Version 2021 release: March, 2021
|
||||
Version 2020 release: January, 2020
|
||||
Version 2019 release: January, 2019
|
||||
|
|
@ -141,7 +143,7 @@ communication channels
|
|||
totally ignores all commands from that player until they are thawed.
|
||||
--Even handier DELETE flag allows you to delete players on the fly.
|
||||
--"set" command (mentioned above) allows you to freeze/unfreeze/
|
||||
delete/siteok/un-siteok players --even if they aren’t logged in!
|
||||
delete/siteok/un-siteok players --even if they aren’t logged in!
|
||||
--Bad password attempts are written to the system log and saved;
|
||||
if someone tries to hack your account, you see "4 LOGIN FAILURES
|
||||
SINCE LAST SUCCESSFUL LOGIN" next time you log on.
|
||||
|
|
|
|||
|
|
@ -110,12 +110,12 @@ is being specified. The command sort name is the shortest part of the command a
|
|||
player must type for it to match. The hide-flag can be either 0 or 1; if 1, the
|
||||
social is hidden from OTHERS if they cannot see the character performing the
|
||||
social. The action is not hidden from the VICTIM, even if s/he cannot see the
|
||||
character performing the social, although in such cases the character’s name
|
||||
will, of course, be replaced with “someone”. The min positions should be set to
|
||||
character performing the social, although in such cases the character’s name
|
||||
will, of course, be replaced with “someone”. The min positions should be set to
|
||||
dictate the minimum position a player must be in to target the victim and
|
||||
perform the social. Min level allows you to further customize who can use what
|
||||
socials.Where it makes sense to do so, text fields may be left empty. If
|
||||
editing manually you should by put a ‘#’ in the first column on the line. Aedit
|
||||
editing manually you should by put a ‘#’ in the first column on the line. Aedit
|
||||
does this automatically.
|
||||
|
||||
Examples:
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ older CircleMUD data files to the versions used in CircleMUD v3, while others
|
|||
are used to convert currently existing files into different formats.
|
||||
|
||||
Overall, these utilities have been created in an attempt to make the tbaMUD
|
||||
administrator’s life a bit easier, and to give the administrator some ideas of
|
||||
administrator’s life a bit easier, and to give the administrator some ideas of
|
||||
further and more grandiose utilities to create. Some are no longer applicable
|
||||
but are retained as examples.
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ the second, and so forth.
|
|||
The split utility is designed to split large world files into smaller, zone
|
||||
sized files that are easier to manage and maintain. The utility reads its input
|
||||
from the standard input and writes the output to files with names specified
|
||||
within the larger world file. This is done by inserting ‘=filename’ into the
|
||||
within the larger world file. This is done by inserting ‘=filename’ into the
|
||||
world file at the appropriate points, where filename is the name of the file
|
||||
for the following section.
|
||||
|
||||
|
|
@ -141,8 +141,8 @@ The command line syntax for autowiz is as follows:
|
|||
autowiz <wizlev> <wizlistfile> <immlev> <immlistfile> [pid to signal]
|
||||
|
||||
where <wizlev> is equal to whatever LVL_GOD is set to in your tbaMUD server,
|
||||
<wizlistfile> is the filename for the file containing the game’s Wizlist.
|
||||
<immlev> should be set to your game’s LVL_IMMORT, while <immlistfile>
|
||||
<wizlistfile> is the filename for the file containing the game’s Wizlist.
|
||||
<immlev> should be set to your game’s LVL_IMMORT, while <immlistfile>
|
||||
is the name of the Immlist file.
|
||||
|
||||
This utility must be recompiled if you make any changes to the player file structure.
|
||||
|
|
|
|||
|
|
@ -6109,7 +6109,7 @@ $n looks around for a victim to strangle.
|
|||
You throw yourself against $N's throat, trying to squeeze the life out.
|
||||
$n throws $mself after $N's throat.
|
||||
$n throws $mself after your throat, you try to defend yourself.
|
||||
AARGH! They must have left... #&%£@!
|
||||
AARGH! They must have left...
|
||||
You put your hands around your throat and stop breathing.
|
||||
$n tries to strangle $mself, making a very strange noise and getting blue in the face.
|
||||
You strangle $M $t.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
T B A M U D
|
||||
2 0 2 1
|
||||
2 0 2 5
|
||||
|
||||
Based on CircleMUD by Jeremy Elson and DikuMUD by Hans-Henrik Staerfeldt,
|
||||
Katja Nyboe, Tom Madsen, Michael Seifert, and Sebastian Hammer
|
||||
|
|
|
|||
|
|
@ -3292,7 +3292,7 @@ the earthquake spell.
|
|||
|
||||
See also: WATERWALK, EARTHQUAKE
|
||||
#0
|
||||
FOLLOWERS
|
||||
FOLLOWERS UNFOLLOW
|
||||
|
||||
Usage: follow <leader>
|
||||
|
||||
|
|
@ -3330,7 +3330,7 @@ The 3rd number is liquid type from the following:
|
|||
value 1: Initial drink units. Must be 1 or greater.
|
||||
value 2: see below
|
||||
value 3: 0 for not poisoned. Otherwise, the number of hours until the poison
|
||||
burns off?
|
||||
burns off.
|
||||
|
||||
value 2: The type of liquid in the drink-container, one of:
|
||||
|
||||
|
|
@ -9859,6 +9859,7 @@ tbalim test 61165
|
|||
return
|
||||
toggle nohassle on
|
||||
|
||||
To list empty zones "show zone none"
|
||||
To setup test with zone 348
|
||||
return
|
||||
saveall
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#30200
|
||||
The Top Of The Greasepole~
|
||||
You've made it to the top! All you have to do now is get down...
|
||||
The Top of the Greasepole~
|
||||
You've made it to the top! All you have to do now is get down.
|
||||
~
|
||||
302 4 0 0 0 5
|
||||
D5
|
||||
|
|
@ -9,6 +9,11 @@ It's a long slide down.
|
|||
~
|
||||
0 -1 30192
|
||||
E
|
||||
pole greasepole~
|
||||
The pole still looks pretty bad, but it doesn't look quite as bad as before.
|
||||
|
||||
~
|
||||
E
|
||||
info credits~
|
||||
See zone description room for Campus.
|
||||
Zone 302 is linked to the following zones:
|
||||
|
|
@ -48,11 +53,6 @@ Links: 64e to catacombs
|
|||
(Mobs Stay_Zone flags have all been disabled to allow free access between
|
||||
301, 302 and 303. Please ensure that any entrances into the area are flagged
|
||||
nomob to keep them in. - Parna for TBAMud.)
|
||||
~
|
||||
E
|
||||
pole greasepole~
|
||||
The pole still looks pretty bad, but it doesn't look quite as bad as before.
|
||||
|
||||
~
|
||||
S
|
||||
#30201
|
||||
|
|
@ -71,13 +71,13 @@ D2
|
|||
~
|
||||
0 -1 30142
|
||||
E
|
||||
mail~
|
||||
Why are you trying to look at the mail, it's private!
|
||||
~
|
||||
E
|
||||
hooks hook key keys~
|
||||
Unfortunately you don't see any keys hanging off of any of the hooks.
|
||||
~
|
||||
E
|
||||
mail~
|
||||
Why are you trying to look at the mail, it's private!
|
||||
~
|
||||
S
|
||||
#30202
|
||||
Main Office~
|
||||
|
|
@ -92,9 +92,10 @@ This way leads back to the reception desk.
|
|||
door~
|
||||
1 30103 30201
|
||||
E
|
||||
chair~
|
||||
The chair is not unusual in any way whatsoever. The chair is in excellent
|
||||
condition.
|
||||
filing cabinet files~
|
||||
Looking through the files you see that Wally World was originally slated to
|
||||
have at least eleven levels but the designers got sick and tired of it and gave
|
||||
up after just a few levels.
|
||||
~
|
||||
E
|
||||
desk~
|
||||
|
|
@ -102,10 +103,9 @@ desk~
|
|||
excellent condition.
|
||||
~
|
||||
E
|
||||
filing cabinet files~
|
||||
Looking through the files you see that Wally World was originally slated to
|
||||
have at least eleven levels but the designers got sick and tired of it and gave
|
||||
up after just a few levels.
|
||||
chair~
|
||||
The chair is not unusual in any way whatsoever. The chair is in excellent
|
||||
condition.
|
||||
~
|
||||
S
|
||||
#30203
|
||||
|
|
@ -230,14 +230,14 @@ You can't tell where this leads.
|
|||
door~
|
||||
1 -1 30210
|
||||
E
|
||||
door~
|
||||
The door on the west has the number 206 and the door on the east, 205.
|
||||
~
|
||||
E
|
||||
floor carpet~
|
||||
This is a nice, groovy, red patterned carpet which extends all the way down
|
||||
the hall.
|
||||
~
|
||||
E
|
||||
door~
|
||||
The door on the west has the number 206 and the door on the east, 205.
|
||||
~
|
||||
S
|
||||
#30209
|
||||
Private Room 205~
|
||||
|
|
@ -300,15 +300,15 @@ You can't tell where this leads.
|
|||
door~
|
||||
1 -1 30213
|
||||
E
|
||||
door~
|
||||
The door on the west has the number 204 and the door on the east, 203 while
|
||||
the door to the north has the number 201.
|
||||
~
|
||||
E
|
||||
floor carpet~
|
||||
This is a nice, groovy, red patterned carpet which extends all the way down
|
||||
the hall.
|
||||
~
|
||||
E
|
||||
door~
|
||||
The door on the west has the number 204 and the door on the east, 203 while
|
||||
the door to the north has the number 201.
|
||||
~
|
||||
S
|
||||
#30212
|
||||
Private Room 203~
|
||||
|
|
@ -388,14 +388,14 @@ You can't tell where this leads.
|
|||
door~
|
||||
1 -1 30217
|
||||
E
|
||||
door~
|
||||
The door on the west has the number 208 and the door on the east, 207.
|
||||
~
|
||||
E
|
||||
floor carpet~
|
||||
This is a nice, groovy, red patterned carpet which extends all the way down
|
||||
the hall.
|
||||
~
|
||||
E
|
||||
door~
|
||||
The door on the west has the number 208 and the door on the east, 207.
|
||||
~
|
||||
S
|
||||
#30216
|
||||
Private Room 207~
|
||||
|
|
@ -458,15 +458,15 @@ You can't tell where this leads.
|
|||
door~
|
||||
1 -1 30220
|
||||
E
|
||||
door~
|
||||
The door on the west has the number 210 and the door on the east, 209 and the
|
||||
door to the south has the number 202.
|
||||
~
|
||||
E
|
||||
floor carpet~
|
||||
This is a nice, groovy, red patterned carpet which extends all the way down
|
||||
the hall.
|
||||
~
|
||||
E
|
||||
door~
|
||||
The door on the west has the number 210 and the door on the east, 209 and the
|
||||
door to the south has the number 202.
|
||||
~
|
||||
S
|
||||
#30219
|
||||
Private Room 209~
|
||||
|
|
@ -654,14 +654,14 @@ The trapdoor leads up... beyond that, you aren't sure where it goes.
|
|||
trapdoor door~
|
||||
1 -1 30233
|
||||
E
|
||||
trapdoor~
|
||||
The trapdoor is neatly fastened with a small hook.
|
||||
~
|
||||
E
|
||||
desk chair plush~
|
||||
The desk and chairs are neatly arranged as if in preparation for an upcoming
|
||||
meeting or something of the sort.
|
||||
~
|
||||
E
|
||||
trapdoor~
|
||||
The trapdoor is neatly fastened with a small hook.
|
||||
~
|
||||
S
|
||||
#30229
|
||||
Hallway~
|
||||
|
|
@ -770,13 +770,13 @@ A chute leads down from this room.
|
|||
~
|
||||
0 -1 30235
|
||||
E
|
||||
chute~
|
||||
The chute is rather smooth and looks to be a fun ride.
|
||||
~
|
||||
E
|
||||
grate~
|
||||
Beyond the grate you can see the attic.
|
||||
~
|
||||
E
|
||||
chute~
|
||||
The chute is rather smooth and looks to be a fun ride.
|
||||
~
|
||||
S
|
||||
#30235
|
||||
The Chute~
|
||||
|
|
@ -871,13 +871,13 @@ An exit from this hellhole.
|
|||
~
|
||||
0 -1 30240
|
||||
E
|
||||
mess~
|
||||
Need you ask?
|
||||
~
|
||||
E
|
||||
hell hole hellhole~
|
||||
Never seen one before?
|
||||
~
|
||||
E
|
||||
mess~
|
||||
Need you ask?
|
||||
~
|
||||
S
|
||||
#30240
|
||||
The Ghetto~
|
||||
|
|
@ -897,13 +897,13 @@ A run-down house lies to the west.
|
|||
~
|
||||
0 -1 30239
|
||||
E
|
||||
house run-down~
|
||||
It's in bad shape.
|
||||
~
|
||||
E
|
||||
overturned police policemobile mobile~
|
||||
It is blocking the road quite nicely. Maybe it is meant to impede passage.
|
||||
~
|
||||
E
|
||||
house run-down~
|
||||
It's in bad shape.
|
||||
~
|
||||
S
|
||||
#30241
|
||||
The Ghetto Intersection~
|
||||
|
|
@ -1344,16 +1344,16 @@ The auditorium is to the north.
|
|||
~
|
||||
0 -1 30259
|
||||
E
|
||||
drab brown curtains curtain~
|
||||
They are just your average, everyday, drab brown curtains.
|
||||
sturdy wooden plank planks~
|
||||
They are sturdy. They are wooden. They are planks.
|
||||
~
|
||||
E
|
||||
cords cord pulley pulleys~
|
||||
Hey! It can make you look like you are flying!
|
||||
~
|
||||
E
|
||||
sturdy wooden plank planks~
|
||||
They are sturdy. They are wooden. They are planks.
|
||||
drab brown curtains curtain~
|
||||
They are just your average, everyday, drab brown curtains.
|
||||
~
|
||||
S
|
||||
#30262
|
||||
|
|
@ -1403,13 +1403,13 @@ It's the same stairwell.
|
|||
~
|
||||
0 -1 30257
|
||||
E
|
||||
cobweb cobwebs web webs~
|
||||
Don't disturb them now!
|
||||
~
|
||||
E
|
||||
huge stone door~
|
||||
The huge stone door looks very inviting.
|
||||
~
|
||||
E
|
||||
cobweb cobwebs web webs~
|
||||
Don't disturb them now!
|
||||
~
|
||||
S
|
||||
#30265
|
||||
The Grant Hall Clock~
|
||||
|
|
@ -1785,10 +1785,6 @@ It is too dark to tell.
|
|||
~
|
||||
0 -1 30276
|
||||
E
|
||||
door~
|
||||
This door is covered with all types of non-magical sigils.
|
||||
~
|
||||
E
|
||||
sigils~
|
||||
The sigils seem to form some strange shapes:
|
||||
SSSSS
|
||||
|
|
@ -1805,6 +1801,10 @@ sigils~
|
|||
SSSSS
|
||||
I wonder what it could be?
|
||||
~
|
||||
E
|
||||
door~
|
||||
This door is covered with all types of non-magical sigils.
|
||||
~
|
||||
S
|
||||
#30281
|
||||
A Classroom~
|
||||
|
|
@ -1851,13 +1851,13 @@ You are repulsed by this exit since the exit to the east is well lit.
|
|||
~
|
||||
0 -1 30274
|
||||
E
|
||||
light~
|
||||
It's nice, warm, and inviting.
|
||||
~
|
||||
E
|
||||
dark~
|
||||
Are you mad?
|
||||
~
|
||||
E
|
||||
light~
|
||||
It's nice, warm, and inviting.
|
||||
~
|
||||
S
|
||||
#30283
|
||||
The Exit~
|
||||
|
|
@ -1875,13 +1875,13 @@ Back into darkness, I don't think so!
|
|||
~
|
||||
0 -1 30282
|
||||
E
|
||||
light~
|
||||
It's nice, warm, and inviting.
|
||||
~
|
||||
E
|
||||
dark~
|
||||
Are you mad?
|
||||
~
|
||||
E
|
||||
light~
|
||||
It's nice, warm, and inviting.
|
||||
~
|
||||
S
|
||||
#30284
|
||||
Mob Chute A~
|
||||
|
|
@ -1916,10 +1916,6 @@ This is just an exit.
|
|||
~
|
||||
0 -1 30106
|
||||
E
|
||||
door~
|
||||
This door is covered with all types of non-magical sigils.
|
||||
~
|
||||
E
|
||||
sigils~
|
||||
The sigils seem to form some strange shapes:
|
||||
MMM MMM OOO OOO !!
|
||||
|
|
@ -1929,6 +1925,10 @@ sigils~
|
|||
MM M MM OO OO OO OO
|
||||
MM MM OOO OOO !!
|
||||
~
|
||||
E
|
||||
door~
|
||||
This door is covered with all types of non-magical sigils.
|
||||
~
|
||||
S
|
||||
#30285
|
||||
Mob Chute B~
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
Matrix of C.A.W.~
|
||||
Campus II~
|
||||
30200 30299 30 2
|
||||
R 0 30200 30112 -1 (a tam)
|
||||
O 1 30112 99 30200 (a tam)
|
||||
M 0 30105 4 30284 (Security)
|
||||
E 1 30115 99 16 (a flashlight)
|
||||
M 0 30105 4 30284 (Security)
|
||||
|
|
@ -32,8 +34,6 @@ M 0 30132 1 30284 (Chris)
|
|||
M 0 30137 1 30284 (Alex)
|
||||
M 0 30138 1 30284 (Steve)
|
||||
M 0 30145 10 30284 (a copy of Golden World)
|
||||
R 0 30200 30112 -1 (a tam)
|
||||
O 1 30112 99 30200 (a tam)
|
||||
M 0 30139 1 30245 (Bob the storekeeper)
|
||||
G 1 30136 99 -1 (a pale apple)
|
||||
G 1 30140 99 -1 (a can of PopCoke)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#4
|
||||
Unknown~
|
||||
Jade Forest~
|
||||
trunks shaoden~
|
||||
Rename~
|
||||
400 499 30 2 d 0 0 0 10 25
|
||||
M 0 481 1 481 (Zachary)
|
||||
G 1 403 99 -1 (rawhide whip)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#6
|
||||
Unknown~
|
||||
q~
|
||||
Sea of Souls~
|
||||
600 699 30 2 d 0 0 0 10 25
|
||||
M 0 600 1 600 (a snail)
|
||||
|
|
|
|||
81
power_curve.ipynb
Normal file
81
power_curve.ipynb
Normal file
File diff suppressed because one or more lines are too long
26
src/CMakeLists.txt
Normal file
26
src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
cmake_minimum_required(VERSION 3.27)
|
||||
|
||||
# Set the project name
|
||||
project(circle)
|
||||
|
||||
# Global definitions
|
||||
if(MSVC)
|
||||
# using Visual Studio C++
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif()
|
||||
|
||||
# circle itself
|
||||
file(GLOB CIRCLE_SOURCES
|
||||
"*.h"
|
||||
"*.c"
|
||||
)
|
||||
|
||||
add_executable(circle ${CIRCLE_SOURCES})
|
||||
|
||||
if(MSVC)
|
||||
target_link_libraries(circle wsock32.lib)
|
||||
|
||||
set_target_properties(circle PROPERTIES
|
||||
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/.."
|
||||
)
|
||||
endif()
|
||||
|
|
@ -20,8 +20,8 @@ CFLAGS = @CFLAGS@ $(MYFLAGS) $(PROFILE)
|
|||
|
||||
LIBS = @LIBS@ @CRYPTLIB@ @NETLIB@
|
||||
|
||||
SRCFILES := act.comm.c act.informative.c act.item.c act.movement.c act.offensive.c act.other.c act.social.c act.wizard.c aedit.c asciimap.c ban.c boards.c bsd-snprintf.c castle.c cedit.c class.c comm.c config.c constants.c db.c dg_comm.c dg_db_scripts.c dg_event.c dg_handler.c dg_misc.c dg_mobcmd.c dg_objcmd.c dg_olc.c dg_scripts.c dg_triggers.c dg_variables.c dg_wldcmd.c fight.c genmob.c genobj.c genolc.c genqst.c genshp.c genwld.c genzon.c graph.c handler.c hedit.c house.c ibt.c improved-edit.c interpreter.c limits.c lists.c magic.c mail.c medit.c mobact.c modify.c msgedit.c mud_event.c oasis.c oasis_copy.c oasis_delete.c oasis_list.c objsave.c oedit.c players.c prefedit.c protocol.c qedit.c quest.c random.c redit.c sedit.c shop.c spec_assign.c spec_procs.c spell_parser.c spells.c tedit.c utils.c weather.c zedit.c zmalloc.c
|
||||
OBJFILES := act.comm.o act.informative.o act.item.o act.movement.o act.offensive.o act.other.o act.social.o act.wizard.o aedit.o asciimap.o ban.o boards.o bsd-snprintf.o castle.o cedit.o class.o comm.o config.o constants.o db.o dg_comm.o dg_db_scripts.o dg_event.o dg_handler.o dg_misc.o dg_mobcmd.o dg_objcmd.o dg_olc.o dg_scripts.o dg_triggers.o dg_variables.o dg_wldcmd.o fight.o genmob.o genobj.o genolc.o genqst.o genshp.o genwld.o genzon.o graph.o handler.o hedit.o house.o ibt.o improved-edit.o interpreter.o limits.o lists.o magic.o mail.o medit.o mobact.o modify.o msgedit.o mud_event.o oasis.o oasis_copy.o oasis_delete.o oasis_list.o objsave.o oedit.o players.o prefedit.o protocol.o qedit.o quest.o random.o redit.o sedit.o shop.o spec_assign.o spec_procs.o spell_parser.o spells.o tedit.o utils.o weather.o zedit.o zmalloc.o
|
||||
SRCFILES := $(shell ls *.c | sort)
|
||||
OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
|
||||
|
||||
default: all
|
||||
|
||||
|
|
|
|||
56
src/Makefile.macOS
Normal file
56
src/Makefile.macOS
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# tbaMUD Makefile.in - Makefile template used by 'configure'
|
||||
# Clean-up provided by seqwith.
|
||||
|
||||
# C compiler to use
|
||||
CC = gcc
|
||||
|
||||
# Any special flags you want to pass to the compiler
|
||||
MYFLAGS = -Wall -Wno-char-subscripts -Wno-invalid-source-encoding -DMEMORY_DEBUG
|
||||
|
||||
#flags for profiling (see hacker.doc for more information)
|
||||
PROFILE =
|
||||
|
||||
##############################################################################
|
||||
# Do Not Modify Anything Below This Line (unless you know what you're doing) #
|
||||
##############################################################################
|
||||
|
||||
BINDIR = ../bin
|
||||
|
||||
CFLAGS = -g -O0 $(MYFLAGS) $(PROFILE)
|
||||
|
||||
LIBS =
|
||||
|
||||
SRCFILES := $(shell ls *.c | sort)
|
||||
OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
|
||||
|
||||
default: all
|
||||
|
||||
all: .accepted
|
||||
$(MAKE) $(BINDIR)/circle
|
||||
$(MAKE) utils
|
||||
|
||||
.accepted:
|
||||
@./licheck less
|
||||
|
||||
utils: .accepted
|
||||
(cd util; $(MAKE) all)
|
||||
|
||||
circle:
|
||||
$(MAKE) $(BINDIR)/circle
|
||||
|
||||
$(BINDIR)/circle : $(OBJFILES)
|
||||
$(CC) -o $(BINDIR)/circle $(PROFILE) $(OBJFILES) $(LIBS)
|
||||
|
||||
$%.o: %.c
|
||||
$(CC) $< $(CFLAGS) -c -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o depend
|
||||
|
||||
# Dependencies for the object files (automagically generated with
|
||||
# gcc -MM)
|
||||
|
||||
depend:
|
||||
$(CC) -MM *.c > depend
|
||||
|
||||
-include depend
|
||||
|
|
@ -51,7 +51,7 @@ static void perform_mortal_where(struct char_data *ch, char *arg);
|
|||
static void print_object_location(int num, struct obj_data *obj, struct char_data *ch, int recur);
|
||||
|
||||
/* Subcommands */
|
||||
/* For show_obj_to_char 'mode'. /-- arbitrary */
|
||||
/* For show_obj_to_char 'mode'. /-- arbitrary */
|
||||
#define SHOW_OBJ_LONG 0
|
||||
#define SHOW_OBJ_SHORT 1
|
||||
#define SHOW_OBJ_ACTION 2
|
||||
|
|
@ -125,7 +125,7 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod
|
|||
snprintf(notebuf, sizeof(notebuf), "There is something written on it:\r\n\r\n%s", obj->action_description);
|
||||
page_string(ch->desc, notebuf, TRUE);
|
||||
} else
|
||||
send_to_char(ch, "It's blank.\r\n");
|
||||
send_to_char(ch, "It's blank.\r\n");
|
||||
return;
|
||||
|
||||
case ITEM_DRINKCON:
|
||||
|
|
@ -225,14 +225,14 @@ static void diag_char_to_char(struct char_data *i, struct char_data *ch)
|
|||
byte percent;
|
||||
const char *text;
|
||||
} diagnosis[] = {
|
||||
{ 100, "is in excellent condition." },
|
||||
{ 90, "has a few scratches." },
|
||||
{ 75, "has some small wounds and bruises." },
|
||||
{ 50, "has quite a few wounds." },
|
||||
{ 30, "has some big nasty wounds and scratches." },
|
||||
{ 15, "looks pretty hurt." },
|
||||
{ 0, "is in awful condition." },
|
||||
{ -1, "is bleeding awfully from big wounds." },
|
||||
{ 100, "is in excellent condition." },
|
||||
{ 90, "has a few scratches." },
|
||||
{ 75, "has some small wounds and bruises." },
|
||||
{ 50, "has quite a few wounds." },
|
||||
{ 30, "has some big nasty wounds and scratches." },
|
||||
{ 15, "looks pretty hurt." },
|
||||
{ 0, "is in awful condition." },
|
||||
{ -1, "is bleeding awfully from big wounds." },
|
||||
};
|
||||
int percent, ar_index;
|
||||
const char *pers = PERS(i, ch);
|
||||
|
|
@ -240,7 +240,7 @@ static void diag_char_to_char(struct char_data *i, struct char_data *ch)
|
|||
if (GET_MAX_HIT(i) > 0)
|
||||
percent = (100 * GET_HIT(i)) / GET_MAX_HIT(i);
|
||||
else
|
||||
percent = -1; /* How could MAX_HIT be < 1?? */
|
||||
percent = -1; /* How could MAX_HIT be < 1?? */
|
||||
|
||||
for (ar_index = 0; diagnosis[ar_index].percent >= 0; ar_index++)
|
||||
if (percent >= diagnosis[ar_index].percent)
|
||||
|
|
@ -269,12 +269,12 @@ static void look_at_char(struct char_data *i, struct char_data *ch)
|
|||
found = TRUE;
|
||||
|
||||
if (found) {
|
||||
send_to_char(ch, "\r\n"); /* act() does capitalization. */
|
||||
send_to_char(ch, "\r\n"); /* act() does capitalization. */
|
||||
act("$n is using:", FALSE, i, 0, ch, TO_VICT);
|
||||
for (j = 0; j < NUM_WEARS; j++)
|
||||
if (GET_EQ(i, j) && CAN_SEE_OBJ(ch, GET_EQ(i, j))) {
|
||||
send_to_char(ch, "%s", wear_where[j]);
|
||||
show_obj_to_char(GET_EQ(i, j), ch, SHOW_OBJ_SHORT);
|
||||
send_to_char(ch, "%s", wear_where[j]);
|
||||
show_obj_to_char(GET_EQ(i, j), ch, SHOW_OBJ_SHORT);
|
||||
}
|
||||
}
|
||||
if (ch != i && (IS_THIEF(ch) || GET_LEVEL(ch) >= LVL_IMMORT)) {
|
||||
|
|
@ -300,7 +300,7 @@ static void list_one_char(struct char_data *i, struct char_data *ch)
|
|||
|
||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS)) {
|
||||
if (IS_NPC(i))
|
||||
send_to_char(ch, "[%d] ", GET_MOB_VNUM(i));
|
||||
send_to_char(ch, "[%d] ", GET_MOB_VNUM(i));
|
||||
if (SCRIPT(i) && TRIGGERS(SCRIPT(i))) {
|
||||
if (!TRIGGERS(SCRIPT(i))->next)
|
||||
send_to_char(ch, "[T%d] ", GET_TRIG_VNUM(TRIGGERS(SCRIPT(i))));
|
||||
|
|
@ -312,12 +312,12 @@ static void list_one_char(struct char_data *i, struct char_data *ch)
|
|||
if (GROUP(i)) {
|
||||
if (GROUP(i) == GROUP(ch))
|
||||
send_to_char(ch, "(%s%s%s) ", CBGRN(ch, C_NRM),
|
||||
GROUP_LEADER(GROUP(i)) == i ? "leader" : "group",
|
||||
CCNRM(ch, C_NRM));
|
||||
GROUP_LEADER(GROUP(i)) == i ? "leader" : "group",
|
||||
CCNRM(ch, C_NRM));
|
||||
else
|
||||
send_to_char(ch, "(%s%s%s) ", CBRED(ch, C_NRM),
|
||||
GROUP_LEADER(GROUP(i)) == i ? "leader" : "group",
|
||||
CCNRM(ch, C_NRM));
|
||||
GROUP_LEADER(GROUP(i)) == i ? "leader" : "group",
|
||||
CCNRM(ch, C_NRM));
|
||||
}
|
||||
|
||||
if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i)) {
|
||||
|
|
@ -326,9 +326,9 @@ static void list_one_char(struct char_data *i, struct char_data *ch)
|
|||
|
||||
if (AFF_FLAGGED(ch, AFF_DETECT_ALIGN)) {
|
||||
if (IS_EVIL(i))
|
||||
send_to_char(ch, "(Red Aura) ");
|
||||
send_to_char(ch, "(Red Aura) ");
|
||||
else if (IS_GOOD(i))
|
||||
send_to_char(ch, "(Blue Aura) ");
|
||||
send_to_char(ch, "(Blue Aura) ");
|
||||
}
|
||||
send_to_char(ch, "%s", i->player.long_descr);
|
||||
|
||||
|
|
@ -361,24 +361,24 @@ static void list_one_char(struct char_data *i, struct char_data *ch)
|
|||
if (GET_POS(i) != POS_FIGHTING) {
|
||||
if (!SITTING(i))
|
||||
send_to_char(ch, "%s", positions[(int) GET_POS(i)]);
|
||||
else {
|
||||
furniture = SITTING(i);
|
||||
send_to_char(ch, " is %s upon %s.", (GET_POS(i) == POS_SLEEPING ?
|
||||
else {
|
||||
furniture = SITTING(i);
|
||||
send_to_char(ch, " is %s upon %s.", (GET_POS(i) == POS_SLEEPING ?
|
||||
"sleeping" : (GET_POS(i) == POS_RESTING ? "resting" : "sitting")),
|
||||
OBJS(furniture, ch));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (FIGHTING(i)) {
|
||||
send_to_char(ch, " is here, fighting ");
|
||||
if (FIGHTING(i) == ch)
|
||||
send_to_char(ch, "YOU!");
|
||||
send_to_char(ch, "YOU!");
|
||||
else {
|
||||
if (IN_ROOM(i) == IN_ROOM(FIGHTING(i)))
|
||||
send_to_char(ch, "%s!", PERS(FIGHTING(i), ch));
|
||||
else
|
||||
send_to_char(ch, "someone who has already left!");
|
||||
if (IN_ROOM(i) == IN_ROOM(FIGHTING(i)))
|
||||
send_to_char(ch, "%s!", PERS(FIGHTING(i), ch));
|
||||
else
|
||||
send_to_char(ch, "someone who has already left!");
|
||||
}
|
||||
} else /* NIL fighting pointer */
|
||||
} else /* NIL fighting pointer */
|
||||
send_to_char(ch, " is here struggling with thin air.");
|
||||
}
|
||||
|
||||
|
|
@ -402,13 +402,13 @@ static void list_char_to_char(struct char_data *list, struct char_data *ch)
|
|||
if (ch != i) {
|
||||
/* hide npcs whose description starts with a '.' from non-holylighted people - Idea from Elaseth of TBA */
|
||||
if (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT) &&
|
||||
IS_NPC(i) && i->player.long_descr && *i->player.long_descr == '.')
|
||||
IS_NPC(i) && i->player.long_descr && *i->player.long_descr == '.')
|
||||
continue;
|
||||
send_to_char(ch, "%s", CCYEL(ch, C_NRM));
|
||||
if (CAN_SEE(ch, i))
|
||||
list_one_char(i, ch);
|
||||
else if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch) &&
|
||||
AFF_FLAGGED(i, AFF_INFRAVISION))
|
||||
AFF_FLAGGED(i, AFF_INFRAVISION))
|
||||
send_to_char(ch, "You see a pair of glowing red eyes looking your way.\r\n");
|
||||
send_to_char(ch, "%s", CCNRM(ch, C_NRM));
|
||||
}
|
||||
|
|
@ -425,12 +425,12 @@ static void do_auto_exits(struct char_data *ch)
|
|||
continue;
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS)
|
||||
continue;
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT))
|
||||
continue;
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT))
|
||||
continue;
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
||||
send_to_char(ch, "%s(%s)%s ", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM));
|
||||
else if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN))
|
||||
send_to_char(ch, "%s%s%s ", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM));
|
||||
send_to_char(ch, "%s(%s)%s ", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM));
|
||||
else if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN))
|
||||
send_to_char(ch, "%s%s%s ", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM));
|
||||
else
|
||||
send_to_char(ch, "\t(%s\t) ", autoexits[door]);
|
||||
slen++;
|
||||
|
|
@ -443,44 +443,50 @@ ACMD(do_exits)
|
|||
{
|
||||
int door, len = 0;
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) {
|
||||
if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT)
|
||||
{
|
||||
send_to_char(ch, "You can't see a damned thing, you're blind!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
send_to_char(ch, "Obvious exits:\r\n");
|
||||
|
||||
for (door = 0; door < DIR_COUNT; door++) {
|
||||
for (door = 0; door < DIR_COUNT; door++)
|
||||
{
|
||||
if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE)
|
||||
continue;
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS)
|
||||
continue;
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
len++;
|
||||
|
||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && !EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
||||
send_to_char(ch, "%-5s - [%5d]%s %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room),
|
||||
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " [HIDDEN]" : "", world[EXIT(ch, door)->to_room].name);
|
||||
else if (CONFIG_DISP_CLOSED_DOORS && EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) {
|
||||
/* But we tell them the door is closed */
|
||||
{
|
||||
send_to_char(ch, "%-5s -[%5d]%s %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room),
|
||||
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? "[HIDDEN]" : "", world[EXIT(ch, door)->to_room].name);
|
||||
}
|
||||
else if (CONFIG_DISP_CLOSED_DOORS && EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
||||
{
|
||||
/*But we tell them the door is closed */
|
||||
send_to_char(ch, "%-5s - The %s is closed%s\r\n", dirs[door],
|
||||
(EXIT(ch, door)->keyword)? fname(EXIT(ch, door)->keyword) : "opening",
|
||||
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " and hidden." : ".");
|
||||
}
|
||||
(EXIT(ch, door)->keyword) ? fname(EXIT(ch, door)->keyword) : "opening",
|
||||
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " and hidden." : ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
send_to_char(ch, "%-5s - %s\r\n", dirs[door], IS_DARK(EXIT(ch, door)->to_room) &&
|
||||
!CAN_SEE_IN_DARK(ch) ? "Too dark to tell." : world[EXIT(ch, door)->to_room].name);
|
||||
!CAN_SEE_IN_DARK(ch) ? "Too dark to tell." : world[EXIT(ch, door)->to_room].name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!len)
|
||||
send_to_char(ch, " None.\r\n");
|
||||
if (!len)
|
||||
send_to_char(ch, " None.\r\n");
|
||||
}
|
||||
|
||||
void look_at_room(struct char_data *ch, int ignore_brief)
|
||||
{
|
||||
trig_data *t;
|
||||
trig_data * t;
|
||||
struct room_data *rm = &world[IN_ROOM(ch)];
|
||||
room_vnum target_room;
|
||||
|
||||
|
|
@ -489,20 +495,22 @@ void look_at_room(struct char_data *ch, int ignore_brief)
|
|||
if (!ch->desc)
|
||||
return;
|
||||
|
||||
if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)) {
|
||||
if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)){
|
||||
send_to_char(ch, "It is pitch black...\r\n");
|
||||
return;
|
||||
} else if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) {
|
||||
}
|
||||
else if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) {
|
||||
send_to_char(ch, "You see nothing but infinite darkness...\r\n");
|
||||
return;
|
||||
}
|
||||
send_to_char(ch, "%s", CCCYN(ch, C_NRM));
|
||||
|
||||
send_to_char(ch, "%s", CCYEL(ch, C_NRM));
|
||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS)) {
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
|
||||
sprintbitarray(ROOM_FLAGS(IN_ROOM(ch)), room_bits, RF_ARRAY_MAX, buf);
|
||||
send_to_char(ch, "[%5d] ", GET_ROOM_VNUM(IN_ROOM(ch)));
|
||||
send_to_char(ch, "%s [ %s] [ %s ]", world[IN_ROOM(ch)].name, buf, sector_types[world[IN_ROOM(ch)].sector_type]);
|
||||
send_to_char(ch, "%s[ %s][ %s ]", world[IN_ROOM(ch)].name, buf, sector_types[world[IN_ROOM(ch)].sector_type]);
|
||||
|
||||
if (SCRIPT(rm)) {
|
||||
send_to_char(ch, "[T");
|
||||
|
|
@ -513,21 +521,23 @@ void look_at_room(struct char_data *ch, int ignore_brief)
|
|||
}
|
||||
else
|
||||
send_to_char(ch, "%s", world[IN_ROOM(ch)].name);
|
||||
|
||||
send_to_char(ch, "%s\r\n", CCNRM(ch, C_NRM));
|
||||
|
||||
if ((!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_BRIEF)) || ignore_brief ||
|
||||
ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH)) {
|
||||
if(!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch))
|
||||
str_and_map(world[target_room].description, ch, target_room);
|
||||
ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH)) {
|
||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch))
|
||||
str_and_map(world[target_room].description, ch, target_room);
|
||||
else
|
||||
send_to_char(ch, "%s", world[IN_ROOM(ch)].description);
|
||||
send_to_char(ch, "%s", world[IN_ROOM(ch)].description);
|
||||
}
|
||||
|
||||
/* autoexits */
|
||||
|
||||
/*autoexits */
|
||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOEXIT))
|
||||
do_auto_exits(ch);
|
||||
|
||||
/* now list characters & objects */
|
||||
/*now list characters &objects */
|
||||
list_obj_to_char(world[IN_ROOM(ch)].contents, ch, SHOW_OBJ_LONG, FALSE);
|
||||
list_char_to_char(world[IN_ROOM(ch)].people, ch);
|
||||
}
|
||||
|
|
@ -557,35 +567,35 @@ static void look_in_obj(struct char_data *ch, char *arg)
|
|||
if (!*arg)
|
||||
send_to_char(ch, "Look in what?\r\n");
|
||||
else if (!(bits = generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM |
|
||||
FIND_OBJ_EQUIP, ch, &dummy, &obj))) {
|
||||
FIND_OBJ_EQUIP, ch, &dummy, &obj))) {
|
||||
send_to_char(ch, "There doesn't seem to be %s %s here.\r\n", AN(arg), arg);
|
||||
} else if ((GET_OBJ_TYPE(obj) != ITEM_DRINKCON) &&
|
||||
(GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) &&
|
||||
(GET_OBJ_TYPE(obj) != ITEM_CONTAINER))
|
||||
(GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) &&
|
||||
(GET_OBJ_TYPE(obj) != ITEM_CONTAINER))
|
||||
send_to_char(ch, "There's nothing inside that!\r\n");
|
||||
else {
|
||||
if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) {
|
||||
if (OBJVAL_FLAGGED(obj, CONT_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || !PRF_FLAGGED(ch, PRF_NOHASSLE)))
|
||||
send_to_char(ch, "It is closed.\r\n");
|
||||
send_to_char(ch, "It is closed.\r\n");
|
||||
else {
|
||||
send_to_char(ch, "%s", fname(obj->name));
|
||||
switch (bits) {
|
||||
case FIND_OBJ_INV:
|
||||
send_to_char(ch, " (carried): \r\n");
|
||||
break;
|
||||
case FIND_OBJ_ROOM:
|
||||
send_to_char(ch, " (here): \r\n");
|
||||
break;
|
||||
case FIND_OBJ_EQUIP:
|
||||
send_to_char(ch, " (used): \r\n");
|
||||
break;
|
||||
}
|
||||
send_to_char(ch, "%s", fname(obj->name));
|
||||
switch (bits) {
|
||||
case FIND_OBJ_INV:
|
||||
send_to_char(ch, " (carried): \r\n");
|
||||
break;
|
||||
case FIND_OBJ_ROOM:
|
||||
send_to_char(ch, " (here): \r\n");
|
||||
break;
|
||||
case FIND_OBJ_EQUIP:
|
||||
send_to_char(ch, " (used): \r\n");
|
||||
break;
|
||||
}
|
||||
|
||||
list_obj_to_char(obj->contains, ch, SHOW_OBJ_SHORT, TRUE);
|
||||
list_obj_to_char(obj->contains, ch, SHOW_OBJ_SHORT, TRUE);
|
||||
}
|
||||
} else { /* item must be a fountain or drink container */
|
||||
} else { /* item must be a fountain or drink container */
|
||||
if ((GET_OBJ_VAL(obj, 1) == 0) && (GET_OBJ_VAL(obj, 0) != -1))
|
||||
send_to_char(ch, "It is empty.\r\n");
|
||||
send_to_char(ch, "It is empty.\r\n");
|
||||
else {
|
||||
if (GET_OBJ_VAL(obj, 0) < 0)
|
||||
{
|
||||
|
|
@ -593,14 +603,15 @@ static void look_in_obj(struct char_data *ch, char *arg)
|
|||
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
|
||||
send_to_char(ch, "It's full of a %s liquid.\r\n", buf2);
|
||||
}
|
||||
else if (GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0))
|
||||
else if (GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0))
|
||||
send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */
|
||||
else {
|
||||
else
|
||||
{
|
||||
char buf2[MAX_STRING_LENGTH];
|
||||
amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0);
|
||||
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
|
||||
send_to_char(ch, "It's %sfull of a %s liquid.\r\n", fullness[amt], buf2);
|
||||
}
|
||||
amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0);
|
||||
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
|
||||
send_to_char(ch, "It's %sfull of a %s liquid.\r\n", fullness[amt], buf2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -637,14 +648,14 @@ static void look_at_target(struct char_data *ch, char *arg)
|
|||
}
|
||||
|
||||
bits = generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM | FIND_OBJ_EQUIP |
|
||||
FIND_CHAR_ROOM, ch, &found_char, &found_obj);
|
||||
FIND_CHAR_ROOM, ch, &found_char, &found_obj);
|
||||
|
||||
/* Is the target a character? */
|
||||
if (found_char != NULL) {
|
||||
look_at_char(found_char, ch);
|
||||
if (ch != found_char) {
|
||||
if (CAN_SEE(found_char, ch))
|
||||
act("$n looks at you.", TRUE, ch, 0, found_char, TO_VICT);
|
||||
act("$n looks at you.", TRUE, ch, 0, found_char, TO_VICT);
|
||||
act("$n looks at $N.", TRUE, ch, 0, found_char, TO_NOTVICT);
|
||||
}
|
||||
return;
|
||||
|
|
@ -666,16 +677,16 @@ static void look_at_target(struct char_data *ch, char *arg)
|
|||
for (j = 0; j < NUM_WEARS && !found; j++)
|
||||
if (GET_EQ(ch, j) && CAN_SEE_OBJ(ch, GET_EQ(ch, j)))
|
||||
if ((desc = find_exdesc(arg, GET_EQ(ch, j)->ex_description)) != NULL && ++i == fnum) {
|
||||
send_to_char(ch, "%s", desc);
|
||||
found = TRUE;
|
||||
send_to_char(ch, "%s", desc);
|
||||
found = TRUE;
|
||||
}
|
||||
|
||||
/* Does the argument match an extra desc in the char's inventory? */
|
||||
for (obj = ch->carrying; obj && !found; obj = obj->next_content) {
|
||||
if (CAN_SEE_OBJ(ch, obj))
|
||||
if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) {
|
||||
send_to_char(ch, "%s", desc);
|
||||
found = TRUE;
|
||||
send_to_char(ch, "%s", desc);
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -683,8 +694,8 @@ static void look_at_target(struct char_data *ch, char *arg)
|
|||
for (obj = world[IN_ROOM(ch)].contents; obj && !found; obj = obj->next_content)
|
||||
if (CAN_SEE_OBJ(ch, obj))
|
||||
if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) {
|
||||
send_to_char(ch, "%s", desc);
|
||||
found = TRUE;
|
||||
send_to_char(ch, "%s", desc);
|
||||
found = TRUE;
|
||||
}
|
||||
|
||||
/* If an object was found back in generic_find */
|
||||
|
|
@ -714,7 +725,7 @@ ACMD(do_look)
|
|||
send_to_char(ch, "You can't see a damned thing, you're blind!\r\n");
|
||||
else if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)) {
|
||||
send_to_char(ch, "It is pitch black...\r\n");
|
||||
list_char_to_char(world[IN_ROOM(ch)].people, ch); /* glowing red eyes */
|
||||
list_char_to_char(world[IN_ROOM(ch)].people, ch); /* glowing red eyes */
|
||||
} else {
|
||||
char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||
|
||||
|
|
@ -722,12 +733,12 @@ ACMD(do_look)
|
|||
|
||||
if (subcmd == SCMD_READ) {
|
||||
if (!*arg)
|
||||
send_to_char(ch, "Read what?\r\n");
|
||||
send_to_char(ch, "Read what?\r\n");
|
||||
else
|
||||
look_at_target(ch, strcpy(tempsave, arg));
|
||||
look_at_target(ch, strcpy(tempsave, arg));
|
||||
return;
|
||||
}
|
||||
if (!*arg) /* "look" alone, without an argument at all */
|
||||
if (!*arg) /* "look" alone, without an argument at all */
|
||||
look_at_room(ch, 1);
|
||||
else if (is_abbrev(arg, "in"))
|
||||
look_in_obj(ch, arg2);
|
||||
|
|
@ -767,15 +778,15 @@ ACMD(do_examine)
|
|||
}
|
||||
|
||||
/* look_at_target() eats the number. */
|
||||
look_at_target(ch, strcpy(tempsave, arg)); /* strcpy: OK */
|
||||
look_at_target(ch, strcpy(tempsave, arg)); /* strcpy: OK */
|
||||
|
||||
generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM | FIND_CHAR_ROOM |
|
||||
FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object);
|
||||
FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object);
|
||||
|
||||
if (tmp_object) {
|
||||
if ((GET_OBJ_TYPE(tmp_object) == ITEM_DRINKCON) ||
|
||||
(GET_OBJ_TYPE(tmp_object) == ITEM_FOUNTAIN) ||
|
||||
(GET_OBJ_TYPE(tmp_object) == ITEM_CONTAINER)) {
|
||||
(GET_OBJ_TYPE(tmp_object) == ITEM_FOUNTAIN) ||
|
||||
(GET_OBJ_TYPE(tmp_object) == ITEM_CONTAINER)) {
|
||||
send_to_char(ch, "When you look inside, you see:\r\n");
|
||||
look_in_obj(ch, arg);
|
||||
}
|
||||
|
|
@ -807,18 +818,18 @@ ACMD(do_score)
|
|||
send_to_char(ch, "\r\n");
|
||||
|
||||
send_to_char(ch, "You have %d(%d) hit, %d(%d) mana and %d(%d) movement points.\r\n",
|
||||
GET_HIT(ch), GET_MAX_HIT(ch), GET_MANA(ch), GET_MAX_MANA(ch),
|
||||
GET_MOVE(ch), GET_MAX_MOVE(ch));
|
||||
GET_HIT(ch), GET_MAX_HIT(ch), GET_MANA(ch), GET_MAX_MANA(ch),
|
||||
GET_MOVE(ch), GET_MAX_MOVE(ch));
|
||||
|
||||
send_to_char(ch, "Your armor class is %d/10, and your alignment is %d.\r\n",
|
||||
compute_armor_class(ch), GET_ALIGNMENT(ch));
|
||||
compute_armor_class(ch), GET_ALIGNMENT(ch));
|
||||
|
||||
send_to_char(ch, "You have %d exp, %d gold coins, and %d questpoints.\r\n",
|
||||
GET_EXP(ch), GET_GOLD(ch), GET_QUESTPOINTS(ch));
|
||||
GET_EXP(ch), GET_GOLD(ch), GET_QUESTPOINTS(ch));
|
||||
|
||||
if (GET_LEVEL(ch) < LVL_IMMORT)
|
||||
send_to_char(ch, "You need %d exp to reach your next level.\r\n",
|
||||
level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1) - GET_EXP(ch));
|
||||
level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1) - GET_EXP(ch));
|
||||
|
||||
send_to_char(ch, "You have earned %d quest points.\r\n", GET_QUESTPOINTS(ch));
|
||||
send_to_char(ch, "You have completed %d quest%s, ",
|
||||
|
|
@ -837,13 +848,13 @@ ACMD(do_score)
|
|||
}
|
||||
|
||||
playing_time = *real_time_passed((time(0) - ch->player.time.logon) +
|
||||
ch->player.time.played, 0);
|
||||
ch->player.time.played, 0);
|
||||
send_to_char(ch, "You have been playing for %d day%s and %d hour%s.\r\n",
|
||||
playing_time.day, playing_time.day == 1 ? "" : "s",
|
||||
playing_time.hours, playing_time.hours == 1 ? "" : "s");
|
||||
|
||||
send_to_char(ch, "This ranks you as %s %s (level %d).\r\n",
|
||||
GET_NAME(ch), GET_TITLE(ch), GET_LEVEL(ch));
|
||||
GET_NAME(ch), GET_TITLE(ch), GET_LEVEL(ch));
|
||||
|
||||
switch (GET_POS(ch)) {
|
||||
case POS_DEAD:
|
||||
|
|
@ -974,8 +985,8 @@ ACMD(do_time)
|
|||
weekday = ((35 * time_info.month) + day) % 7;
|
||||
|
||||
send_to_char(ch, "It is %d o'clock %s, on %s.\r\n",
|
||||
(time_info.hours % 12 == 0) ? 12 : (time_info.hours % 12),
|
||||
time_info.hours >= 12 ? "pm" : "am", weekdays[weekday]);
|
||||
(time_info.hours % 12 == 0) ? 12 : (time_info.hours % 12),
|
||||
time_info.hours >= 12 ? "pm" : "am", weekdays[weekday]);
|
||||
|
||||
/* Peter Ajamian supplied the following as a fix for a bug introduced in the
|
||||
* ordinal display that caused 11, 12, and 13 to be incorrectly displayed as
|
||||
|
|
@ -997,7 +1008,7 @@ ACMD(do_time)
|
|||
}
|
||||
}
|
||||
send_to_char(ch, "The %d%s Day of the %s, Year %d.\r\n",
|
||||
day, suf, month_name[time_info.month], time_info.year);
|
||||
day, suf, month_name[time_info.month], time_info.year);
|
||||
}
|
||||
|
||||
ACMD(do_weather)
|
||||
|
|
@ -1012,8 +1023,8 @@ ACMD(do_weather)
|
|||
if (OUTSIDE(ch))
|
||||
{
|
||||
send_to_char(ch, "The sky is %s and %s.\r\n", sky_look[weather_info.sky],
|
||||
weather_info.change >= 0 ? "you feel a warm wind from south" :
|
||||
"your foot tells you bad weather is due");
|
||||
weather_info.change >= 0 ? "you feel a warm wind from south" :
|
||||
"your foot tells you bad weather is due");
|
||||
if (GET_LEVEL(ch) >= LVL_GOD)
|
||||
send_to_char(ch, "Pressure: %d (change: %d), Sky: %d (%s)\r\n",
|
||||
weather_info.pressure,
|
||||
|
|
@ -1051,7 +1062,7 @@ int search_help(const char *argument, int level)
|
|||
mid++;
|
||||
if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level)
|
||||
break;
|
||||
|
||||
|
||||
return (mid);
|
||||
}
|
||||
else if (chk > 0)
|
||||
|
|
@ -1278,7 +1289,7 @@ ACMD(do_who)
|
|||
GET_LEVEL(tch), CLASS_ABBR(tch),
|
||||
GET_NAME(tch), (*GET_TITLE(tch) ? " " : ""), GET_TITLE(tch),
|
||||
CCNRM(ch, C_SPR));
|
||||
|
||||
|
||||
if (GET_INVIS_LEV(tch))
|
||||
send_to_char(ch, " (i%d)", GET_INVIS_LEV(tch));
|
||||
else if (AFF_FLAGGED(tch, AFF_INVISIBLE))
|
||||
|
|
@ -1371,7 +1382,7 @@ ACMD(do_users)
|
|||
|
||||
host_search[0] = name_search[0] = '\0';
|
||||
|
||||
strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */
|
||||
strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */
|
||||
while (*buf) {
|
||||
char buf1[MAX_INPUT_LENGTH];
|
||||
|
||||
|
|
@ -1381,49 +1392,49 @@ ACMD(do_users)
|
|||
switch (mode) {
|
||||
case 'o':
|
||||
case 'k':
|
||||
outlaws = 1;
|
||||
playing = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
outlaws = 1;
|
||||
playing = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'p':
|
||||
playing = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
playing = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'd':
|
||||
deadweight = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
deadweight = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'l':
|
||||
playing = 1;
|
||||
half_chop(buf1, arg, buf);
|
||||
sscanf(arg, "%d-%d", &low, &high);
|
||||
break;
|
||||
playing = 1;
|
||||
half_chop(buf1, arg, buf);
|
||||
sscanf(arg, "%d-%d", &low, &high);
|
||||
break;
|
||||
case 'n':
|
||||
playing = 1;
|
||||
half_chop(buf1, name_search, buf);
|
||||
break;
|
||||
playing = 1;
|
||||
half_chop(buf1, name_search, buf);
|
||||
break;
|
||||
case 'h':
|
||||
playing = 1;
|
||||
half_chop(buf1, host_search, buf);
|
||||
break;
|
||||
playing = 1;
|
||||
half_chop(buf1, host_search, buf);
|
||||
break;
|
||||
case 'c':
|
||||
playing = 1;
|
||||
half_chop(buf1, arg, buf);
|
||||
showclass = find_class_bitvector(arg);
|
||||
break;
|
||||
playing = 1;
|
||||
half_chop(buf1, arg, buf);
|
||||
showclass = find_class_bitvector(arg);
|
||||
break;
|
||||
default:
|
||||
send_to_char(ch, "%s", USERS_FORMAT);
|
||||
return;
|
||||
} /* end of switch */
|
||||
send_to_char(ch, "%s", USERS_FORMAT);
|
||||
return;
|
||||
} /* end of switch */
|
||||
|
||||
} else { /* endif */
|
||||
} else { /* endif */
|
||||
send_to_char(ch, "%s", USERS_FORMAT);
|
||||
return;
|
||||
}
|
||||
} /* end while (parser) */
|
||||
} /* end while (parser) */
|
||||
send_to_char(ch,
|
||||
"Num Class Name State Idl Login\t* Site\r\n"
|
||||
"--- ------- ------------ -------------- ----- -------- ------------------------\r\n");
|
||||
"Num Class Name State Idl Login\t* Site\r\n"
|
||||
"--- ------- ------------ -------------- ----- -------- ------------------------\r\n");
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
|
|
@ -1445,7 +1456,7 @@ ACMD(do_users)
|
|||
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
||||
continue;
|
||||
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) &&
|
||||
!PLR_FLAGGED(tch, PLR_THIEF))
|
||||
!PLR_FLAGGED(tch, PLR_THIEF))
|
||||
continue;
|
||||
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
||||
continue;
|
||||
|
|
@ -1453,11 +1464,11 @@ ACMD(do_users)
|
|||
continue;
|
||||
|
||||
if (d->original)
|
||||
sprintf(classname, "[%2d %s]", GET_LEVEL(d->original),
|
||||
CLASS_ABBR(d->original));
|
||||
sprintf(classname, "[%2d %s]", GET_LEVEL(d->original),
|
||||
CLASS_ABBR(d->original));
|
||||
else
|
||||
sprintf(classname, "[%2d %s]", GET_LEVEL(d->character),
|
||||
CLASS_ABBR(d->character));
|
||||
sprintf(classname, "[%2d %s]", GET_LEVEL(d->character),
|
||||
CLASS_ABBR(d->character));
|
||||
} else
|
||||
strcpy(classname, " - ");
|
||||
|
||||
|
|
@ -1470,15 +1481,15 @@ ACMD(do_users)
|
|||
|
||||
if (d->character && STATE(d) == CON_PLAYING)
|
||||
sprintf(idletime, "%5d", d->character->char_specials.timer *
|
||||
SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN);
|
||||
SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN);
|
||||
else
|
||||
strcpy(idletime, " ");
|
||||
|
||||
sprintf(line, "%3d %-7s %-12s %-14s %-3s %-8s ", d->desc_num, classname,
|
||||
d->original && d->original->player.name ? d->original->player.name :
|
||||
d->character && d->character->player.name ? d->character->player.name :
|
||||
"UNDEFINED",
|
||||
state, idletime, timestr);
|
||||
d->original && d->original->player.name ? d->original->player.name :
|
||||
d->character && d->character->player.name ? d->character->player.name :
|
||||
"UNDEFINED",
|
||||
state, idletime, timestr);
|
||||
|
||||
if (*d->host)
|
||||
sprintf(line + strlen(line), "[%s]\r\n", d->host);
|
||||
|
|
@ -1568,23 +1579,23 @@ static void perform_mortal_where(struct char_data *ch, char *arg)
|
|||
send_to_char(ch, "Players in %s\tn.\r\n--------------------\r\n", zone_table[j].name);
|
||||
for (d = descriptor_list; d; d = d->next) {
|
||||
if (STATE(d) != CON_PLAYING || d->character == ch)
|
||||
continue;
|
||||
continue;
|
||||
if ((i = (d->original ? d->original : d->character)) == NULL)
|
||||
continue;
|
||||
continue;
|
||||
if (IN_ROOM(i) == NOWHERE || !CAN_SEE(ch, i))
|
||||
continue;
|
||||
continue;
|
||||
if (world[IN_ROOM(ch)].zone != world[IN_ROOM(i)].zone)
|
||||
continue;
|
||||
continue;
|
||||
send_to_char(ch, "%-20s%s - %s%s\r\n", GET_NAME(i), QNRM, world[IN_ROOM(i)].name, QNRM);
|
||||
}
|
||||
} else { /* print only FIRST char, not all. */
|
||||
} else { /* print only FIRST char, not all. */
|
||||
for (i = character_list; i; i = i->next) {
|
||||
if (IN_ROOM(i) == NOWHERE || i == ch)
|
||||
continue;
|
||||
continue;
|
||||
if (!CAN_SEE(ch, i) || world[IN_ROOM(i)].zone != world[IN_ROOM(ch)].zone)
|
||||
continue;
|
||||
continue;
|
||||
if (!isname(arg, i->player.name))
|
||||
continue;
|
||||
continue;
|
||||
send_to_char(ch, "%-25s%s - %s%s\r\n", GET_NAME(i), QNRM, world[IN_ROOM(i)].name, QNRM);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1593,7 +1604,7 @@ static void perform_mortal_where(struct char_data *ch, char *arg)
|
|||
}
|
||||
|
||||
static void print_object_location(int num, struct obj_data *obj, struct char_data *ch,
|
||||
int recur)
|
||||
int recur)
|
||||
{
|
||||
if (num > 0)
|
||||
send_to_char(ch, "O%3d. %-25s%s - ", num, obj->short_description, QNRM);
|
||||
|
|
@ -1658,7 +1669,7 @@ static void perform_immort_where(struct char_data *ch, char *arg)
|
|||
else
|
||||
send_to_char(ch, "[TRIGS] ");
|
||||
}
|
||||
send_to_char(ch, "%s\r\n", QNRM);
|
||||
send_to_char(ch, "%s\r\n", QNRM);
|
||||
}
|
||||
for (num = 0, k = object_list; k; k = k->next)
|
||||
if (CAN_SEE_OBJ(ch, k) && isname(arg, k->name)) {
|
||||
|
|
@ -1727,7 +1738,7 @@ ACMD(do_levels)
|
|||
|
||||
for (i = min_lev; i < max_lev; i++) {
|
||||
nlen = snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d-%-8d : ", (int)i,
|
||||
level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1);
|
||||
level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1);
|
||||
if (len + nlen >= sizeof(buf))
|
||||
break;
|
||||
len += nlen;
|
||||
|
|
@ -1751,7 +1762,7 @@ ACMD(do_levels)
|
|||
|
||||
if (len < sizeof(buf) && max_lev == LVL_IMMORT)
|
||||
snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d : Immortality\r\n",
|
||||
LVL_IMMORT, level_exp(GET_CLASS(ch), LVL_IMMORT));
|
||||
LVL_IMMORT, level_exp(GET_CLASS(ch), LVL_IMMORT));
|
||||
page_string(ch->desc, buf, TRUE);
|
||||
}
|
||||
|
||||
|
|
@ -1939,16 +1950,17 @@ ACMD(do_toggle)
|
|||
if (!GET_WIMP_LEV(ch))
|
||||
strcpy(buf2, "OFF"); /* strcpy: OK */
|
||||
else
|
||||
sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */
|
||||
snprintf(buf2, sizeof(buf2), "%-3.3d", GET_WIMP_LEV(ch)); /* thanks to Ironfist for the fix for the buffer overrun here */
|
||||
|
||||
|
||||
if (GET_LEVEL(ch) == LVL_IMPL) {
|
||||
if (GET_LEVEL(ch) == LVL_IMPL) {
|
||||
send_to_char(ch,
|
||||
" SlowNameserver: %-3s "
|
||||
" "
|
||||
" Trackthru Doors: %-3s\r\n",
|
||||
" "
|
||||
" Trackthru Doors: %-3s\r\n",
|
||||
|
||||
ONOFF(CONFIG_NS_IS_SLOW),
|
||||
ONOFF(CONFIG_TRACK_T_DOORS));
|
||||
ONOFF(CONFIG_NS_IS_SLOW),
|
||||
ONOFF(CONFIG_TRACK_T_DOORS));
|
||||
}
|
||||
|
||||
if (GET_LEVEL(ch) >= LVL_IMMORT) {
|
||||
|
|
@ -2112,7 +2124,7 @@ ACMD(do_toggle)
|
|||
for (i=0; *arg2 && *(sector_types[i]) != '\n'; i++)
|
||||
if (is_abbrev(arg2, sector_types[i]))
|
||||
break;
|
||||
if (*(sector_types[i]) == '\n')
|
||||
if (*(sector_types[i]) == '\n')
|
||||
i=0;
|
||||
GET_BUILDWALK_SECTOR(ch) = i;
|
||||
send_to_char(ch, "Default sector type is %s\r\n", sector_types[i]);
|
||||
|
|
@ -2365,9 +2377,9 @@ ACMD(do_whois)
|
|||
{
|
||||
CREATE(victim, struct char_data, 1);
|
||||
clear_char(victim);
|
||||
|
||||
|
||||
new_mobile_data(victim);
|
||||
|
||||
|
||||
CREATE(victim->player_specials, struct player_special_data, 1);
|
||||
|
||||
if (load_char(buf, victim) > -1)
|
||||
|
|
|
|||
|
|
@ -785,6 +785,9 @@ void name_from_drinkcon(struct obj_data *obj)
|
|||
if (!obj || (GET_OBJ_TYPE(obj) != ITEM_DRINKCON && GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN))
|
||||
return;
|
||||
|
||||
if (obj->name == obj_proto[GET_OBJ_RNUM(obj)].name)
|
||||
obj->name = strdup(obj_proto[GET_OBJ_RNUM(obj)].name);
|
||||
|
||||
liqname = drinknames[GET_OBJ_VAL(obj, 2)];
|
||||
|
||||
remove_from_string(obj->name, liqname);
|
||||
|
|
|
|||
|
|
@ -461,6 +461,9 @@ int has_key(struct char_data *ch, obj_vnum key)
|
|||
{
|
||||
struct obj_data *o;
|
||||
|
||||
if (key == NOTHING)
|
||||
return (0);
|
||||
|
||||
for (o = ch->carrying; o; o = o->next_content)
|
||||
if (GET_OBJ_VNUM(o) == key)
|
||||
return (1);
|
||||
|
|
|
|||
|
|
@ -546,7 +546,6 @@ ACMD(do_split)
|
|||
if (rest) {
|
||||
send_to_char(ch, "%d coin%s %s not splitable, so you keep the money.\r\n",
|
||||
rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were");
|
||||
increase_gold(ch, rest);
|
||||
}
|
||||
} else {
|
||||
send_to_char(ch, "How many coins do you wish to split with your group?\r\n");
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
}
|
||||
if (OLC_ACTION(d)->command)
|
||||
free(OLC_ACTION(d)->command);
|
||||
OLC_ACTION(d)->command = strdup(arg);
|
||||
OLC_ACTION(d)->command = strdup(arg);
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -566,10 +566,10 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
aedit_disp_menu(d);
|
||||
return;
|
||||
}
|
||||
if (OLC_ACTION(d)->sort_as) {
|
||||
if (OLC_ACTION(d)->sort_as)
|
||||
free(OLC_ACTION(d)->sort_as);
|
||||
OLC_ACTION(d)->sort_as = strdup(arg);
|
||||
}
|
||||
OLC_ACTION(d)->sort_as = strdup(arg);
|
||||
|
||||
break;
|
||||
|
||||
case AEDIT_MIN_CHAR_POS:
|
||||
|
|
|
|||
|
|
@ -1585,7 +1585,7 @@ static int process_output(struct descriptor_data *t)
|
|||
result = write_to_descriptor(t->descriptor, osb);
|
||||
|
||||
if (result < 0) { /* Oops, fatal error. Bye! */
|
||||
close_socket(t);
|
||||
// close_socket(t); // close_socket is called after return of negative result
|
||||
return (-1);
|
||||
} else if (result == 0) /* Socket buffer full. Try later. */
|
||||
return (0);
|
||||
|
|
|
|||
367
src/conf.h.macOS
Normal file
367
src/conf.h.macOS
Normal file
|
|
@ -0,0 +1,367 @@
|
|||
#ifndef _CONF_H_
|
||||
#define _CONF_H_
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
/* #undef STDC_HEADERS */
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define if we're compiling CircleMUD under any type of UNIX system. */
|
||||
#define CIRCLE_UNIX 1
|
||||
|
||||
/* Machine-specific dependencies for running on modern macOS systems 10.13+ (High Sierra)
|
||||
* Updated by Victor Augusto Borges Dias de Almeida (aka Stoneheart), 26 June 2024.
|
||||
*
|
||||
* Tested on:
|
||||
* - macOS 10.13: High Sierra - September 25, 2017 (Latest: 10.13.6)
|
||||
* - macOS 10.14: Mojave - September 24, 2018 (Latest: 10.14.6)
|
||||
* - macOS 10.15: Catalina - October 7, 2019 (Latest: 10.15.7)
|
||||
* - macOS 11: Big Sur - November 12, 2020 (Latest: 11.7.10)
|
||||
* - macOS 12: Monterey - October 25, 2021 (Latest: 12.7)
|
||||
* - macOS 13: Ventura - November 7, 2022 (Latest: 13.7)
|
||||
* - macOS 14: Sonoma - November 7, 2023 (Latest: 14.3)
|
||||
*
|
||||
* This file works on Apple Silicon Chips (M1, M2, M3) without futher configurations. */
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#define CIRCLE_MAC_OS 1
|
||||
#endif
|
||||
|
||||
/* Define if the system is capable of using crypt() to encrypt. */
|
||||
#define CIRCLE_CRYPT 1
|
||||
|
||||
/* Define if we don't have proper support for the system's crypt(). */
|
||||
/* #undef HAVE_UNSAFE_CRYPT */
|
||||
|
||||
/* Define is the system has struct in_addr. */
|
||||
#define HAVE_STRUCT_IN_ADDR 1
|
||||
|
||||
/* Define to `int' if <sys/socket.h> doesn't define. */
|
||||
/* #undef socklen_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef ssize_t */
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define if you have the inet_addr function. */
|
||||
#define HAVE_INET_ADDR 1
|
||||
|
||||
/* Define if you have the inet_aton function. */
|
||||
#define HAVE_INET_ATON 1
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the stricmp function. */
|
||||
/* #undef HAVE_STRICMP */
|
||||
|
||||
/* Define if you have the strlcpy function. */
|
||||
#ifndef CIRCLE_MAC_OS
|
||||
#define HAVE_STRLCPY 1
|
||||
#else
|
||||
#define HAVE_STRLCPY 0
|
||||
#endif
|
||||
|
||||
/* Define if you have the strncasecmp function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
|
||||
/* Define if you have the strnicmp function. */
|
||||
/* #undef HAVE_STRNICMP */
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define if you have the vsnprintf function. */
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Define if you have the <arpa/inet.h> header file. */
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
|
||||
/* Define if you have the <arpa/telnet.h> header file. */
|
||||
#define HAVE_ARPA_TELNET_H 1
|
||||
|
||||
/* Define if you have the <assert.h> header file. */
|
||||
#define HAVE_ASSERT_H 1
|
||||
|
||||
/* Define if you have the <crypt.h> header file. */
|
||||
/* #undef HAVE_CRYPT_H */
|
||||
#ifdef CIRCLE_MAC_OS
|
||||
#define HAVE_CRYPT_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define if you have the <mcheck.h> header file. */
|
||||
/* #undef HAVE_MCHECK_H */
|
||||
#ifdef CIRCLE_MAC_OS
|
||||
#define HAVE_MCHECK_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define if you have the <net/errno.h> header file. */
|
||||
/* #undef HAVE_NET_ERRNO_H */
|
||||
|
||||
/* Define if you have the <netdb.h> header file. */
|
||||
#define HAVE_NETDB_H 1
|
||||
|
||||
/* Define if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define if you have the <signal.h> header file. */
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define if you have the <sys/fcntl.h> header file. */
|
||||
#define HAVE_SYS_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <sys/resource.h> header file. */
|
||||
#define HAVE_SYS_RESOURCE_H 1
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you have the <sys/uio.h> header file. */
|
||||
#define HAVE_SYS_UIO_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you have the malloc library (-lmalloc). */
|
||||
/* #undef HAVE_LIBMALLOC */
|
||||
|
||||
/* Check for a prototype to accept. */
|
||||
/* #undef NEED_ACCEPT_PROTO */
|
||||
|
||||
#ifndef CIRCLE_MAC_OS
|
||||
/* Check for a prototype to atoi. */
|
||||
#define NEED_ATOI_PROTO
|
||||
/* Check for a prototype to atol. */
|
||||
#define NEED_ATOL_PROTO
|
||||
#endif
|
||||
|
||||
/* Check for a prototype to bind. */
|
||||
/* #undef NEED_BIND_PROTO */
|
||||
|
||||
/* Check for a prototype to bzero. */
|
||||
/* #undef NEED_BZERO_PROTO */
|
||||
|
||||
/* Check for a prototype to chdir. */
|
||||
/* #undef NEED_CHDIR_PROTO */
|
||||
|
||||
/* Check for a prototype to close. */
|
||||
/* #undef NEED_CLOSE_PROTO */
|
||||
|
||||
/* Check for a prototype to crypt. */
|
||||
/* #undef NEED_CRYPT_PROTO */
|
||||
|
||||
/* Check for a prototype to fclose. */
|
||||
/* #undef NEED_FCLOSE_PROTO */
|
||||
|
||||
/* Check for a prototype to fcntl. */
|
||||
/* #undef NEED_FCNTL_PROTO */
|
||||
|
||||
/* Check for a prototype to fflush. */
|
||||
/* #undef NEED_FFLUSH_PROTO */
|
||||
|
||||
/* Check for a prototype to fprintf. */
|
||||
/* #undef NEED_FPRINTF_PROTO */
|
||||
|
||||
/* Check for a prototype to fputc. */
|
||||
/* #undef NEED_FPUTC_PROTO */
|
||||
|
||||
/* Check for a prototype to fputs. */
|
||||
/* #undef NEED_FPUTS_PROTO */
|
||||
|
||||
/* Check for a prototype to fread. */
|
||||
/* #undef NEED_FREAD_PROTO */
|
||||
|
||||
/* Check for a prototype to fscanf. */
|
||||
/* #undef NEED_FSCANF_PROTO */
|
||||
|
||||
/* Check for a prototype to fseek. */
|
||||
/* #undef NEED_FSEEK_PROTO */
|
||||
|
||||
/* Check for a prototype to fwrite. */
|
||||
/* #undef NEED_FWRITE_PROTO */
|
||||
|
||||
/* Check for a prototype to getpeername. */
|
||||
/* #undef NEED_GETPEERNAME_PROTO */
|
||||
|
||||
/* Check for a prototype to getpid. */
|
||||
/* #undef NEED_GETPID_PROTO */
|
||||
|
||||
/* Check for a prototype to getrlimit. */
|
||||
/* #undef NEED_GETRLIMIT_PROTO */
|
||||
|
||||
/* Check for a prototype to getsockname. */
|
||||
/* #undef NEED_GETSOCKNAME_PROTO */
|
||||
|
||||
/* Check for a prototype to gettimeofday. */
|
||||
/* #undef NEED_GETTIMEOFDAY_PROTO */
|
||||
|
||||
/* Check for a prototype to htonl. */
|
||||
/* #undef NEED_HTONL_PROTO */
|
||||
|
||||
/* Check for a prototype to htons. */
|
||||
/* #undef NEED_HTONS_PROTO */
|
||||
|
||||
/* Check for a prototype to inet_addr. */
|
||||
/* #undef NEED_INET_ADDR_PROTO */
|
||||
|
||||
/* Check for a prototype to inet_aton. */
|
||||
/* #undef NEED_INET_ATON_PROTO */
|
||||
|
||||
/* Check for a prototype to inet_ntoa. */
|
||||
/* #undef NEED_INET_NTOA_PROTO */
|
||||
|
||||
/* Check for a prototype to listen. */
|
||||
/* #undef NEED_LISTEN_PROTO */
|
||||
|
||||
/* Check for a prototype to ntohl. */
|
||||
/* #undef NEED_NTOHL_PROTO */
|
||||
|
||||
/* Check for a prototype to perror. */
|
||||
/* #undef NEED_PERROR_PROTO */
|
||||
|
||||
/* Check for a prototype to printf. */
|
||||
/* #undef NEED_PRINTF_PROTO */
|
||||
|
||||
/* Check for a prototype to qsort. */
|
||||
#ifndef CIRCLE_MAC_OS
|
||||
#define NEED_QSORT_PROTO
|
||||
#endif
|
||||
|
||||
/* Check for a prototype to read. */
|
||||
/* #undef NEED_READ_PROTO */
|
||||
|
||||
/* Check for a prototype to remove. */
|
||||
/* #undef NEED_REMOVE_PROTO */
|
||||
|
||||
/* Check for a prototype to rewind. */
|
||||
/* #undef NEED_REWIND_PROTO */
|
||||
|
||||
/* Check for a prototype to select. */
|
||||
/* #undef NEED_SELECT_PROTO */
|
||||
|
||||
/* Check for a prototype to setitimer. */
|
||||
/* #undef NEED_SETITIMER_PROTO */
|
||||
|
||||
/* Check for a prototype to setrlimit. */
|
||||
/* #undef NEED_SETRLIMIT_PROTO */
|
||||
|
||||
/* Check for a prototype to setsockopt. */
|
||||
/* #undef NEED_SETSOCKOPT_PROTO */
|
||||
|
||||
/* Check for a prototype to snprintf. */
|
||||
/* #undef NEED_SNPRINTF_PROTO */
|
||||
|
||||
/* Check for a prototype to socket. */
|
||||
/* #undef NEED_SOCKET_PROTO */
|
||||
|
||||
/* Check for a prototype to sprintf. */
|
||||
/* #undef NEED_SPRINTF_PROTO */
|
||||
|
||||
/* Check for a prototype to sscanf. */
|
||||
/* #undef NEED_SSCANF_PROTO */
|
||||
|
||||
/* Check for a prototype to strcasecmp. */
|
||||
/* #undef NEED_STRCASECMP_PROTO */
|
||||
|
||||
/* Check for a prototype to strdup. */
|
||||
/* #undef NEED_STRDUP_PROTO */
|
||||
|
||||
/* Check for a prototype to strerror. */
|
||||
/* #undef NEED_STRERROR_PROTO */
|
||||
|
||||
/* Check for a prototype to stricmp. */
|
||||
#define NEED_STRICMP_PROTO
|
||||
|
||||
/* Check for a prototype to strlcpy. */
|
||||
/* #undef NEED_STRLCPY_PROTO */
|
||||
|
||||
/* Check for a prototype to strncasecmp. */
|
||||
/* #undef NEED_STRNCASECMP_PROTO */
|
||||
|
||||
/* Check for a prototype to strnicmp. */
|
||||
#define NEED_STRNICMP_PROTO
|
||||
|
||||
/* Check for a prototype to system. */
|
||||
#ifndef CIRCLE_MAC_OS
|
||||
#define NEED_SYSTEM_PROTO
|
||||
#endif
|
||||
|
||||
/* Check for a prototype to time. */
|
||||
/* #undef NEED_TIME_PROTO */
|
||||
|
||||
/* Check for a prototype to unlink. */
|
||||
/* #undef NEED_UNLINK_PROTO */
|
||||
|
||||
/* Check for a prototype to vsnprintf. */
|
||||
/* #undef NEED_VSNPRINTF_PROTO */
|
||||
|
||||
/* Check for a prototype to write. */
|
||||
/* #undef NEED_WRITE_PROTO */
|
||||
|
||||
|
||||
#endif /* _CONF_H_ */
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
* @todo cpp_extern isn't needed here (or anywhere) as the extern reserved word
|
||||
* works correctly with C compilers (at least in my Experience)
|
||||
* Jeremy Osborne 1/28/2008 */
|
||||
cpp_extern const char *tbamud_version = "tbaMUD 2021";
|
||||
cpp_extern const char *tbamud_version = "tbaMUD 2025";
|
||||
|
||||
/* strings corresponding to ordinals/bitvectors in structs.h */
|
||||
/* (Note: strings for class definitions in class.c instead of here) */
|
||||
|
|
|
|||
79
src/dg_olc.c
79
src/dg_olc.c
|
|
@ -1091,70 +1091,85 @@ int format_script(struct descriptor_data *d)
|
|||
char nsc[MAX_CMD_LENGTH], *t, line[READ_SIZE];
|
||||
char *sc;
|
||||
size_t len = 0, nlen = 0, llen = 0;
|
||||
int indent = 0, indent_next = FALSE, found_case = FALSE, i, line_num = 0, ret;
|
||||
int indent = 0, indent_next = FALSE, line_num = 0, ret, i; // Declare i here
|
||||
int block_stack[READ_SIZE]; // Stack to track block types
|
||||
int stack_top = -1; // Initialize stack as empty
|
||||
int switch_indent[READ_SIZE]; // Array to track switch indent levels
|
||||
int switch_top = -1; // Index for switch_indent array
|
||||
int case_indent = 0; // Track indent for case blocks
|
||||
int in_switch = 0; // Flag to indicate if we're inside a switch block
|
||||
|
||||
if (!d->str || !*d->str)
|
||||
return FALSE;
|
||||
|
||||
sc = strdup(*d->str); /* we work on a copy, because of strtok() */
|
||||
sc = strdup(*d->str); // Work on a copy
|
||||
t = strtok(sc, "\n\r");
|
||||
*nsc = '\0';
|
||||
|
||||
while (t) {
|
||||
line_num++;
|
||||
skip_spaces(&t);
|
||||
if (!strn_cmp(t, "if ", 3) ||
|
||||
!strn_cmp(t, "switch ", 7)) {
|
||||
|
||||
if (!strn_cmp(t, "switch ", 7)) {
|
||||
indent_next = TRUE;
|
||||
} else if (!strn_cmp(t, "while ", 6)) {
|
||||
found_case = TRUE; /* so you can 'break' a loop without complains */
|
||||
stack_top++;
|
||||
block_stack[stack_top] = 's'; // 's' for switch
|
||||
switch_top++;
|
||||
switch_indent[switch_top] = indent; // Save current indent level for switch
|
||||
in_switch++; // We're entering a switch block
|
||||
} else if (!strn_cmp(t, "case", 4) || !strn_cmp(t, "default", 7)) {
|
||||
if (in_switch > 0) { // If we're inside a switch
|
||||
indent = switch_indent[switch_top] + 1; // Indent cases one level under switch
|
||||
indent_next = TRUE; // Indent the next line after case
|
||||
case_indent = indent; // Save indent for case block
|
||||
}
|
||||
} else if (!strn_cmp(t, "if ", 3) || !strn_cmp(t, "while ", 6)) {
|
||||
indent_next = TRUE;
|
||||
} else if (!strn_cmp(t, "end", 3) ||
|
||||
!strn_cmp(t, "done", 4)) {
|
||||
if (!indent) {
|
||||
stack_top++;
|
||||
block_stack[stack_top] = 'l'; // 'l' for loop or conditional
|
||||
} else if (!strn_cmp(t, "end", 3) || !strn_cmp(t, "done", 4)) {
|
||||
if (stack_top < 0) {
|
||||
write_to_output(d, "Unmatched 'end' or 'done' (line %d)!\r\n", line_num);
|
||||
free(sc);
|
||||
return FALSE;
|
||||
}
|
||||
indent--;
|
||||
indent_next = FALSE;
|
||||
if (block_stack[stack_top] == 's') {
|
||||
indent = switch_indent[switch_top]; // Reset to the exact indent level where switch was declared
|
||||
switch_top--; // Decrease switch stack if ending a switch
|
||||
case_indent = 0; // Reset case indent since we're leaving the switch
|
||||
in_switch--; // We're leaving a switch block
|
||||
} else {
|
||||
indent--; // For other blocks like while
|
||||
}
|
||||
stack_top--;
|
||||
indent_next = FALSE; // Reset for next line
|
||||
} else if (!strn_cmp(t, "else", 4)) {
|
||||
if (!indent) {
|
||||
if (stack_top < 0 || block_stack[stack_top] != 'l') {
|
||||
write_to_output(d, "Unmatched 'else' (line %d)!\r\n", line_num);
|
||||
free(sc);
|
||||
return FALSE;
|
||||
}
|
||||
indent--;
|
||||
indent--; // Reduce indent for else, then increment for next statement
|
||||
indent_next = TRUE;
|
||||
} else if (!strn_cmp(t, "case", 4) ||
|
||||
!strn_cmp(t, "default", 7)) {
|
||||
if (!indent) {
|
||||
write_to_output(d, "Case/default outside switch (line %d)!\r\n", line_num);
|
||||
free(sc);
|
||||
return FALSE;
|
||||
}
|
||||
if (!found_case) /* so we don't indent multiple case statements without a break */
|
||||
indent_next = TRUE;
|
||||
found_case = TRUE;
|
||||
} else if (!strn_cmp(t, "break", 5)) {
|
||||
if (!found_case || !indent ) {
|
||||
write_to_output(d, "Break not in case (line %d)!\r\n", line_num);
|
||||
if (stack_top < 0 || (block_stack[stack_top] != 's' && block_stack[stack_top] != 'l')) {
|
||||
write_to_output(d, "Break not in case or loop (line %d)!\r\n", line_num);
|
||||
free(sc);
|
||||
return FALSE;
|
||||
}
|
||||
found_case = FALSE;
|
||||
indent--;
|
||||
indent = case_indent + 1; // Indent break one level deeper than case
|
||||
indent_next = FALSE; // Ensure no automatic increase for next line after break
|
||||
}
|
||||
|
||||
*line = '\0';
|
||||
for (nlen = 0, i = 0;i<indent;i++) {
|
||||
strncat(line, " ", sizeof(line)-1);
|
||||
for (nlen = 0, i = 0; i < indent; i++) {
|
||||
strncat(line, " ", sizeof(line) - strlen(line) - 1);
|
||||
nlen += 2;
|
||||
}
|
||||
|
||||
ret = snprintf(line + nlen, sizeof(line) - nlen, "%s\r\n", t);
|
||||
llen = (size_t)ret;
|
||||
if (ret < 0 || llen + nlen + len > d->max_str - 1 ) {
|
||||
if (ret < 0 || llen + nlen + len > d->max_str - 1) {
|
||||
write_to_output(d, "String too long, formatting aborted\r\n");
|
||||
free(sc);
|
||||
return FALSE;
|
||||
|
|
@ -1169,8 +1184,8 @@ int format_script(struct descriptor_data *d)
|
|||
t = strtok(NULL, "\n\r");
|
||||
}
|
||||
|
||||
if (indent)
|
||||
write_to_output(d, "Unmatched if, while or switch ignored.\r\n");
|
||||
if (stack_top >= 0)
|
||||
write_to_output(d, "Unmatched block statements ignored.\r\n");
|
||||
|
||||
free(*d->str);
|
||||
*d->str = strdup(nsc);
|
||||
|
|
|
|||
|
|
@ -2486,7 +2486,6 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
|
|||
char cmd[MAX_INPUT_LENGTH], *p;
|
||||
struct script_data *sc = 0;
|
||||
struct cmdlist_element *temp;
|
||||
unsigned long loops = 0;
|
||||
void *go = NULL;
|
||||
|
||||
void obj_command_interpreter(obj_data *obj, char *argument);
|
||||
|
|
@ -2578,8 +2577,8 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
|
|||
if (process_if(p + 6, go, sc, trig, type)) {
|
||||
temp->original = cl;
|
||||
} else {
|
||||
cl->loops = 0;
|
||||
cl = temp;
|
||||
loops = 0;
|
||||
}
|
||||
} else if (!strn_cmp("switch ", p, 7)) {
|
||||
cl = find_case(trig, cl, go, sc, type, p + 7);
|
||||
|
|
@ -2599,9 +2598,10 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
|
|||
if (cl->original && process_if(orig_cmd + 6, go, sc, trig,
|
||||
type)) {
|
||||
cl = cl->original;
|
||||
loops++;
|
||||
cl->loops++;
|
||||
GET_TRIG_LOOPS(trig)++;
|
||||
if (loops == 30) {
|
||||
if (cl->loops == 30) {
|
||||
cl->loops = 0;
|
||||
process_wait(go, trig, type, "wait 1", cl);
|
||||
depth--;
|
||||
return ret_val;
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ struct cmdlist_element {
|
|||
char *cmd; /* one line of a trigger */
|
||||
struct cmdlist_element *original;
|
||||
struct cmdlist_element *next;
|
||||
int loops; /* for counting number of runs in a while loop */
|
||||
};
|
||||
|
||||
struct trig_var_data {
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ void create_world_index(int znum, const char *type)
|
|||
while (get_line(oldfile, buf)) {
|
||||
if (*buf == '$') {
|
||||
/* The following used to add a blank line, thanks to Brian Taylor for the fix. */
|
||||
fprintf(newfile, "%s", (!found ? strncat(buf1, "\n$\n", sizeof(buf1)-1) : "$\n"));
|
||||
fprintf(newfile, "%s", (!found ? strncat(buf1, "\n$\n", sizeof(buf1) - strlen(buf1) - 1) : "$\n"));
|
||||
break;
|
||||
} else if (!found) {
|
||||
sscanf(buf, "%d", &num);
|
||||
|
|
|
|||
|
|
@ -671,12 +671,20 @@ struct char_data *get_char_num(mob_rnum nr)
|
|||
/* put an object in a room */
|
||||
void obj_to_room(struct obj_data *object, room_rnum room)
|
||||
{
|
||||
if (!object || room == NOWHERE || room > top_of_world)
|
||||
if (!object || room == NOWHERE || room > top_of_world){
|
||||
log("SYSERR: Illegal value(s) passed to obj_to_room. (Room #%d/%d, obj %p)",
|
||||
room, top_of_world, (void *)object);
|
||||
}
|
||||
else {
|
||||
object->next_content = world[room].contents;
|
||||
world[room].contents = object;
|
||||
if (world[room].contents == NULL){ // if list is empty
|
||||
world[room].contents = object; // add object to list
|
||||
}
|
||||
else {
|
||||
struct obj_data *i = world[room].contents; // define a temporary pointer
|
||||
while (i->next_content != NULL) i = i->next_content; // find the first without a next_content
|
||||
i->next_content = object; // add object at the end
|
||||
}
|
||||
object->next_content = NULL; // mostly for sanity. should do nothing.
|
||||
IN_ROOM(object) = room;
|
||||
object->carried_by = NULL;
|
||||
if (ROOM_FLAGGED(room, ROOM_HOUSE))
|
||||
|
|
|
|||
|
|
@ -177,6 +177,13 @@ static IBT_DATA *read_ibt( char *filename, FILE *fp )
|
|||
}
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
if (!str_cmp(word, "Flags")) {
|
||||
fMatch = TRUE;
|
||||
fread_flags(fp, ibtData->flags, 4);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
TXT_KEY("IdNum", id_num, fread_line(fp));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@
|
|||
#include <sys/types.h>
|
||||
#include "protocol.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include "telnet.h"
|
||||
#define alloca _alloca
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
The following section is for Diku/Merc derivatives. Replace as needed.
|
||||
******************************************************************************/
|
||||
|
|
@ -1763,7 +1768,26 @@ static void PerformSubnegotiation( descriptor_t *apDescriptor, char aCmd, char *
|
|||
Write(apDescriptor, RequestTTYPE);
|
||||
}
|
||||
|
||||
if ( PrefixString("Mudlet", pClientName) )
|
||||
if ( PrefixString("MTTS ", pClientName) )
|
||||
{
|
||||
pProtocol->pVariables[eMSDP_CLIENT_VERSION]->ValueInt = atoi(pClientName+5);
|
||||
|
||||
if (pProtocol->pVariables[eMSDP_CLIENT_VERSION]->ValueInt & 1)
|
||||
{
|
||||
pProtocol->pVariables[eMSDP_ANSI_COLORS]->ValueInt = 1;
|
||||
}
|
||||
if (pProtocol->pVariables[eMSDP_CLIENT_VERSION]->ValueInt & 4)
|
||||
{
|
||||
pProtocol->pVariables[eMSDP_UTF_8]->ValueInt = 1;
|
||||
}
|
||||
if (pProtocol->pVariables[eMSDP_CLIENT_VERSION]->ValueInt & 8)
|
||||
{
|
||||
pProtocol->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt = 1;
|
||||
pProtocol->b256Support = eYES;
|
||||
}
|
||||
|
||||
}
|
||||
else if ( PrefixString("Mudlet", pClientName) )
|
||||
{
|
||||
/* Mudlet beta 15 and later supports 256 colours, but we can't
|
||||
* identify it from the mud - everything prior to 1.1 claims
|
||||
|
|
|
|||
|
|
@ -1276,7 +1276,7 @@ struct happyhour {
|
|||
struct recent_player
|
||||
{
|
||||
int vnum; /* The ID number for this instance */
|
||||
char name[MAX_NAME_LENGTH]; /* The char name of the player */
|
||||
char name[MAX_NAME_LENGTH+1];/* The char name of the player */
|
||||
bool new_player; /* Is this a new player? */
|
||||
bool copyover_player; /* Is this a player that was on during the last copyover? */
|
||||
time_t time; /* login time */
|
||||
|
|
|
|||
29
src/sysdep.h
29
src/sysdep.h
|
|
@ -63,6 +63,24 @@
|
|||
|
||||
/* Do not change anything below this line. */
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
/* Machine-specific dependencies for running on modern macOS systems 10.13+ (High Sierra)
|
||||
* Updated by Victor Augusto Borges Dias de Almeida (aka Stoneheart), 26 June 2024.
|
||||
*
|
||||
* Tested on:
|
||||
* - macOS 10.13: High Sierra (Lobo) - September 25, 2017 (Latest: 10.13.6)
|
||||
* - macOS 10.14: Mojave (Liberty) - September 24, 2018 (Latest: 10.14.6)
|
||||
* - macOS 10.15: Catalina (Jazz) - October 7, 2019 (Latest: 10.15.7)
|
||||
* - macOS 11: Big Sur (GoldenGate) - November 12, 2020 (Latest: 11.7.10)
|
||||
* - macOS 12: Monterey (Star) - October 25, 2021 (Latest: 12.7)
|
||||
* - macOS 13: Ventura (Rome) - November 7, 2022 (Latest: 13.7)
|
||||
* - macOS 14: Sonoma (Sunburst) - November 7, 2023 (Latest: 14.3)
|
||||
*
|
||||
* This file works on Apple Silicon Chips (M1, M2, M3) without futher configurations.
|
||||
*/
|
||||
#define CIRCLE_MAC_OS 1
|
||||
#endif
|
||||
|
||||
/* Set up various machine-specific things based on the values determined from
|
||||
* configure and conf.h. */
|
||||
|
||||
|
|
@ -78,7 +96,7 @@
|
|||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
|
||||
#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__) || defined(CIRCLE_MAC_OS))
|
||||
#include <stdlib.h>
|
||||
|
||||
#else /* No standard headers. */
|
||||
|
|
@ -88,9 +106,8 @@
|
|||
#endif
|
||||
|
||||
extern char *malloc(), *calloc(), *realloc();
|
||||
extern void free ();
|
||||
|
||||
extern void abort (), exit ();
|
||||
extern void free();
|
||||
extern void abort(), exit();
|
||||
|
||||
#endif /* Standard headers. */
|
||||
|
||||
|
|
@ -150,9 +167,11 @@ extern void abort (), exit ();
|
|||
#include <sys/errno.h>
|
||||
#endif
|
||||
|
||||
#ifndef CIRCLE_MAC_OS
|
||||
#ifdef HAVE_CRYPT_H
|
||||
#include <crypt.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
|
|
@ -434,9 +453,11 @@ struct in_addr {
|
|||
char *strerror(int errnum);
|
||||
#endif
|
||||
|
||||
#ifndef CIRCLE_MAC_OS
|
||||
#ifdef NEED_STRLCPY_PROTO
|
||||
size_t strlcpy(char *dest, const char *src, size_t copylen);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_SYSTEM_PROTO
|
||||
int system(const char *string);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
|
||||
#define NOWHERE -1 /* nil reference for room-database */
|
||||
|
||||
/* The cardinal directions: used as index to room_data.dir_option[] */
|
||||
|
|
@ -22,14 +21,17 @@
|
|||
#define WEST 3
|
||||
#define UP 4
|
||||
#define DOWN 5
|
||||
#define NORTHWEST 6
|
||||
#define NORTHEAST 7
|
||||
#define SOUTHEAST 8
|
||||
#define SOUTHWEST 9
|
||||
|
||||
#define NUM_OF_DIRS 6
|
||||
#define NUM_OF_DIRS 10
|
||||
|
||||
#define CREATE(result, type, number) do {\
|
||||
if (!((result) = (type *) calloc ((number), sizeof(type))))\
|
||||
{ perror("malloc failure"); abort(); } } while(0)
|
||||
|
||||
|
||||
/* Exit info: used in room_data.dir_option.exit_info */
|
||||
#define EX_ISDOOR (1 << 0) /* Exit is a door */
|
||||
#define EX_CLOSED (1 << 1) /* The door is closed */
|
||||
|
|
@ -45,7 +47,7 @@ typedef unsigned short int ush_int;
|
|||
typedef char bool;
|
||||
typedef char byte;
|
||||
|
||||
typedef sh_int room_num;
|
||||
typedef int room_num;
|
||||
typedef sh_int obj_num;
|
||||
|
||||
|
||||
|
|
@ -133,13 +135,14 @@ struct room_data {
|
|||
|
||||
struct room_data *world = NULL; /* array of rooms */
|
||||
int top_of_world = 0; /* ref to top element of world */
|
||||
int rec_count = 0;
|
||||
|
||||
|
||||
|
||||
/* local functions */
|
||||
char *fread_string(FILE * fl, char *error);
|
||||
void setup_dir(FILE * fl, int room, int dir);
|
||||
void index_boot(char *name);
|
||||
void index_boot(int cnt, char **name);
|
||||
void discrete_load(FILE * fl);
|
||||
void parse_room(FILE * fl, int virtual_nr);
|
||||
void parse_mobile(FILE * mob_f, int nr);
|
||||
|
|
@ -150,7 +153,7 @@ void write_output(void);
|
|||
|
||||
|
||||
char *dir_names[] =
|
||||
{"North", "East", "South", "West", "Up", "Down"};
|
||||
{"North", "East", "South", "West", "Up", "Down","North West","North East","South East","South West"};
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
|
|
@ -160,14 +163,12 @@ char *dir_names[] =
|
|||
/* body of the booting system */
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <world-file-name>\n", argv[0]);
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage: %s <world-file-name(s)>\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
index_boot(argv[1]);
|
||||
|
||||
log("Renumbering rooms.");
|
||||
renum_world();
|
||||
index_boot(argc,argv);
|
||||
|
||||
log("Writing output.");
|
||||
write_output();
|
||||
|
|
@ -176,6 +177,21 @@ int main(int argc, char **argv)
|
|||
return (0);
|
||||
}
|
||||
|
||||
/* Since the world is loaded into memory by index
|
||||
* and not room number, we need to search through
|
||||
* all rooms and return the correct one. This is
|
||||
* used to generate door information (ie: the name)
|
||||
*/
|
||||
struct room_data* findRoom(int nr)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<rec_count;i++)
|
||||
if (world[i].number==nr)
|
||||
return &world[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void write_output(void)
|
||||
{
|
||||
|
|
@ -184,11 +200,22 @@ void write_output(void)
|
|||
char buf[128];
|
||||
register int door, found;
|
||||
|
||||
for (i = 0; i <= top_of_world; i++) {
|
||||
for (i=0;i<rec_count;i++) {
|
||||
//print the record number, but no linefeed.
|
||||
fprintf(stderr, "Record: %d ",i);
|
||||
if (world[i].name == NULL) {
|
||||
//linefeed the prior record since we're skipping this one.
|
||||
log("");
|
||||
//the name is blank, which means, most likely, the record is bad as well.
|
||||
continue;
|
||||
}
|
||||
sprintf(buf, "Writing %d.html", world[i].number);
|
||||
log(buf);
|
||||
sprintf(buf, "%d.html", world[i].number);
|
||||
|
||||
//for some reason, if you use %d with sprintf it rolls over like its 16bit,
|
||||
//but only if you use the buffer with fopen.
|
||||
//using %ld and casting to long solves this in case someone really wants
|
||||
//to use negative room numbers.
|
||||
sprintf(buf, "%ld.html",(long)world[i].number);
|
||||
if (!(fl = fopen(buf, "w"))) {
|
||||
perror("opening output file");
|
||||
exit(1);
|
||||
|
|
@ -203,18 +230,22 @@ void write_output(void)
|
|||
found = 0;
|
||||
for (door = 0; door < NUM_OF_DIRS; door++)
|
||||
if (world[i].dir_option[door] &&
|
||||
world[i].dir_option[door]->to_room != NOWHERE) {
|
||||
found = 1;
|
||||
fprintf(fl, "<a href = \"%d.html\"> %s to %s</a> <p>\n",
|
||||
world[world[i].dir_option[door]->to_room].number,
|
||||
dir_names[door],
|
||||
world[world[i].dir_option[door]->to_room].name);
|
||||
world[i].dir_option[door]->to_room != NOWHERE) {
|
||||
found = 1;
|
||||
//this call gets a pointer to the room referenced by the to_room for the door.
|
||||
//This fixes a lot of issues introduced with the whole 'renumbering rooms' call
|
||||
//and the binary search that didn't work well.
|
||||
struct room_data* to_room = findRoom(world[i].dir_option[door]->to_room);
|
||||
fprintf(fl, "<a href = \"%d.html\"> %s to %s</a> <p>\n",
|
||||
to_room->number,
|
||||
dir_names[door],
|
||||
to_room->name);
|
||||
}
|
||||
if (!found)
|
||||
fprintf(fl, "None!");
|
||||
fclose(fl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* function to count how many hash-mark delimited records exist in a file */
|
||||
int count_hash_records(FILE * fl)
|
||||
|
|
@ -231,19 +262,35 @@ int count_hash_records(FILE * fl)
|
|||
|
||||
|
||||
|
||||
void index_boot(char *name)
|
||||
void index_boot(int cnt, char **names)
|
||||
{
|
||||
FILE *db_file;
|
||||
int rec_count = 0;
|
||||
|
||||
if (!(db_file = fopen(name, "r"))) {
|
||||
perror("error opening world file");
|
||||
exit(1);
|
||||
//throw first entry away as that is the executable.
|
||||
for (int i=1;i<cnt;i++) {
|
||||
if (!(db_file = fopen(names[i], "r"))) {
|
||||
perror("error opening world file");
|
||||
exit(1);
|
||||
}
|
||||
//have to loop through files twice.
|
||||
//once to get total record count
|
||||
//second time to load them
|
||||
rec_count += count_hash_records(db_file);
|
||||
fclose(db_file);
|
||||
}
|
||||
rec_count = count_hash_records(db_file);
|
||||
sprintf(buf,"Total records: %d\n",rec_count);
|
||||
log(buf);
|
||||
//now that we know how many records in total
|
||||
//we can create the memory structure
|
||||
CREATE(world, struct room_data, rec_count);
|
||||
rewind(db_file);
|
||||
discrete_load(db_file);
|
||||
//now loop through files and load them
|
||||
for (int i=1;i<cnt;i++) {
|
||||
if (!(db_file = fopen(names[i], "r"))) {
|
||||
perror("error opening world file");
|
||||
exit(1);
|
||||
}
|
||||
discrete_load(db_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -257,6 +304,9 @@ void discrete_load(FILE * fl)
|
|||
fprintf(stderr, "Format error after room #%d\n", nr);
|
||||
exit(1);
|
||||
}
|
||||
if (*line == 'T') //Toss triggers. THey currently break this util.
|
||||
continue;
|
||||
|
||||
if (*line == '$')
|
||||
return;
|
||||
|
||||
|
|
@ -394,22 +444,6 @@ void setup_dir(FILE * fl, int room, int dir)
|
|||
}
|
||||
|
||||
|
||||
/* resolve all vnums into rnums in the world */
|
||||
void renum_world(void)
|
||||
{
|
||||
register int room, door;
|
||||
|
||||
for (room = 0; room <= top_of_world; room++)
|
||||
for (door = 0; door < NUM_OF_DIRS; door++)
|
||||
if (world[room].dir_option[door])
|
||||
if (world[room].dir_option[door]->to_room != NOWHERE)
|
||||
world[room].dir_option[door]->to_room =
|
||||
real_room(world[room].dir_option[door]->to_room,
|
||||
world[room].number);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* procedures for resetting, both play-time and boot-time *
|
||||
*********************************************************************** */
|
||||
|
|
@ -464,32 +498,6 @@ char *fread_string(FILE * fl, char *error)
|
|||
|
||||
|
||||
|
||||
/* returns the real number of the room with given virtual number */
|
||||
int real_room(int virtual, int reference)
|
||||
{
|
||||
int bot, top, mid;
|
||||
|
||||
bot = 0;
|
||||
top = top_of_world;
|
||||
|
||||
/* perform binary search on world-table */
|
||||
for (;;) {
|
||||
mid = (bot + top) / 2;
|
||||
|
||||
if ((world + mid)->number == virtual)
|
||||
return (mid);
|
||||
if (bot >= top) {
|
||||
fprintf(stderr, "Room %d does not exist in database (referenced in room %d)\n", virtual, reference);
|
||||
return (-1);
|
||||
}
|
||||
if ((world + mid)->number > virtual)
|
||||
top = mid - 1;
|
||||
else
|
||||
bot = mid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* get_line reads the next non-blank line off of the input stream.
|
||||
* The newline character is removed from the input. Lines which begin
|
||||
* with '*' are considered to be comments.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue