forked from github/server
Fix der NMR-Berechnung
This commit is contained in:
parent
45fad69789
commit
ae41442b01
|
@ -171,6 +171,7 @@ update_nmrs(void)
|
||||||
{
|
{
|
||||||
int i, newplayers =0;
|
int i, newplayers =0;
|
||||||
faction *f;
|
faction *f;
|
||||||
|
int turn = global.data_turn;
|
||||||
|
|
||||||
if (nmrs==NULL) nmrs = malloc(sizeof(int)*(NMRTimeout()+1));
|
if (nmrs==NULL) nmrs = malloc(sizeof(int)*(NMRTimeout()+1));
|
||||||
for (i = 0; i <= NMRTimeout(); ++i) {
|
for (i = 0; i <= NMRTimeout(); ++i) {
|
||||||
|
@ -181,7 +182,7 @@ update_nmrs(void)
|
||||||
if (fval(f, FFL_ISNEW)) {
|
if (fval(f, FFL_ISNEW)) {
|
||||||
++newplayers;
|
++newplayers;
|
||||||
} else if (f->no != MONSTER_FACTION) {
|
} else if (f->no != MONSTER_FACTION) {
|
||||||
int nmr = turn-f->lastorders;
|
int nmr = turn-f->lastorders+1;
|
||||||
if (nmr<0 || nmr>NMRTimeout()) {
|
if (nmr<0 || nmr>NMRTimeout()) {
|
||||||
log_error(("faction %s has %d NMRS\n", factionid(f), nmr));
|
log_error(("faction %s has %d NMRS\n", factionid(f), nmr));
|
||||||
nmr = max(0, nmr);
|
nmr = max(0, nmr);
|
||||||
|
|
|
@ -62,12 +62,6 @@ function process(orders)
|
||||||
print("could not read " .. orders)
|
print("could not read " .. orders)
|
||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
nmrs = get_nmrs(1)
|
|
||||||
if nmrs >= 60 then
|
|
||||||
print("Shit. More than 60 factions with 1 NMR (" .. nmrs .. ")")
|
|
||||||
return -1
|
|
||||||
end
|
|
||||||
print (nmrs .. " Factions with 1 NMR")
|
|
||||||
run_scripts()
|
run_scripts()
|
||||||
|
|
||||||
-- create new monsters:
|
-- create new monsters:
|
||||||
|
@ -77,6 +71,14 @@ function process(orders)
|
||||||
spawn_ents()
|
spawn_ents()
|
||||||
|
|
||||||
plan_monsters()
|
plan_monsters()
|
||||||
|
|
||||||
|
local nmrs = get_nmrs(1)
|
||||||
|
if nmrs >= 60 then
|
||||||
|
print("Shit. More than 60 factions with 1 NMR (" .. nmrs .. ")")
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
print (nmrs .. " Factions with 1 NMR")
|
||||||
|
|
||||||
process_orders()
|
process_orders()
|
||||||
|
|
||||||
-- post-turn updates:
|
-- post-turn updates:
|
||||||
|
|
Loading…
Reference in New Issue