Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] (PR#2521) general effects framework
Home

[Freeciv-Dev] (PR#2521) general effects framework

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#2521) general effects framework
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 21 Nov 2003 18:15:41 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=2521 >

Per asked me to post this because I will have no time to work on this
until Christmas, so I'm posting despite the fact there's a serious bug that
I've yet to track down. Also many people are interested in this work and
perhaps one of them can track it down and test it.

This is version 5 of the general effects framework. version 4 was
internal. Included in the tarball are:

1. effects-pre1.diff
2. effects5.diff
3. effects-immed1.diff
4. effects-city1-1.diff

they should be applied to CVS in that order using the -p1 flag.

The "effects-pre1.diff" patch creates the flags for the two surviving effects:
Enable_Space and Enable_Nuke. This _will_ change savegames, so compare
effects savegames to savegames from this patch. Note that backwards
compatibility is not supported, so a kludge regarding Apollo and Manhattan
will have to be done.

The "effects5.diff" patch in the bulk of the framework. It creates the
necessary iterators and update functions as well as the network code.
There are several new things. Among them are the effects for all the unit
flags. and a effect.value1 and effect.value2 for paratrooper support.
add_unit_effects() got completed. I'm sure that I fixed a bunch of bugs,
but if was a long time ago. The units effects is starting to seem a bit
overkill to me since for now, unit effects are local only, but the code's
there for now.

The "effect-immed1.diff" is the first patch which actually _does_
something. It allows effect producers to use the Give_Imm_Adv, Improve_Rep, 
Enable_Space, Enable_Nuke, Reveal_Cities, and Reveal_Map effects. It has
been tested (at least a bit) and seems to work. It will only change
savegames from the effects-pre1 patch if the Enable_Space or Enable_Nuke
flags are set.

The "effect-city1-1.diff" attempts to add the per-tile effects. These are:
Food_Add_Tile, Food_Inc_Tile, Food_Per_Tile, Prod_Add_Tile, Prod_Inc_Tile,
Prod_Per_Tile, Trade_Add_Tile, Trade_Inc_Tile, and Trade_Per_Tile.
It had massive inspiration from Ben Webb's per-tile code.

It crashes:

1: AI Passengers counting reported false positive 1
> civserver: map.c:1273: contains_special: Assertion `masked ==
> S_NO_SPECIAL || masked == to_test_for' failed.
Aborted (core dumped)

here's the relavent code (i think):

        /* check .aff_spec and .aff_terr */
        if ((contains_special(tile_spec[x][y], eff->defn->aff_spec)
             || eff->defn->aff_spec == S_NO_SPECIAL)
            && (tile_terr[x][y] == eff->defn->aff_terr
                || eff->defn->aff_terr == T_UNKNOWN)) {
          int amount = eff->defn->amount;

          switch(eff->defn->type) {

in city.c:584.

#0  0x400e66f1 in kill () from /lib/libc.so.6
#1  0x400e64ad in raise () from /lib/libc.so.6
#2  0x400e78b4 in abort () from /lib/libc.so.6
#3  0x400dff95 in __assert_fail () from /lib/libc.so.6
#4  0x080bcc44 in contains_special (set=266, to_test_for=S_NO_SPECIAL)
    at map.c:1276
#5  0x080aca97 in update_city_per_tile_modifiers (pcity=0x85b6d28)
    at city.c:585
#6  0x080b4576 in effects_update_all_common () at effects.c:466
#7  0x08077fc9 in effects_update_all () at gamehand.c:568
#8  0x0806f680 in city_build_building (pplayer=0x821a5c8, pcity=0x85b6d28)
    at cityturn.c:960

(gdb) fr 4
#4  0x080bcc44 in contains_special (set=266, to_test_for=S_NO_SPECIAL)
    at map.c:1276
1276    }
(gdb) p masked
$1 = 1075712736

It looks to me like memory corruption somewhere, for the value of masked
makes no sense. If someone can figure this out, that would be nice. I've
attached the savegame.

Enjoy.

-mike

Attachment: effects5.tar.gz
Description: application/tar-gz

Attachment: civgame-0579.sav.gz
Description: application/gunzip


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2521) general effects framework, Mike Kaufman <=