]> git.pond.sub.org Git - empserver/commitdiff
budget: Fix level prod. forecast when required level is too low
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 5 Jun 2016 10:15:58 +0000 (12:15 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 17:59:58 +0000 (19:59 +0200)
When the required level is too low for production, produce() returns
early.  Except when simulating.  Messed up when Empire 3 made the
update code work for budget.

This can make budget show level production even when it's not actually
possible.  In the stock game, this can happen for tech and research,
which require education > 5.0.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/update/produce.c
tests/update/04-4
tests/update/journal.log

index 38fafef17ac120707c35824edbeabdb6bfe6d49c..632668f899a47f3f3ed79f15bd19b5a0c9a952ec 100644 (file)
@@ -96,10 +96,11 @@ produce(struct natstr *np, struct sctstr *sp, int *cost)
        return 0;
 
     prodeff = prod_eff(sp->sct_type, np->nat_level[product->p_nlndx]);
-    if (prodeff <= 0.0 && !player->simulation) {
-       wu(0, sp->sct_own,
-          "%s level too low to produce in %s (need %d)\n",
-          levelnames[product->p_nlndx], ownxy(sp), product->p_nlmin);
+    if (prodeff <= 0.0) {
+       if (!player->simulation)
+           wu(0, sp->sct_own,
+              "%s level too low to produce in %s (need %d)\n",
+              levelnames[product->p_nlndx], ownxy(sp), product->p_nlmin);
        return 0;
     }
     /*
index d649399473e58a7fcfa8775677978d5f1f2cb71a..1fae53cfb3d96fd1cfc41000737113002e842523 100644 (file)
@@ -1,6 +1,5 @@
 budget
 | BUG: stopped city pays no maintenance
-| BUG: tech despite insufficient edu
 | TODO is it accurate?
 production *
 | TODO is it accurate?
index 093d04e118c220e5d5964357e8f4abc033826f1a..245744dc8e67f57e24f061c3d096fcac0d2f6ea9 100644 (file)
     Play#4 input budget
     Play#4 command budget
     Play#4 output Play#4 1 Sector Type                 Production                          Cost
-    Play#4 output Play#4 1 technical center            0 tech                               300
     Play#4 output Play#4 1 bank                        4 bars                                40
     Play#4 output Play#4 1 Ship maintenance            10 ships                             300
     Play#4 output Play#4 1 Unit maintenance            10 units                             600
     Play#4 output Play#4 1 Military payroll            1110 mil, 0 res                     5552
-    Play#4 output Play#4 1 Total expenses......................................................6792
+    Play#4 output Play#4 1 Total expenses......................................................6492
     Play#4 output Play#4 1 Income from taxes           23604 civs, 4100 uws                +212
     Play#4 output Play#4 1 Income from bars            100 bars                           +1500
     Play#4 output Play#4 1 Total income.......................................................+1712
     Play#4 output Play#4 1 Balance forward                                                        25000
-    Play#4 output Play#4 1 Estimated delta                                                        -5080
-    Play#4 output Play#4 1 Estimated new treasury.............................................19920
+    Play#4 output Play#4 1 Estimated delta                                                        -4780
+    Play#4 output Play#4 1 Estimated new treasury.............................................20220
     Play#4 output Play#4 6 0 99
     Play#4 input production *
     Play#4 command production