--- crossfire/server ---


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

Filename: weather.c
Revision 1.47ryo_saeba 2006/08/26 11:09:13 +42 -39
Fix spurious logic in weather_avoid
Show difference between Revision 1.46 and 1.47
Revision 1.46mwedel 2006/06/05 01:28:57 +9 -4
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.45 and 1.46
Revision 1.45ryo_saeba 2005/11/27 08:19:13 +11 -52
Revert accidental commit
Show difference between Revision 1.44 and 1.45
Revision 1.44ryo_saeba 2005/11/27 08:16:46 +53 -12
Add a filter to skills command
Show difference between Revision 1.43 and 1.44
Revision 1.43akirschbaum 2005/11/01 03:02:55 +119 -69
General cleanup of weather code.
Show difference between Revision 1.42 and 1.43
Revision 1.42akirschbaum 2005/10/28 14:08:53 +5 -3
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.41 and 1.42
Revision 1.41akirschbaum 2005/09/04 11:58:13 +3 -3
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.40 and 1.41
Revision 1.40ryo_saeba 2005/07/17 06:00:05 +19 -22
Use const char* instead of char* when possible. Removed unused variables from weather code.
Show difference between Revision 1.39 and 1.40
Revision 1.39akirschbaum 2005/07/16 16:10:40 +2 -2
Fix spelling errors in string constants.
Show difference between Revision 1.38 and 1.39
Revision 1.38tchize 2005/05/07 06:51:20 +11 -11

Corrected silinesses in code. Now compiles when CFLAGS=-ansi -pedantic
Show difference between Revision 1.37 and 1.38
Revision 1.37ryo_saeba 2005/04/14 14:15:42 +7 -8
Fix a few things, use const char* instead of char* when possible
Show difference between Revision 1.36 and 1.37
Revision 1.36tchize 2005/03/24 15:07:47 +44 -37

Modified lots of call to GET_MAP_OB not checking for null
Show difference between Revision 1.35 and 1.36
Revision 1.35mwedel 2003/09/26 01:12:07 +4 -4
PAtch by nicolas.weeger@laposte.net to replace usage of long long with
sint64 values.
MSW 2003-09-25
Show difference between Revision 1.34 and 1.35
Revision 1.34mwedel 2003/09/13 00:02:13 +1 -4
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.33 and 1.34
Revision 1.33garbled 2003/07/14 17:10:14 +72 -15
Disable the feather_map routine, and replace with a jitter factor to smooth
the edges of the weathermaps. If this works out, I'll yank the whole
routine from the code. As of now, as far as I can tell, weather works up
to level 5 properly.
Show difference between Revision 1.32 and 1.33
Revision 1.32garbled 2003/07/13 02:33:13 +268 -43
Add selected patches contributed by David Seikel:
Fix the sscanf's in a few of the read operations.
Add the globe_spinning routine to help moosh the humidity around a bit
Add the wind factor stuff
Add the automatic image generation
Make the game stop writing the elevation data all the time.
Some minor humidity tweaks.

Also a few minor tweaks by myself. Not all of David's changes were added
in, but most of them were.
Show difference between Revision 1.31 and 1.32
Revision 1.31tchize 2003/06/30 14:14:13 +102 -62


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.30 and 1.31
Revision 1.30temitchell 2003/03/30 10:40:20 +7 -6
added one more groundtype to the weather code:
Show difference between Revision 1.29 and 1.30
Revision 1.29garbled 2003/02/25 09:08:03 +4 -2
For the 1.5 release, put feather_map under dynamiclevel 4. It still has
some issues apparently, and I'm not going to have time to fix them before
the release. This way people can set dynamiclevel to 2 and 3 without
experiencing bizzare problems. 4 and 5 work, but aren't ready for
primetime yet.
Show difference between Revision 1.28 and 1.29
Revision 1.28garbled 2003/02/09 01:30:50 +1 -3
Remove the supplydb code. It has served it's purpose, and if we decide
we want to investigate that again.. thats what cvs -r is for.
Show difference between Revision 1.27 and 1.28
Revision 1.27temitchell 2003/01/30 16:12:55 +16 -2
-modified let_it_snow to produce rivlets not puddles on mountains
-modified siinging_in_the_rain to produce rivlets not puddles on mountains
Show difference between Revision 1.26 and 1.27
Revision 1.26temitchell 2003/01/28 23:44:08 +4 -4
-bugfixes to let_it_snow and plant_a_garden (Tim walked me through these - was hitting empty spaces due to multipart objects in maps)
Show difference between Revision 1.25 and 1.26
Revision 1.25temitchell 2003/01/27 23:12:35 +22 -6
- added mountain snow and mountain rain to aviod list (to prevent buildups)
- added mushrooms and mountain foilage to the garden list
Show difference between Revision 1.24 and 1.25
Revision 1.24garbled 2003/01/26 00:00:31 +3 -1
Experimental code to attempt a supply and demand based economy for
shops. This code lays the framework for a supply and demand based
pricing scheme, and tracks all purchases and sales by players. It
calculates what the price for the item should be, based on the data it
has collected.

