Dumpfbackenbrot, Wahrnehmungscheck.

Einheitlicher "Einheit nicht gefunden" Fehler (63, nicht 64)
This commit is contained in:
Enno Rehling 2003-03-08 20:57:38 +00:00
parent 64980aec64
commit 251be32bce
11 changed files with 52 additions and 79 deletions

View File

@ -715,7 +715,7 @@ giveunit(region * r, unit * u, unit * u2, strlist * S)
givemen(u->number, u, NULL, S->s); givemen(u->number, u, NULL, S->s);
cmistake(u, S->s, 153, MSG_COMMERCE); cmistake(u, S->s, 153, MSG_COMMERCE);
} else { } else {
cmistake(u, S->s, 64, MSG_COMMERCE); cmistake(u, S->s, 63, MSG_COMMERCE);
} }
return; return;
} }
@ -2921,7 +2921,7 @@ steal(region * r, unit * u, request ** stealorders)
} }
if (!u2) { if (!u2) {
cmistake(u, findorder(u, u->thisorder), 64, MSG_INCOME); cmistake(u, findorder(u, u->thisorder), 63, MSG_INCOME);
return; return;
} }

View File

@ -1572,7 +1572,7 @@ set_name(region * r, unit * u, strlist * S)
if (foreign == true) { if (foreign == true) {
unit *u2 = getunit(r, u->faction); unit *u2 = getunit(r, u->faction);
if (!u2 || !cansee(u->faction, r, u2, 0)) { if (!u2 || !cansee(u->faction, r, u2, 0)) {
cmistake(u, S->s, 64, MSG_EVENT); cmistake(u, S->s, 63, MSG_EVENT);
break; break;
} }
if (!fval(u,FL_UNNAMED)) { if (!fval(u,FL_UNNAMED)) {
@ -1677,7 +1677,7 @@ mailunit(region * r, unit * u, int n, strlist * S, const char * s)
deliverMail(u2->faction, r, u, s, u2); deliverMail(u2->faction, r, u, s, u2);
} }
else else
cmistake(u, S->s, 64, MSG_MESSAGE); cmistake(u, S->s, 63, MSG_MESSAGE);
/* Immer eine Meldung - sonst könnte man so getarnte EHs enttarnen: /* Immer eine Meldung - sonst könnte man so getarnte EHs enttarnen:
* keine Meldung -> EH hier. */ * keine Meldung -> EH hier. */
} }
@ -1767,7 +1767,7 @@ distributeMail(region * r, unit * u, strlist * S)
} }
if(see == false) { if(see == false) {
cmistake(u, S->s, 64, MSG_MESSAGE); cmistake(u, S->s, 63, MSG_MESSAGE);
return; return;
} }

View File

