Mehrere Bugfixes die aus der vorangegangenen Aenderung resultierten.

Ausserdem: Bei falsch geschriebenen Befehlen (ZCHTE) wird der falsche Befehl
in der Meldung ausgegeben.
This commit is contained in:
Enno Rehling 2006-08-13 00:36:42 +00:00
parent ed70863843
commit f1b26f0234
5 changed files with 42 additions and 115 deletions

View File

@ -68,10 +68,8 @@ use_studypotion(struct unit * u, const struct item_type * itype, int amount, str
static int static int
use_speedsail(struct unit * u, const struct item_type * itype, int amount, struct order * ord) use_speedsail(struct unit * u, const struct item_type * itype, int amount, struct order * ord)
{ {
struct plane * p = rplane(u->region);
unused(amount);
unused(itype);
#ifdef SPEEDAIL_ENABLED #ifdef SPEEDAIL_ENABLED
struct plane * p = rplane(u->region);
/* disabled because of abuse */ /* disabled because of abuse */
if (p!=NULL) { if (p!=NULL) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", "")); ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
@ -94,6 +92,8 @@ use_speedsail(struct unit * u, const struct item_type * itype, int amount, struc
} }
} }
#endif #endif
unused(amount);
unused(itype);
return EUNUSABLE; return EUNUSABLE;
} }
/* END speedsail */ /* END speedsail */

View File

