--- crossfire/common ---


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

Filename: porting.c
Revision 1.34mwedel 2006/06/05 01:28:56 +3 -7
Clean up some compiler warnings. Most of the changes are related to replaced
%lld with FMT64 defines so that the format will be correct, no matter if
the 64 bit type is a long, long long, or if this is windows. #if 0 out a
bunch of code that isn't used.
--
common/exp.c: Replaced lld with FMT64
common/holy.c: #if 0 out baptize_altar(). Add banner copyright at top of file.
common/info.c, common/item.c, common/loader.l, common/loader.c, common/map.c:
common/porting.c Replaced lld with FMT64
common/time.c: Replace a bunch of variables declared as longs to be uint32.
Update various sprintf appropriately.
include/global.h: Add FMT64 and FMT64U as appropriate for different systems.
Change max_time to be a uint32
include/sockproto.h, include/sproto.h: rebuilt
server/apply.c: #if 0 out monster_apply_special
server/c_range.c: Add != 0 in assignment if statement - same meaning, clearer
on intention and avoids compiler warning.
server/c_wiz.c: Update command_kick() to take const char. Update command_speed()
to operate properly based on max_time being a uint32. Update various lld
to FMT64. Clarify ambiguous if/if/else statement in command_insert_into()
server/commands.c: Add cast to command_kick for new function prototype. #if
0 out find_command(), parse_string(), parse_command()
server/disease.c: #if 0 out find_disease(), reduce_symptoms()
server/egoitem.c: #if 0 out create_artifact(). Add copyright at top of file.
server/gods.c: #if 0 out get_god()
server/hiscore.c: Replace lld with FMT64
server/login.c: #if 0 out create_savedir_if_needed()
server/resurrection.c: Replace lld with FMT64. #if 0 out dead_character() and
dead_player_exists()
server/server.c: Remove info_keys() - hasn't been used in a long time. #if 0
out process_active_maps()
server/skill_util.c: Replace lld with FMT64
server/spell_util.c: #if 0 out check_spell_effect()
server/weather.c: #if 0 out feather_map(). Fix what I suspect is an error
in worldmap_to_weathermap() to skip over starting slashes.
socket/image.c: Add a fair number of char * casts to suppress warnings.
socket/init.c: Change buflen in init_connection() to socklen_t to match
function prototype. Add some char * casts.
socket/loop.c: Add some char * casts.
--
MSW 2006-06-04
Show difference between Revision 1.33 and 1.34
Revision 1.33akirschbaum 2006/05/21 07:44:35 +2 -2
Remove useless sizeof() operator.
Show difference between Revision 1.32 and 1.33
Revision 1.32akirschbaum 2006/05/21 07:43:30 +3 -2
Do not crash in strdup_local() in out of memory condition.
Show difference between Revision 1.31 and 1.32
Revision 1.31akirschbaum 2006/05/21 07:41:48 +2 -2
Fix error message.
Show difference between Revision 1.30 and 1.31
Revision 1.30ryo_saeba 2006/03/18 11:15:24 +3 -3
Use const when possible. Patch courtesy Stefan Huehner.
Show difference between Revision 1.29 and 1.30
Revision 1.29akirschbaum 2005/12/11 13:11:32 +107 -73
Fix buffer overflows which can be triggered remotely.
Show difference between Revision 1.28 and 1.29
Revision 1.28akirschbaum 2005/10/28 18:43:30 +5 -17
Prevent problems (crashes) for large item piles. Now limit nrof to less than 2^31.
Show difference between Revision 1.27 and 1.28
Revision 1.27akirschbaum 2005/09/04 11:58:12 +2 -2
common/{anim.c, image.c, los.c, map.c, porting.c, treasure.c},
include/define.h, random_maps/treasure.c,
server/{apply.c, c_misc.c, c_object.c, c_wiz.c, commands.c, daemon.c,
hiscore.c, init.c, login.c, player.c, plugins.c, resurrection.c, weather.c},
socket/{init.c, item.c, loop.c, lowlevel.c}: Use LOG() for error messages and
debug output instead of stdout/stderr. Include filename in error messages.
server/resurrection.c: Fix error message in read_player().
Show difference between Revision 1.26 and 1.27
Revision 1.26ryo_saeba 2005/08/12 03:18:59 +7 -7
Use const char* instead of char* when possible
Show difference between Revision 1.25 and 1.26
Revision 1.25mwedel 2005/04/27 01:39:50 +6 -1
Apply patch 1190107 so server compiles on HURD.
common/porting.c: Add define for MAXPATHLEN
socket/init.c: Add check for __GNU__ for setsockopt()
MSW 2005-04-27
Show difference between Revision 1.24 and 1.25
Revision 1.24ryo_saeba 2004/04/28 17:04:08 +2 -2
Change char* to const char*, value shouldn't be changed
Show difference between Revision 1.23 and 1.24
Revision 1.23ryo_saeba 2004/03/26 16:41:43 +4 -4
Const specifiers
Show difference between Revision 1.22 and 1.23
Revision 1.22ryo_saeba 2004/03/26 15:59:28 +5 -1
Win32 fixes
Show difference between Revision 1.21 and 1.22
Revision 1.21tchize 2003/06/30 14:14:13 +11 -2


