forked from github/server
rename get_keyword, because something else should have that name.
This commit is contained in:
parent
64e0c221ec
commit
c8dc6be6f2
|
@ -37,13 +37,13 @@ static void process_cmd(keyword_t kwd, int (*callback)(unit *, order *), int fla
|
|||
|
||||
for (u=r->units; u; u=u->next) {
|
||||
if (flags & PROC_LONG_ORDER) {
|
||||
if (kwd == get_keyword(u->thisorder)) {
|
||||
if (kwd == getkeyword(u->thisorder)) {
|
||||
callback(u, u->thisorder);
|
||||
}
|
||||
} else {
|
||||
order * ord;
|
||||
for (ord=u->orders; ord; ord=ord->next) {
|
||||
if (kwd == get_keyword(ord)) {
|
||||
if (kwd == getkeyword(ord)) {
|
||||
callback(u, ord);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void process_produce(void) {
|
|||
for (u=r->units; u; u=u->next) {
|
||||
order * ord;
|
||||
for (ord=u->orders; ord; ord=ord->next) {
|
||||
if (K_MAKE == get_keyword(ord)) {
|
||||
if (K_MAKE == getkeyword(ord)) {
|
||||
make_cmd(u, ord);
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ void process_settings(void) {
|
|||
for (u=r->units; u; u=u->next) {
|
||||
order * ord;
|
||||
for (ord=u->orders; ord; ord=ord->next) {
|
||||
keyword_t kwd = get_keyword(ord);
|
||||
keyword_t kwd = getkeyword(ord);
|
||||
if (kwd==K_BANNER) {
|
||||
banner_cmd(u, ord);
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ void process_maintenance(void) {
|
|||
for (u = r->units; u; u = u->next) {
|
||||
order *ord;
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
keyword_t kwd = get_keyword(ord);
|
||||
keyword_t kwd = getkeyword(ord);
|
||||
if (kwd == K_PAY) {
|
||||
pay_cmd(u, ord);
|
||||
}
|
||||
|
|
|
@ -1154,7 +1154,7 @@ void economics(region * r)
|
|||
bool destroyed = false;
|
||||
if (u->number > 0) {
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
keyword_t kwd = get_keyword(ord);
|
||||
keyword_t kwd = getkeyword(ord);
|
||||
if (kwd == K_DESTROY) {
|
||||
if (!destroyed) {
|
||||
if (destroy_cmd(u, ord) != 0)
|
||||
|
@ -1181,7 +1181,7 @@ void economics(region * r)
|
|||
|
||||
if ((rules_recruit & RECRUIT_MERGE) || u->number == 0) {
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == K_RECRUIT) {
|
||||
if (getkeyword(ord) == K_RECRUIT) {
|
||||
if (rules_recruit & RECRUIT_CLASSIC) {
|
||||
recruit(u, ord, &recruitorders);
|
||||
}
|
||||
|
@ -3245,7 +3245,7 @@ void produce(struct region *r)
|
|||
}
|
||||
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
keyword_t kwd = get_keyword(ord);
|
||||
keyword_t kwd = getkeyword(ord);
|
||||
if (kwd == K_BUY) {
|
||||
buy(u, &buyorders, ord);
|
||||
trader = true;
|
||||
|
@ -3265,7 +3265,7 @@ void produce(struct region *r)
|
|||
continue;
|
||||
}
|
||||
|
||||
todo = get_keyword(u->thisorder);
|
||||
todo = getkeyword(u->thisorder);
|
||||
if (todo == NOKEYWORD)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ static int
|
|||
use_studypotion(struct unit *u, const struct item_type *itype, int amount,
|
||||
struct order *ord)
|
||||
{
|
||||
if (get_keyword(u->thisorder) == K_STUDY) {
|
||||
if (getkeyword(u->thisorder) == K_STUDY) {
|
||||
skill_t sk;
|
||||
skill *sv;
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ static void execute(const struct syntaxtree *syntax, keyword_t kwd)
|
|||
void *root = stree_find(syntax, lang);
|
||||
order *ord;
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == kwd) {
|
||||
if (getkeyword(ord) == kwd) {
|
||||
do_command(root, u, ord);
|
||||
run = 1;
|
||||
}
|
||||
|
|
|
@ -3921,7 +3921,7 @@ static bool start_battle(region * r, battle ** bp)
|
|||
slave_ct = ct_find("slavery");
|
||||
calm_ct = ct_find("calmmonster");
|
||||
}
|
||||
if (get_keyword(ord) == K_ATTACK) {
|
||||
if (getkeyword(ord) == K_ATTACK) {
|
||||
unit *u2;
|
||||
fighter *c1, *c2;
|
||||
ship *lsh = NULL;
|
||||
|
|
|
@ -1195,7 +1195,7 @@ parse(keyword_t kword, int (*dofun) (unit *, struct order *), bool thisorder)
|
|||
ordp = &u->thisorder;
|
||||
while (*ordp) {
|
||||
order *ord = *ordp;
|
||||
if (get_keyword(ord) == kword) {
|
||||
if (getkeyword(ord) == kword) {
|
||||
if (dofun(u, ord) != 0)
|
||||
break;
|
||||
if (u->orders == NULL)
|
||||
|
|
|
@ -2466,7 +2466,7 @@ static bool is_moving_ship(const region * r, ship * sh)
|
|||
const unit *u = ship_owner(sh);
|
||||
|
||||
if (u)
|
||||
switch (get_keyword(u->thisorder)) {
|
||||
switch (getkeyword(u->thisorder)) {
|
||||
case K_ROUTE:
|
||||
case K_MOVE:
|
||||
case K_FOLLOW:
|
||||
|
@ -2745,7 +2745,7 @@ void magic(void)
|
|||
|
||||
if (u->thisorder != NULL) {
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == K_CAST) {
|
||||
if (getkeyword(ord) == K_CAST) {
|
||||
castorder *co = cast_cmd(u, ord);
|
||||
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
if (co) {
|
||||
|
|
|
@ -1009,7 +1009,7 @@ static void cycle_route(order * ord, unit * u, int gereist)
|
|||
order *norder;
|
||||
size_t size = sizeof(tail) - 1;
|
||||
|
||||
if (get_keyword(ord) != K_ROUTE)
|
||||
if (getkeyword(ord) != K_ROUTE)
|
||||
return;
|
||||
tail[0] = '\0';
|
||||
|
||||
|
@ -1088,7 +1088,7 @@ static bool transport(unit * ut, unit * u)
|
|||
}
|
||||
|
||||
for (ord = ut->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == K_TRANSPORT) {
|
||||
if (getkeyword(ord) == K_TRANSPORT) {
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
if (getunit(ut->region, ut->faction) == u) {
|
||||
|
@ -1119,7 +1119,7 @@ static void init_transportation(void)
|
|||
* K_DRIVE. This is time consuming for an error check, but there
|
||||
* doesn't seem to be an easy way to speed this up. */
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (get_keyword(u->thisorder) == K_DRIVE && can_move(u)
|
||||
if (getkeyword(u->thisorder) == K_DRIVE && can_move(u)
|
||||
&& !fval(u, UFL_NOTMOVING) && !LongHunger(u)) {
|
||||
unit *ut;
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ static void init_transportation(void)
|
|||
int w = 0;
|
||||
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == K_TRANSPORT) {
|
||||
if (getkeyword(ord) == K_TRANSPORT) {
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
for (;;) {
|
||||
|
@ -1160,7 +1160,7 @@ static void init_transportation(void)
|
|||
|
||||
if (ut == NULL)
|
||||
break;
|
||||
if (get_keyword(ut->thisorder) == K_DRIVE && can_move(ut)
|
||||
if (getkeyword(ut->thisorder) == K_DRIVE && can_move(ut)
|
||||
&& !fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) {
|
||||
init_tokens(ut->thisorder);
|
||||
skip_token();
|
||||
|
@ -2017,14 +2017,14 @@ static const region_list *travel_i(unit * u, const region_list * route_begin,
|
|||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
unit *ut;
|
||||
|
||||
if (get_keyword(ord) != K_TRANSPORT)
|
||||
if (getkeyword(ord) != K_TRANSPORT)
|
||||
continue;
|
||||
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
ut = getunit(r, u->faction);
|
||||
if (ut != NULL) {
|
||||
if (get_keyword(ut->thisorder) == K_DRIVE) {
|
||||
if (getkeyword(ut->thisorder) == K_DRIVE) {
|
||||
if (ut->building && !can_leave(ut)) {
|
||||
cmistake(ut, ut->thisorder, 150, MSG_MOVE);
|
||||
cmistake(u, ord, 99, MSG_MOVE);
|
||||
|
@ -2467,7 +2467,7 @@ static void move_hunters(void)
|
|||
order *ord;
|
||||
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == K_FOLLOW) {
|
||||
if (getkeyword(ord) == K_FOLLOW) {
|
||||
param_t p;
|
||||
|
||||
init_tokens(ord);
|
||||
|
@ -2516,7 +2516,7 @@ static void move_pirates(void)
|
|||
while (*up) {
|
||||
unit *u = *up;
|
||||
|
||||
if (!fval(u, UFL_NOTMOVING) && get_keyword(u->thisorder) == K_PIRACY) {
|
||||
if (!fval(u, UFL_NOTMOVING) && getkeyword(u->thisorder) == K_PIRACY) {
|
||||
piracy_cmd(u, u->thisorder);
|
||||
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
}
|
||||
|
@ -2562,7 +2562,7 @@ void movement(void)
|
|||
up = &u->next;
|
||||
continue;
|
||||
}
|
||||
kword = get_keyword(u->thisorder);
|
||||
kword = getkeyword(u->thisorder);
|
||||
|
||||
if (kword == K_ROUTE || kword == K_MOVE) {
|
||||
/* after moving, the unit has no thisorder. this prevents
|
||||
|
@ -2645,7 +2645,7 @@ void follow_unit(unit * u)
|
|||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
const struct locale *lang = u->faction->locale;
|
||||
|
||||
if (get_keyword(ord) == K_FOLLOW) {
|
||||
if (getkeyword(ord) == K_FOLLOW) {
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
if (getparam(lang) == P_UNIT) {
|
||||
|
@ -2678,7 +2678,7 @@ void follow_unit(unit * u)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (get_keyword(u2->thisorder)) {
|
||||
switch (getkeyword(u2->thisorder)) {
|
||||
case K_MOVE:
|
||||
case K_ROUTE:
|
||||
case K_DRIVE:
|
||||
|
@ -2686,7 +2686,7 @@ void follow_unit(unit * u)
|
|||
break;
|
||||
default:
|
||||
for (ord = u2->orders; ord; ord = ord->next) {
|
||||
switch (get_keyword(ord)) {
|
||||
switch (getkeyword(ord)) {
|
||||
case K_FOLLOW:
|
||||
case K_PIRACY:
|
||||
follow = true;
|
||||
|
|
|
@ -76,7 +76,7 @@ void replace_order(order ** dlist, order * orig, const order * src)
|
|||
}
|
||||
}
|
||||
|
||||
keyword_t get_keyword(const order * ord)
|
||||
keyword_t getkeyword(const order * ord)
|
||||
{
|
||||
if (ord == NULL) {
|
||||
return NOKEYWORD;
|
||||
|
|
|
@ -50,7 +50,7 @@ extern "C" {
|
|||
extern void push_order(struct order **olist, struct order *ord);
|
||||
|
||||
/* access functions for orders */
|
||||
extern keyword_t get_keyword(const order * ord);
|
||||
extern keyword_t getkeyword(const order * ord);
|
||||
extern void set_order(order ** destp, order * src);
|
||||
extern char *getcommand(const order * ord);
|
||||
extern bool is_persistent(const order * ord);
|
||||
|
|
30
src/laws.c
30
src/laws.c
|
@ -1321,7 +1321,7 @@ static void do_contact(region * r)
|
|||
for (u = r->units; u; u = u->next) {
|
||||
order *ord;
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
keyword_t kwd = get_keyword(ord);
|
||||
keyword_t kwd = getkeyword(ord);
|
||||
if (kwd == K_CONTACT) {
|
||||
contact_cmd(u, ord);
|
||||
}
|
||||
|
@ -1339,7 +1339,7 @@ void do_enter(struct region *r, bool is_final_attempt)
|
|||
|
||||
while (*ordp) {
|
||||
order *ord = *ordp;
|
||||
if (get_keyword(ord) == K_ENTER) {
|
||||
if (getkeyword(ord) == K_ENTER) {
|
||||
param_t p;
|
||||
int id;
|
||||
unit *ulast = NULL;
|
||||
|
@ -2756,7 +2756,7 @@ int origin_cmd(unit * u, struct order *ord)
|
|||
|
||||
int guard_off_cmd(unit * u, struct order *ord)
|
||||
{
|
||||
assert(get_keyword(ord) == K_GUARD);
|
||||
assert(getkeyword(ord) == K_GUARD);
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
|
||||
|
@ -2917,7 +2917,7 @@ void update_guards(void)
|
|||
|
||||
int guard_on_cmd(unit * u, struct order *ord)
|
||||
{
|
||||
assert(get_keyword(ord) == K_GUARD);
|
||||
assert(getkeyword(ord) == K_GUARD);
|
||||
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
|
@ -3067,7 +3067,7 @@ void restack_units(void)
|
|||
if (!fval(u, UFL_MARK)) {
|
||||
struct order *ord;
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == K_SORT) {
|
||||
if (getkeyword(ord) == K_SORT) {
|
||||
const char *s;
|
||||
param_t p;
|
||||
int id;
|
||||
|
@ -3524,7 +3524,7 @@ void new_units(void)
|
|||
|
||||
while (*ordp) {
|
||||
order *makeord = *ordp;
|
||||
if (get_keyword(makeord) == K_MAKE) {
|
||||
if (getkeyword(makeord) == K_MAKE) {
|
||||
init_tokens(makeord);
|
||||
skip_token();
|
||||
if (isparam(getstrtoken(), u->faction->locale, P_TEMP)) {
|
||||
|
@ -3551,7 +3551,7 @@ void new_units(void)
|
|||
|
||||
while (*ordp) {
|
||||
order *ord = *ordp;
|
||||
if (get_keyword(ord) == K_END)
|
||||
if (getkeyword(ord) == K_END)
|
||||
break;
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
|
@ -3581,7 +3581,7 @@ void new_units(void)
|
|||
newordersp = &u2->orders;
|
||||
while (*ordp) {
|
||||
order *ord = *ordp;
|
||||
if (get_keyword(ord) == K_END)
|
||||
if (getkeyword(ord) == K_END)
|
||||
break;
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
|
@ -3605,10 +3605,10 @@ void check_long_orders(unit * u)
|
|||
keyword_t otherorder = MAXKEYWORDS;
|
||||
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == NOKEYWORD) {
|
||||
if (getkeyword(ord) == NOKEYWORD) {
|
||||
cmistake(u, ord, 22, MSG_EVENT);
|
||||
} else if (is_long(ord)) {
|
||||
keyword_t longorder = get_keyword(ord);
|
||||
keyword_t longorder = getkeyword(ord);
|
||||
if (otherorder != MAXKEYWORDS) {
|
||||
switch (longorder) {
|
||||
case K_CAST:
|
||||
|
@ -3654,7 +3654,7 @@ void update_long_order(unit * u)
|
|||
}
|
||||
/* check all orders for a potential new long order this round: */
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == NOKEYWORD)
|
||||
if (getkeyword(ord) == NOKEYWORD)
|
||||
continue;
|
||||
|
||||
if (u->old_orders && is_repeated(ord)) {
|
||||
|
@ -3675,7 +3675,7 @@ void update_long_order(unit * u)
|
|||
}
|
||||
break;
|
||||
} else {
|
||||
keyword_t keyword = get_keyword(ord);
|
||||
keyword_t keyword = getkeyword(ord);
|
||||
switch (keyword) {
|
||||
/* Wenn gehandelt wird, darf kein langer Befehl ausgeführt
|
||||
* werden. Da Handel erst nach anderen langen Befehlen kommt,
|
||||
|
@ -3863,7 +3863,7 @@ void defaultorders(void)
|
|||
order **ordp = &u->orders;
|
||||
while (*ordp != NULL) {
|
||||
order *ord = *ordp;
|
||||
if (get_keyword(ord) == K_DEFAULT) {
|
||||
if (getkeyword(ord) == K_DEFAULT) {
|
||||
char lbuf[8192];
|
||||
order *new_order;
|
||||
init_tokens(ord);
|
||||
|
@ -4261,7 +4261,7 @@ void process(void)
|
|||
ordp = &u->thisorder;
|
||||
while (*ordp) {
|
||||
order *ord = *ordp;
|
||||
if (get_keyword(ord) == porder->data.per_order.kword) {
|
||||
if (getkeyword(ord) == porder->data.per_order.kword) {
|
||||
if (porder->flags & PROC_LONGORDER) {
|
||||
if (u->number == 0) {
|
||||
ord = NULL;
|
||||
|
@ -4418,7 +4418,7 @@ void do_siege(region * r)
|
|||
unit *u;
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (get_keyword(u->thisorder) == K_BESIEGE) {
|
||||
if (getkeyword(u->thisorder) == K_BESIEGE) {
|
||||
siege_cmd(u, u->thisorder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ int teach_cmd(unit * u, struct order *ord)
|
|||
if (fval(student, UFL_HUNGER))
|
||||
continue;
|
||||
#endif
|
||||
if (get_keyword(student->thisorder) == K_STUDY) {
|
||||
if (getkeyword(student->thisorder) == K_STUDY) {
|
||||
/* Input ist nun von student->thisorder !! */
|
||||
init_tokens(student->thisorder);
|
||||
skip_token();
|
||||
|
@ -366,7 +366,7 @@ int teach_cmd(unit * u, struct order *ord)
|
|||
if (fval(student, UFL_HUNGER))
|
||||
continue;
|
||||
#endif
|
||||
if (get_keyword(student->thisorder) == K_STUDY) {
|
||||
if (getkeyword(student->thisorder) == K_STUDY) {
|
||||
/* Input ist nun von student->thisorder !! */
|
||||
init_tokens(student->thisorder);
|
||||
skip_token();
|
||||
|
@ -439,7 +439,7 @@ int teach_cmd(unit * u, struct order *ord)
|
|||
strcat(zOrder, " ");
|
||||
strcat(zOrder, unitid(u2));
|
||||
|
||||
if (get_keyword(u2->thisorder) != K_STUDY) {
|
||||
if (getkeyword(u2->thisorder) != K_STUDY) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_feedback(u, ord, "teach_nolearn", "student", u2));
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue