--- crossfire/common ---


Protocol:pserver User:anonymous
Machine:crossfire.cvs.sourceforge.net CVSROOT:/cvsroot/crossfire

Filename: readable.c
Revision 1.31tchize 2006/04/06 16:18:34 +2 -2

finished common/arch.c unit test, fixed a few bugs, moved function around and renamed other
Show difference between Revision 1.30 and 1.31
Revision 1.30ryo_saeba 2006/03/18 11:15:24 +2 -3
Use const when possible. Patch courtesy Stefan Huehner.
Show difference between Revision 1.29 and 1.30
Revision 1.29akirschbaum 2006/02/10 17:59:25 +16 -16
Apply slightly modified patch #1428309 (code-cleanup: const, static) by
Stefan Huehner: add const/static to functions/variables. Remove some type
casts.
Show difference between Revision 1.28 and 1.29
Revision 1.28akirschbaum 2006/02/08 18:48:36 +5 -5
Apply patch #1427979 (code-cleanup: add const, fix warnings) by Stefan
Huehner.
Show difference between Revision 1.27 and 1.28
Revision 1.27akirschbaum 2005/12/05 17:34:03 +4 -4
Apply patch #1371956 (code cleanup patch) by Stefan Huehner: fix old-style
function declarations and prototypes to proper Ansi C syntax. This patch
allows the compiler to check function arguments and also removes some warnings
when compiling with -Wstrict-prototypes.
Show difference between Revision 1.26 and 1.27
Revision 1.26akirschbaum 2005/10/31 15:23:00 +4 -21
Fix bug #1102975 (Bronze items not keeping their + in alchemy): the problem
was that a formula for full_helmet did exist but not for b_full_helmet. Since
both helmet's names are "full helmet", the recipe was selected even if using
the ingredient b_full_helmet. This fix adds new formulae for alternative
archetypes with the same name as the base object, and makes the server code
select the matching formula from multiple arch names in the "arch" field.
Show difference between Revision 1.25 and 1.26
Revision 1.25akirschbaum 2005/10/28 14:08:53 +5 -6
Fix compiler warnings. Most changes do not change the program (remove unused
variables, convert "if(x = y)" into "x = y; if(x)"); a few actually fix
(possible) problems (fix uninitialized variables, fix printf format
specifiers, fix mismatches between signed and unsigned variables, add missing
return and default statements).
Show difference between Revision 1.24 and 1.25
Revision 1.24akirschbaum 2005/10/24 14:49:10 +2 -2
common/readable.c: Fix out of bounds access to max_titles[] in
init_book_archive().
Show difference between Revision 1.23 and 1.24
Revision 1.23mwedel 2005/10/13 02:24:28 +2 -2
Remove subtype<0 check - subtype is an unsigned value, so can never
be less than zero - removes gcc warning message.
MSW 2005-10-12
Show difference between Revision 1.22 and 1.23
Revision 1.22ryo_saeba 2005/09/25 04:47:22 +3 -2
Fix some compilation warnings.
Show difference between Revision 1.21 and 1.22
Revision 1.21ryo_saeba 2005/08/12 08:46:34 +19 -16
Fields changed from char* to const char*, cleanup.
Show difference between Revision 1.20 and 1.21
Revision 1.20ryo_saeba 2005/08/12 03:18:59 +2 -2
Use const char* instead of char* when possible
Show difference between Revision 1.19 and 1.20
Revision 1.19akirschbaum 2005/07/16 16:10:37 +4 -4
Fix spelling errors in string constants.
Show difference between Revision 1.18 and 1.19
Revision 1.18tchize 2005/05/06 16:10:07 +78 -3

