From 3145295ad4804535c15a365240417a05855bcf09 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 26 Mar 2006 21:49:37 +0000 Subject: [PATCH] =?UTF-8?q?http://eressea.upb.de/mantis/view.php=3Fid=3D86?= =?UTF-8?q?9=20BEWACHE=20nach=20"langen"=20Kampf=20nicht=20m=C3=B6glich;?= =?UTF-8?q?=20Fehlermeldungen=20nach=20"langen"=20Kampf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Noch ein Flag eingeführt. Hoffe, dass das klappt. --- src/common/gamecode/economy.c | 2 +- src/common/gamecode/laws.c | 4 ++-- src/common/gamecode/study.c | 4 ++-- src/common/kernel/battle.c | 2 +- src/common/kernel/eressea.h | 1 - src/common/kernel/magic.c | 6 +----- src/common/kernel/movement.c | 18 +++++++++--------- src/common/kernel/unit.h | 6 +++--- src/eressea/lua/eressea.cpp | 23 +++++++++++++---------- src/res/messages.xml | 2 +- 10 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 6e0d25267..355bf437e 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -3076,7 +3076,7 @@ produce(void) !is_cursed(u->attribs, C_KAELTESCHUTZ,0)) continue; - if (attacked(u) && u->thisorder==NULL) { + if (fval(u, UFL_LONGACTION) && u->thisorder==NULL) { cmistake(u, u->thisorder, 52, MSG_PRODUCE); continue; } diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index f946e8fa4..0ccb97dd0 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -2665,7 +2665,7 @@ instant_orders(void) unit * u; for (u = r->units; u; u = u->next) { order * ord; - freset(u, UFL_MOVED); + freset(u, UFL_MOVED); /* reset, because it was saved in the datafile (monsters!) */ for (ord = u->orders; ord; ord = ord->next) { switch (get_keyword(ord)) { case K_QUIT: @@ -2748,7 +2748,7 @@ guard_on_cmd(unit * u, struct order * ord) } else { if (fval(u, UFL_MOVED)) { cmistake(u, ord, 187, MSG_EVENT); - } else if (fval(u->race, RCF_ILLUSIONARY) || u->race == new_race[RC_SPELL]) { + } else if (fval(u->race, RCF_ILLUSIONARY) || u->race == new_race[RC_SPELL]) { cmistake(u, ord, 95, MSG_EVENT); } else { /* Monster der Monsterpartei dürfen immer bewachen */ diff --git a/src/common/gamecode/study.c b/src/common/gamecode/study.c index 8e148c4a9..fdb61a8f7 100644 --- a/src/common/gamecode/study.c +++ b/src/common/gamecode/study.c @@ -473,7 +473,7 @@ learn(void) && !is_cursed(u->attribs, C_KAELTESCHUTZ,0)) { continue; } - if (attacked(u)) { + if (fval(u, UFL_LONGACTION)) { cmistake(u, u->thisorder, 52, MSG_PRODUCE); continue; } @@ -769,7 +769,7 @@ teaching(void) switch (get_keyword(u->thisorder)) { case K_TEACH: - if (attacked(u)){ + if (fval(u, UFL_LONGACTION)) { cmistake(u, u->thisorder, 52, MSG_PRODUCE); continue; } else { diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 35f14d9ba..10a364f6a 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -2428,7 +2428,7 @@ aftermath(battle * b) snumber += du->number; if (relevant) { - fset(du, UFL_MOVED); /* unit cannot move this round */ + fset(du, UFL_NOTMOVING); /* unit cannot move this round */ if (df->action_counter >= du->number) { ship * sh = du->ship?du->ship:leftship(du); if (sh) fset(sh, SF_DAMAGED); diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 2f191da5a..ab3ee2bcc 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -997,7 +997,6 @@ const char *strcheck(const char *s, size_t maxlen); #define strcheck(s, ml) (s) #endif -#define attacked(u) (fval(u, UFL_LONGACTION)) boolean idle(struct faction * f); boolean unit_has_cursed_item(struct unit *u); diff --git a/src/common/kernel/magic.c b/src/common/kernel/magic.c index abd0ca129..404f2e30d 100644 --- a/src/common/kernel/magic.c +++ b/src/common/kernel/magic.c @@ -2470,11 +2470,7 @@ magic(void) !is_cursed(u->attribs, C_KAELTESCHUTZ,0)) continue; - if(fval(u, UFL_WERE)) { - continue; - } - - if (attacked(u)) { + if(fval(u, UFL_WERE|UFL_LONGACTION)) { continue; } diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index fe7235e2a..1b0b0f695 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -2238,12 +2238,12 @@ hunt(unit *u) cmistake(u, u->thisorder, 144, MSG_MOVE); fset(u, UFL_LONGACTION); /* FOLGE SCHIFF ist immer lang */ return 0; - } else if(!fval(u, UFL_OWNER)) { + } else if (!fval(u, UFL_OWNER)) { cmistake(u, u->thisorder, 146, MSG_MOVE); fset(u, UFL_LONGACTION); /* FOLGE SCHIFF ist immer lang */ return 0; - } else if(attacked(u)) { - cmistake(u, u->thisorder, 52, MSG_MOVE); + } else if (fval(u, UFL_NOTMOVING)) { + cmistake(u, u->thisorder, 187, MSG_MOVE); fset(u, UFL_LONGACTION); /* FOLGE SCHIFF ist immer lang */ return 0; } else if (!can_move(u)) { @@ -2329,7 +2329,7 @@ move_hunters(void) while (*up!=NULL) { unit * u = *up; - if (!fval(u, UFL_MOVED)) { + if (!fval(u, UFL_MOVED|UFL_NOTMOVING)) { order * ord; for (ord=u->orders;ord;ord=ord->next) { @@ -2435,16 +2435,16 @@ movement(void) case K_MOVE: /* after moving, the unit has no thisorder. this prevents * it from moving twice (or getting error messages twice). - * UFL_MOVED is set in combat if the unit is not allowed + * UFL_NOTMOVING is set in combat if the unit is not allowed * to move because it was involved in a battle. */ - if (fval(u, UFL_LONGACTION) || fval(u, UFL_MOVED)) { - cmistake(u, u->thisorder, 52, MSG_MOVE); + if (fval(u, UFL_LONGACTION|UFL_MOVED|UFL_NOTMOVING)) { + cmistake(u, u->thisorder, 187, MSG_MOVE); set_order(&u->thisorder, NULL); } else if (!can_move(u)) { cmistake(u, u->thisorder, 55, MSG_MOVE); set_order(&u->thisorder, NULL); - } else if (!fval(u, UFL_MOVED)) { + } else if (!fval(u, UFL_MOVED|UFL_NOTMOVING)) { if (ships) { if (u->ship && fval(u, UFL_OWNER)) { init_tokens(u->thisorder); @@ -2530,7 +2530,7 @@ follow_unit(void) } } - if (a && !fval(u, UFL_MOVED)) { + if (a && !fval(u, UFL_MOVED|UFL_NOTMOVING)) { unit * u2 = a->data.v; boolean follow = false; diff --git a/src/common/kernel/unit.h b/src/common/kernel/unit.h index bd2d7d7e6..82b2d6cf8 100644 --- a/src/common/kernel/unit.h +++ b/src/common/kernel/unit.h @@ -39,8 +39,7 @@ struct item; #define UFL_WARMTH (1<<6) /* 64 */ #define UFL_HERO (1<<7) #define UFL_MOVED (1<<8) -#define UFL_FOLLOWING (1<<9) -#define UFL_FOLLOWED (1<<10) +#define UFL_NOTMOVING (1<<9) /* Die Einheit kann sich wg. langen Kampfes nicht bewegen */ #define UFL_HUNGER (1<<11) /* kann im Folgemonat keinen langen Befehl außer ARBEITE ausführen */ #define UFL_SIEGE (1<<12) /* speedup: belagert eine burg, siehe attribut */ #define UFL_TARGET (1<<13) /* speedup: hat ein target, siehe attribut */ @@ -50,8 +49,9 @@ struct item; /* warning: von 512/1024 gewechslet, wegen konflikt mit NEW_FOLLOW */ #define UFL_LOCKED (1<<16) /* Einheit kann keine Personen aufnehmen oder weggeben, nicht rekrutieren. */ #define UFL_DH (1<<18) /* same as FL_DH */ - #define UFL_STORM (1<<19) /* Kapitän war in einem Sturm */ +#define UFL_FOLLOWING (1<<20) +#define UFL_FOLLOWED (1<<21) #define UFL_NOAID (1<<22) /* Einheit hat Noaid-Status */ #define UFL_MARK (1<<23) /* same as FL_MARK */ diff --git a/src/eressea/lua/eressea.cpp b/src/eressea/lua/eressea.cpp index e21cf5c22..441eb2ff0 100644 --- a/src/eressea/lua/eressea.cpp +++ b/src/eressea/lua/eressea.cpp @@ -97,7 +97,7 @@ write_summary() } return -1; } - + extern int process_orders(void); @@ -163,7 +163,7 @@ lua_planmonsters(void) } } -static void +static void race_setscript(const char * rcname, const luabind::object& f) { race * rc = rc_find(rcname); @@ -175,17 +175,20 @@ race_setscript(const char * rcname, const luabind::object& f) #define ISLANDSIZE 20 #define TURNS_PER_ISLAND 4 -static void +static void lua_autoseed(const char * filename, bool new_island) { newfaction * players = read_newfactions(filename); - while (players) { - int n = listlen(players); - int k = (n+ISLANDSIZE-1)/ISLANDSIZE; - k = n / k; - n = autoseed(&players, k, new_island || (turn % TURNS_PER_ISLAND)==0); - if (n==0) { - break; + if (players!=NULL) { + rng_init(players->subscription); + while (players) { + int n = listlen(players); + int k = (n+ISLANDSIZE-1)/ISLANDSIZE; + k = n / k; + n = autoseed(&players, k, new_island || (turn % TURNS_PER_ISLAND)==0); + if (n==0) { + break; + } } } } diff --git a/src/res/messages.xml b/src/res/messages.xml index b77a647e6..97fd850dd 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -4034,7 +4034,7 @@ - "$unit($unit) in $region($region): '$order($command)' - Die Einheit kann den Befehl in dieser nicht ausführen, da sie sich bewegt hat oder in einen Kampf verwickelt war." + "$unit($unit) in $region($region): '$order($command)' - Die Einheit kann den Befehl in dieser Runde nicht ausführen, da sie sich bewegt hat oder in einen Kampf verwickelt war." "$unit($unit) in $region($region): '$order($command)' - The unit cannot execute this command because it has either moved or been in combat." "$unit($unit) in $region($region): '$order($command)' - The unit cannot execute this command because it has either moved or been in combat."