hackish optimization for STUDY orders

This commit is contained in:
Enno Rehling 2017-10-09 20:33:47 +02:00
parent f62c0866e3
commit fc80f2bd8c
20 changed files with 164 additions and 104 deletions

View File

@ -3841,7 +3841,7 @@ static bool start_battle(region * r, battle ** bp)
/* Ende Fehlerbehandlung Angreifer */ /* Ende Fehlerbehandlung Angreifer */
init_order(ord); init_order_depr(ord);
/* attackierte Einheit ermitteln */ /* attackierte Einheit ermitteln */
getunit(r, u->faction, &u2); getunit(r, u->faction, &u2);

View File

@ -13,7 +13,7 @@ static int tolua_order_get_token(lua_State *L) {
order *ord = (order *)tolua_tousertype(L, 1, 0); order *ord = (order *)tolua_tousertype(L, 1, 0);
int n = (int)tolua_tonumber(L, 2, 0); int n = (int)tolua_tonumber(L, 2, 0);
const char * str = 0; const char * str = 0;
init_order(ord); init_order_depr(ord);
while (n-->0) { while (n-->0) {
str = getstrtoken(); str = getstrtoken();
if (!str) { if (!str) {

View File

@ -441,7 +441,7 @@ static void recruit(unit * u, struct order *ord, request ** recruitorders)
const char *str; const char *str;
int n; int n;
init_order(ord); init_order_depr(ord);
n = getint(); n = getint();
if (n <= 0) { if (n <= 0) {
syntax_error(u, ord); syntax_error(u, ord);
@ -598,7 +598,7 @@ int give_control_cmd(unit * u, order * ord)
unit *u2; unit *u2;
const char *s; const char *s;
init_order(ord); init_order_depr(ord);
getunit(r, u->faction, &u2); getunit(r, u->faction, &u2);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
@ -657,7 +657,7 @@ static int forget_cmd(unit * u, order * ord)
return 0; return 0;
} }
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
sk = get_skill(s, u->faction->locale); sk = get_skill(s, u->faction->locale);
@ -1303,7 +1303,7 @@ int make_cmd(unit * u, struct order *ord)
char ibuf[16]; char ibuf[16];
keyword_t kwd; keyword_t kwd;
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_MAKE); assert(kwd == K_MAKE);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
@ -1582,7 +1582,7 @@ static void buy(unit * u, request ** buyorders, struct order *ord)
/* Im Augenblick kann man nur 1 Produkt kaufen. expandbuying ist aber /* Im Augenblick kann man nur 1 Produkt kaufen. expandbuying ist aber
* schon daf<EFBFBD>r ausger<EFBFBD>stet, mehrere Produkte zu kaufen. */ * schon daf<EFBFBD>r ausger<EFBFBD>stet, mehrere Produkte zu kaufen. */
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_BUY); assert(kwd == K_BUY);
n = getint(); n = getint();
if (n <= 0) { if (n <= 0) {
@ -1896,7 +1896,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord)
/* sellorders sind KEIN array, weil f<>r alle items DIE SELBE resource /* sellorders sind KEIN array, weil f<>r alle items DIE SELBE resource
* (das geld der region) aufgebraucht wird. */ * (das geld der region) aufgebraucht wird. */
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_SELL); assert(kwd == K_SELL);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
@ -2287,7 +2287,7 @@ static void breed_cmd(unit * u, struct order *ord)
} }
/* z<>chte [<anzahl>] <parameter> */ /* z<>chte [<anzahl>] <parameter> */
(void)init_order(ord); (void)init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
m = s ? atoip(s) : 0; m = s ? atoip(s) : 0;
@ -2354,7 +2354,7 @@ static void research_cmd(unit * u, struct order *ord)
region *r = u->region; region *r = u->region;
keyword_t kwd; keyword_t kwd;
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_RESEARCH); assert(kwd == K_RESEARCH);
if (effskill(u, SK_HERBALISM, 0) < 7) { if (effskill(u, SK_HERBALISM, 0) < 7) {
@ -2430,7 +2430,7 @@ static void steal_cmd(unit * u, struct order *ord, request ** stealorders)
message * msg; message * msg;
keyword_t kwd; keyword_t kwd;
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_STEAL); assert(kwd == K_STEAL);
assert(skill_enabled(SK_PERCEPTION) && skill_enabled(SK_STEALTH)); assert(skill_enabled(SK_PERCEPTION) && skill_enabled(SK_STEALTH));
@ -2568,7 +2568,7 @@ void entertain_cmd(unit * u, struct order *ord)
static int entertainperlevel = 0; static int entertainperlevel = 0;
keyword_t kwd; keyword_t kwd;
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_ENTERTAIN); assert(kwd == K_ENTERTAIN);
if (!entertainbase) { if (!entertainbase) {
const char *str = config_get("entertain.base"); const char *str = config_get("entertain.base");
@ -2778,7 +2778,7 @@ void tax_cmd(unit * u, struct order *ord, request ** taxorders)
taxperlevel = config_get_int("taxing.perlevel", 0); taxperlevel = config_get_int("taxing.perlevel", 0);
} }
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_TAX); assert(kwd == K_TAX);
if (!humanoidrace(u_race(u)) && !is_monsters(u->faction)) { if (!humanoidrace(u_race(u)) && !is_monsters(u->faction)) {
@ -2847,7 +2847,7 @@ void loot_cmd(unit * u, struct order *ord, request ** lootorders)
request *o; request *o;
keyword_t kwd; keyword_t kwd;
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_LOOT); assert(kwd == K_LOOT);
if (config_get_int("rules.enable_loot", 0) == 0 && !is_monsters(u->faction)) { if (config_get_int("rules.enable_loot", 0) == 0 && !is_monsters(u->faction)) {

View File

@ -634,7 +634,7 @@ void give_cmd(unit * u, order * ord)
message *msg; message *msg;
keyword_t kwd; keyword_t kwd;
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_GIVE); assert(kwd == K_GIVE);
err = getunit(r, u->faction, &u2); err = getunit(r, u->faction, &u2);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));