added a new command to identify the type of text send to client.
media tags can be included inside them. Those text types include
scrolls, books, message of the day, signs, aso.
See protocol doc for details
Show difference between Revision 1.17 and 1.18
Revision 1.17akirschbaum 2005/03/06 14:38:52 +4 -4
common/{map.c, readable.c, treasure.c}, crossedit/Attr.c, server/{apply.c,
attack.c, c_wiz.c, init.c, monster.c, pets.c, shop.c, skill_util.c, skills.c,
spell_attack.c, spell_effect.c, time.c}, socket/{info.c, request.c}: Add
missing newline character to LOG() messages.
Show difference between Revision 1.16 and 1.17
Revision 1.16mwedel 2004/12/28 19:08:48 +13 -5
Applied patch 1001079 - make alchemy books say what skill & equipment
is needed - by Kevin Rudat.
common/readable.c: Update code that generates book title, contents
to denote what skill and equipment is needed.
random_maps/{random_map.c, random_map.h, reader.l, reader.c, standalone.c},
server/main.c:
Remove generate_treasure_now as an option
for random maps - none are using delayed treasure, and IMO, if someone
did, it would horribly break things, so it should never be used - given
that, no reason to leave the code there.
server/main.c: Add additional debugging for process events on removed
objects - trying to track down occasional disease crash.
server/time.c: Fix crash in move_player_mover() - it was never map tile
aware, but even more so, appears to have always been broken if the
player move tried to push the player off the edge of a map. Check
for out of map condition, as well as make it map tile aware.
MSW 2004-12-28
Show difference between Revision 1.15 and 1.16
Revision 1.15akirschbaum 2004/10/09 14:36:29 +5 -2
common/readable.c: Apply patch by Kevin Rudat to add some alchemy book names.
Show difference between Revision 1.14 and 1.15
Revision 1.14akirschbaum 2004/10/09 14:26:44 +23 -9
common/readable.c: Apply patch by Kevin Rudat to fix buffer overrun while
generating book titles.
Show difference between Revision 1.13 and 1.14
Revision 1.13mwedel 2003/09/13 00:01:30 +30 -90
Updated code for skill + spell code. skills and spells are now objects.
tuning these now means changing the archetypes. New spells can now
be added just by making a new archetype. Lots of code cleanup
also done.
MSW 2003-09-12
Show difference between Revision 1.12 and 1.13
Revision 1.12garbled 2002/11/13 18:19:32 +1 -9
Nuke #ifdef ALCHEMY from orbit. If you don't want alchemy cp /dev/null
lib/formulae.
Show difference between Revision 1.11 and 1.12
Revision 1.11mwedel 2002/09/05 00:23:15 +3 -5
common/readlable.c: Fix crash caused by passing null value to mon_desc -
check for non null was at end of { } do loop - check should be at the
start.
server/monster.c: Make it so that monsters with see invisible are not
immune to blind - monster can be given appropriate resistance to make
it so it is not effected by blind.
MSW 2002-09-11
Show difference between Revision 1.10 and 1.11
Revision 1.10mwedel 2002/07/14 23:57:12 +5 -5
-- Start body commit notes --
Major commit. This adds body locations which is used for equipping items.
Equipment has information which body part it gets equipped to, and monsters
have information on how which body locations they can have.

As part of this work, I also did a lot of code cleanup.

To use this, you must use up to date archetypes - the ones included
in this commit are fine - just make sure you install them. If
you don't, players will not be able to equip items.

