forked from github/server
crashbug, von default_order änderung verursacht
This commit is contained in:
parent
3460cf5b82
commit
caa658a334
|
@ -1915,15 +1915,15 @@ createunit(region * r, faction * f, int number, const struct race * rc)
|
||||||
unit *
|
unit *
|
||||||
create_unit(region * r, faction * f, int number, const struct race *urace, int id, const char * dname, unit *creator)
|
create_unit(region * r, faction * f, int number, const struct race *urace, int id, const char * dname, unit *creator)
|
||||||
{
|
{
|
||||||
unit * u = calloc(1, sizeof(unit));
|
unit * u = calloc(1, sizeof(unit));
|
||||||
order * deford = default_order(f->locale);
|
order * deford = default_order(f->locale);
|
||||||
|
|
||||||
assert(urace);
|
assert(urace);
|
||||||
assert(f->alive);
|
assert(f->alive);
|
||||||
u_setfaction(u, f);
|
u_setfaction(u, f);
|
||||||
set_order(&u->thisorder, NULL);
|
set_order(&u->thisorder, NULL);
|
||||||
#ifdef LASTORDER
|
#ifdef LASTORDER
|
||||||
set_order(&u->lastorder, deford);
|
set_order(&u->lastorder, deford);
|
||||||
#else
|
#else
|
||||||
addlist(&u->orders, deford);
|
addlist(&u->orders, deford);
|
||||||
#endif
|
#endif
|
||||||
|
@ -3250,21 +3250,7 @@ kernel_init(void)
|
||||||
order *
|
order *
|
||||||
default_order(const struct locale * lang)
|
default_order(const struct locale * lang)
|
||||||
{
|
{
|
||||||
static struct orders {
|
return parse_order(locale_string(lang, "defaultorder"), lang);
|
||||||
const struct locale * lang;
|
|
||||||
struct order * ord;
|
|
||||||
struct orders * next;
|
|
||||||
} * defaults = NULL;
|
|
||||||
struct orders * olist = defaults;
|
|
||||||
while (olist) {
|
|
||||||
if (olist->lang==lang) return olist->ord;
|
|
||||||
olist = olist->next;
|
|
||||||
}
|
|
||||||
olist = (struct orders*)malloc(sizeof(struct orders));
|
|
||||||
defaults = olist;
|
|
||||||
olist->next = defaults;
|
|
||||||
olist->lang = lang;
|
|
||||||
return olist->ord = parse_order(locale_string(lang, "defaultorder"), lang);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue