forked from github/server
"Einheiten produzieren kein Holz, Pferde, Steine" Reihenfolge-Fix der zu Neu-AW gefuehrt hat.
This commit is contained in:
parent
bb374629ba
commit
3e09fc0c7d
|
@ -1509,7 +1509,7 @@ get_allocator(const struct resource_type * rtype)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
split_allocations(region * r)
|
split_allocations(region * r)
|
||||||
{
|
{
|
||||||
allocation_list ** p_alist=&allocations;
|
allocation_list ** p_alist=&allocations;
|
||||||
|
@ -3171,7 +3171,6 @@ produce(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
split_allocations(r);
|
|
||||||
/* Entertainment (expandentertainment) und Besteuerung (expandtax) vor den
|
/* Entertainment (expandentertainment) und Besteuerung (expandtax) vor den
|
||||||
* Befehlen, die den Bauern mehr Geld geben, damit man aus den Zahlen der
|
* Befehlen, die den Bauern mehr Geld geben, damit man aus den Zahlen der
|
||||||
* letzten Runde berechnen kann, wieviel die Bauern für Unterhaltung
|
* letzten Runde berechnen kann, wieviel die Bauern für Unterhaltung
|
||||||
|
|
|
@ -54,6 +54,7 @@ enum { IC_WORK, IC_ENTERTAIN, IC_TAX, IC_TRADE, IC_TRADETAX, IC_STEAL, IC_MAGIC
|
||||||
void maintain_buildings(struct region * r, boolean crash);
|
void maintain_buildings(struct region * r, boolean crash);
|
||||||
extern void add_spende(struct faction * f1, struct faction * f2, int betrag, struct region * r);
|
extern void add_spende(struct faction * f1, struct faction * f2, int betrag, struct region * r);
|
||||||
extern int make_cmd(struct unit * u, struct order * ord);
|
extern int make_cmd(struct unit * u, struct order * ord);
|
||||||
|
extern void split_allocations(struct region * r);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -3690,7 +3690,7 @@ claim_cmd(unit * u, struct order * ord)
|
||||||
typedef struct processor {
|
typedef struct processor {
|
||||||
struct processor * next;
|
struct processor * next;
|
||||||
int priority;
|
int priority;
|
||||||
enum { PR_GLOBAL, PR_REGION, PR_UNIT, PR_ORDER } type;
|
enum { PR_GLOBAL, PR_REGION_PRE, PR_UNIT, PR_ORDER, PR_REGION_POST } type;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
keyword_t kword;
|
keyword_t kword;
|
||||||
|
@ -3712,8 +3712,8 @@ typedef struct processor {
|
||||||
|
|
||||||
static processor * processors;
|
static processor * processors;
|
||||||
|
|
||||||
void
|
processor *
|
||||||
add_proc_order(int priority, keyword_t kword, int (*parser)(struct unit *, struct order *), boolean thisorder, const char * name)
|
add_proc(int priority, const char * name, int type)
|
||||||
{
|
{
|
||||||
processor **pproc = &processors;
|
processor **pproc = &processors;
|
||||||
processor *proc;
|
processor *proc;
|
||||||
|
@ -3721,87 +3721,67 @@ add_proc_order(int priority, keyword_t kword, int (*parser)(struct unit *, struc
|
||||||
while (*pproc) {
|
while (*pproc) {
|
||||||
proc = *pproc;
|
proc = *pproc;
|
||||||
if (proc->priority>priority) break;
|
if (proc->priority>priority) break;
|
||||||
else if (proc->priority==priority && proc->type>=PR_ORDER) break;
|
else if (proc->priority==priority && proc->type>=type) break;
|
||||||
pproc = &proc->next;
|
pproc = &proc->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc = malloc(sizeof(processor));
|
proc = malloc(sizeof(processor));
|
||||||
proc->priority = priority;
|
proc->priority = priority;
|
||||||
proc->type = PR_ORDER;
|
proc->type = type;
|
||||||
proc->data.per_order.process = parser;
|
|
||||||
proc->data.per_order.kword = kword;
|
|
||||||
proc->data.per_order.thisorder = thisorder;
|
|
||||||
proc->name = name;
|
proc->name = name;
|
||||||
proc->next = *pproc;
|
proc->next = *pproc;
|
||||||
*pproc = proc;
|
*pproc = proc;
|
||||||
|
return proc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
add_proc_order(int priority, keyword_t kword, int (*parser)(struct unit *, struct order *), boolean thisorder, const char * name)
|
||||||
|
{
|
||||||
|
processor * proc = add_proc(priority, name, PR_ORDER);
|
||||||
|
if (proc) {
|
||||||
|
proc->data.per_order.process = parser;
|
||||||
|
proc->data.per_order.kword = kword;
|
||||||
|
proc->data.per_order.thisorder = thisorder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_proc_global(int priority, void (*process)(void), const char * name)
|
add_proc_global(int priority, void (*process)(void), const char * name)
|
||||||
{
|
{
|
||||||
processor **pproc = &processors;
|
processor * proc = add_proc(priority, name, PR_GLOBAL);
|
||||||
processor *proc;
|
if (proc) {
|
||||||
|
|
||||||
while (*pproc) {
|
|
||||||
proc = *pproc;
|
|
||||||
if (proc->priority>priority) break;
|
|
||||||
else if (proc->priority==priority && proc->type>PR_GLOBAL) break;
|
|
||||||
pproc = &proc->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = malloc(sizeof(processor));
|
|
||||||
proc->priority = priority;
|
|
||||||
proc->type = PR_GLOBAL;
|
|
||||||
proc->data.global.process = process;
|
proc->data.global.process = process;
|
||||||
proc->name = name;
|
}
|
||||||
proc->next = *pproc;
|
|
||||||
*pproc = proc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_proc_region(int priority, void (*process)(region *), const char * name)
|
add_proc_region(int priority, void (*process)(region *), const char * name)
|
||||||
{
|
{
|
||||||
processor **pproc = &processors;
|
processor * proc = add_proc(priority, name, PR_REGION_PRE);
|
||||||
processor *proc;
|
if (proc) {
|
||||||
|
proc->data.per_region.process = process;
|
||||||
while (*pproc) {
|
}
|
||||||
proc = *pproc;
|
|
||||||
if (proc->priority>priority) break;
|
|
||||||
else if (proc->priority==priority && proc->type>PR_REGION) break;
|
|
||||||
pproc = &proc->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc = malloc(sizeof(processor));
|
void
|
||||||
proc->priority = priority;
|
add_proc_postregion(int priority, void (*process)(region *), const char * name)
|
||||||
proc->type = PR_REGION;
|
{
|
||||||
|
processor * proc = add_proc(priority, name, PR_REGION_POST);
|
||||||
|
if (proc) {
|
||||||
proc->data.per_region.process = process;
|
proc->data.per_region.process = process;
|
||||||
proc->name = name;
|
}
|
||||||
proc->next = *pproc;
|
|
||||||
*pproc = proc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_proc_unit(int priority, void (*process)(unit *), const char * name)
|
add_proc_unit(int priority, void (*process)(unit *), const char * name)
|
||||||
{
|
{
|
||||||
processor **pproc = &processors;
|
processor * proc = add_proc(priority, name, PR_UNIT);
|
||||||
processor *proc;
|
if (proc) {
|
||||||
|
|
||||||
while (*pproc) {
|
|
||||||
proc = *pproc;
|
|
||||||
if (proc->priority>priority) break;
|
|
||||||
else if (proc->priority==priority && proc->type>PR_UNIT) break;
|
|
||||||
pproc = &proc->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = malloc(sizeof(processor));
|
|
||||||
proc->priority = priority;
|
|
||||||
proc->type = PR_UNIT;
|
|
||||||
proc->data.per_unit.process = process;
|
proc->data.per_unit.process = process;
|
||||||
proc->name = name;
|
}
|
||||||
proc->next = *pproc;
|
|
||||||
*pproc = proc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* per priority, execute processors in order from PR_GLOBAL down to PR_ORDER */
|
||||||
void
|
void
|
||||||
process(void)
|
process(void)
|
||||||
{
|
{
|
||||||
|
@ -3827,7 +3807,7 @@ process(void)
|
||||||
unit *u;
|
unit *u;
|
||||||
processor *pregion = pglobal;
|
processor *pregion = pglobal;
|
||||||
|
|
||||||
while (pregion && pregion->priority==prio && pregion->type==PR_REGION) {
|
while (pregion && pregion->priority==prio && pregion->type==PR_REGION_PRE) {
|
||||||
pregion->data.per_region.process(r);
|
pregion->data.per_region.process(r);
|
||||||
pregion = pregion->next;
|
pregion = pregion->next;
|
||||||
}
|
}
|
||||||
|
@ -3856,6 +3836,12 @@ process(void)
|
||||||
porder = porder->next;
|
porder = porder->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (pregion && pregion->priority==prio && pregion->type==PR_REGION_POST) {
|
||||||
|
pregion->data.per_region.process(r);
|
||||||
|
pregion = pregion->next;
|
||||||
|
}
|
||||||
|
if (pregion==NULL || pregion->priority!=prio) continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3971,8 +3957,9 @@ processorders (void)
|
||||||
add_proc_order(p, K_STUDY, &learn_cmd, true, "Lernen");
|
add_proc_order(p, K_STUDY, &learn_cmd, true, "Lernen");
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
add_proc_order(p, K_MAKE, &make_cmd, true, "Produktion");
|
|
||||||
add_proc_global(p, &produce, "Arbeiten, Handel, Rekruten");
|
add_proc_global(p, &produce, "Arbeiten, Handel, Rekruten");
|
||||||
|
add_proc_order(p, K_MAKE, &make_cmd, true, "Produktion");
|
||||||
|
add_proc_postregion(p, &split_allocations, "Produktion II");
|
||||||
|
|
||||||
p+=10;
|
p+=10;
|
||||||
add_proc_region(p, &enter_2, "Kontaktieren & Betreten (3. Versuch)");
|
add_proc_region(p, &enter_2, "Kontaktieren & Betreten (3. Versuch)");
|
||||||
|
|
Loading…
Reference in New Issue