]> git.pond.sub.org Git - empserver/commitdiff
Change newcap back to not wiping the country
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 5 Nov 2011 15:57:56 +0000 (16:57 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 29 Dec 2011 10:47:05 +0000 (11:47 +0100)
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

index f7f3ff48b42f3a5b5173c2df0101aee99be70bd3..cc082e9302721fc47c46a4a8bba44e859262fb95 100644 (file)
@@ -28,6 +28,7 @@
  *
  *  Known contributors to this file:
  *     Dave Pare, 1986
+ *     Markus Armbruster, 2004-2011
  */
 
 #include <config.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #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;
 }