you should be able to guard even after combat (and if UFL_MOVED is set).

This commit is contained in:
Enno Rehling 2006-01-29 15:50:38 +00:00
parent 7580c0fd72
commit 3a313515c0
4 changed files with 27 additions and 23 deletions

View File

@ -2758,7 +2758,6 @@ update_guards(void)
static int
guard_on_cmd(unit * u, struct order * ord)
{
if (fval(u, UFL_MOVED)) return 0;
assert(get_keyword(ord)==K_GUARD);
init_tokens(ord);

View File

@ -15,6 +15,7 @@
#include "umlaut.h"
#include "language.h"
#include "log.h"
/* libc includes */
#include <assert.h>
@ -65,7 +66,7 @@ add_command(struct tnode * keys, struct tnode * tnext,
addtoken(keys, str, var);
}
static void
static int
do_command_i(const struct tnode * keys, void * u, const char * str, struct order * ord)
{
size_t i;
@ -81,22 +82,26 @@ do_command_i(const struct tnode * keys, void * u, const char * str, struct order
zText[i]=0;
if (findtoken(keys, zText, &var)==E_TOK_SUCCESS) {
command * cmd = (command *)var.v;
if (cmd->nodes) {
if (cmd->nodes && *c) {
assert(!cmd->fun);
do_command_i(cmd->nodes, u, ++c, ord);
return;
}
assert(cmd->fun);
return do_command_i(cmd->nodes, u, ++c, ord);
} else if (cmd->fun) {
cmd->fun(cmd->nodes, ++c, u, ord);
return E_TOK_SUCCESS;
}
}
return E_TOK_NOMATCH;
}
extern char * getcommand(struct order * ord);
extern char * unitname(struct unit * u);
void
do_command(const struct tnode * keys, void * u, struct order * ord)
{
char * cmd = getcommand(ord);
do_command_i(keys, u, cmd, ord);
if (do_command_i(keys, u, cmd, ord)!=E_TOK_SUCCESS) {
log_warning(("%s failed GM command '%s'\n", unitname(u), cmd));
}
free(cmd);
}