@ -63,7 +63,7 @@ spy(region * r, unit * u)
target = getunit(r, u->faction); target = getunit(r, u->faction);
if (!target) { if (!target) {
cmistake(u, findorder(u, u->thisorder), 64, MSG_EVENT); cmistake(u, findorder(u, u->thisorder), 63, MSG_EVENT);
return; return;
} }
if (!can_contact(r, u, target)) { if (!can_contact(r, u, target)) {

View File

@ -584,15 +584,22 @@ reportcasualties(battle * b, fighter * fig, int dead)
bfaction * bf; bfaction * bf;
if (fig->alive == fig->unit->number) if (fig->alive == fig->unit->number)
return; return;
#ifndef NO_RUNNING
if (fig->run.region == NULL) { if (fig->run.region == NULL) {
fig->run.region = fleeregion(fig->unit); fig->run.region = fleeregion(fig->unit);
if (fig->run.region == NULL) fig->run.region = b->region; if (fig->run.region == NULL) fig->run.region = b->region;
} }
#endif
fbattlerecord(fig->unit->faction, b->region, " "); fbattlerecord(fig->unit->faction, b->region, " ");
for (bf = b->factions;bf;bf=bf->next) { for (bf = b->factions;bf;bf=bf->next) {
faction * f = bf->faction; faction * f = bf->faction;
#ifdef NO_RUNNING
struct message * m = msg_message("casualties", "unit runto run alive fallen",
fig->unit, NULL, fig->run.number, fig->alive, dead);
#else
struct message * m = msg_message("casualties", "unit runto run alive fallen", struct message * m = msg_message("casualties", "unit runto run alive fallen",
fig->unit, fig->run.region, fig->run.number, fig->alive, dead); fig->unit, fig->run.region, fig->run.number, fig->alive, dead);
#endif
brecord(f, b->region, m); brecord(f, b->region, m);
msg_release(m); msg_release(m);
} }
@ -2251,6 +2258,7 @@ loot_items(fighter * corpse)
} }
} }
#ifndef NO_RUNNING
static void static void
loot_fleeing(fighter* fig, unit* runner) loot_fleeing(fighter* fig, unit* runner)
{ {
@ -2266,6 +2274,7 @@ merge_fleeloot(fighter* fig, unit* u)
{ {
i_merge(&u->items, &fig->run.items); i_merge(&u->items, &fig->run.items);
} }
#endif
static boolean static boolean
seematrix(const faction * f, const side * s) seematrix(const faction * f, const side * s)
@ -2398,8 +2407,8 @@ aftermath(battle * b)
assert(du->number >= 0); assert(du->number >= 0);
if (df->run.hp) { if (df->run.hp) {
#ifndef NO_RUNNING
if (df->alive == 0) { if (df->alive == 0) {
/* Report the casualties */ /* Report the casualties */
reportcasualties(b, df, dead); reportcasualties(b, df, dead);
@ -2422,11 +2431,15 @@ aftermath(battle * b)
travel(r, du, df->run.region, 1); travel(r, du, df->run.region, 1);
df->run.region = du->region; df->run.region = du->region;
} }
} else { } else
#endif
{
/* nur teilweise geflohene Einheiten mergen sich wieder */ /* nur teilweise geflohene Einheiten mergen sich wieder */
df->alive += df->run.number; df->alive += df->run.number;
sum_hp += df->run.hp; sum_hp += df->run.hp;
#ifndef NO_RUNNING
merge_fleeloot(df, du); merge_fleeloot(df, du);
#endif
df->run.number = 0; df->run.number = 0;
df->run.hp = 0; df->run.hp = 0;
/* df->run.region = NULL;*/ /* df->run.region = NULL;*/
@ -2441,7 +2454,9 @@ aftermath(battle * b)
/* alle sind tot, niemand geflohen. Einheit auflösen */ /* alle sind tot, niemand geflohen. Einheit auflösen */
df->run.number = 0; df->run.number = 0;
df->run.hp = 0; df->run.hp = 0;
#ifndef NO_RUNNING
df->run.region = NULL; df->run.region = NULL;
#endif
/* Report the casualties */ /* Report the casualties */
reportcasualties(b, df, dead); reportcasualties(b, df, dead);
@ -3327,11 +3342,12 @@ void
flee(const troop dt) flee(const troop dt)
{ {
fighter * fig = dt.fighter; fighter * fig = dt.fighter;
#ifndef NO_RUNNING
unit * u = fig->unit; unit * u = fig->unit;
int carry = personcapacity(u) - u->race->weight; int carry = personcapacity(u) - u->race->weight;
int money; int money;
item ** ip = &u->items; item ** ip = &u->items;
while (*ip) { while (*ip) {
item * itm = *ip; item * itm = *ip;
const item_type * itype = itm->type; const item_type * itype = itm->type;
@ -3370,6 +3386,7 @@ flee(const troop dt)
i_change(&u->items, i_silver, -money); i_change(&u->items, i_silver, -money);
i_change(&fig->run.items, i_silver, +money); i_change(&fig->run.items, i_silver, +money);
} }
#endif
fig->run.hp += fig->person[dt.index].hp; fig->run.hp += fig->person[dt.index].hp;
++fig->run.number; ++fig->run.number;
@ -3488,7 +3505,7 @@ do_battle(void)
/* Fehler: "Die Einheit wurde nicht gefunden" */ /* Fehler: "Die Einheit wurde nicht gefunden" */
if (!u2 || fval(u2, FL_MOVED) || u2->number == 0 if (!u2 || fval(u2, FL_MOVED) || u2->number == 0
|| !cansee(u->faction, u->region, u2, 0)) { || !cansee(u->faction, u->region, u2, 0)) {
cmistake(u, sl->s, 64, MSG_BATTLE); cmistake(u, sl->s, 63, MSG_BATTLE);
list_continue(sl); list_continue(sl);
} }
/* Fehler: "Die Einheit ist eine der unsrigen" */ /* Fehler: "Die Einheit ist eine der unsrigen" */
@ -3648,14 +3665,13 @@ do_battle(void)
/* Flucht nicht bei mehr als 600 HP. Damit Wyrme tötbar bleiben. */ /* Flucht nicht bei mehr als 600 HP. Damit Wyrme tötbar bleiben. */
int runhp = min(600,(int)(0.9+unit_max_hp(u)*hpflee(u->status))); int runhp = min(600,(int)(0.9+unit_max_hp(u)*hpflee(u->status)));
side *side = fig->side; side *side = fig->side;
region *r = NULL;
if (fval(u->race, RCF_UNDEAD) || old_race(u->race) == RC_SHADOWKNIGHT) continue; if (fval(u->race, RCF_UNDEAD) || old_race(u->race) == RC_SHADOWKNIGHT) continue;
if (u->ship) continue; if (u->ship) continue;
dt.fighter = fig; dt.fighter = fig;
#ifndef NO_RUNNING
if (!fig->run.region) fig->run.region = fleeregion(u); if (!fig->run.region) fig->run.region = fleeregion(u);
r = fig->run.region; if (!fig->run.region) continue;
if (!r) #endif
continue;
dt.index = fig->alive - fig->removed; dt.index = fig->alive - fig->removed;
while (side->size[SUM_ROW] && dt.index != 0) { while (side->size[SUM_ROW] && dt.index != 0) {
--dt.index; --dt.index;

View File

@ -163,8 +163,10 @@ typedef struct fighter {
struct { struct {
int number; /* number of people who have flown */ int number; /* number of people who have flown */
int hp; /* accumulated hp of fleeing people */ int hp; /* accumulated hp of fleeing people */
#ifndef NO_RUNNING
struct region *region; /* destination of fleeing people */ struct region *region; /* destination of fleeing people */
struct item * items; /* items they take */ struct item * items; /* items they take */
#endif
} run; } run;
int action_counter; /* number of active actions the struct unit did in the fight */ int action_counter; /* number of active actions the struct unit did in the fight */
#ifdef SHOW_KILLS #ifdef SHOW_KILLS

View File

@ -1947,7 +1947,10 @@ use_foolpotion(struct unit *u, int targetno, const struct item_type *itype, int
cmistake(u, cmd, 63, MSG_EVENT); cmistake(u, cmd, 63, MSG_EVENT);
return ECUSTOM; return ECUSTOM;
} }
/* TODO: wahrnehmung-check */ if (effskill(u, SK_STEALTH)<=effskill(target, SK_OBSERVATION)) {
cmistake(u, cmd, 63, MSG_EVENT);
return ECUSTOM;
}
ADDMSG(&u->faction->msgs, msg_message("givedumb", ADDMSG(&u->faction->msgs, msg_message("givedumb",
"unit recipient amount", u, target, amount)); "unit recipient amount", u, target, amount));
assert(oldpotiontype[P_FOOL]->itype==itype); assert(oldpotiontype[P_FOOL]->itype==itype);

View File

@ -817,7 +817,7 @@ init_drive(void)
boolean found = false; boolean found = false;
ut = getunit(r, u->faction); ut = getunit(r, u->faction);
if(!ut) { if(!ut) {
cmistake(u, findorder(u, u->thisorder), 64, MSG_MOVE); cmistake(u, findorder(u, u->thisorder), 63, MSG_MOVE);
continue; continue;
} }
for (S = ut->orders; S; S = S->next) { for (S = ut->orders; S; S = S->next) {
@ -832,7 +832,7 @@ init_drive(void)
if(cansee(u->faction, r, ut, 0)) { if(cansee(u->faction, r, ut, 0)) {
cmistake(u, findorder(u, u->thisorder), 286, MSG_MOVE); cmistake(u, findorder(u, u->thisorder), 286, MSG_MOVE);
} else { } else {
cmistake(u, findorder(u, u->thisorder), 64, MSG_MOVE); cmistake(u, findorder(u, u->thisorder), 63, MSG_MOVE);
} }
} }
} }
@ -1243,12 +1243,12 @@ travel(region * first, unit * u, region * next, int flucht)
if(cansee(u->faction, u->region, ut, 0)) { if(cansee(u->faction, u->region, ut, 0)) {
cmistake(u, findorder(u, u->thisorder), 90, MSG_MOVE); cmistake(u, findorder(u, u->thisorder), 90, MSG_MOVE);
} else { } else {
cmistake(u, findorder(u, u->thisorder), 64, MSG_MOVE); cmistake(u, findorder(u, u->thisorder), 63, MSG_MOVE);
} }
} }
} else { } else {
if (ut) { if (ut) {
cmistake(u, findorder(u, u->thisorder), 64, MSG_MOVE); cmistake(u, findorder(u, u->thisorder), 63, MSG_MOVE);
} else { } else {
cmistake(u, findorder(u, u->thisorder), 99, MSG_MOVE); cmistake(u, findorder(u, u->thisorder), 99, MSG_MOVE);
} }

View File

@ -22,7 +22,6 @@
#ifndef CONFIG_H #ifndef CONFIG_H
#define CONFIG_H #define CONFIG_H
/**** **** /**** ****
** Debugging Libraries ** ** Debugging Libraries **
**** ****/ **** ****/

View File

@ -381,17 +381,15 @@ game_done(void)
#include "magic.h" #include "magic.h"
#if (defined(_MSC_VER))
# define MALLOCDBG 1
#endif
#if MALLOCDBG #if MALLOCDBG
static void void
init_malloc_debug(void) init_malloc_debug(void)
{ {
#if (defined(_MSC_VER)) #if (defined(_MSC_VER))
# if MALLOCDBG == 2 # if MALLOCDBG == 2
# define CHECKON() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF) # define CHECKON() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF)
# elif MALLOCDBG == 3
# define CHECKON() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) & 0)
# elif MALLOCDBG == 1 # elif MALLOCDBG == 1
# define CHECKON() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_CRT_DF | _CRTDBG_DELAY_FREE_MEM_DF) # define CHECKON() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_CRT_DF | _CRTDBG_DELAY_FREE_MEM_DF)
# endif # endif
@ -640,7 +638,7 @@ main(int argc, char *argv[])
return -1; return -1;
} }
#endif #endif
#if MALLOCDBG #if 0
init_malloc_debug(); init_malloc_debug();
#endif #endif

View File

@ -1209,30 +1209,25 @@
</locale> </locale>
</message> </message>
<message name="error63"> <message name="error63" section="errors">
<type> <type>
<arg name="unit" type="unit"></arg> <arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg> <arg name="region" type="region"></arg>
<arg name="command" type="string"></arg> <arg name="command" type="string"></arg>
</type> </type>
<locale name="de"> <text locale="de">"$unit($unit) in $region($region): '$command' - Die Einheit wurde nicht gefunden."</text>
<nr section="errors"> <text locale="en">"$unit($unit) in $region($region): '$command' - The unit could not be found."</text>
<text>"$unit($unit) in $region($region): '$command' - Die Einheit wurde nicht gefunden."</text>
</nr>
</locale> </locale>
</message> </message>
<message name="error64"> <message name="error64" section="errors">
<type> <type>
<arg name="unit" type="unit"></arg> <arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg> <arg name="region" type="region"></arg>
<arg name="command" type="string"></arg> <arg name="command" type="string"></arg>
</type> </type>
<locale name="de"> <text locale="de">"$unit($unit) in $region($region): '$command' - $unit($unit) ist nicht ausreichend getarnt."</text>
<nr section="errors"> <text locale="en">"$unit($unit) in $region($region): '$command' - $unit($unit) is not sufficiently stealthy."</text>
<text>"$unit($unit) in $region($region): '$command' - Die Einheit wurde nicht gefunden."</text>
</nr>
</locale>
</message> </message>
<message name="use_realworld_only" section="errors"> <message name="use_realworld_only" section="errors">
@ -6949,7 +6944,8 @@
<arg name="run" type="int"></arg> <arg name="run" type="int"></arg>
<arg name="runto" type="region"></arg> <arg name="runto" type="region"></arg>
</type> </type>
<text locale="de">"$unit($unit) verlor $int($fallen) Personen$if($alive,", $int($alive) überlebten","")$if($run," und $int($run) flohen nach $region($runto)","")."</text> <text locale="de">"$unit($unit) verlor $int($fallen) Personen$if($alive,", $int($alive) überlebten","")$if($run," und $int($run) flohen$if($isnull($runto),""," nach $region($runto)"),"")."</text>
<text locale="en">"$unit($unit) lost $int($fallen) people: $int($alive) survived$if($run," and $int($run) fled$if($isnull($runto),""," to $region($runto)"),"")."</text>
</message> </message>
<message name="new_fspecial"> <message name="new_fspecial">

View File

@ -727,32 +727,6 @@
</locale> </locale>
</message> </message>
<message name="error63">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
</type>
<locale name="en">
<nr section="errors">
<text>"$unit($unit) in $region($region): '$command' - The unit could not be found."</text>
</nr>
</locale>
</message>
<message name="error64">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
</type>
<locale name="en">
<nr section="errors">
<text>"$unit($unit) in $region($region): '$command' - The unit could not be found."</text>
</nr>
</locale>
</message>
<message name="error65"> <message name="error65">
<type> <type>
<arg name="unit" type="unit"></arg> <arg name="unit" type="unit"></arg>
@ -3904,21 +3878,6 @@
</locale> </locale>
</message> </message>
<message name="casualties">
<type>
<arg name="unit" type="unit"></arg>
<arg name="fallen" type="int"></arg>
<arg name="alive" type="int"></arg>
<arg name="run" type="int"></arg>
<arg name="runto" type="region"></arg>
</type>
<locale name="en">
<nr section="none">
<text>"$unit($unit) lost $int($fallen) people: $int($alive) survived and $int($run) fled to $region($runto)."</text>
</nr>
</locale>
</message>
<message name="studycost"> <message name="studycost">
<type> <type>
<arg name="unit" type="unit"></arg> <arg name="unit" type="unit"></arg>