summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFate <fate.tmw@googlemail.com>2008-11-08 06:43:20 +0000
committerFate <fate.tmw@googlemail.com>2008-11-08 06:43:20 +0000
commitf52600e3795cd8a40c716ff92db6d8f55cc8e7cf (patch)
tree640394a2db695b69cd1b41dc05656f148070552b
parent74b8e841fcaf7454fa677bf6225036f4d2ebaa26 (diff)
downloadtmwa-f52600e3795cd8a40c716ff92db6d8f55cc8e7cf.tar.gz
tmwa-f52600e3795cd8a40c716ff92db6d8f55cc8e7cf.tar.bz2
tmwa-f52600e3795cd8a40c716ff92db6d8f55cc8e7cf.tar.xz
tmwa-f52600e3795cd8a40c716ff92db6d8f55cc8e7cf.zip
* Change SLang interpreter time handling to be universally unsigned
* Add debug output to SLang guard checking to print why particular guards failed
-rw-r--r--src/map/magic-interpreter-base.c16
-rw-r--r--src/map/map.h2
2 files changed, 11 insertions, 7 deletions
diff --git a/src/map/magic-interpreter-base.c b/src/map/magic-interpreter-base.c
index 6da7acb..dc0fa02 100644
--- a/src/map/magic-interpreter-base.c
+++ b/src/map/magic-interpreter-base.c
@@ -290,15 +290,17 @@ consume_components(character_t *caster, component_t *component)
static int
spellguard_can_satisfy(spellguard_check_t *check, character_t *caster, env_t *env, int *near_miss)
{
- int tick = gettick();
+ unsigned int tick = gettick();
int retval = check_prerequisites(caster, check->catalysts);
-/*
- fprintf(stderr, "Check: can satisfy? %d%d%d%d\n", retval,
+
+ fprintf(stderr, "MC(%d/%s)? %d%d%d%d (%u <= %u)\n",
+ caster->bl.id, caster->status.name,
+ retval,
caster->cast_tick <= tick,
check->mana <= caster->status.sp,
- check_prerequisites(caster, check->components));
-*/
+ check_prerequisites(caster, check->components),
+ caster->cast_tick, tick);
if (retval && near_miss)
*near_miss = 1; // close enough!
@@ -309,13 +311,15 @@ spellguard_can_satisfy(spellguard_check_t *check, character_t *caster, env_t *en
&& check_prerequisites(caster, check->components);
if (retval) {
- int casttime = check->casttime;
+ unsigned int casttime = (unsigned int) check->casttime;
if (VAR(VAR_MIN_CASTTIME).ty == TY_INT)
casttime = MAX(casttime, VAR(VAR_MIN_CASTTIME).v.v_int);
caster->cast_tick = tick + casttime; /* Make sure not to cast too frequently */
+ fprintf(stderr, " -> NC %u + %u = %u\n", tick, casttime, caster->cast_tick);
+
consume_components(caster, check->components);
pc_heal(caster, 0, -check->mana);
}
diff --git a/src/map/map.h b/src/map/map.h
index bc34d7c..54179ac 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -208,7 +208,7 @@ struct map_session_data {
int followtimer; // [MouseJstr]
int followtarget;
- int cast_tick; // [Fate] Next tick at which spellcasting is allowed
+ unsigned int cast_tick; // [Fate] Next tick at which spellcasting is allowed
struct invocation *active_spells; // [Fate] Singly-linked list of active spells linked to this PC
int attack_spell_override; // [Fate] When an attack spell is active for this player, they trigger it
// like a weapon. Check pc_attack_timer() for details.