From 10b1306b30bec389eb803e3241f3d5a5fe143abd Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Sun, 7 May 2006 21:11:49 +0000 Subject: [PATCH] Diverse wdw-Fixes --- src/common/gamecode/laws.c | 12 +++++++----- src/common/items/artrewards.c | 18 +++++++++++++++++- src/common/kernel/alliance.c | 18 ++++++++++++++++++ src/common/kernel/battle.c | 1 + src/common/kernel/eressea.c | 1 + src/common/spells/combatspells.c | 22 +++++++++++----------- src/eressea/korrektur.c | 2 +- src/res/messages.xml | 10 +++++++++- src/res/races.xml | 2 +- src/res/vinyambar-wdw.xml | 4 ++-- src/res/vinyambar/wdw-buildings.xml | 9 +++++++++ src/res/vinyambar/wdw-races.xml | 8 +------- src/scripts/wdw/phoenix.lua | 5 ++++- 13 files changed, 82 insertions(+), 30 deletions(-) diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 0ccb97dd0..6bd525179 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1089,12 +1089,14 @@ quit(void) if (f->flags & FFL_QUIT) { if (EnhancedQuit()) { const char * token = get_variable(f->attribs, "quit"); - int f2_id = atoi36(token); - faction *f2 = findfaction(f2_id); + if(token != NULL) { + int f2_id = atoi36(token); + faction *f2 = findfaction(f2_id); - assert(f2_id>0); - assert(f2!=NULL); - transfer_faction(f, f2); + assert(f2_id>0); + assert(f2!=NULL); + transfer_faction(f, f2); + } } destroyfaction(f); } diff --git a/src/common/items/artrewards.c b/src/common/items/artrewards.c index abbee8f5c..d1835a4d4 100644 --- a/src/common/items/artrewards.c +++ b/src/common/items/artrewards.c @@ -98,8 +98,9 @@ use_hornofdancing(struct unit * u, const struct item_type * itype, #define SPEEDUP 2 + static int -use_trappedairelemental(struct unit * u, int shipId, +useonother_trappedairelemental(struct unit * u, int shipId, const struct item_type * itype, int amount, struct order * ord) { @@ -131,10 +132,25 @@ use_trappedairelemental(struct unit * u, int shipId, return 0; } +static int +use_trappedairelemental(struct unit * u, + const struct item_type * itype, + int amount, struct order * ord) +{ + ship *sh = u->ship; + + if(sh == NULL) { + cmistake(u, ord, 20, MSG_MOVE); + return -1; + } + return useonother_trappedairelemental(u, sh->no, itype, amount,ord); +} + void register_artrewards(void) { at_register(&at_peaceimmune); register_function((pf_generic)use_hornofdancing, "use_hornofdancing"); register_function((pf_generic)use_trappedairelemental, "use_trappedairelemental"); + register_function((pf_generic)useonother_trappedairelemental, "useonother_trappedairelemental"); } diff --git a/src/common/kernel/alliance.c b/src/common/kernel/alliance.c index fa7c9c8a7..ed664b1a1 100644 --- a/src/common/kernel/alliance.c +++ b/src/common/kernel/alliance.c @@ -306,6 +306,7 @@ victorycondition(const alliance * al, const char * name) if (!found) return 0; } return 1; + } else if (strcmp(name, "phoenix")==0) { faction_list * flist = al->members; for (;flist;flist=flist->next) { @@ -315,7 +316,24 @@ victorycondition(const alliance * al, const char * name) } } return 0; + } else if (strcmp(name, "pyramid")==0) { + + /* Logik: + * - if (pyr > last_passed_size && pyr > all_others) { + * pyr->passed->counter++; + * for(all_other_pyrs) { + * pyr->passed->counter=0; + * } + * + * if(pyr->passed->counter >= 3) { + * set(pyr, passed); + * pyr->owner->set_attrib(pyra); + * } + * last_passed_size = pyr->size; + * } + */ + faction_list * flist = al->members; for (;flist;flist=flist->next) { faction * f = flist->data; diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 280dd5c7e..e1b097829 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -1452,6 +1452,7 @@ do_combatmagic(battle *b, combatmagic_t was) const spell * sp = co->sp; int level = co->level; double power = co->force; + if (sp->sp_function==NULL) { log_error(("spell '%s' has no function.\n", sp->sname)); } else { diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 28e6ca249..fb2c47026 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -531,6 +531,7 @@ max_skill(faction * f, skill_t sk) int ac = listlen(f->alliance->members); /* number of factions */ int al = allied_skilllimit(f, sk); /* limit per alliance */ int fl = (al+ac-1)/ac; /* faction limit */ + /* the following ist _very_ weird, please examine */ int sc = al - allied_skillcount(f, sk); if (sc==0) return count_skill(f, sk); return fl; diff --git a/src/common/spells/combatspells.c b/src/common/spells/combatspells.c index 758d33cf6..fd8dab45e 100644 --- a/src/common/spells/combatspells.c +++ b/src/common/spells/combatspells.c @@ -1049,27 +1049,27 @@ sp_flee(fighter * fi, int level, double power, spell * sp) int sp_hero(fighter * fi, int level, double power, spell * sp) { - battle *b = fi->side->battle; - unit *mage = fi->unit; - /* Immer aus der ersten Reihe nehmen */ - int minrow = FIGHT_ROW; - int maxrow = BEHIND_ROW-1; - int df_bonus = 0; - int force = 0; - int allies; - int targets = 0; + battle *b = fi->side->battle; + unit *mage = fi->unit; + /* Immer aus der ersten Reihe nehmen */ + int minrow = FIGHT_ROW; + int maxrow = BEHIND_ROW; + int df_bonus = 0; + int force = 0; + int allies; + int targets = 0; sprintf(buf, "%s zaubert %s", unitname(mage), spell_name(sp, default_locale)); switch(sp->id) { case SPL_HERO: df_bonus = (int)(power/5); - force = lovar(get_force(power, 4)); + force = max(1, lovar(get_force(power, 4))); break; default: df_bonus = 1; - force = (int)power; + force = max(1, (int)power); } scat(":"); battlerecord(b, buf); diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index c64b5acb1..dbb0a9830 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -841,7 +841,7 @@ check_mages(void) } if (mages>maxmages) { log_error(("faction %s has %d of max %d magicians.\n", - factionid(u->faction), mages, maxmages)); + factionid(f), mages, maxmages)); } } } diff --git a/src/res/messages.xml b/src/res/messages.xml index 34f05a8a7..26120a349 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -183,7 +183,15 @@ "In dieser Gegend steht das Korn besonders gut im Feld. ($int36($id))" "($int36($id))" - "The grain in this region is esecially healthy. ($int36($id))" + "The grain in this region is especially healthy. ($int36($id))" + + + + + + "Die Winde scheinen dieses Schiff besonders zu beguenstigen. ($int36($id))" + "($int36($id))" + "The winds seem to favor this ship. ($int36($id))" diff --git a/src/res/races.xml b/src/res/races.xml index 53106b653..bdf8b0763 100644 --- a/src/res/races.xml +++ b/src/res/races.xml @@ -680,7 +680,7 @@ - + diff --git a/src/res/vinyambar-wdw.xml b/src/res/vinyambar-wdw.xml index 7e93e8bda..958a3effd 100644 --- a/src/res/vinyambar-wdw.xml +++ b/src/res/vinyambar-wdw.xml @@ -88,9 +88,9 @@ - + - + diff --git a/src/res/vinyambar/wdw-buildings.xml b/src/res/vinyambar/wdw-buildings.xml index 7c70ce6f1..fb69f6bff 100644 --- a/src/res/vinyambar/wdw-buildings.xml +++ b/src/res/vinyambar/wdw-buildings.xml @@ -19,26 +19,35 @@ + + + + + + + + + diff --git a/src/res/vinyambar/wdw-races.xml b/src/res/vinyambar/wdw-races.xml index 6bc7354f1..417b165cf 100644 --- a/src/res/vinyambar/wdw-races.xml +++ b/src/res/vinyambar/wdw-races.xml @@ -159,7 +159,6 @@ - @@ -173,11 +172,7 @@ - - - - - + @@ -188,7 +183,6 @@ - diff --git a/src/scripts/wdw/phoenix.lua b/src/scripts/wdw/phoenix.lua index 7955da923..972daff49 100644 --- a/src/scripts/wdw/phoenix.lua +++ b/src/scripts/wdw/phoenix.lua @@ -10,7 +10,10 @@ function update_phoenix() end f = get_faction(0) if (f~=nil) then - local r, nregions = 0 + local r + local nregions + + nregions = 0 for r in regions() do nregions = nregions+1 end