diff --git a/scripts/tests/bindings.lua b/scripts/tests/bindings.lua index 61c8ed93c..9e937e985 100755 --- a/scripts/tests/bindings.lua +++ b/scripts/tests/bindings.lua @@ -42,6 +42,7 @@ function test_process() assert_equal("function", _G.type(eressea.process.enter)) assert_equal("function", _G.type(eressea.process.magic)) assert_equal("function", _G.type(eressea.process.give_control)) + assert_equal("function", _G.type(eressea.process.regeneration)) end function test_settings() diff --git a/scripts/tests/orders.lua b/scripts/tests/orders.lua index 890c7b825..d2d95b743 100755 --- a/scripts/tests/orders.lua +++ b/scripts/tests/orders.lua @@ -224,3 +224,8 @@ end function test_process_give_control() eressea.process.give_control() end + +function test_process_regeneration() + eressea.process.regeneration() +end + diff --git a/src/bindings/bind_process.c b/src/bindings/bind_process.c index 5244ef317..c52d66f8e 100755 --- a/src/bindings/bind_process.c +++ b/src/bindings/bind_process.c @@ -211,6 +211,11 @@ void process_give_control(void) { process_cmd(K_CONTACT, give_control_cmd, 0); } +void process_regeneration(void) { + monthly_healing(); + regenerate_aura(); +} + void process_enter(int final) { region * r; for (r=regions; r; r=r->next) { diff --git a/src/bindings/bind_process.h b/src/bindings/bind_process.h index 128692c49..61bc5e573 100755 --- a/src/bindings/bind_process.h +++ b/src/bindings/bind_process.h @@ -34,6 +34,7 @@ void process_contact(void); void process_enter(int final); void process_magic(void); void process_give_control(void); +void process_regeneration(void); #ifdef __cplusplus } diff --git a/src/bindings/process.pkg b/src/bindings/process.pkg index 339fa6a7c..5a86b632d 100755 --- a/src/bindings/process.pkg +++ b/src/bindings/process.pkg @@ -31,5 +31,6 @@ module eressea { void process_enter @ enter(int message); /* ENTER */ void process_magic @ magic(void); /* CAST */ void process_give_control @ give_control(void); /* GIVE CONTROL */ + void process_regeneration @ regeneration(void); /* regen health & aura */ } } diff --git a/src/gamecode/laws.c b/src/gamecode/laws.c index 1d925f98f..313c68469 100755 --- a/src/gamecode/laws.c +++ b/src/gamecode/laws.c @@ -1514,9 +1514,16 @@ void quit(void) } } destroyfaction(f); + } else { + ++f->age; + if (f->age + 1 < NewbieImmunity()) { + ADDMSG(&f->msgs, msg_message("newbieimmunity", "turns", + NewbieImmunity() - f->age - 1)); + } } - if (*fptr == f) + if (*fptr == f) { fptr = &f->next; + } } remove_idle_players(); remove_empty_units(); @@ -3773,7 +3780,7 @@ static double heal_factor(const unit * u) } } -static void monthly_healing(void) +void monthly_healing(void) { region *r; static const curse_type *heal_ct = NULL; @@ -3979,19 +3986,6 @@ static void update_spells(void) } } -static void age_factions(void) -{ - faction *f; - - for (f = factions; f; f = f->next) { - ++f->age; - if (f->age + 1 < NewbieImmunity()) { - ADDMSG(&f->msgs, msg_message("newbieimmunity", "turns", - NewbieImmunity() - f->age - 1)); - } - } -} - int use_cmd(unit * u, struct order *ord) { const char *t; @@ -4489,7 +4483,6 @@ void init_processor(void) } p += 10; - add_proc_global(p, &age_factions, "Parteienalter++"); add_proc_order(p, K_MAIL, &mail_cmd, 0, "Botschaften"); add_proc_order(p, K_CONTACT, &contact_cmd, 0, "Kontaktieren"); @@ -4580,7 +4573,7 @@ void init_processor(void) p += 10; add_proc_global(p, &monthly_healing, "Regeneration (HP)"); - add_proc_global(p, ®eneration_magiepunkte, "Regeneration (Aura)"); + add_proc_global(p, ®enerate_aura, "Regeneration (Aura)"); if (!global.disabled[K_DEFAULT]) { add_proc_global(p, &defaultorders, "Defaults setzen"); } diff --git a/src/gamecode/laws.h b/src/gamecode/laws.h index 3dd492153..583a07af3 100755 --- a/src/gamecode/laws.h +++ b/src/gamecode/laws.h @@ -51,6 +51,7 @@ extern "C" { extern void new_units(void); extern void quit(void); + extern void monthly_healing(void); extern void renumber_factions(void); extern void restack_units(void); extern void update_long_order(struct unit *u); diff --git a/src/kernel/magic.c b/src/kernel/magic.c index a0bbef2a0..e716528ce 100644 --- a/src/kernel/magic.c +++ b/src/kernel/magic.c @@ -1445,7 +1445,7 @@ static double regeneration(unit * u) return aura; } -void regeneration_magiepunkte(void) +void regenerate_aura(void) { region *r; unit *u; diff --git a/src/kernel/magic.h b/src/kernel/magic.h index 07ec04772..0f5b6b56d 100644 --- a/src/kernel/magic.h +++ b/src/kernel/magic.h @@ -192,7 +192,7 @@ typedef struct sc_mage { void magic(void); - void regeneration_magiepunkte(void); + void regenerate_aura(void); extern struct attrib_type at_seenspell; extern struct attrib_type at_mage;