common/arch.c: Initialize body_used to be same as body_info for
archetypes - this way when monsters are created, they can
start equipping items right away.
common/exp.c: update new_exp() - some flags it checked for before no longer
exist or have new names.
common/info.c: describe_item() now takes second parameter - update
dump_abilities to use new calling convention.
common/item.c: Add table that describes the body_info locations and
their names. Add functions that calculate item power for objects
that don't have it set. Update display functions to show
item_power in items. Update describe_monster() - use_horn/wand/rod
merged into just use_range. Modify describe_item() to take second
paramater - who the item is being described for. Show item_power
in describe_item.
common/living.c: Pull out MAXLEVEL from being defined in this file -
define in in define.h, since other files use it. Add NUM_STATS
define - replace hard coded values of having just 7 stats with it.
Update change_abil to not display that the player has a new
attacktype when equipping a bow that has it - fix_player() ignores
the attacktype of the bow, so it was incorrect information.
fix_player(): Initialize player ranges structure to null -
will get filled in by code in function, updated to deal with
updating the body_used data from body_info in the objects.
Replace instances of last_heal with gen_sp_armour. Rearrange
some code to make function more readable.
common/loader.c, common/loader.l: Remove the variable_const information - no
longer needed and confusing for new people when adding in new object
elements. Add set_body_info() - parses the string from the load file and
sets the appropriate array element. Add check_loaded_object() - does
sanity checking for an object after finished loading - replaces need for
long processing directive in the actual rules by having seperate function.
Remove unused flags from load directives (apply_once, no_pretext,
can_apply), add some new ones (item_power, gen_sp_armour), update others
to can_use_range. Replace flag_links with simple array that contains the
name for each corresponding flag. Update get_ob_diff to not use the V_
values and just include the actual string name - all recent changes have
done this, just updated for old stuff. Update get_ob_diff to save new
values that have been added.
common/object.c: clear_object: Modify to use memset to clear
the structure to zero - this is less error prone than listing
all the specific values, and probably faster. Also, makes it
easier to add new elements - no need to update object.c in most
cases.
common/player.c: Remove get_player_ob routine - this is now merged
in with get_player_ob in server/player.c. Remove generate_ext_title -
not used.
common/readable.c: Update to pass second argument to describe_item.
common/treasure.c: Update to calculate item_power of generated items.
Clean up a lot of code formatting. Update add_abilities
to use gen_sp_armour values, not last heal (note, it appears
the last_heal values weren't being used before). Update
calls to describe item to take second parameter.
doc/Developers/objects: Update will_apply notes, add note about
item_power, body location.
include/define.h: Comment out unused flags (flag_apply_once, flag_paralyzed,
flag_no_pretext, flag_ready_rod, flag_read_horn). Add flag_use_shield.
rename flag_use_wand to flag_use_range. rename flag_ready_wand to
flag_ready_range. Add flag_ready_scroll. Update ARMOUR_SPELLS access
macro. Add AP_PRINT flag to apply flags. Add CAN_APPLY_.. return types
for can_apply_object function.
include/includes.h: add strftime, mktime checks to this file.
include/libproto.h: rebuilt.
include/living.h: Add NUM_STATS define, update extern declarations
to use it for sizing.
include/loader.h: remove the V_.. info and xbm_.. externs that were not
used.
include/newserver.h: Remove ext_tile information.
include/object.h: Add Body_Locations structure, NUM_BODY_LOCATIONS define.
Add definitions for WILL_APPLY values. Clean up object structure -
formatting is now consistent, ordering of values groups values
together more logically. Update all types to use the int8/int16/int32
types. Several unused fields removed.
include/player.h: Update rangetype enum. Add unapplymode enum.
Clean up player structure - type updates, unused fields removed,
formatting fixed up.
include/spells.h: remove range_name extern. Update SpellTypeFrom
field to combine wand/rod/horn into spellMisc - none of the
spell casting code was differentiating these.
include/sproto.h: rebuilt.
lib/Makefile.in: Add new help files (applymode, bind, brace)
lib/archetypes: rebuilt for body_info, gen_sp_armour, item_power,
can_use_shield information.
lib/artifacts: updated for item_poer and gen_sp_armour changes.
lib/treasures: remove unused _force for player treasure.
plugin/plugin_python.c: Change FLAG_USE_WAND to FLAG_USE_RANGE.
server/apply.c: Move stftime, mktime to include/includes.h. Remove
draw_find() - one line function can just as easly be in the
code itself. Update calls to long_desc to pass second parameter.
move gravestone_text() to player.c file. Add direction parameter to
apply_scroll() - in this way monsters can use it properly.
Remove dead code. Update apply_special function. Add
unapply_special(), get_item_from_body_location(), unapply_for_ob(),
and can_apply_object() functions.
server/attack.c: Remove SET_FLAG(op, FLAG_PARALYZED) line - no code
was ever checking status of FLAG_PARALYZED.
server/c_misc.c: add command_body() which dumps body information for
player. Update who as idle element in player structure removed -
was not being used by anything. Add command_applymode() to
set players prefered unapply method. Remove calls to unlock_player()
in various functions - unlock_player() has not done anything
meaningful for a while.
server/c_object.c: Modify long_desc to take a second parameter
which is who is examing the object. this is needed so that we
can pass it down to some of the lower level functions.
Update calls to describe_item to pass this second parameter.
remove FLAG_NO_PRETEXT code - no archetyps were using it. When
examining objects, also tell player where to put them on.
server/c_range.c: Update legal_range() - we now store the object that
is responsible for a range in the player object, so code is
much simpler. Update change_spell() to not destroy golem
just by readying another spell - we now let players regain control
of golems after switching to another range. Update change_spell
to use item name of object for range description.
server/c_wiz.c: remove reference to count_left from player object -
field removed from structure.
server/commands.c: add new commands (applymode, body) to command dispatch
table.
server/login.c: Remove unlock_player() and lock_player() and calls to it -
current checking of names at login should be sufficient to
prevent duplicates. Remove dead code from check_name. Update
load/save code for unapply mode value. Add set_flag(op,
FLAG_USE_SHIELD) if player is allowed to use armor - needed since
flag_use_shield is really a class feature and so is not automatically
updated for old player files.
server/main.c: Remove references to count_left. memset marker object to
NULL - seems to increase stability on metalforge server.
server/monster.c: Many updates related to the body info - monsters follow some
rules as players. Add monster_should_cast_spell function - monsters will
use this for all spellcasting related actions (abilities, scrolls, wands,
etc). Update for merged rod/horn/wand ranges. Update bow use by monsters
- they don't actually need to equip it to fire - this way we don't need to
constantly swap the monsters weapons between the bow and melee item. Use
fire_bow from player.c for most of the work. Modify scroll usage -
monster will use it when player is near, not when it first picks it up.
Add FLAG_READY_SCROLL to denote the monster has a scroll to use. Also,
monster now casts it in appropriate direciton. Merge the
monster_use_wand/rod/horn into monster_use_range. Modify
check_good_weapon and check_good_armour to just look at the stats of the
two items without needing the monster to apply it first.
server/player.c: Print motd in green so it is more noticable. Update
get_player function to do work it did before as well as that of
get_player_ob. Have get_player take a parameter which is the object of
the player if he has one. Modify to use memset to clear the player
structure - more sure fire than explicitly listing values to initialize.
Remove calls to unlock_player. Modify fire_bow so that monsters can also
use the function. Add fire_misc_object() to fire_wand/rod/horn - removes
code from fire(). Add gravesetone_text() to this file.
server/shop.c: Update to pass second parameter to describe_item().
server/skill_util.c: Update check_skill_to_fire since there are fewer
rangetypes now. change range_scroll name to range_golem, as that is
a bit more accurate for what it actually does. Modify show_skills()
to show player his item power and total of items he has equipped.
server/skills.c: Add second paramater to long_desc, remove references to
count_left.
server/spell_effect.c: Add second paramater to long_desc, remove references to
count_left. Update range_scroll to range_golem
server/spell_util.c: remove references to count_left. Update messages
if player trying to cast where he can't with new range names.
socket/info.c: Update range information and how we display what it is -
we will use the object name of the range if available. Remove
reference last_known_spell, last_shoot, last_spell, last_value
player structure fields.
socket/init.c: Remove ext_title information.
socket/request.c: Add element for life_stealing in the resistance array.
Remove references to idle, count_left in player structure. remove
ext2 title information.
MSW 2002-07-14
-- End body commit notes --
Show difference between Revision 1.9 and 1.10
Revision 1.9michtoen 2001/10/29 20:30:19 +3 -3
Remove a bug, reset some modules
Show difference between Revision 1.8 and 1.9
Revision 1.8michtoen 2001/10/29 18:49:02 +4 -4
really SOME fixes - most casting
Show difference between Revision 1.7 and 1.8
Revision 1.7mwedel 2001/05/28 23:41:53 +1 -6
Make ALLOW_SKILLS standard part of game (remove #ifdef's for it)
Files affected: common/living.c common/object.c common/treasure.c
include/config.h include/player.h server/apply.c server/attack.c
server/c_move.c server/c_range.c server/c_wiz.c server/commands.c
server/init.c server/login.c server/monster.c server/player.c
server/rune.c server/skill_util.c server/spell_util.c
Make MULTIPLE_GODS standards part of game (remove #ifdefs for it)
Files affected: common/readable.c include/spellist.h include/config.h
server/attack.c server/gods.c server/skills.c server/spell_effect.c
server/spell_util.c
doc/Makefile.in, doc/Protocol: Add protocol description file here instead
of in the client distribution.
include/global.h: Move declaration of MAX_EXP_CAT near top of file
so it is set before player.h is included.
include/newclient.h: Add CS_STAT_SKILL* values for sending skill
experience information to client.
include/newserver.h: Add skillexp value to socket struct which determines
if client wants skill experience informatiion.
include/player.h: Add skill information tracking to player structure
so we can easily know when to send updates to client.
random_maps/expand2x.c: remove unused variable to prevent compiler warnings.
random_maps/square_spiral.c: Include prototype information on all systems,
not just win32 to prevent compiler warnings.
server/skill_util.c: Initialize skill pointers to make it easier to
find skill information when we want to update client.
socket/init.c: Init socket->skillexp to 0.
socket/loop.c: Fix indentation of table - whitespace change only
socket/metaserver.c: Minor fix to prevent compile warnings (on the sprintf
that composes the data to send to the metaserver)
socket/request.c: Redo SetUp function to be more compact and IMO simpler as
wll as easier to read (functionality remains the same).
VersionCmd modified to warn users of on dxclients (code on MT)
StatsCmd added to send skill information if client wants it.
The sending of skill experience is by MT, rest of the changes by me.
MSW 2001-05-28
Show difference between Revision 1.6 and 1.7
Revision 1.6mwedel 2001/05/26 02:29:22 +98 -74
common/readable.c: When making recipe books, give the recipe that they
are for in the title. Makes it more worthwhile to buy them.
lib/treasures.c: Increase the chance of readables in chests some (in fact,
add a chance.)
MSW 2001-05-25
Show difference between Revision 1.5 and 1.6
Revision 1.5mwedel 2001/05/09 01:58:12 +2 -2
Various improvements to make finding memory leaks easier.
common/anim.c: Add free_all_anim function
common/arch.c: Modify free_all_arch to free more data
common/init.c: If running under MEMORY_DEBUG, don't pre-allocate objects.
common/map.c: Add free_all_maps functiion.
common/object.c: Modify object allocations if using MEMORY_DEBUG to only
malloc one object at a time, and not pre-allocate objects.
common/readable.c: Fix memory leak.
common/shstr.c: Include autoconf.h so it can pull in dmalloc.h file.
include/config.h: Remove notes of what was removed a long time ago.
Add MEMORY_DEBUG option.
include/libproto.h, include/sockproto.h, include/sproto.h: automatic rebuild
server/c_misc.c: Fix 'malloc info command so it reports right memory total
for maps. Add command_style_map_info which sums up memory used by
style maps.
server/commands.c: Add style_info wiz command which dumps memory usage
for style maps.
server/init.c: Have sighup handler call cleanup function.
server/main.c: Fix clean_tmp_files which could result in crash if one
of the maps in memory has 0 reset time. Modify cleanup function
to free more data.
server/player.c: op_on_battleground: Fix compile warning about unuused variable.
socket/init.c: Change name of free_all_ericserver to free_all_newserver,
have it free all face data.
MSW 2001-05-08
Show difference between Revision 1.4 and 1.5
Revision 1.4mwedel 2001/03/30 00:14:25 +47 -14
common/readable.c: Name spellbooks based on level of spell, and not
just randomly. Patch by Preston Crow, applied by Mark Wedel 2001-03-29
Show difference between Revision 1.3 and 1.4
Revision 1.3cvs 2000/12/03 18:40:03 +35 -56
Checking for partial resistance code. Various minor errors also fixed
(compiler warnings, unused variables, Makefile.in changes, etc).
PR code also includes support to send protections to the client.
Show difference between Revision 1.2 and 1.3
Revision 1.2damn 1999/09/17 14:22:32 +3 -3
- spelling fix: grimore -> grimoire --DAMN
Show difference between Revision 1.1 and 1.2
Revision 1.1uid200 1999/04/02 13:10:03 None
Initial revision
First version
Revision 1.1.1.1uid200 1999/04/02 13:10:03 +0 -0
First CVS revsion: crossfire-0.95.3
Show difference between Revision 1.1 and 1.1.1.1


File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:17