--- crossfire/common ---


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

Filename: utils.c
Revision 1.26akirschbaum 2006/05/21 07:23:40 +2 -1
Declare missing variable if NEW_MATERIAL_CODE is defined.
Show difference between Revision 1.25 and 1.26
Revision 1.25ryo_saeba 2006/03/18 11:15:24 +1 -2
Use const when possible. Patch courtesy Stefan Huehner.
Show difference between Revision 1.24 and 1.25
Revision 1.24ryo_saeba 2006/03/14 08:41:00 +5 -1
Apply patch #1445892 (transmute_materialname crash) courtesy the cf.schmorp.de development team
Show difference between Revision 1.23 and 1.24
Revision 1.23akirschbaum 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.22 and 1.23
Revision 1.22qal21 2006/01/08 16:47:56 +3 -2
Fix warning with paranoid cflags and make more proper: Don't let inactive code that would never be reached get through the preprocessor.
Show difference between Revision 1.21 and 1.22
Revision 1.21cavesomething 2005/10/21 14:03:24 +33 -1
make shops check if a player can afford all items, before buying any of them
Show difference between Revision 1.20 and 1.21
Revision 1.20qal21 2005/10/17 08:08:26 +37 -1
Add convenience function for string replacement (Which I plan to use soon)
Show difference between Revision 1.19 and 1.20
Revision 1.19mwedel 2005/10/13 02:26:00 +2 -2
Add extra set of parentheses (and !=NULL check for clarity) -
gcc warns on while (a=b) type constructs.
MSW 2005-10-12
Show difference between Revision 1.18 and 1.19
Revision 1.18ryo_saeba 2005/07/17 06:00:03 +2 -2
Use const char* instead of char* when possible. Removed unused variables from weather code.
Show difference between Revision 1.17 and 1.18
Revision 1.17akirschbaum 2005/07/14 04:18:55 +7 -3
common/{button.c, treasure.c, utils.c}, server/{c_wiz.c, login.c, shop.c,
skill_util.c, spell_effect.c}, socket/{image.c, item.c}: Fix printf like
format specifiers. At least one of them fixes a means to crash the server.
Andreas Kirschbaum 2005-07-14
Show difference between Revision 1.16 and 1.17
Revision 1.16tchize 2005/05/29 10:37:53 +20 -1

MOTD now splitted in 3 files: rules, news and motd.
They are sent on connection to client in this exact order.
Show difference between Revision 1.15 and 1.16
Revision 1.15tchize 2005/05/06 16:10:07 +24 -1

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.14 and 1.15
Revision 1.14ryo_saeba 2005/04/16 17:05:09 +2 -2
Use const char* instead of char* in function parameters
Show difference between Revision 1.13 and 1.14
Revision 1.13akirschbaum 2004/09/19 11:17:48 +10 -7
common/utils.c: Fix random_roll() and die_roll() to not return out of range
values.
Show difference between Revision 1.12 and 1.13
Revision 1.12mwedel 2003/11/09 23:39:50 +43 -1
bulk of this is to fix exp loss when changing gods if you have more than
2 billion exp, removal of spells when you switch levels, and not giving you
all new spells when you switch religions.
--
common/living.c: Update exp functions to be fully 64 bit aware. Don't
take away from player total exp if SK_SUBTRACT_SKILL_EXP is passed in.
common/utils.c: Add 64 bit version of random_roll(), called random_roll64()
lib/treasures: Make indentation consistent for some treasures.
server/apply.c: Use the FLAG_STARTEQUIP to denote god given spells, instead
of using special prayer markers. This simplifies the spell learning
and removal code.
server/gods.c: Make exp loss for changing religions 64 bit compliant.
Fix become_follower() so that it doesn't give all the new gods special
spells if you switch religions. Fix code so that it properly removes
all special prayers from previous god, and also print out message on what
spells you lost. Don't set the prayer skill as applied in various
areas - this results in two skills being applied, which isn't proper.
MSW 2003-11-09
Show difference between Revision 1.11 and 1.12
Revision 1.11mwedel 2003/05/21 02:31:13 +19 -1
common/item.c, common/utils.c, include/config.h: Add #define NEW_MATERIAL_CODE
and checks in the other files for this - if this is commented out
(default), then the new material naming code is disabled - material
names won't be put in the items names as shown in the inventory
(can still see material by examining an object), and objects that are
created will be created with the default material (eg, iron for
most armor/weapons, eg, brass, bronze, copper items won't show
up anymore).
lib/settings: Add comments from the old config.h file that describes
what the options already does. Having no comments in this file
or in config.h anymore is very unfriendly.
MSW 2003-05-20
Show difference between Revision 1.10 and 1.11
Revision 1.10garbled 2003/02/13 23:50:29 +21 -13
Lots of updates here:
common/item.c: make item_power stop showing up in ring short descriptions.
fix some of the items that were double-displaying materialnames, like
mithril mithril chainmail.
common/loader.l: add tooltype
common/utils.c: Unless the object is armour or weapons, pick the first
materialname we find. Now, newly generated diamonds will stack.
Fix name_to_material to return NULL if it finds nothing, fixes
navar_city/museum crash.
Change set_materialname to take a materialtype_t argument, allowing
functions to manually set the materialname, rather than let the
randomizer pick for them.
include/define.h: Add TOOL and BUILDFAC for item building.
include/object.h: add tooltype for item building.
include/materials.h: add M_SPECIAL. Set this in an object, to prevent things
like mithril mithril chainmail. This is primarily only needed in
artifacts, because they change the base material of the arch. Also
useful in things like the demonspawn shield, and on maps.
lib/artifacts: sprinkle M_SPECIAL around.
server/player.c: remove auto_heal. This never should have been
committed, and was never referenced by any code.
server/c_object.c: add item building, but add it disabled. Too many
bugfixes were tied in with this code to cleanly add them. When
enabled, this code will add player item building, similar to
create to take place. Requires a host of graphics and arches
to be useable.
Show difference between Revision 1.9 and 1.10
Revision 1.9garbled 2003/02/07 00:57:17 +1 -8
Mark clued me in that query_name existed.. and that brought to light that
the way I was handling materialnames before was stupid. Back the old
code out, and use query_name instead. Put something in the loader to
back the names out of the objects I mangled.
Show difference between Revision 1.8 and 1.9
Revision 1.8garbled 2003/02/06 02:08:49 +40 -3
Fix the following bugs:
When doing alchemy with a transmute formula, check if we should add one
of the materialtype's special modification properties into the newly
created object.
When performing alchemy, do better checks to remove the materialname form
the object's strtoint value. Don't remove the materialname on
non-weapon/armour, and don't remove it if the object has it manually
specified in the arch.
Fixes alot of formulae I broke.
Show difference between Revision 1.7 and 1.8
Revision 1.7garbled 2003/01/29 18:07:08 +64 -1
New materialtype system for crossfire. Based in concept on my original
design, but rewritten from scratch to make it easily extensible.

