macros/cf_python.m4: Support Python 3 but prefer Python 2 when possible. This
is because Python 3 is still rather experimental. To force building against a
specific Python version use --with-python=path where path is replaced with the
install prefix for Python.
46 lines of code changed in 2 files:
plugins/cfpython/cjson.c: Add support for Python 3. For Python 3 we always
encode to Bytes but can decode both Bytes and Unicode. For decoded strings the
default is to use Unicode under Python 3 (and under 2.x we still default to
String).
plugins/cfpython/cfpython: Support for Python 3. This involves some changes for
Python 2.x too in order to make it possible to maintain the code. Some of the
Python 3.x specific code for caching bytecode is rather messy and could be
probably be improved. The way the constant modules are created has been
changed to support both Python 2.x and 3.x (now using PyModule_New()).
460 lines of code changed in 3 files:
server/attack.c: Fix for bug 1922771: xp non zero in meditation. In
poison_living(), do some more work to find proper skill to set to credit
the exp gain - for players, op->skill doesn't look like it is set,
but op->chosen_skill is.
MSW 2009-02-26
12 lines of code changed in 2 files:
autogen.sh: Error out if the various programs called aren't successful. This
means we can hopefully get the first error in bug reports instead of errors
caused by the first error later.
10 lines of code changed in 2 files:
server/attack.c: Fix for bug 2019648: Too high experience gain with draining
monsters. Don't add more exp to monsters than the player lost by draining.
Record original exp of player before draining and use that as a check in
MIN() statement - because from old code, divisor is twice as much as
we remove, very likely the old method will be less than actual lost exp.
MSW 2009-02-25
13 lines of code changed in 2 files:
server/attack.c: Fix for bug 2021012: Do insane damage in arena - if
characters are on battleground, do not reduce damage for them
being friendly.
MSW 2009-02-24
16 lines of code changed in 2 files:
Fix for bug 1988417 - rebalanced WC bug.
common/living.c: Remove unneeded if op->type==PLAYER right after closing
brace for same if clause. Move character_load to top of that code
block. Fix wc calculation so now if skill_level>=1 and not >1.
Fix fallback method to divide characters overall level in calculating
wc to give more sane results. Add key/value wc_increase_rate so
skills can be better tuned instead of having it hardcoded (it is
still hardcoded as a fallback if that isn't set)
doc/Developers/skills: Update some notes on values in combat skills,
especially the wc_increase_rate.
MSW 2009-02-22
34 lines of code changed in 3 files:
plugins/cfpython/cfpython_archetype.c, plugins/cfpython/cfpython_object.c,
plugins/cfpython/cfpython_party.c, plugins/cfpython/cfpython_region.c,
plugins/cfpython/cfpython_map.c,
plugins/cfpython/include/cfpython_object_private.h,
plugins/cfpython/include/cfpython_map_private.h,
plugins/cfpython/include/cfpython_party_private.h,
plugins/cfpython/include/cfpython_region_private.h,
plugins/cfpython/include/cfpython_archetype_private.h: Implement the function
tp_richcompare, since Python 3.x no longer uses tp_compare. tp_richcompare can
also be used on Python 2.x. Also fix broken compare for players since
tp_richcompare and tp_compare are not inherited if tp_hash is non-NULL.
Also fix type definition head initialisation for Python 3.x.
plugins/cfpython/include/cfpython_region_private.h: Fix a typo that resulted in
Python showing region type name as Crossfire.Party.
plugins/cfpython/cfpython_map.c: Fix several crash bugs related to swapped out
maps.
294 lines of code changed in 11 files:
server/c_range.c, server/init.c, server/shop.c, server/login.c, server/c_wiz.c:
Fix some format string bugs (found using the GCC format __attribute__ for some
crossfire functions).
server/c_wiz.c: Add some missing [fixed] to style_info output.
14 lines of code changed in 6 files:
socket/item.c, socket/loop.c, socket/lowlevel.c, socket/metaserver.c: Fix some
format string bugs (found using the GCC format __attribute__ for some
crossfire functions).
12 lines of code changed in 5 files:
common/map.c: Make a function static.
common/loader.l, common/object.c, common/readable.c: Fix some format string bugs
(found using the GCC format __attribute__ for some crossfire functions).
18 lines of code changed in 5 files:
common/map.c: Properly fill in op->more for multipart objects in containers.
Multipart objects in containers can happen for customised monsters in
generator inventories. This happened on /darcap/raffle/raffle1_u3.
55 lines of code changed in 2 files:
README: Update the README file somewhat. It mentioned CVS and various other
outdated things.
39 lines of code changed in 2 files:
This is another step towards Python 3.x support, however in this commit there
are mostly fixes for various bugs in the existing found when working on the
porting. Also this commit drops support for Python 2.3 and older. This support
was already broken (some code already used modern features).
---
plugins/cfpython/include/cfpython.h: We need more python-version dependant
defines so rewrite the checks to be cleaner as well.
plugins/cfpython/include/cfpython_object.h: Add a variant of the EXISTCHECK()
macro that also verifies that the type matches (to fix some crashes).
plugins/cfpython/include/cfpython_party_private.h,
plugins/cfpython/include/cfpython_region_private.h,
plugins/cfpython/include/cfpython_archetype_private.h: Fix the method calling
conventions to match was actually being done in the code.
plugins/cfpython/include/cfpython_object_private.h,
plugins/cfpython/include/cfpython_map_private.h,
plugins/cfpython/cfpython_object.c, plugins/cfpython/cfpython_map.c: Fix out
of date PyNumberMethods structs. Handle the int/long unification in Python 3
as well. Change to calling convention METH_NOARGS when no arguments were
passed to the methods. Change to METH_O when a single object argument was
passed. Add checks for correct type of objects where that was missing (could
result in crashes before, if there were bugs in the python scripts, now such
bugs will just throw a python exception).
plugins/cfpython/cfpython.c: Change to calling convention METH_NOARGS when no
arguments were passed to the methods.
macros/cf_python.m4: Remove checks for Python 2.3 and older.
220 lines of code changed in 12 files:
plugins/cfpython/cfpython.c, plugins/cfpython/cfpython_map.c,
plugins/cfpython/include/cfpython_archetype_private.h,
plugins/cfpython/include/cfpython_region_private.h,
plugins/cfpython/include/cfpython_party_private.h,
plugins/cfpython/include/cfpython_map_private.h,
plugins/cfpython/include/cfpython_object_private.h,
plugins/cfpython/include/cfpython.h, plugins/cfpython/cfpython_object.c: Some
of the changes needed to support Python 3: Adding some compatibility defines
to support some stuff on both Python 2 and Python 3. This also means we now
support unicode strings in a few places we didn't before. Also properly handle
"hash not supported" under Python 2.6 or later.
73 lines of code changed in 10 files:
server/apply.c, server/skills.c, server/player.c, server/spell_attack.c: Add a
comment marking some variables set but then never used (found with compiler
warnings). Unsure about what the correct way to solve them are (that is:
should the variable assignment be removed, or should the variable be used
somewhere).
server/c_misc.c, common/map.c, common/object.c: Fix some format strings using %d
when %u should have been used.
Arvid Norlander 2009-02-13
18 lines of code changed in 8 files:
plugins/cfpython/include/cfpython_proto.h, plugins/cfpython/cfpython.c: Fix
broken give command. Was broken due to MSW removing -Bsymbolic when building
plugins about half a year ago. Also change some other symbols to static in the
plugins to avoid more issues like this.
plugins/cflogger/include/cflogger_proto.h, plugins/cflogger/cflogger.c,
plugins/citylife/include/citylife_proto.h, plugins/citylife/citylife.c,
plugins/cfrhg/include/cfrhg_proto.h, plugins/cfrhg/cfrhg.c,
plugins/cfanim/include/cfanim.h, plugins/cfanim/include/cfanim_proto.h,
plugins/cfanim/cfanim.c, plugins/cfnewspaper/include/cfnewspaper_proto.h,
plugins/cfnewspaper/cfnewspaper.c: More changes in the same style as the above
python changes to reduce possible symbol lookup conflicts. Also make some
functions static.
plugins/cfrhg/include/cfrhg_proto.h, plugins/cfrhg/cfrhg.c: Fix a typo in cfrhg
(was "cfrgh" in one place).
41 lines of code changed in 14 files:
common/treasure.c: Restore item_power if GT_MINIMAL is passed into
fix_generated_item(). Fixes bug 2590465: Anvils making items without
item power
MSW 2009-02-11
8 lines of code changed in 2 files:
lib/Makefile.am: replace make with $(MAKE) - needed if using non default
make, or otherwise have special set up.
MSW 2009-02-11
9 lines of code changed in 2 files:
Fix for bug# [ 2565212 ] Output quirk with wraith feed ability (You You). Removed 'You' text from the attack messages file.
17 lines of code changed in 2 files:
lib/.collect-stamp, lib/smooth: Both of these are generated by make collect,
remove them from SVN. The latter file also showed up a lot in svn diff because
the locally generated copy no longer matched the svn version and no one
committed the change.
lib/: Add those two removed files to svn:ignore.
lib/Makefile.am: Update to match change, also add some other auto generated
files to MAINTAINERCLEANFILES.
15 lines of code changed in 4 files:
include/living.h, include/player.h: Rearrange member order in some structs to
reduce wasted space due to alignment.
9 lines of code changed in 3 files:
plugins/cfnewspaper/cfnewspaper.c: Remove unused function.
3 lines of code changed in 2 files:
types/README: Fix indentation.
7 lines of code changed in 2 files:
test/templates/logresult.xsl: Fix case of tag, must be lower case since it
generates XHTML, not HTML.
check-fragment.am: Make report generation work for out of tree builds. We now
copy the xsl files to test/logs/ before everything else, instead of after. We
also use the copy now, instead of using the file in test/templates/.
29 lines of code changed in 3 files:
test/templates/crossfire-logo-unit-failed.png,
test/templates/crossfire-logo-unit-success.png,
test/templates/txtlog.png, test/templates/failure.png,
test/templates/success.png, test/templates/error.png,
test/templates/crossfire-logo-unit.png: Recompress png images for smaller file
size.
8 lines of code changed in 8 files:
check-fragment.am: Add a define -DBUILD_ROOT to support out of tree builds
properly.
test/unit/common/check_object.c, test/unit/common/check_loader.c,
test/unit/common/check_arch.c, test/unit/common/check_item.c: make check
should now works for out of tree builds. Not well tested yet. Not functional
changes for in-tree builds.
13 lines of code changed in 6 files:
include/Makefile.am: Make svnversion.h work properly when the build tree is
not the source tree.
6 lines of code changed in 2 files:
include/object.h: Small spelling correction in comment.
utils/mapper.c: Fix a crash when generating tiled (non-world) maps (such as for
greenway) and the user used -limit.
10 lines of code changed in 3 files:
plugins/cfpython/cfpython_object.c,
plugins/cfpython/include/cfpython_object_private.h: Add Object_GetAnimated()
to be able to read this property (it used to be write only from python).
13 lines of code changed in 3 files:
plugins/cfpython/cfpython_object.c,
plugins/cfpython/include/cfpython_object_private.h: Make it possible to set
Object.Identified as well as get it. This was used by some python scripts
(though it didn't actually work).
19 lines of code changed in 3 files:
utils/mapper.c: Fix a segfault when generating world map and not all input maps
was found (could happen using -limit).
10 lines of code changed in 2 files:
utils/mapper.c: Change // style comment to /**/ style. Add missing include. Make
some variables and functions static (fixing GCC warnings about missing
prototypes). Change some 0 to NULL for pointers to make code clearer.
141 lines of code changed in 2 files:
utils/mapper.c: Change all sprintf() to snprintf(). Also fix a crash due to
division by zero when using -limit and we didn't get as far as processing any
maps with non-zero elevation.
35 lines of code changed in 2 files:
utils/mapper.c: Remove some unused variables. Get rid of zero length snprintf()
(caused GCC warning).
6 lines of code changed in 2 files:
include/libproto.h, common/dialog.c, common/init.c, common/object.c,
common/button.c, common/region.c, common/living.c, common/time.c,
common/recipe.c, common/map.c, common/arch.c, common/treasure.c: Make a lot
of functions that aren't used outside one file in common/ static.
78 lines of code changed in 13 files:
common/readable.c, common/object.c, common/map.c, include/libproto.h: Use size_t
instead of int for buffer sizes.
common/readable.c, include/libproto.h: Make some functions not used elsewhere
static.
common/readable.c: Get rid of sprintf().
49 lines of code changed in 5 files:
common/porting.c: Fix format string.
5 lines of code changed in 2 files:
common/player.c: Remove unused variables.
3 lines of code changed in 2 files:
types/mood_floor/mood_floor.c: Use NULL instead of 0 for pointers.
types/player_mover/player_mover.c: Assigning a floating point constant to an
integer variable makes no sense.
7 lines of code changed in 3 files:
include/libproto.h, include/ob_methods.h, include/typesproto.h,
common/ob_methods.c, types/common/describe.c, types/legacy/legacy_describe.c:
Use size_t when working with buffer sizes.
include/sproto.h, server/attack.c, server/spell_util.c: Attack type should be
uint32 and not int.
24 lines of code changed in 10 files:
types/shop_inventory/shop_inventory.c: Use size_t not int when working with
list sizes. The variable i is used for several things, but using size_t should
be safe for all uses of it.
7 lines of code changed in 2 files:
types/deep_swamp/deep_swamp.c: Replace sprintf() with snprintf().
5 lines of code changed in 2 files:
common/readable.c: Fix a snprintf() with non-constant format string and no
parameters passed.
5 lines of code changed in 2 files:
types/detector/detector.c: Fix GCC warning caused by a declaration of an
unimplemented, unused static function.
4 lines of code changed in 2 files:
plugins/cfpython/include/cfpython_object_private.h,
plugins/cfpython/include/cfpython_map_private.h,
plugins/cfpython/include/cfpython_party_private.h,
plugins/cfpython/include/cfpython_region_private.h,
plugins/cfpython/include/cfpython_archetype_private.h,
plugins/cfpython/cfpython.c: Fix some minor issues (variables that should have
been static, using 0 instead of NULL [leading to more confusing code]).
242 lines of code changed in 7 files:
plugins/cfanim/cfanim.c, plugins/cflogger/cflogger.c: Fix some minor issues
(variables that should have been static, using 0 instead of NULL, leading to
more confusing code) found using the static analysis tool "sparse".
9 lines of code changed in 3 files:
server/init.c: Avoid some warnings by casting function to one with the right
type before calling. Also convert some char* to const char* and make the
variable options static.
33 lines of code changed in 2 files:
server/pets.c, server/player.c, server/plugins.c: Fix some minor issues (such as
using 0 instead of NULL [leading to more confusing code], using snprintf with
no format arguments [use strncpy instead], using int instead of tag_t [which
is typedefed to unsigned int]).
16 lines of code changed in 4 files:
socket/info.c, server/alchemy.c, server/gods.c: Fix some minor issues (using 0
instead of NULL [leading to confusing code], casting const char* to char*).
10 lines of code changed in 4 files:
include/global.h: Get rid of some warnings by making some "char*" "const char*"
in the Settings struct.
19 lines of code changed in 2 files:
server/player.c: Make sure unpaid items are removed at death even on non-shop
floors.
9 lines of code changed in 2 files:
server/spell_effect.c: Fix part of bug #2457751
"Unpaid items work for some things...". Staff to snake and animate weapon no
longer works on unpaid items.
10 lines of code changed in 2 files:
common/readable.c: Passing the same buffer as both the output buffer as a
parameter in the format to s(n)printf invokes undefined behaviour. Avoid doing
that. Tests showed that glibc treated the buffer as empty, resulting in
ignoring whatever was in the buffer before.
7 lines of code changed in 2 files:
common/item.c: Make item_types_size static, it isn't used elsewhere.
4 lines of code changed in 2 files:
server/attack.c: Fix rare abort() with spells like dragonfire on multi-tile
objects. Required some single tile object to be on top of the multi-tile
object.
8 lines of code changed in 2 files:
server/spell_attack.c: Fix bug #2353025 "2.0, holy wrath and ret. strike freeze
server". This happened because explosion spells use stats.maxhp as a unique ID
to avoid running out of control. This one was properly set by bullet spells,
but not by smite spells. Fix this.
16 lines of code changed in 2 files:
server/spell_util.c: Put cap on level used for cast_magic_storm() in
prayer_failure() - otherwise, spell can hang the server as it
gets cast at super high level.
MSW 2009-02-04
11 lines of code changed in 2 files:
updating version numbers (bug #2544874)
1 lines of code changed in 1 file:
common/button.c: Fix bug #2457751 "Unpaid items work for some things...". Now
dropping unpaid items on altars no longer works.
9 lines of code changed in 2 files:
Fix out-of-bounds accessess to xxx_bonus[] (and similar) arrays.
35 lines of code changed in 2 files:
random_maps/wall.c, random_maps/style.c, random_maps/door.c, random_maps/exit.c,
random_maps/random_map.c, random_maps/rogue_layout.c, random_maps/test.c,
random_maps/special.c, random_maps/floor.c, random_maps/monster.c,
random_maps/standalone.c, random_maps/treasure.c: Fix some minor issues
(variables that should have been static, using 0 instead of NULL [leading to
more confusing code], mismatching prototype and so on) found using the static
analysis tool "sparse" (made for Linux kernel originally).
46 lines of code changed in 13 files:
random_maps/reader.l, common/loader.l, include/libproto.h: The shared yyerror()
in loader.l didn't work properly in reader.l (which was the intention).
Instead it caused memory errors (and potentially segfaults) when called. This
was due to yyerror() accessing the static variable yytext, which is unique to
each file. Since yytext in loader.l was often freed already when yyerror() in
reader.l was called this would cause memory errors. If it wasn't yet freed it
would instead report irrelevant data in the error message. Thus duplicate the
routine to both of the files, and make them both static.
23 lines of code changed in 4 files:
Encapsulate access to xxx_bonus[] (and similar) arrays with accessor functions get_xxx_bonus().
133 lines of code changed in 13 files:
common/object.c, common/exp.c, common/time.c, common/recipe.c, common/arch.c,
common/map.c, common/los.c: Fix some minor issues (variables that should have
been static, using 0 instead of NULL, leading to more confusing code) found
using the static analysis tool "sparse" (made for Linux kernel originally).
28 lines of code changed in 8 files:
plugins/cfpython/include/cfpython.h, plugins/cfpython/cfpython.c:
To make porting to Python 3 in the future easier, enable the forward
compatibility warning flag if crossfire is compiled against Python 2.6, this
will result in warnings to stderr about "DeprecationWarning" if incompatible
code is found. Several issues has already been fixed recently (thanks to
having this enabled locally). Compiling Crossfire against Python 2.5 or older
still works (of course). Also add a missing include causing warnings under
Python 2.6.
22 lines of code changed in 3 files:
common/shstr.c: Use the correct return type from hashstr() current code assumed
sizeof(int) == sizeof(long) == sizeof(void*) which is incorrect for many
systems (such as x86_64). There was another potential (as in: would not happen
with current hash table size) issue in the same code with mixing signed and
unsigned. Also fixed.
14 lines of code changed in 2 files:
Fix possible buffer overflow when initializing plugins.
6 lines of code changed in 2 files:
doc/Developers/smooth.pdf, doc/Developers/img/sgrass.base.111.eps,
doc/Developers/img/smoothlevel.eps, doc/Developers/img/canvas_smooth.eps,
doc/Developers/smooth.tex: smooth.pdf was broken (due to someone using
svn:eol-style on it [as far as I can tell], pdf are binary files and shouldn't
be mangled like that!). Also the pdf couldn't be re-generated from smooth.tex
since some of the image files were missing. (They were erroneously removed in
revision 3560). Add the three *.eps needed back. Then regenerate the pdf.
Also some cosmetic changes to the file.
972 lines of code changed in 7 files:
doc/Developers/sound, doc/Developers/*.dox, doc/Developers/types/*.dox,
doc/Developers/fields/*.dox: Set svn:eol-style to native. Correct a few files
that were stored with CRLF.
266 lines of code changed in 240 files:
Remove remaining references to max_carry.
3 lines of code changed in 6 files:
include/define.h, include/libproto.h, common/item.c, common/readable.c,
common/loader.l: Make safe_strcat() (defined in include/define.h for some
odd reason) use size_t instead of int for buffer size, since this includes
changing a pointer to int into a pointer to size_t update all calls to
safe_strcat() to use size_t for that.
36 lines of code changed in 6 files:
common/object.c, include/config.h: Document the different levels of MEMORY_DEBUG
and add a third level that calls free() instead of adding back to free list
in order to more properly detect use after free.
18 lines of code changed in 3 files:
common/object.c, include/config.h: Workaround to make MEMORY_DEBUG usable,
currently we can't realloc on allocation to ensure the backtrace is correct
(as the comment in the code described) since a lot of stuff access objects
after freeing and fixing these are non-trivial. So disable realloc() for now
unless MEMORY_DEBUG is defined to a value greater than 1. Also fix one of the
accesses after free_object() (was in clean_friendly_list()).
29 lines of code changed in 3 files:
common/re-cmp.c: Correct some #ifdef to use the correct variable name
(SAFE_CHECKS not SAFE_CHECK).
7 lines of code changed in 2 files: