forked from github/server
you should be able to guard even after combat (and if UFL_MOVED is set).
This commit is contained in:
parent
7580c0fd72
commit
3a313515c0
4 changed files with 27 additions and 23 deletions
|
@ -2758,7 +2758,6 @@ update_guards(void)
|
||||||
static int
|
static int
|
||||||
guard_on_cmd(unit * u, struct order * ord)
|
guard_on_cmd(unit * u, struct order * ord)
|
||||||
{
|
{
|
||||||
if (fval(u, UFL_MOVED)) return 0;
|
|
||||||
assert(get_keyword(ord)==K_GUARD);
|
assert(get_keyword(ord)==K_GUARD);
|
||||||
|
|
||||||
init_tokens(ord);
|
init_tokens(ord);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include "umlaut.h"
|
#include "umlaut.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -65,7 +66,7 @@ add_command(struct tnode * keys, struct tnode * tnext,
|
||||||
addtoken(keys, str, var);
|
addtoken(keys, str, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
do_command_i(const struct tnode * keys, void * u, const char * str, struct order * ord)
|
do_command_i(const struct tnode * keys, void * u, const char * str, struct order * ord)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -81,22 +82,26 @@ do_command_i(const struct tnode * keys, void * u, const char * str, struct order
|
||||||
zText[i]=0;
|
zText[i]=0;
|
||||||
if (findtoken(keys, zText, &var)==E_TOK_SUCCESS) {
|
if (findtoken(keys, zText, &var)==E_TOK_SUCCESS) {
|
||||||
command * cmd = (command *)var.v;
|
command * cmd = (command *)var.v;
|
||||||
if (cmd->nodes) {
|
if (cmd->nodes && *c) {
|
||||||
assert(!cmd->fun);
|
assert(!cmd->fun);
|
||||||
do_command_i(cmd->nodes, u, ++c, ord);
|
return do_command_i(cmd->nodes, u, ++c, ord);
|
||||||
return;
|
} else if (cmd->fun) {
|
||||||
}
|
|
||||||
assert(cmd->fun);
|
|
||||||
cmd->fun(cmd->nodes, ++c, u, ord);
|
cmd->fun(cmd->nodes, ++c, u, ord);
|
||||||
|
return E_TOK_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return E_TOK_NOMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
extern char * getcommand(struct order * ord);
|
extern char * getcommand(struct order * ord);
|
||||||
|
extern char * unitname(struct unit * u);
|
||||||
|
|
||||||
void
|
void
|
||||||
do_command(const struct tnode * keys, void * u, struct order * ord)
|
do_command(const struct tnode * keys, void * u, struct order * ord)
|
||||||
{
|
{
|
||||||
char * cmd = getcommand(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);
|
free(cmd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue