Merge remote-tracking branch 'upstream/develop' into develop

Conflicts:
	scripts/tests/e2/init.lua
	src/battle.c
	src/magic.c
	src/magic.h
This commit is contained in:
Enno Rehling 2015-08-06 20:56:06 +02:00
commit 0e1f318a0c
5 changed files with 9 additions and 9 deletions

View File

@ -1852,7 +1852,7 @@ static void do_combatspell(troop at)
log_error("spell '%s' has no function.\n", sp->sname);
}
else {
level = cast_combatspell(at, sp, level, MagicPower(power));
level = cast_combatspell(at, sp, level, power);
}
}
@ -1870,7 +1870,7 @@ static void do_extra_spell(troop at, const att * a)
}
else {
assert(a->level > 0);
cast_combatspell(at, sp, a->level, MagicPower(a->level));
cast_combatspell(at, sp, a->level, a->level);
}
}

View File

@ -525,7 +525,7 @@ static void unit_castspell(unit * u, const char *name, int level)
}
else {
castorder co;
create_castorder(&co, u, 0, sp, u->region, level, MagicPower((float)level), 0, 0, 0);
create_castorder(&co, u, 0, sp, u->region, level, (double)level, 0, 0, 0);
sp->cast(&co);
free_castorder(&co);
}

View File

@ -118,7 +118,8 @@ static float MagicRegeneration(void)
return value;
}
double MagicPower(double force) {
static double MagicPower(double force)
{
if (force > 0) {
const char *str = get_param(global.parameters, "magic.power");
double value = str ? atof(str) : 1.0;
@ -1074,8 +1075,6 @@ spellpower(region * r, unit * u, const spell * sp, int cast_level, struct order
}
}
force = MagicPower(force);
return _max(force, 0);
}
@ -2073,7 +2072,7 @@ castorder *create_castorder(castorder * co, unit *caster, unit * familiar, const
co->_familiar = familiar;
co->sp = sp;
co->level = lev;
co->force = force;
co->force = MagicPower(force);
co->_rtarget = r ? r : (familiar ? familiar->region : (caster ? caster->region : 0));
co->distance = range;
co->order = copy_order(ord);
@ -2821,7 +2820,7 @@ void magic(void)
continue;
}
co->force = spellpower(target_r, u, sp, co->level, ord);
co->force = MagicPower(spellpower(target_r, u, sp, co->level, ord));
/* die Stärke kann durch Antimagie auf 0 sinken */
if (co->force <= 0) {
co->force = 0;

View File

@ -360,7 +360,6 @@ extern "C" {
extern void write_spells(struct quicklist *slist, struct storage *store);
extern void read_spells(struct quicklist **slistp, magic_t mtype,
struct storage *store);
double MagicPower(double force);
extern struct spellbook * get_spellbook(const char * name);
extern void free_spellbooks(void);

View File

@ -2,6 +2,7 @@
#include "study.h"
#include <kernel/config.h>
#include <kernel/unit.h>
#include <kernel/faction.h>
#include <kernel/order.h>
@ -26,6 +27,7 @@ static void setup_study(study_fixture *fix, skill_t sk) {
assert(fix);
test_cleanup();
set_param(&global.parameters, "study.random_progress", "0");
test_create_world();
r = test_create_region(0, 0, 0);
f = test_create_faction(0);