In a nutshell:

Each of the old materialtypes (metal, glass, stone, wood) are now a class
of materials. When an item in the game is created, if it does not have a
specific materialname of it's own, a materialname is generated randomly
from the matching entries in the "lib/materials" file. This file
contains all of the saving throws, and other material specific
modifications for each of the expanded materials.

Materials can be manually specified in the arch with the "materialname"
directive. Such as the gold coins, which are specified to be made of,
you guessed it, gold.

Saving throws have been slightly rewritten to use the new materialtypes,
and a few other minor details associated with materialtypes have been
patched up.

Adding a new type of stone or wood, is as simple as adding a new entry in
the lib/materials file. The game will automatically start distributing
them around randomly.
Show difference between Revision 1.6 and 1.7
Revision 1.6garbled 2002/11/08 02:50:44 +4 -2
Add glue for weather_effect from server/weather.c
Make decay_objects stop destroying all my snow and puddles. Lower the
ferocity of this function a bit as well.
in ready_map_name, we call weather_effect, so that as a player enters a
worldmap tile, he will immediately see the current weather conditions.
Show difference between Revision 1.5 and 1.6
Revision 1.5mwedel 2002/07/14 23:25:39 +3 -3
Update banner copyright with proper contact information.
MSW 2002-07-14
Show difference between Revision 1.4 and 1.5
Revision 1.4garbled 2002/01/01 17:37:54 +62 -1
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.3 and 1.4
Revision 1.3garbled 2001/10/01 14:29:11 +2 -2
Argh.. fix my stupidity here. typo.

garbled 2001-10-01
Show difference between Revision 1.2 and 1.3
Revision 1.2garbled 2001/10/01 14:10:27 +6 -2
Fix a potential SIGFPE and an off-by-one error in rndm(). Thanks to mids
for spotting it.

garbled 2001-10-01
Show difference between Revision 1.1 and 1.2
Revision 1.1garbled 2001/09/26 16:12:33 None
Initial commit of new luck code.
utils.c is the file that contains the actual luck routines, living.c was
modified to use the luck code.

Discussed at length with dhb, av and gros. Has been tested on both the
mids crossfire server, and on my private server.

This code removes all current use of the luck stat for players, and replaces
it with a general luck modifier for all random rolls. The intent of this
code is to give a general positive (or negative) effect on a player due
to luck. This effect should be generally intangible to the player, yet
help him out over the course of a game.
First version


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