View File

@ -47,7 +47,7 @@ static int
use_studypotion(struct unit *u, const struct item_type *itype, int amount, use_studypotion(struct unit *u, const struct item_type *itype, int amount,
struct order *ord) struct order *ord)
{ {
if (u->thisorder && init_order(u->thisorder) == K_STUDY) { if (u->thisorder && init_order(u->thisorder, u->faction->locale) == K_STUDY) {
char token[128]; char token[128];
skill_t sk = NOSKILL; skill_t sk = NOSKILL;
skill *sv = 0; skill *sv = 0;

View File

@ -171,7 +171,7 @@ static void perform_kick(void)
if (al && alliance_get_leader(al) == ta->u->faction) { if (al && alliance_get_leader(al) == ta->u->faction) {
faction *f; faction *f;
init_order(ta->ord); init_order_depr(ta->ord);
skip_token(); skip_token();
f = getfaction(); f = getfaction();
if (f && f_get_alliance(f) == al) { if (f && f_get_alliance(f) == al) {
@ -192,7 +192,7 @@ static void perform_new(void)
int id; int id;
faction *f = ta->u->faction; faction *f = ta->u->faction;
init_order(ta->ord); init_order_depr(ta->ord);
skip_token(); skip_token();
id = getid(); id = getid();
@ -227,7 +227,7 @@ static void perform_transfer(void)
if (al && alliance_get_leader(al) == ta->u->faction) { if (al && alliance_get_leader(al) == ta->u->faction) {
faction *f; faction *f;
init_order(ta->ord); init_order_depr(ta->ord);
skip_token(); skip_token();
f = getfaction(); f = getfaction();
if (f && f_get_alliance(f) == al) { if (f && f_get_alliance(f) == al) {
@ -264,7 +264,7 @@ static void perform_join(void)
faction *fj = ta->u->faction; faction *fj = ta->u->faction;
int aid; int aid;
init_order(ta->ord); init_order_depr(ta->ord);
skip_token(); skip_token();
aid = getid(); aid = getid();
if (aid) { if (aid) {
@ -276,7 +276,7 @@ static void perform_join(void)
faction *fi = ti->u->faction; faction *fi = ti->u->faction;
if (fi && f_get_alliance(fi) == al) { if (fi && f_get_alliance(fi) == al) {
int fid; int fid;
init_order(ti->ord); init_order_depr(ti->ord);
skip_token(); skip_token();
fid = getid(); fid = getid();
if (fid == fj->no) { if (fid == fj->no) {

View File

@ -161,7 +161,7 @@ int destroy_cmd(unit * u, struct order *ord)
return 52; return 52;
} }
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
if (s && *s) { if (s && *s) {

View File

@ -105,7 +105,7 @@ static int do_command_i(const struct tnode *keys, struct unit *u, struct order *
void do_command(const struct tnode *keys, struct unit *u, struct order *ord) void do_command(const struct tnode *keys, struct unit *u, struct order *ord)
{ {
init_order(ord); init_order_depr(ord);
if (do_command_i(keys, u, ord) != E_TOK_SUCCESS) { if (do_command_i(keys, u, ord) != E_TOK_SUCCESS) {
char cmd[ORDERSIZE]; char cmd[ORDERSIZE];
get_command(ord, u->faction->locale, cmd, sizeof(cmd)); get_command(ord, u->faction->locale, cmd, sizeof(cmd));

View File

@ -32,28 +32,28 @@ static void test_read_unitid(CuTest *tc) {
a->data.i = atoi36("42"); /* this unit is also TEMP 42 */ a->data.i = atoi36("42"); /* this unit is also TEMP 42 */
ord = create_order(K_GIVE, lang, "TEMP 42"); ord = create_order(K_GIVE, lang, "TEMP 42");
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, u->no, read_unitid(u->faction, u->region)); CuAssertIntEquals(tc, u->no, read_unitid(u->faction, u->region));
free_order(ord); free_order(ord);
ord = create_order(K_GIVE, lang, "8"); ord = create_order(K_GIVE, lang, "8");
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, 8, read_unitid(u->faction, u->region)); CuAssertIntEquals(tc, 8, read_unitid(u->faction, u->region));
free_order(ord); free_order(ord);
ord = create_order(K_GIVE, lang, ""); ord = create_order(K_GIVE, lang, "");
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, -1, read_unitid(u->faction, u->region)); CuAssertIntEquals(tc, -1, read_unitid(u->faction, u->region));
free_order(ord); free_order(ord);
ord = create_order(K_GIVE, lang, "TEMP"); ord = create_order(K_GIVE, lang, "TEMP");
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, -1, read_unitid(u->faction, u->region)); CuAssertIntEquals(tc, -1, read_unitid(u->faction, u->region));
free_order(ord); free_order(ord);
/* bug https://bugs.eressea.de/view.php?id=1685 */ /* bug https://bugs.eressea.de/view.php?id=1685 */
ord = create_order(K_GIVE, lang, "##"); ord = create_order(K_GIVE, lang, "##");
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, -1, read_unitid(u->faction, u->region)); CuAssertIntEquals(tc, -1, read_unitid(u->faction, u->region));
free_order(ord); free_order(ord);
@ -78,42 +78,42 @@ static void test_getunit(CuTest *tc) {
r = test_create_region(1, 0, t_plain); r = test_create_region(1, 0, t_plain);
ord = create_order(K_GIVE, lang, itoa36(u->no)); ord = create_order(K_GIVE, lang, itoa36(u->no));
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, GET_UNIT, getunit(u->region, u->faction, &u2)); CuAssertIntEquals(tc, GET_UNIT, getunit(u->region, u->faction, &u2));
CuAssertPtrEquals(tc, u, u2); CuAssertPtrEquals(tc, u, u2);
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, GET_NOTFOUND, getunit(r, u->faction, &u2)); CuAssertIntEquals(tc, GET_NOTFOUND, getunit(r, u->faction, &u2));
CuAssertPtrEquals(tc, NULL, u2); CuAssertPtrEquals(tc, NULL, u2);
free_order(ord); free_order(ord);
ord = create_order(K_GIVE, lang, itoa36(u->no + 1)); ord = create_order(K_GIVE, lang, itoa36(u->no + 1));
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, GET_NOTFOUND, getunit(u->region, u->faction, &u2)); CuAssertIntEquals(tc, GET_NOTFOUND, getunit(u->region, u->faction, &u2));
CuAssertPtrEquals(tc, NULL, u2); CuAssertPtrEquals(tc, NULL, u2);
free_order(ord); free_order(ord);
ord = create_order(K_GIVE, lang, "0"); ord = create_order(K_GIVE, lang, "0");
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, GET_PEASANTS, getunit(u->region, u->faction, &u2)); CuAssertIntEquals(tc, GET_PEASANTS, getunit(u->region, u->faction, &u2));
CuAssertPtrEquals(tc, NULL, u2); CuAssertPtrEquals(tc, NULL, u2);
free_order(ord); free_order(ord);
/* bug https://bugs.eressea.de/view.php?id=1685 */ /* bug https://bugs.eressea.de/view.php?id=1685 */
ord = create_order(K_GIVE, lang, "TEMP ##"); ord = create_order(K_GIVE, lang, "TEMP ##");
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, GET_NOTFOUND, getunit(u->region, u->faction, &u2)); CuAssertIntEquals(tc, GET_NOTFOUND, getunit(u->region, u->faction, &u2));
CuAssertPtrEquals(tc, NULL, u2); CuAssertPtrEquals(tc, NULL, u2);
free_order(ord); free_order(ord);
/* bug https://bugs.eressea.de/view.php?id=1685 */ /* bug https://bugs.eressea.de/view.php?id=1685 */
ord = create_order(K_GIVE, lang, "##"); ord = create_order(K_GIVE, lang, "##");
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, GET_NOTFOUND, getunit(u->region, u->faction, &u2)); CuAssertIntEquals(tc, GET_NOTFOUND, getunit(u->region, u->faction, &u2));
CuAssertPtrEquals(tc, NULL, u2); CuAssertPtrEquals(tc, NULL, u2);
free_order(ord); free_order(ord);
ord = create_order(K_GIVE, lang, "TEMP 42"); ord = create_order(K_GIVE, lang, "TEMP 42");
init_order(ord); init_order_depr(ord);
CuAssertIntEquals(tc, GET_UNIT, getunit(u->region, u->faction, &u2)); CuAssertIntEquals(tc, GET_UNIT, getunit(u->region, u->faction, &u2));
CuAssertPtrEquals(tc, u, u2); CuAssertPtrEquals(tc, u, u2);
free_order(ord); free_order(ord);

View File

@ -155,7 +155,7 @@ char* get_command(const order *ord, const struct locale *lang, char *sbuffer, si
} }
if (ord->id < 0) { if (ord->id < 0) {
skill_t sk = (skill_t)(100-ord->id); skill_t sk = (skill_t)(100+ord->id);
assert(kwd == K_STUDY && sk != SK_MAGIC); assert(kwd == K_STUDY && sk != SK_MAGIC);
text = skillname(sk, lang); text = skillname(sk, lang);
} else { } else {
@ -569,7 +569,7 @@ void push_order(order ** ordp, order * ord)
static order_data *parser_od; static order_data *parser_od;
keyword_t init_order(const struct order *ord) keyword_t init_order(const struct order *ord, const struct locale *lang)
{ {
if (!ord) { if (!ord) {
release_data(parser_od); release_data(parser_od);
@ -577,19 +577,38 @@ keyword_t init_order(const struct order *ord)
return NOKEYWORD; return NOKEYWORD;
} }
else { else {
keyword_t kwd = ORD_KEYWORD(ord);
if (parser_od) { if (parser_od) {
/* TODO: warning */ /* TODO: warning */
release_data(parser_od); release_data(parser_od);
parser_od = NULL;
} }
if (ord->id < 0) {
skill_t sk = (skill_t)(100 + ord->id);
assert(lang);
assert(kwd == K_STUDY);
init_tokens_str(skillname(sk, lang));
}
else {
parser_od = load_data(ord->id); parser_od = load_data(ord->id);
init_tokens_str(OD_STRING(parser_od)); init_tokens_str(OD_STRING(parser_od));
return ORD_KEYWORD(ord);
} }
return kwd;
}
}
keyword_t init_order_depr(const struct order *ord)
{
if (ord) {
keyword_t kwd = ORD_KEYWORD(ord);
assert(kwd != K_STUDY);
}
return init_order(ord, NULL);
} }
void close_orders(void) { void close_orders(void) {
if (parser_od) { if (parser_od) {
init_order(NULL); (void)init_order(NULL, NULL);
} }
free_data(); free_data();
} }

View File

@ -69,7 +69,8 @@ extern "C" {
char *write_order(const order * ord, const struct locale *lang, char *write_order(const order * ord, const struct locale *lang,
char *buffer, size_t size); char *buffer, size_t size);
keyword_t init_order(const struct order *ord); keyword_t init_order_depr(const struct order *ord);
keyword_t init_order(const struct order *ord, const struct locale *lang);
void close_orders(void); void close_orders(void);

View File

@ -2,6 +2,8 @@
#include <kernel/config.h> #include <kernel/config.h>
#include "order.h" #include "order.h"
#include <kernel/skills.h>
#include <util/parser.h> #include <util/parser.h>
#include <util/language.h> #include <util/language.h>
@ -22,7 +24,7 @@ static void test_create_order(CuTest *tc) {
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord)); CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
CuAssertStrEquals(tc, "move NORTH", get_command(ord, lang, cmd, sizeof(cmd))); CuAssertStrEquals(tc, "move NORTH", get_command(ord, lang, cmd, sizeof(cmd)));
CuAssertIntEquals(tc, K_MOVE, init_order(ord)); CuAssertIntEquals(tc, K_MOVE, init_order_depr(ord));
CuAssertStrEquals(tc, "NORTH", getstrtoken()); CuAssertStrEquals(tc, "NORTH", getstrtoken());
free_order(ord); free_order(ord);
test_cleanup(); test_cleanup();
@ -42,7 +44,7 @@ static void test_parse_order(CuTest *tc) {
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord)); CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
CuAssertStrEquals(tc, "move NORTH", get_command(ord, lang, cmd, sizeof(cmd))); CuAssertStrEquals(tc, "move NORTH", get_command(ord, lang, cmd, sizeof(cmd)));
CuAssertIntEquals(tc, K_MOVE, init_order(ord)); CuAssertIntEquals(tc, K_MOVE, init_order_depr(ord));
CuAssertStrEquals(tc, "NORTH", getstrtoken()); CuAssertStrEquals(tc, "NORTH", getstrtoken());
free_order(ord); free_order(ord);
@ -100,7 +102,7 @@ static void test_parse_make(CuTest *tc) {
CuAssertIntEquals(tc, K_MAKE, getkeyword(ord)); CuAssertIntEquals(tc, K_MAKE, getkeyword(ord));
CuAssertStrEquals(tc, "MAKE hurrdurr", get_command(ord, lang, cmd, sizeof(cmd))); CuAssertStrEquals(tc, "MAKE hurrdurr", get_command(ord, lang, cmd, sizeof(cmd)));
CuAssertIntEquals(tc, K_MAKE, init_order(ord)); CuAssertIntEquals(tc, K_MAKE, init_order_depr(ord));
CuAssertStrEquals(tc, "hurrdurr", getstrtoken()); CuAssertStrEquals(tc, "hurrdurr", getstrtoken());
free_order(ord); free_order(ord);
test_cleanup(); test_cleanup();
@ -123,7 +125,7 @@ static void test_parse_make_temp(CuTest *tc) {
CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord)); CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord));
CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, lang, cmd, sizeof(cmd))); CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, lang, cmd, sizeof(cmd)));
CuAssertIntEquals(tc, K_MAKETEMP, init_order(ord)); CuAssertIntEquals(tc, K_MAKETEMP, init_order_depr(ord));
CuAssertStrEquals(tc, "herp", getstrtoken()); CuAssertStrEquals(tc, "herp", getstrtoken());
free_order(ord); free_order(ord);
test_cleanup(); test_cleanup();
@ -146,7 +148,7 @@ static void test_parse_maketemp(CuTest *tc) {
CuAssertPtrNotNull(tc, ord); CuAssertPtrNotNull(tc, ord);
CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, lang, cmd, sizeof(cmd))); CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, lang, cmd, sizeof(cmd)));
CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord)); CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord));
CuAssertIntEquals(tc, K_MAKETEMP, init_order(ord)); CuAssertIntEquals(tc, K_MAKETEMP, init_order_depr(ord));
CuAssertStrEquals(tc, "herp", getstrtoken()); CuAssertStrEquals(tc, "herp", getstrtoken());
free_order(ord); free_order(ord);
test_cleanup(); test_cleanup();
@ -160,7 +162,7 @@ static void test_init_order(CuTest *tc) {
lang = get_or_create_locale("en"); lang = get_or_create_locale("en");
ord = create_order(K_MAKETEMP, lang, "hurr durr"); ord = create_order(K_MAKETEMP, lang, "hurr durr");
CuAssertIntEquals(tc, K_MAKETEMP, init_order(ord)); CuAssertIntEquals(tc, K_MAKETEMP, init_order_depr(ord));
CuAssertStrEquals(tc, "hurr", getstrtoken()); CuAssertStrEquals(tc, "hurr", getstrtoken());
CuAssertStrEquals(tc, "durr", getstrtoken()); CuAssertStrEquals(tc, "durr", getstrtoken());
free_order(ord); free_order(ord);
@ -292,10 +294,48 @@ static void test_is_silent(CuTest *tc) {
test_cleanup(); test_cleanup();
} }
static void test_study_orders(CuTest *tc) {
order *ord;
struct locale *lang;
const char *s;
char token[16];
test_setup();
lang = test_create_locale();
ord = create_order(K_STUDY, lang, skillname(SK_CROSSBOW, lang));
CuAssertIntEquals(tc, K_STUDY, getkeyword(ord));
CuAssertIntEquals(tc, K_STUDY, init_order(ord, lang));
s = gettoken(token, sizeof(token));
CuAssertStrEquals(tc, skillname(SK_CROSSBOW, lang), s);
CuAssertPtrEquals(tc, NULL, (void *)getstrtoken());
free_order(ord);
ord = create_order(K_STUDY, lang, skillname(SK_MAGIC, lang));
CuAssertIntEquals(tc, K_STUDY, getkeyword(ord));
CuAssertIntEquals(tc, K_STUDY, init_order(ord, lang));
s = gettoken(token, sizeof(token));
CuAssertStrEquals(tc, skillname(SK_MAGIC, lang), s);
CuAssertPtrEquals(tc, NULL, (void *)getstrtoken());
free_order(ord);
ord = create_order(K_STUDY, lang, "%s 100", skillname(SK_MAGIC, lang));
CuAssertIntEquals(tc, K_STUDY, getkeyword(ord));
CuAssertIntEquals(tc, K_STUDY, init_order(ord, lang));
s = gettoken(token, sizeof(token));
CuAssertStrEquals(tc, skillname(SK_MAGIC, lang), s);
CuAssertIntEquals(tc, 100, getint());
free_order(ord);
test_cleanup();
}
CuSuite *get_order_suite(void) CuSuite *get_order_suite(void)
{ {
CuSuite *suite = CuSuiteNew(); CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_create_order); SUITE_ADD_TEST(suite, test_create_order);
SUITE_ADD_TEST(suite, test_study_orders);
SUITE_ADD_TEST(suite, test_parse_order); SUITE_ADD_TEST(suite, test_parse_order);
SUITE_ADD_TEST(suite, test_parse_make); SUITE_ADD_TEST(suite, test_parse_make);
SUITE_ADD_TEST(suite, test_parse_make_temp); SUITE_ADD_TEST(suite, test_parse_make_temp);

View File

@ -910,7 +910,7 @@ int contact_cmd(unit * u, order * ord)
unit *u2; unit *u2;
int n; int n;
init_order(ord); init_order_depr(ord);
n = read_unitid(u->faction, u->region); n = read_unitid(u->faction, u->region);
u2 = findunit(n); u2 = findunit(n);
@ -960,7 +960,7 @@ int quit_cmd(unit * u, struct order *ord)
const char *passwd; const char *passwd;
keyword_t kwd; keyword_t kwd;
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_QUIT); assert(kwd == K_QUIT);
passwd = gettoken(token, sizeof(token)); passwd = gettoken(token, sizeof(token));
if (checkpasswd(f, (const char *)passwd)) { if (checkpasswd(f, (const char *)passwd)) {
@ -1146,7 +1146,7 @@ void do_enter(struct region *r, bool is_final_attempt)
unit *ulast = NULL; unit *ulast = NULL;
const char * s; const char * s;
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
p = findparam_ex(s, u->faction->locale); p = findparam_ex(s, u->faction->locale);
id = getid(); id = getid();
@ -1306,7 +1306,7 @@ int ally_cmd(unit * u, struct order *ord)
int keyword, not_kw; int keyword, not_kw;
const char *s; const char *s;
init_order(ord); init_order_depr(ord);
f = getfaction(); f = getfaction();
if (f == NULL || is_monsters(f)) { if (f == NULL || is_monsters(f)) {
@ -1473,7 +1473,7 @@ int prefix_cmd(unit * u, struct order *ord)
for (in = pnames; in->lang != lang; in = in->next); for (in = pnames; in->lang != lang; in = in->next);
} }
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
if (!s || !*s) { if (!s || !*s) {
@ -1517,7 +1517,7 @@ int display_cmd(unit * u, struct order *ord)
const char *str; const char *str;
region *r = u->region; region *r = u->region;
init_order(ord); init_order_depr(ord);
str = gettoken(token, sizeof(token)); str = gettoken(token, sizeof(token));
switch (findparam_ex(str, u->faction->locale)) { switch (findparam_ex(str, u->faction->locale)) {
@ -1690,7 +1690,7 @@ int name_cmd(struct unit *u, struct order *ord)
bool foreign = false; bool foreign = false;
const char *str; const char *str;
init_order(ord); init_order_depr(ord);
str = gettoken(token, sizeof(token)); str = gettoken(token, sizeof(token));
p = findparam_ex(str, u->faction->locale); p = findparam_ex(str, u->faction->locale);
@ -1948,7 +1948,7 @@ int mail_cmd(unit * u, struct order *ord)
const char *s; const char *s;
int n, cont; int n, cont;
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
/* Falls kein Parameter, ist das eine Einheitsnummer; /* Falls kein Parameter, ist das eine Einheitsnummer;
@ -2105,7 +2105,7 @@ int banner_cmd(unit * u, struct order *ord)
const char * s; const char * s;
free(u->faction->banner); free(u->faction->banner);
init_order(ord); init_order_depr(ord);
s = getstrtoken(); s = getstrtoken();
u->faction->banner = s ? strdup(s) : 0; u->faction->banner = s ? strdup(s) : 0;
add_message(&u->faction->msgs, msg_message("changebanner", "value", add_message(&u->faction->msgs, msg_message("changebanner", "value",
@ -2118,7 +2118,7 @@ int email_cmd(unit * u, struct order *ord)
{ {
const char *s; const char *s;
init_order(ord); init_order_depr(ord);
s = getstrtoken(); s = getstrtoken();
if (!s || !s[0]) { if (!s || !s[0]) {
@ -2144,7 +2144,7 @@ int password_cmd(unit * u, struct order *ord)
const char *s; const char *s;
bool pwok = true; bool pwok = true;
init_order(ord); init_order_depr(ord);
s = gettoken(pwbuf, sizeof(pwbuf)); s = gettoken(pwbuf, sizeof(pwbuf));
if (!s || !*s) { if (!s || !*s) {
@ -2177,7 +2177,7 @@ int send_cmd(unit * u, struct order *ord)
const char *s; const char *s;
int option; int option;
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
option = findoption(s, u->faction->locale); option = findoption(s, u->faction->locale);
@ -2512,7 +2512,7 @@ int group_cmd(unit * u, struct order *ord)
{ {
keyword_t kwd; keyword_t kwd;
kwd = init_order(ord); kwd = init_order_depr(ord);
assert(kwd == K_GROUP); assert(kwd == K_GROUP);
join_group(u, getstrtoken()); join_group(u, getstrtoken());
return 0; return 0;
@ -2522,7 +2522,7 @@ int origin_cmd(unit * u, struct order *ord)
{ {
short px, py; short px, py;
init_order(ord); init_order_depr(ord);
px = (short)getint(); px = (short)getint();
py = (short)getint(); py = (short)getint();
@ -2534,7 +2534,7 @@ int origin_cmd(unit * u, struct order *ord)
int guard_off_cmd(unit * u, struct order *ord) int guard_off_cmd(unit * u, struct order *ord)
{ {
assert(getkeyword(ord) == K_GUARD); assert(getkeyword(ord) == K_GUARD);
init_order(ord); init_order_depr(ord);
if (getparam(u->faction->locale) == P_NOT) { if (getparam(u->faction->locale) == P_NOT) {
setguard(u, false); setguard(u, false);
@ -2548,7 +2548,7 @@ int reshow_cmd(unit * u, struct order *ord)
const char *s; const char *s;
param_t p = NOPARAM; param_t p = NOPARAM;
init_order(ord); init_order_depr(ord);
s = gettoken(lbuf, sizeof(lbuf)); s = gettoken(lbuf, sizeof(lbuf));
if (s && isparam(s, u->faction->locale, P_ANY)) { if (s && isparam(s, u->faction->locale, P_ANY)) {
@ -2565,7 +2565,7 @@ int status_cmd(unit * u, struct order *ord)
char token[128]; char token[128];
const char *s; const char *s;
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
switch (findparam(s, u->faction->locale)) { switch (findparam(s, u->faction->locale)) {
case P_NOT: case P_NOT:
@ -2613,7 +2613,7 @@ int combatspell_cmd(unit * u, struct order *ord)
int level = 0; int level = 0;
spell *sp = 0; spell *sp = 0;
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
/* KAMPFZAUBER [NICHT] löscht alle gesetzten Kampfzauber */ /* KAMPFZAUBER [NICHT] löscht alle gesetzten Kampfzauber */
@ -2658,7 +2658,7 @@ int guard_on_cmd(unit * u, struct order *ord)
assert(u); assert(u);
assert(u->faction); assert(u->faction);
init_order(ord); init_order_depr(ord);
/* GUARD NOT is handled in goard_off_cmd earlier in the turn */ /* GUARD NOT is handled in goard_off_cmd earlier in the turn */
if (getparam(u->faction->locale) == P_NOT) { if (getparam(u->faction->locale) == P_NOT) {
@ -2739,7 +2739,7 @@ void restack_units(void)
int id; int id;
unit *v; unit *v;
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
p = findparam(s, u->faction->locale); p = findparam(s, u->faction->locale);
id = getid(); id = getid();
@ -3049,7 +3049,7 @@ void maketemp_cmd(unit *u, order **olist)
unit *u2; unit *u2;
order **ordp, **oinsert; order **ordp, **oinsert;
#ifndef NDEBUG #ifndef NDEBUG
keyword_t kwd = init_order(makeord); keyword_t kwd = init_order_depr(makeord);
assert(kwd == K_MAKETEMP); assert(kwd == K_MAKETEMP);
#endif #endif
alias = getid(); alias = getid();
@ -3347,7 +3347,7 @@ void defaultorders(void)
char lbuf[8192]; char lbuf[8192];
order *new_order = 0; order *new_order = 0;
const char *s; const char *s;
init_order(ord); init_order_depr(ord);
s = gettoken(lbuf, sizeof(lbuf)); s = gettoken(lbuf, sizeof(lbuf));
if (s) { if (s) {
new_order = parse_order(s, u->faction->locale); new_order = parse_order(s, u->faction->locale);
@ -3463,7 +3463,7 @@ int use_cmd(unit * u, struct order *ord)
int n, err = ENOITEM; int n, err = ENOITEM;
const item_type *itype; const item_type *itype;
init_order(ord); init_order_depr(ord);
t = gettoken(token, sizeof(token)); t = gettoken(token, sizeof(token));
if (!t) { if (!t) {
@ -3518,7 +3518,7 @@ int pay_cmd(unit * u, struct order *ord)
param_t p; param_t p;
int id; int id;
init_order(ord); init_order_depr(ord);
p = getparam(u->faction->locale); p = getparam(u->faction->locale);
id = getid(); id = getid();
if (p == P_NOT) { if (p == P_NOT) {
@ -3572,7 +3572,7 @@ static int reserve_i(unit * u, struct order *ord, int flags)
const item_type *itype; const item_type *itype;
const char *s; const char *s;
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
count = s ? atoip(s) : 0; count = s ? atoip(s) : 0;
para = findparam(s, u->faction->locale); para = findparam(s, u->faction->locale);
@ -3615,7 +3615,7 @@ int claim_cmd(unit * u, struct order *ord)
int n = 1; int n = 1;
const item_type *itype = 0; const item_type *itype = 0;
init_order(ord); init_order_depr(ord);
t = gettoken(token, sizeof(token)); t = gettoken(token, sizeof(token));
if (t) { if (t) {
@ -3909,7 +3909,7 @@ int siege_cmd(unit * u, order * ord)
resource_type *rt_catapultammo = NULL; resource_type *rt_catapultammo = NULL;
resource_type *rt_catapult = NULL; resource_type *rt_catapult = NULL;
init_order(ord); init_order_depr(ord);
b = getbuilding(r); b = getbuilding(r);
if (!b) { if (!b) {

View File

@ -2514,7 +2514,7 @@ static castorder *cast_cmd(unit * u, order * ord)
} }
level = effskill(u, SK_MAGIC, 0); level = effskill(u, SK_MAGIC, 0);
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
param = findparam(s, u->faction->locale); param = findparam(s, u->faction->locale);
/* für Syntax ' STUFE x REGION y z ' */ /* für Syntax ' STUFE x REGION y z ' */

View File

@ -1067,7 +1067,7 @@ static void cycle_route(order * ord, unit * u, int gereist)
return; return;
tail[0] = '\0'; tail[0] = '\0';
init_order(ord); init_order_depr(ord);
neworder[0] = 0; neworder[0] = 0;
for (cm = 0;; ++cm) { for (cm = 0;; ++cm) {
@ -1144,7 +1144,7 @@ static bool transport(unit * ut, unit * u)
for (ord = ut->orders; ord; ord = ord->next) { for (ord = ut->orders; ord; ord = ord->next) {
if (getkeyword(ord) == K_TRANSPORT) { if (getkeyword(ord) == K_TRANSPORT) {
unit *u2; unit *u2;
init_order(ord); init_order_depr(ord);
getunit(ut->region, ut->faction, &u2); getunit(ut->region, ut->faction, &u2);
if (u2 == u) { if (u2 == u) {
return true; return true;
@ -1178,7 +1178,7 @@ static void init_transportation(void)
&& !fval(u, UFL_NOTMOVING) && !LongHunger(u)) { && !fval(u, UFL_NOTMOVING) && !LongHunger(u)) {
unit *ut = 0; unit *ut = 0;
init_order(u->thisorder); init_order_depr(u->thisorder);
if (getunit(r, u->faction, &ut) != GET_UNIT) { if (getunit(r, u->faction, &ut) != GET_UNIT) {
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder,
"feedback_unit_not_found", "")); "feedback_unit_not_found", ""));
@ -1207,7 +1207,7 @@ static void init_transportation(void)
for (ord = u->orders; ord; ord = ord->next) { for (ord = u->orders; ord; ord = ord->next) {
if (getkeyword(ord) == K_TRANSPORT) { if (getkeyword(ord) == K_TRANSPORT) {
init_order(ord); init_order_depr(ord);
for (;;) { for (;;) {
unit *ut = 0; unit *ut = 0;
@ -1218,7 +1218,7 @@ static void init_transportation(void)
can_move(ut) && !fval(ut, UFL_NOTMOVING) && can_move(ut) && !fval(ut, UFL_NOTMOVING) &&
!LongHunger(ut)) { !LongHunger(ut)) {
unit *u2; unit *u2;
init_order(ut->thisorder); init_order_depr(ut->thisorder);
getunit(r, ut->faction, &u2); getunit(r, ut->faction, &u2);
if (u2 == u) { if (u2 == u) {
w += weight(ut); w += weight(ut);
@ -2062,7 +2062,7 @@ static const region_list *travel_i(unit * u, const region_list * route_begin,
if (getkeyword(ord) != K_TRANSPORT) if (getkeyword(ord) != K_TRANSPORT)
continue; continue;
init_order(ord); init_order_depr(ord);
if (getunit(r, u->faction, &ut) == GET_UNIT) { if (getunit(r, u->faction, &ut) == GET_UNIT) {
if (getkeyword(ut->thisorder) == K_DRIVE) { if (getkeyword(ut->thisorder) == K_DRIVE) {
if (ut->building && !can_leave(ut)) { if (ut->building && !can_leave(ut)) {
@ -2077,7 +2077,7 @@ static const region_list *travel_i(unit * u, const region_list * route_begin,
if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) { if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) {
unit *u2; unit *u2;
init_order(ut->thisorder); init_order_depr(ut->thisorder);
getunit(u->region, ut->faction, &u2); getunit(u->region, ut->faction, &u2);
if (u2 == u) { if (u2 == u) {
const region_list *route_to = const region_list *route_to =
@ -2363,7 +2363,7 @@ static void move_hunters(void)
if (getkeyword(ord) == K_FOLLOW) { if (getkeyword(ord) == K_FOLLOW) {
param_t p; param_t p;
init_order(ord); init_order_depr(ord);
p = getparam(u->faction->locale); p = getparam(u->faction->locale);
if (p != P_SHIP) { if (p != P_SHIP) {
if (p != P_UNIT) { if (p != P_UNIT) {
@ -2485,13 +2485,13 @@ void movement(void)
else { else {
if (ships) { if (ships) {
if (u->ship && ship_owner(u->ship) == u) { if (u->ship && ship_owner(u->ship) == u) {
init_order(u->thisorder); init_order_depr(u->thisorder);
move_cmd(u, u->thisorder); move_cmd(u, u->thisorder);
} }
} }
else { else {
if (!u->ship || ship_owner(u->ship) != u) { if (!u->ship || ship_owner(u->ship) != u) {
init_order(u->thisorder); init_order_depr(u->thisorder);
move_cmd(u, u->thisorder); move_cmd(u, u->thisorder);
} }
} }
@ -2548,7 +2548,7 @@ void follow_unit(unit * u)
if (getkeyword(ord) == K_FOLLOW) { if (getkeyword(ord) == K_FOLLOW) {
int id; int id;
param_t p; param_t p;
init_order(ord); init_order_depr(ord);
p = getparam(lang); p = getparam(lang);
if (p == P_UNIT) { if (p == P_UNIT) {
id = read_unitid(u->faction, r); id = read_unitid(u->faction, r);

View File

@ -462,7 +462,7 @@ static void test_follow_ship_msg(CuTest * tc) {
mt_register(mt_new_va("error18", "unit:unit", "region:region", "command:order", 0)); mt_register(mt_new_va("error18", "unit:unit", "region:region", "command:order", 0));
init_order(ord); init_order_depr(ord);
getstrtoken(); getstrtoken();
follow_ship(u, ord); follow_ship(u, ord);

View File

@ -86,7 +86,7 @@ int *parse_ids(const order *ord) {
const char *s; const char *s;
int *il = NULL; int *il = NULL;
init_order(ord); init_order_depr(ord);
s = getstrtoken(); s = getstrtoken();
if (s != NULL && *s) { if (s != NULL && *s) {
il = intlist_init(); il = intlist_init();
@ -211,7 +211,7 @@ void piracy_cmd(unit * u)
ord = create_order(K_MOVE, u->faction->locale, "%s", LOC(u->faction->locale, directions[target_dir])); ord = create_order(K_MOVE, u->faction->locale, "%s", LOC(u->faction->locale, directions[target_dir]));
/* Bewegung ausführen */ /* Bewegung ausführen */
init_order(ord); init_order_depr(ord);
move_cmd(u, ord); move_cmd(u, ord);
free_order(ord); free_order(ord);
} }

View File

@ -80,7 +80,7 @@ int renumber_cmd(unit * u, order * ord)
int i = 0; int i = 0;
faction *f = u->faction; faction *f = u->faction;
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
switch (findparam_ex(s, u->faction->locale)) { switch (findparam_ex(s, u->faction->locale)) {

View File

@ -126,7 +126,7 @@ int spy_cmd(unit * u, struct order *ord)
double spychance, observechance; double spychance, observechance;
region *r = u->region; region *r = u->region;
init_order(ord); init_order_depr(ord);
getunit(r, u->faction, &target); getunit(r, u->faction, &target);
if (!target) { if (!target) {
@ -219,7 +219,7 @@ int setstealth_cmd(unit * u, struct order *ord)
const char *s; const char *s;
int level; int level;
init_order(ord); init_order_depr(ord);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
/* Tarne ohne Parameter: Setzt maximale Tarnung */ /* Tarne ohne Parameter: Setzt maximale Tarnung */
@ -494,10 +494,10 @@ int sabotage_cmd(unit * u, struct order *ord)
assert(u); assert(u);
assert(ord); assert(ord);
init_order(ord); init_order_depr(ord);
s = getstrtoken(); s = getstrtoken();
p = findparam(s, u->faction->locale); p = findparam(s, u->faction->locale);
init_order(NULL); init_order_depr(NULL);
switch (p) { switch (p) {
case P_SHIP: case P_SHIP:

View File

@ -283,7 +283,7 @@ int teach_cmd(unit * teacher, struct order *ord)
count = 0; count = 0;
init_order(ord); init_order_depr(ord);
#if TEACH_ALL #if TEACH_ALL
if (getparam(teacher->faction->locale) == P_ANY) { if (getparam(teacher->faction->locale) == P_ANY) {
@ -304,7 +304,7 @@ int teach_cmd(unit * teacher, struct order *ord)
else if (student->faction == teacher->faction) { else if (student->faction == teacher->faction) {
if (getkeyword(student->thisorder) == K_STUDY) { if (getkeyword(student->thisorder) == K_STUDY) {
/* Input ist nun von student->thisorder !! */ /* Input ist nun von student->thisorder !! */
init_order(student->thisorder); init_order(student->thisorder, student->faction->locale);
sk = getskill(student->faction->locale); sk = getskill(student->faction->locale);
if (sk != NOSKILL && teachskill[0] != NOSKILL) { if (sk != NOSKILL && teachskill[0] != NOSKILL) {
for (t = 0; teachskill[t] != NOSKILL; ++t) { for (t = 0; teachskill[t] != NOSKILL; ++t) {
@ -324,7 +324,7 @@ int teach_cmd(unit * teacher, struct order *ord)
else if (alliedunit(teacher, student->faction, HELP_GUARD)) { else if (alliedunit(teacher, student->faction, HELP_GUARD)) {
if (getkeyword(student->thisorder) == K_STUDY) { if (getkeyword(student->thisorder) == K_STUDY) {
/* Input ist nun von student->thisorder !! */ /* Input ist nun von student->thisorder !! */
init_order(student->thisorder); init_order(student->thisorder, student->faction->locale);
sk = getskill(student->faction->locale); sk = getskill(student->faction->locale);
if (sk != NOSKILL if (sk != NOSKILL
&& effskill_study(teacher, sk, 0) - TEACHDIFFERENCE >= effskill(student, sk, 0)) { && effskill_study(teacher, sk, 0) - TEACHDIFFERENCE >= effskill(student, sk, 0)) {
@ -343,7 +343,7 @@ int teach_cmd(unit * teacher, struct order *ord)
order *new_order; order *new_order;
zOrder[0] = '\0'; zOrder[0] = '\0';
init_order(ord); init_order_depr(ord);
while (!parser_end()) { while (!parser_end()) {
skill_t sk; skill_t sk;
@ -361,7 +361,7 @@ int teach_cmd(unit * teacher, struct order *ord)
const char *token; const char *token;
/* Finde den string, der den Fehler verursacht hat */ /* Finde den string, der den Fehler verursacht hat */
parser_pushstate(); parser_pushstate();
init_order(ord); init_order_depr(ord);
for (j = 0; j != count - 1; ++j) { for (j = 0; j != count - 1; ++j) {
/* skip over the first 'count' units */ /* skip over the first 'count' units */
@ -406,7 +406,7 @@ int teach_cmd(unit * teacher, struct order *ord)
/* Input ist nun von student->thisorder !! */ /* Input ist nun von student->thisorder !! */
parser_pushstate(); parser_pushstate();
init_order(student->thisorder); init_order(student->thisorder, student->faction->locale);
sk = getskill(student->faction->locale); sk = getskill(student->faction->locale);
parser_popstate(); parser_popstate();
@ -448,7 +448,7 @@ int teach_cmd(unit * teacher, struct order *ord)
if (academy_students > 0 && sk_academy!=NOSKILL) { if (academy_students > 0 && sk_academy!=NOSKILL) {
academy_teaching_bonus(teacher, sk_academy, academy_students); academy_teaching_bonus(teacher, sk_academy, academy_students);
} }
init_order(NULL); init_order_depr(NULL);
return 0; return 0;
} }
@ -557,7 +557,7 @@ int study_cmd(unit * u, order * ord)
return 0; return 0;
} }
init_order(ord); (void)init_order(ord, u->faction->locale);
sk = getskill(u->faction->locale); sk = getskill(u->faction->locale);
if (sk < 0) { if (sk < 0) {
@ -785,7 +785,7 @@ int study_cmd(unit * u, order * ord)
mage = create_mage(u, u->faction->magiegebiet); mage = create_mage(u, u->faction->magiegebiet);
} }
} }
init_order(NULL); init_order_depr(NULL);
return 0; return 0;
} }