From d7a054c20a79876a9d9e47facfc6b9fbdb44734b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 20 Jan 2004 16:51:43 +0000 Subject: [PATCH] (ROLLOVER_AVAIL, opt_ROLLOVER_AVAIL, Options, do_feed, prod, newe): New option ROLLOVER_AVAIL; from Drake Diedrich. --- include/options.h | 1 + include/optlist.h | 1 + info/Server/Options.t | 3 ++- src/lib/commands/newe.c | 13 ++++++++++--- src/lib/commands/prod.c | 6 ++++++ src/lib/global/options.c | 7 +++++++ src/lib/update/human.c | 6 ++++++ 7 files changed, 33 insertions(+), 4 deletions(-) diff --git a/include/options.h b/include/options.h index 18b06c733..803271822 100644 --- a/include/options.h +++ b/include/options.h @@ -100,6 +100,7 @@ #define ALL_BLEED /* Tech bleeds to everyone */ /*#define DRNUKE*//* Need research to make nukes */ #define NO_PLAGUE /* Plague is disabled */ +/*#define ROLLOVER_AVAIL*/ /* Avail builds up across updates like mob */ #define NEW_STARVE /* UW's starve, then civs, then mil */ #define NEW_WORK /* Work is changed in proportion to the # of civs mvd */ /*#define RES_POP*//* population is limited by research */ diff --git a/include/optlist.h b/include/optlist.h index 477735ed4..65b233272 100644 --- a/include/optlist.h +++ b/include/optlist.h @@ -99,6 +99,7 @@ extern int opt_DEMANDUPDATE; extern int opt_BIG_CITY; extern int opt_INTERDICT_ATT; extern int opt_TECH_POP; +extern int opt_ROLLOVER_AVAIL; struct keymatch; /* forward decl */ diff --git a/info/Server/Options.t b/info/Server/Options.t index 728f7460c..f7da7fa7a 100644 --- a/info/Server/Options.t +++ b/info/Server/Options.t @@ -10,7 +10,7 @@ SAIL: another wait to automatically move ships (may also be buggy) NUKEFAIL(etc): nukes on missiles that explode in launching may detonate SHIPNAMES: ships may be named DEMANDUPDATE: updates may be allowed on player demand -UPDATESC(etc): updates can be controlled by the 'hours' file. NITP +UPDATESCHED: updates can be controlled by the 'hours' file. NITP The following options were introduced in the Chainsaw server: @@ -44,6 +44,7 @@ BIG_CITY: 'c' sectors cost $, lcm, hcm to build and hold 10x civs INTERDICT_ATT Interdict units & mil as they move in after an attack The following options were introduced in the Empire4 Server: +ROLLOVER_AVAIL: Unused production avail is rolled over across updates. BRIDGETOWERS: You can build bridge towers, which allow you to build bridges from them. DEFENSE_INFRA: Use the new defensive infrastructure. Otherwise, use diff --git a/src/lib/commands/newe.c b/src/lib/commands/newe.c index 4608b1a9f..3f2175705 100644 --- a/src/lib/commands/newe.c +++ b/src/lib/commands/newe.c @@ -42,6 +42,7 @@ #include "item.h" #include "file.h" #include "commands.h" +#include "optlist.h" int newe(void) @@ -83,11 +84,17 @@ newe(void) uws = min(uws, maxpop); /* This isn't quite right, since research might rise/fall */ /* during the update, but it's the best we can really do */ - wforce = (int) - ((civs * sect.sct_work) / 100.0 - + uws + items[I_MILIT] * 2 / 5.0); + wforce = (int)((civs * sect.sct_work) / 100.0 + + uws + items[I_MILIT] * 2 / 5.0); work = etu_per_update * wforce / 100.0; + if (opt_ROLLOVER_AVAIL) { + if (sect.sct_type == sect.sct_newtype) { + work += sect.sct_avail; + } + if (work > 999) work = 999; + } + bwork = work / 2; type = sect.sct_type; diff --git a/src/lib/commands/prod.c b/src/lib/commands/prod.c index 9daf60921..1065454ec 100644 --- a/src/lib/commands/prod.c +++ b/src/lib/commands/prod.c @@ -142,6 +142,12 @@ prod(void) / 100.0 + (double)uws + (double)items[I_MILIT] * 2.0 / 5.0); work = (double)etu_per_update *(double)wforce / 100.0; + if (opt_ROLLOVER_AVAIL) { + if (sect.sct_type == sect.sct_newtype) { + work += sect.sct_avail; + } + if (work > 999) work = 999; + } bwork = (int)((double)work / 2.0); if (sect.sct_off) diff --git a/src/lib/global/options.c b/src/lib/global/options.c index fb07ba37e..7c193fbef 100644 --- a/src/lib/global/options.c +++ b/src/lib/global/options.c @@ -327,6 +327,12 @@ int opt_TECH_POP = 1; int opt_TECH_POP = 0; #endif +#ifdef ROLLOVER_AVAIL +int opt_ROLLOVER_AVAIL = 1; +#else +int opt_ROLLOVER_AVAIL = 0; +#endif + struct option_list Options[] = { {"ALL_BLEED", &opt_ALL_BLEED}, {"BIG_CITY", &opt_BIG_CITY}, @@ -365,6 +371,7 @@ struct option_list Options[] = { {"PINPOINTMISSILE", &opt_PINPOINTMISSILE}, {"PLANENAMES", &opt_PLANENAMES}, {"RES_POP", &opt_RES_POP}, + {"ROLLOVER_AVAIL", &opt_ROLLOVER_AVAIL}, {"SAIL", &opt_SAIL}, {"SHIP_DECAY", &opt_SHIP_DECAY}, {"SHIPNAMES", &opt_SHIPNAMES}, diff --git a/src/lib/update/human.c b/src/lib/update/human.c index ab71ce107..19e2ed478 100644 --- a/src/lib/update/human.c +++ b/src/lib/update/human.c @@ -82,6 +82,11 @@ do_feed(register struct sctstr *sp, register struct natstr *np, int *vec, uws = (vec[I_UW] > maxpop) ? maxpop : vec[I_UW]; mil = (vec[I_MILIT] > maxpop) ? maxpop : vec[I_MILIT]; work_avail = total_work(sctwork, etu, civvies, mil, uws); + if (opt_ROLLOVER_AVAIL) { + if (sp->sct_type == sp->sct_newtype) { + work_avail += sp->sct_avail; + } + } people = vec[I_CIVIL] + vec[I_MILIT] + vec[I_UW]; if (sp->sct_type != SCT_SANCT) { @@ -140,6 +145,7 @@ do_feed(register struct sctstr *sp, register struct natstr *np, int *vec, pt_bg_nmbr(bp, sp, I_CIVIL, vec[I_CIVIL]); pt_bg_nmbr(bp, sp, I_UW, vec[I_UW]); pt_bg_nmbr(bp, sp, I_MILIT, vec[I_MILIT]); + if (work_avail > 999) work_avail = 999; *workp = work_avail; return sctwork; } -- 2.43.0