Various code optimisations to help preventing peeks at maploads. Includes:
* rewritten saving of objects, removed needs for sprintf calls and most strlen calls
* modified map structures for saving of a very small amount of additionnal precalculated datas for weather
* added FAST_xxx macros for fast string manipulations
Show difference between Revision 1.20 and 1.21
Revision 1.20mwedel 2003/04/04 23:39:48 +2 -2
acinclude.m4: Update path to find python includes, since aclocal.m4 gets
derived from this file.
configure.ac, configure: Add utils/scores.pl to list of files to substitute on.
common/loader.l, loader.c: Add subtype for objects - will be used in future work.
common/object.c: Add subtype diff check in CAN_MERGE()
common/porting.c: Have it use SAVE_DIR_MODE when doing the mkdir, and not have
hardcoded 777 permissions.
doc/Makefile.in, doc/Makefile.am, doc/Developers/Makefile.am,
doc/Developers/Makefile.in: Move some of the spell docs around and merge
them together
doc/Developers/objects: Add notes about subtype.
doc/Developers/spells: New file, contains preliminary work on spell objects.
include/config.h: Remove command about DM_MAIL and LIBDIR from file, as they
are options no longer present. Update comment about SAVE_MODE, and add
SAVE_DIR_MODE
include/object.h: Add subtype field to object.
server/login.c: Have it use SAVE_DIR_MODE when doing the mkdir, and not have
hardcoded 6700 permissions.
utils/Makefile.in: Updated to know about scores.pl
utils/scores.pl.in: New file - reads player file to generate HTML score
file.
MSW 2003-04-04
Show difference between Revision 1.19 and 1.20
Revision 1.19mwedel 2003/03/07 23:35:32 +17 -17
Patch for 64 bit experience total, as well as flexible number of levels.
Basically, max level is now dynamic, set in exp_table file. Experience
is now a 64 bit value, so much higher totals now allowed. To
allow for flexible levels, add new function - did_make_save() which is used
for players/monsters to see if they make their saving throw - this is
necessary because the savethrow[] array may not be as large as max level -
did_make_save takes this into account.
NOTE: If your updating a server, you will need to copy over/set up a
new exp_table file that has max_levels defined and at least one of the
tables uncommented. There are no longer any compiled in defaults
--
configure, configure.ac: Add AC_CHECK_SIZEOF calls for long and long long
so we can know which one to use for 64 bit support (other checks
may need to be added)
common/exp.c: Remove levels table, replace it with a 64 bit pointer.
Change init_experience to allocate appropriately sized table, have it
read max_level value from exp_table file. Replace atoi calls with
atoll to get 64 bit value. Update dump_experience to properly
print 64 bit values.
common/info.c: Update dump routines that dump exp to properly print
64 bit values.
common/init.c: Add initializing for settings.max_level value.
common/item.c: Update sprintf's to handle 64 bit output of exp (speed)
value in objects.
common/living.c: change MAX_EXP define, update MAX_EXP_IN_OBJ define,
add MAX_SAVE_LEVEL which corresponds to how large the savethrow
table is. Change MAXLEVEL to settings.max_level. Change level_exp()
to return 64 bit value, other updates in functions to use 64 bit
values. Add did_make_save() function.
common/loader.l, common/loader.c: Update load/save routins of exp to
deal with 64 bit values.
common/map.c: Update calculate_difficulty to use 64 bit values when
storing exp - unlikely to make a difference, since unlikely any map
will get to a point where it has that much exp on it.
common/porting.c: Remove dead code from save_long(), add save_long_long()
to save 64 bit values.
include/autoconf.h.in: SIZEOF_LONG and SIZEOF_LONG_LONG values added.
include/global.h: Add code to typedef sint64/uint64 types based on what
type gives us those values. Add max_level to settings array.
include/libproto.h: rebuilt.
include/living.h: Replace exp field with 64 bit value.
include/player.h: Update party kill log exp tracking to have 64 bit
values.
lib/exp_table: Udpate comments about max_level, uncomment what
was the default table so new installs have working table.
Add 5 levels to all the tables.
random_maps/monster.c: Update place_monsters to use 64 bit when storing
exp total for map/per square.
server/apply.c: Replace MAXLEVEL with settings.max_level, add
did_make_save calls where appropriate
server/c_misc.c: have statistics command properly print 64 bit
exp value.
server/c_wiz.c: Have stats command properly display 64 bit value.
server/hiscore.c: Replace exp values with 64 bit values, update to
properly load/display them.
server/player.c: replace savethrow[] reference with did_make_save()
server/skill_util.c: Update skills command to properly show 64 bit exp values.
server/spell_effect.c: replace savethrow[] reference with did_make_save(),
allow players to cast directors right beneath themselves, but other
walls must be on empty space.
MSW 2003-03-07
Show difference between Revision 1.18 and 1.19
Revision 1.18garbled 2003/02/04 00:26:06 +20 -1
Fix some bugs for once, rather than introduce them.
Show difference between Revision 1.17 and 1.18
Revision 1.17mwedel 2002/12/03 01:40:10 +10 -9
TODO: Move more items from my mailbox to the TODO list.
common/living.c: Init item_power in player to zero in fix_player() -
bogus results were getting generated as it just kept getting incremented.
common/porting.c: fix remove_directory so it works properly - checking
for . and .. entries too late, calling unlink instead of rmdir.
include/sproto.h: rebuilt
lib/animations, lib/archetypes, lib/bmaps, lib/bmaps.paths, lib/crossfire.0,
lib/crossfire.1, lib/faces: Rebuilt - new archs added, catch is_thrown
addition to thrown rock/boulder archs.
server/c_move.c, server/c_range.c: Add another parameter to do_skill() - part, which
is closest part of creature to target object - current only used
for the throw code. Update calls to this function to add additional
parameter.
server/c_object.c: Remove the NDI_UNIQUE from the 'item is too heavy
to pick up' so that it won't flood the client with them if players
goes onto space with lots of objects.
server/main.c: Minor cleanup to fix compiler warning about ambigous
if/else.
server/monster.c: Pass closest part of monster when having it use
a skill so that it doesn't throw rocks into itself. Update calls to
do_skill as described above.
server/player.c: Cal delete_player() when player quits - this properly
cleans up any per player unique maps they have. Also, check for
any such maps currently in memory, and delete those so that unique
maps don't get 'gifted' to the next character of the same name.
Update calls to do_skill as described above.
server/shop.c: Combine items of the same name together in the output
of the shop listings. Include the number of items, remove special
casing of some objects so that query_base_name is used for all item
types.
server/skill_util.c: Modify do_skill() to take additional param as
described above. Also, have do_skill return 1 on success,
0 on failur to use skill, and not return exp - otherwise,
monster code has no idea if skill was successfully used, as throw
doesn't grant exp, and this caused monsters to move into the
object they just threw. Update calls to do_skill as described
above.
server/skills.c: Clean up skill_throw function to return meaningfull
value. Also, pass along extra part of closest monster part
to target. Modify do_throw to return value, use closest
part of body as origin point for thwon object.
server/spell_effect.c: Use isqrt function instead of definining
ISQRT that used float version. Cleans up compile warning - most
likely not seen before as spell was #ifdef SPELL_ENCUMBERANCE out.
server/time.c: Put sanity checking for players speed_left in
move_player_mover() - got some reports of infinite negative speed
on metalforge, and this is the only place in the code where I could
see that happening given the description of the events.
utils/arch2xml.py, utils/cfarches.xsl: New script (and template) by
Todd Mitchell. Script can convert archs to xml, and the template
is usuable with mozilla to look at the output.
MSW 2002-12-02
Show difference between Revision 1.16 and 1.17
Revision 1.16mwedel 2002/10/08 01:38:25 +2 -1
configure, configure.ac: Remove --enable-old-layout option - that is more than
3+ years old now. Add --enable-dmalloc option so code can be compiled
with dmalloc debugging without needing to change/rebuild the configure
files.
common/porting.c: Add stdarg.h to list of included files.
include/autoconf.h.in: rebuilt, HAVE_LIBDMALLOC undef added.
random_maps/square_spiral.c: fix bound checking value.
MSW 2002-10-07
Show difference between Revision 1.15 and 1.16
Revision 1.15mwedel 2002/09/24 01:34:59 +17 -1
Add snprintf function if HAVE_SNPRINTF is not defined.
MSW 2002-09-23
Show difference between Revision 1.14 and 1.15
Revision 1.14mwedel 2002/09/07 00:55:18 +3 -2
More bugfixes:
common/loader.l, loader.c: Fix up the handling with speed with respect
to style maps - the objects were still getting put on the active
list.
common/map.c: Fix up blocked_link() to behave more like the
blocked_two() function - inventory checkers and door handling.
Comment out blocked_two since it isn't used anymore. Modify
load_objects to remove objects on style maps from the active
list. Remove some of the debug messages about map loading.
common/object.c: Add remove_from_active_list() function for use
in map.c to remove objects from active list.
common/porting.c: Comment out debug message if open_and_uncompress()
can open a file - caller of the function should print out messages,
and it really isn't much of an error in any case.
include/libproto.h: rebuilt.
random_maps/special.c: Modify place_special_exit() - this should fix
bug of very large treasure maps - problem was if the generated map
size was too small, when generate_random_map was called, it would
generate a newly sized map that was much larger. Code was also
re-arranged some to make it a little more readable.
server/attack.c: Fix crash when creature may not have an owner and
it kills something else.
server/move.c: comment added - no code change.
socket/request.c: Fix off by one error in esrv_send_animation() -
rare condition as it only showed up when trying to send the last
animation (zombie) - only an issue if the player is put on top of
a zombie for some reason (no other space for them) - observed when
leaving the random dungeon in the undead church in scorn without
clearing out all the zombies first.
MSW 2002-09-06
Show difference between Revision 1.13 and 1.14
Revision 1.13mwedel 2002/07/14 23:25:39 +3 -3
Update banner copyright with proper contact information.
MSW 2002-07-14
Show difference between Revision 1.12 and 1.13
Revision 1.12michtoen 2001/10/29 20:30:19 +1 -1
Remove a bug, reset some modules
Show difference between Revision 1.11 and 1.12
Revision 1.11michtoen 2001/10/29 18:49:02 +0 -0
really SOME fixes - most casting
Show difference between Revision 1.10 and 1.11
Revision 1.10michtoen 2001/10/29 17:24:13 +2 -1
no message
Show difference between Revision 1.9 and 1.10
Revision 1.9mwedel 2001/07/13 23:04:53 +228 -1
common/Makefile.in: Remove ltostr.c and sqrt.c from list of files
common/ltostr.c, common/sqrt.c: Moved into porting.c
common/anim.c, common/button.c, common/item.c: Update calls to update_object
common/living.c: have fix_player calculate light value for player/monster.
common/logger.c: Remove code that has server exit if too many LOG messages
happen too quickly. This was not a reliable mechanism, and it should
really be up to the functions doing the logging to know if they can
continue or not.
common/los.c: Changes on how it deals with lighting on maps - get light
value from map space array instead of using the linked list. Functions
that managed the light list have been removed. Change logic of
line of sight function to be more efficient (before, we may examine
the same space multiple times). rename update_all_los to
update_all_map_los, and change update_all_los to take coordinates
so that we only have clients within view of the change recalculate
los. Also, have update_all_los check for tiled maps that may have
clients that need to get updated.
common/map.c: remove refresh_map - this used to be used to try to recover
from map errors if many_cores was not set - IMO better to core and
just restart and really fix the error than try to deal with possible
corruption that may otherwise result.
Move open_and_uncompress and close_and_delete functions to porting.c -
they are 'common' functions that are not related to the map code.
Remove some lighting related code, as that is no longer done with
a list. Many modifications because of new map structure. And
logic to load and save the new map structure format. Modify
many of the functions to take map tiling into account. Change
way multipart objects are saved, and add logic to relink objects
when maps are loaded up. Remove some functions that are only
used by the editor into the editor. Move update_position from
object.c to map.c as it is better placed in map.c. Modify
function to figure out light for a space. Make out_of_map a
function that knows about map tiling. New function - get_map_from_coord
which knows about map tiling and does coordinate and map translation.
common/object.c: Have update_object take another parameter which tells
update object what has changed about the object. This lets the function
know if it should call update_position right away or if it can just
mark the space as needing an update at a later time. move update_position
to map.c.
insert_ob_in_map: now takes another parameter that describes actions not
to do. modified to know about map tiling and do appropriate translation.
Does some object sorting so it should handle spell objects more
efficiently.
insert_ob_in_map_simple is now replaced by
using appropriate flag to this changed version of insert_ob_in_map.
Clean up remove_ob - seemed to have done things in a more complicated
fashion that is no longer necessary. Modify check_walk_on to look
at all objects on space, not those below the object - with changes to
insert_ob_in_map, new object won't always be on top.
common/porting.c: functions from ltostr.c, sqrt.c, as open_and_uncompress
close_and_delete, make_path_to_file from map.c
common/treasure.c: Modified to use updated insert_ob_in_map
MSW 2001-07-13
Show difference between Revision 1.8 and 1.9
Revision 1.8mwedel 2001/04/09 01:59:46 +5 -5
Main thing this commit does:
Undo MT's last commit, which should not have been checked it at this time.
As that did not fix any bugs, it should wait until after 1.0 (at least
one file also fails to compile)
Fix minor bug in server/player.c which prevent keyring weight from
getting updated when keys are automatically used out of the rings.
move the GETTIMEOFDAY macro to include/global.h so it doesn't have to
be done in both arch.c and time.c
remove some ^M characters from porting.c
MSW 2001-04-08
Show difference between Revision 1.7 and 1.8
Revision 1.7michtoen 2001/04/06 14:07:49 +6 -4
win32: change // to /* */ and put autoconfig.h outside win32 area
Show difference between Revision 1.6 and 1.7
Revision 1.6mwedel 2001/04/06 01:25:10 +8 -4
common/porting.c: Fix compile warnings/bugs introduced by Win32 changes.
server/time.c: Modify move_player_mover so that it determines direction
of the mover and then process accordingly, as well as formatting
changes.
server/c_object.c: modify examine so that it properly shows info about
magic bullet spell books. MSW 2001-04-05
Show difference between Revision 1.5 and 1.6
Revision 1.5michtoen 2001/04/05 19:45:04 +6 -3
*** empty log message ***
Show difference between Revision 1.4 and 1.5
Revision 1.4cvs 2001/02/07 01:54:47 +1 -16
MSW 2001/02/06:
common/porting.c: relocate clean_path from this file to server/main.c
server/main.c: relocate clean_path from porting.c. Add unclean_path.
Modify enter_unique_exit so it supports relative maps on unique maps.
Modify enter_exit so word of recall (or other forcelike fields), work
when the return point is a swapped out unique map.
Show difference between Revision 1.3 and 1.4
Revision 1.3cvs 2000/06/21 00:03:46 +2 -2
Makefile.in: Update version to 0.95.6
include/patchlevel.h: Update to .6 for 0.95.6 release
common/porting.c, include/config.h, include/loader.h, include/skills.h,
include/spells.h, include/treasure.h, include/version.h, random_maps/style.c:
Update my mail address and copyright date. Mostly committed to sync
up my data with the CVS repository - MSW 6/20/2000
Show difference between Revision 1.2 and 1.3
Revision 1.2cvs 1999/07/13 01:02:42 +0 -0

Global commit for 0.95.4 - most files have no changes but just have
differing headers between my local RCS and the CVS versions and need to
get synced up.
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:16