However.. the code to make it actually chaneg the prices in the game has
not been added. At this stage, the code only tracks the prices in a
database, var/supplydb. It is my intention to collect this data from
running servers to see what effect such a change would make. It is quite
possible that this scheme will be backed out, and a different one used
based on the data collected. The data should give us a reasonable
picture of what is sold and purchased in the game, to better judge future
economic changes.

There should be no gameplay changes from this commit.
Show difference between Revision 1.23 and 1.24
Revision 1.23mwedel 2003/01/03 18:28:52 +7 -2
TODO - add notes about item damage - clear it out of my mailbox.
common/loader.l, loader.c: Add check at load time to see if monsters
hp is higher than its maxhp and print a debug message if so.
devel/Makefile: Remove - makefiles shouldn't be in CVS, only .in versions.
server/attack.c: Fix calculation of max_damage in kill_object - this
was being done incorrectly, resulting in fired spell objects causing
incorrect amounts of damage, resulint in some monsters ending up with
a lot of hp. Fix call to kill_object to pass in correct damage value.
server/monster.c: Put in check so that monster won't regen to more hp
than they should have.
server/spell_util.c: Removed unused variable from move_missile.
server/weather.c: fix bug that causes crash if empty space is encountered
on map.
MSW 2003-01-03
Show difference between Revision 1.22 and 1.23
Revision 1.22temitchell 2002/12/22 14:43:37 +8 -6
- modified weather table to use snow mountain transparancies
Show difference between Revision 1.21 and 1.22
Revision 1.21mwedel 2002/12/21 02:02:35 +3 -3
Various bug fixes:
common/living.c: Reset glow_radius for players, so they stop glowing
after they snuff out their torch or whatever.
server/apply.c: Fix message about improving armour so that it is now
accurate.
server/monster.c: Add some debug lines that may show cause of excess
monster hp.
server/spell_effect.c: fix compile warning in summon_pet(). Clean up
indentation of alchemy functions, but functional changes is to
insert gold nuggets below player (so more of the actions work),
as well as to reset the view position, so that it won't have the
'previous 50' object selection. Add suggested parens in
cast_detection.
server/weather.c: Fix crash in weather code if snow was only object
on space.
MSW 2002-12-20
Show difference between Revision 1.20 and 1.21
Revision 1.20garbled 2002/12/11 13:54:52 +3 -3
Fix an off by one error in the weather pointed out by Mark. Change the
who command so dm's can see what level everyone is.
Show difference between Revision 1.19 and 1.20
Revision 1.19garbled 2002/12/08 22:55:38 +13 -17
Clean up the warnings from gcc in this file.
Show difference between Revision 1.18 and 1.19
Revision 1.18garbled 2002/12/08 21:52:46 +438 -74
More weather routines:

Now the game will attempt to completely reformat the world, and modify it
with the weather and elevation. When dynamiclevel is set to 5 or above,
the game looks at each tile, and the weather conditions present in that
tile. It then consults a table of different terrain types, and what
conditions they prefer to grow under. If the conditions match the spot,
and there is nothing special about the spot (like a house, or a road),
then we drop the new tile type on the overlay map on that location.

Tuning of this can be done at the top of weather.c, by changing the
weather_tile array.

Also.. add a feather_map() routine which tries to break up the blockiness
of some of the weather effects by spreading the tiles around.

