From 773983059496c89c72bede42938d60b7d5181c9a Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 5 Nov 2011 16:57:56 +0100 Subject: [PATCH] Change newcap back to not wiping the country Just create sanctuaries, put country into STAT_SANCT, grant BTUs and money, set origin and initial realms. This reverts commit e1a68c72 (v4.3.12) as far as newcap is concerned. Except we still set nat_access, because that needs to be set along with nat_btu. Additionally, leave levels and telegrams alone. Should have no effect in practice, because newcap works only in STAT_NEW, and we get there with the add command, which wipes the country. --- src/lib/commands/new.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/lib/commands/new.c b/src/lib/commands/new.c index f7f3ff48..cc082e93 100644 --- a/src/lib/commands/new.c +++ b/src/lib/commands/new.c @@ -28,6 +28,7 @@ * * Known contributors to this file: * Dave Pare, 1986 + * Markus Armbruster, 2004-2011 */ #include @@ -36,20 +37,22 @@ #include #include #include "commands.h" -#include "land.h" +#include "game.h" #include "optlist.h" -#include "path.h" -#include "prototypes.h" static void init_sanct(struct natstr *, coord, coord); int new(void) { + static struct range defrealm = { -8, -5, 10, 5, 0, 0 }; struct sctstr sect; struct natstr *natp; + struct realmstr newrealm; + struct range absrealm; natid num; coord x, y; + int i; char *p; char buf[1024]; @@ -83,10 +86,28 @@ new(void) } pr("added country %d at %s\n", num, xyas(x, y, player->cnum)); - nat_reset(natp, STAT_SANCT, x, y); + natp->nat_btu = max_btus; + game_tick_to_now(&natp->nat_access); + natp->nat_stat = STAT_SANCT; + natp->nat_xcap = natp->nat_xorg = x; + natp->nat_ycap = natp->nat_yorg = y; + xyabsrange(natp, &defrealm, &absrealm); + for (i = 0; i < MAXNOR; i++) { + ef_blank(EF_REALM, i + natp->nat_cnum * MAXNOR, &newrealm); + newrealm.r_xl = absrealm.lx; + newrealm.r_xh = absrealm.hx; + newrealm.r_yl = absrealm.ly; + newrealm.r_yh = absrealm.hy; + putrealm(&newrealm); + } + if (players_at_00) { + natp->nat_xorg = 0; + natp->nat_yorg = 0; + } + natp->nat_money = start_cash; + putnat(natp); init_sanct(natp, x, y); init_sanct(natp, x + 2, y); - putnat(natp); return RET_OK; }