@ -2548,85 +2548,6 @@ combatspell_cmd(unit * u, struct order * ord)
return 0; return 0;
} }
static void
instant_orders(void)
{
region *r;
faction *f;
puts(" - Kontakte, Hilfe, Status, Kampfzauber, Texte, Bewachen (aus), Zeigen");
for (f = factions; f; f = f->next) {
attrib *a;
a = a_find(f->attribs, &at_showitem);
while (a!=NULL && a->type==&at_showitem) {
const item_type * itype = (const item_type *)a->data.v;
const potion_type * ptype = resource2potion(itype->rtype);
attrib * an = a->next;
if (ptype!=NULL) {
/* potions werden separat behandelt */
display_item(f, NULL, (const item_type *)a->data.v);
a_remove(&f->attribs, a);
}
a = an;
}
}
for (r = regions; r; r = r->next) {
unit * u;
for (u = r->units; u; u = u->next) {
order * ord;
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:
quit_cmd(u, ord);
break;
case K_URSPRUNG:
origin_cmd(u, ord);
break;
case K_ALLY:
ally_cmd(u, ord);
break;
case K_PREFIX:
prefix_cmd(u, ord);
break;
case K_SYNONYM:
synonym_cmd(u, ord);
break;
case K_SETSTEALTH:
setstealth_cmd(u, ord);
break;
#ifdef KARMA_MODULE
case K_WEREWOLF:
setwere_cmd(u, ord);
break;
#endif /* KARMA_MODULE */
case K_STATUS:
/* KAEMPFE [ NICHT | AGGRESSIV | DEFENSIV | HINTEN | FLIEHE ] */
status_cmd(u, ord);
break;
case K_COMBAT:
/* KAMPFZAUBER [[STUFE n] "<Spruchname>"] [NICHT] */
combatspell_cmd(u, ord);
break;
case K_DISPLAY:
display_cmd(u, ord);
break;
case K_NAME:
name_cmd(u, ord);
break;
case K_GUARD:
guard_off_cmd(u, ord);
break;
case K_RESHOW:
reshow_cmd(u, ord);
break;
}
}
}
}
}
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Beachten: einige Monster sollen auch unbewaffent die Region bewachen /* Beachten: einige Monster sollen auch unbewaffent die Region bewachen
* können */ * können */
@ -3400,26 +3321,29 @@ setdefaults(unit *u)
* werden. Da Handel erst nach anderen langen Befehlen kommt, * werden. Da Handel erst nach anderen langen Befehlen kommt,
* muß das vorher abgefangen werden. Wir merken uns also * muß das vorher abgefangen werden. Wir merken uns also
* hier, ob die Einheit handelt. */ * hier, ob die Einheit handelt. */
case K_BUY: case NOKEYWORD:
case K_SELL: cmistake(u, ord, 22, MSG_EVENT);
/* Wenn die Einheit handelt, muß der Default-Befehl gelöscht break;
* werden. */ case K_BUY:
trade = true; case K_SELL:
break; /* Wenn die Einheit handelt, muß der Default-Befehl gelöscht
* werden. */
case K_CAST: trade = true;
/* dient dazu, das neben Zaubern kein weiterer Befehl break;
* ausgeführt werden kann, Zaubern ist ein kurzer Befehl */
set_order(&u->thisorder, NULL); case K_CAST:
break; /* dient dazu, das neben Zaubern kein weiterer Befehl
* ausgeführt werden kann, Zaubern ist ein kurzer Befehl */
case K_WEREWOLF: set_order(&u->thisorder, NULL);
set_order(&u->thisorder, copy_order(ord)); break;
break;
case K_WEREWOLF:
/* Wird je diese Ausschliesslichkeit aufgehoben, muss man aufpassen set_order(&u->thisorder, copy_order(ord));
* mit der Reihenfolge von Kaufen, Verkaufen etc., damit es Spielern break;
* nicht moeglich ist, Schulden zu machen. */
/* Wird je diese Ausschliesslichkeit aufgehoben, muss man aufpassen
* mit der Reihenfolge von Kaufen, Verkaufen etc., damit es Spielern
* nicht moeglich ist, Schulden zu machen. */
} }
} }
} }
@ -3648,10 +3572,12 @@ update_spells(void)
for(r=regions; r; r=r->next) { for(r=regions; r; r=r->next) {
unit *u; unit *u;
for(u=r->units;u;u=u->next) { for(u=r->units;u;u=u->next) {
sc_mage *m = get_mage(u); if (u->faction!=NULL && u->number>0) {
if (u->faction->no != MONSTER_FACTION && m != NULL) { sc_mage *m = get_mage(u);
if (m->magietyp == M_GRAU) continue; if (u->faction->no != MONSTER_FACTION && m != NULL) {
updatespelllist(u); if (m->magietyp == M_GRAU) continue;
updatespelllist(u);
}
} }
} }
} }
@ -3880,7 +3806,7 @@ process(void)
if (pglobal==NULL || pglobal->priority!=prio) continue; if (pglobal==NULL || pglobal->priority!=prio) continue;
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
unit **up; unit *u;
processor *pregion = pglobal; processor *pregion = pglobal;
while (pregion && pregion->priority==prio && pregion->type==PR_REGION) { while (pregion && pregion->priority==prio && pregion->type==PR_REGION) {
@ -3889,8 +3815,7 @@ process(void)
} }
if (pregion==NULL || pregion->priority!=prio) continue; if (pregion==NULL || pregion->priority!=prio) continue;
for (up=&r->units;*up;) { for (u=r->units;u;u=u->next) {
unit * u = *up;
processor *porder, *punit = pregion; processor *porder, *punit = pregion;
while (punit && punit->priority==prio && punit->type==PR_UNIT) { while (punit && punit->priority==prio && punit->type==PR_UNIT) {
@ -3912,8 +3837,6 @@ process(void)
} }
porder = porder->next; porder = porder->next;
} }
assert(*up==u);
up=&u->next;
} }
} }
} }
@ -4095,6 +4018,7 @@ processorders (void)
puts(" - Attribute altern"); puts(" - Attribute altern");
ageing(); ageing();
remove_empty_units();
#ifdef WORMHOLE_MODULE #ifdef WORMHOLE_MODULE
create_wormholes(); create_wormholes();

View File

@ -730,6 +730,7 @@ learn_cmd(unit * u, order * ord)
} }
} }
} }
return 0;
} }
void void

View File

@ -464,7 +464,8 @@ write_order(const order * ord, const struct locale * lang, char * buffer, size_t
} else { } else {
keyword_t kwd = ORD_KEYWORD(ord); keyword_t kwd = ORD_KEYWORD(ord);
if (kwd==NOKEYWORD) { if (kwd==NOKEYWORD) {
buffer[0]=0; const char * text = ORD_STRING(ord);
strlcpy(buffer, text, size);
} else { } else {
get_command(ord, buffer, size); get_command(ord, buffer, size);
} }

View File

@ -75,9 +75,10 @@ do_shock(unit *u, const char *reason)
if (strcmp(reason, "trigger")==0) { if (strcmp(reason, "trigger")==0) {
remove_familiar(u); remove_familiar(u);
} }
if (u->faction!=NULL) {
ADDMSG(&u->faction->msgs, msg_message("shock", ADDMSG(&u->faction->msgs, msg_message("shock",
"mage reason", u, strdup(reason))); "mage reason", u, strdup(reason)));
}
} }
static int static int