This code works.. but needs tuning, and probably a little more testing.
Some of the conditions for the various tiles really need to be looked at,
and fiddled with.
Show difference between Revision 1.17 and 1.18
Revision 1.17garbled 2002/11/26 19:51:04 +107 -1
Add yet another table and function. plant_a_garden(). Allows for herb
(and whatnot) growth on the map.
Show difference between Revision 1.16 and 1.17
Revision 1.16garbled 2002/11/26 16:13:10 +101 -25
Add comments to most of weather.c's functions to make it.. well..
comprehensible.
Show difference between Revision 1.15 and 1.16
Revision 1.15garbled 2002/11/26 15:53:29 +154 -115
Change singing_in_the_rain and let_it_snow to use a table lookup, rather
than embedding the names of all the special arches used to make it snow/rain.

Add my name to this file's copyright, as I think I deserve it. :)
Show difference between Revision 1.14 and 1.15
Revision 1.14garbled 2002/11/26 04:00:08 +38 -41
Change avoid_weather() to use a table lookup located at the beginning of
weather.c, rather than a mess of ifs/elses.
Show difference between Revision 1.13 and 1.14
Revision 1.13garbled 2002/11/08 02:54:07 +247 -84
Add new command "weather". Displays the current weather conditions to the
player. TODO: make it dump the weathermap data for a wiz.
Add rain. Touch up snow a bit, and hunt down and kill a few minor bugs.
All that is left to do for basic visual weather is hail and fog, and then
messages to the player expressing conditional changes.
Rain and snow only occur at dynamiclevel >= 2.
Show difference between Revision 1.12 and 1.13
Revision 1.12garbled 2002/11/06 03:47:23 +63 -15
Better handling for snow. Now when snowing on cobblestones, we use a
see-through image, so we don't obscure the paths. Provide handling for
upgrading and downgrading snow. Actually melt glaciers. Create a new
flag, FLAG_FLOOR_OVERLAY. When set in an overlay map, this item is
loaded INS_ABOVE_FLOOR_ONLY, so we can load the see-through-snow over
cobblestones without obscuring things like signs and walls.
Show difference between Revision 1.11 and 1.12
Revision 1.11garbled 2002/10/30 22:50:12 +307 -14
Minor twiddlings and bugfixes throughout the weather code.

Addition of rainfall accumulation data, and finally something for
dynamiclevel 2: Snow. Yes, it now snows, melts, and oceans freeze into
glaciers. Still imperfect, and I don't reccomend turning it on just yet,
(at least for players). It's stable, it just makes a mess of the roads.
Show difference between Revision 1.10 and 1.11
Revision 1.10garbled 2002/10/29 04:24:53 +136 -2
Hurray! Weather now works and functions. (still no game effect)
This commit adds the compute_sky routine. This routine takes all of the
conditions that make up the weather, and actually figures out what the real
weather is. Also, if we are in fastclock mode, we write the skymap out
occasionally, for debugging purposes. We never read the skymap, it is
allways computed on the fly.

Change the maps program to read the new skymap.
Show difference between Revision 1.9 and 1.10
Revision 1.9garbled 2002/10/29 03:00:44 +74 -1
Add a routine to figure out which weathermap something is in, given it's
x,y coordinates, and the name of the current map. Also add a function
to compute the real temperature of a given weathermap location. This
function takes the base temp, and applies wind and time to it.
Show difference between Revision 1.8 and 1.9
Revision 1.8garbled 2002/10/29 01:49:32 +7 -7
Finally. Fix the temperature calculations, so that the equator actually
moves north<->south during the seasons. Now the base temperature map is
actually correct.
Show difference between Revision 1.7 and 1.8
Revision 1.7garbled 2002/10/29 01:16:14 +248 -66
Add better code for handling the "gulf stream". Now the gulf stream
actually persists, and is no longer nuked by the pressuremap. More
twiddles to the humidity, to try and prevent the whole continent from
becoming a vast desert. It would really help things if there were a few
more lakes and rivers...
Show difference between Revision 1.6 and 1.7
Revision 1.6garbled 2002/10/28 04:20:08 +9 -5
If you are going to generate a file that takes 30 minutes to generate,
make sure you actually generate it correctly. Lots of fixes for humidity,
but humidity still isn't quite right.
Show difference between Revision 1.5 and 1.6
Revision 1.5garbled 2002/10/27 22:50:39 +990 -52
server/init.c: add code to read fastclock setting
server/weather.c: Complete update, largely rewritten. Now the world is
cut into a 100x100 matrix of weathermaps. Each one of these maps is
computed at initial boot, and written to disk, following which, they are
simply read from disk at boot. For each of the main weather types
(pressure, humitidy, base temperature, wind direction, wind speed) the
game recomputes the entire weathermap, applying smoothing algorithims, or
derriving each map from it's predecessor. Weathermaps are only used if
you have set your dynamiclevel to 1 or greater, and, are using the
bigmap set. At this time, there is still no functional change to the game,
bigmap, or not.
Show difference between Revision 1.4 and 1.5
Revision 1.4mwedel 2002/07/30 01:37:22 +7 -2
Various fixes:
INSTALL: Update with note about --with-includes configure option.
common/loader.c, common/loader.l: Add comment about flag_invis_undead
include/define.h: Add FLAG_INVIS_UNDEAD
lib/adm/map_info: Modify to not follow symbolic links.
server/monster.c: Modify can_detect_enemy to be a bit more straightforward
in its logic. Also, modify detection of invisible creatures - don't
reduce duration, just return that the monster can detect the player.
There were also spurious messages about the player being seen.
Modify can_see_enemy to check FLAG_INVIS_UNDEAD, also fix broken
comparison
server/player.c: Clear FLAG_INVIS_UNDEAD when invisibility ends. Fix
action_makes_visible() - had reverse logic on FLAG_MAKE_INVIS check,
and a typo in the printed message.
server/spell_effect.c: cast_invisible() to use FLAG_INVIS_UNDEAD -
also check for maximum duration, and only search active objects when
clearing enemy.
server/weather.c: Fix off by one on comparision when intializing maps
darkness when loading map from disk. In dawn_to_dusk, don't do
further processing if the light hasn't changed.
MSW 2002-07-29
Show difference between Revision 1.3 and 1.4
Revision 1.3mwedel 2002/04/21 00:23:20 +28 -1
Various minor bugfixes. Note the changes may appear larger than they
really are due to formatting/indentation changes. Run diff -w to
supress those:
make_win32/installwin32.bat: Update for new image files.
server/c_object.c: Fix SAVE_INTERVAL #ifdef block. It failed to compile
as it was written. Simplify code, but it should have the same effect.
server/move.c: Modify push_object so that if a player swaps position
with his pet, we send a esrv_map_scroll. This should save bandwidth,
and also prevents display corruption when fog of war on the client
is in use. Add some new comments, adjust some formatting.
server/player.c: Fix minor typo in comment.
server/skills.c: Modify new_draw_info that is responsible for the
"You pray" messages to not have the NDI_UNIQUE flag so that
they can get batched up, depending on users value of output-count
server/swap.c: Remove swapped out per player unique maps from the list
of maps. Reduces cpu and memory consumption by a minor amount, and
results in a cleaner 'maps command output.
server/weather.c: Add standard crossfire banner to top of file.
Modify long long declartion to just be a long.
MSW 2002-04-20
Show difference between Revision 1.2 and 1.3
Revision 1.2garbled 2002/01/01 17:37:55 +136 -0
Add the concept of overlay maps to the code. An overlay map is a map which
is loaded on top of another map, replacing values in the header, and placing
objects on top of other objects. This is the fundamental part of the new
weather code, but also can be used to allow dynamic editing of the worldmaps
by DM's eventually.
garbled 2002-01-01

Phase II of the new weather system is done. Please let me know immediately
if this causes any bizzare effects.
Show difference between Revision 1.1 and 1.2
Revision 1.1garbled 2001/12/18 02:58:03 None
Lots of changes here. Basically implement a night and day system, as
well as tracking of game time. A clockdata file is now created and
updated by the server to increment time. Time increases by 1 hour,
approximately every 2 minutes of real time. Right now this code has
virtually no effect, but as maps are updated with outdoor settings,
nightfall will occur automatically. The time command has been modified
to show the current game time, and the clock objects have been changed to
show the game time as well.
garbled 2001-12-18
First version


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