]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/move.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / subs / move.c
index 673904edcee6dfdd28666d0b590d903df2c583eb..7b83f21fb0c27ac8b2c565bc76ed3c59df3cd7d6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
  *     
  */
 
+#include <config.h>
+
 #include "misc.h"
 #include "player.h"
-#include "var.h"
 #include "sect.h"
 #include "item.h"
 #include "file.h"
@@ -55,7 +56,6 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
 {
     struct sctstr sect, ending_sect;
     struct sctstr next, dsect;
-    int vec[I_MAX + 1];
     coord curx, cury, oldx, oldy;
     coord tmpx, tmpy;
     coord dx, dy;
@@ -169,7 +169,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
        else if (dir == DIR_VIEW) {
            pr("%d%% %s with %d civilians.\n", sect.sct_effic,
               dchr[sect.sct_type].d_name,
-              getvar(V_CIVIL, (s_char *)&sect, EF_SECTOR));
+              sect.sct_item[I_CIVIL]);
            continue;
        }
        /*
@@ -191,9 +191,10 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
                *movstr = 0;
                continue;
            }
-           getvec(VT_ITEM, vec, (s_char *)&next, EF_SECTOR);
            sect_mcost = sector_mcost(&next, MOB_ROAD);
-           if ((!player->owner && (!exploring || vec[I_MILIT] || vec[I_CIVIL]))
+           if ((!player->owner && (!exploring
+                                   || next.sct_item[I_MILIT]
+                                   || next.sct_item[I_CIVIL]))
                || sect_mcost == -1.0) {
                /* already-owned, or prohibited terrain */
                pr("You can't go there...\n");
@@ -258,7 +259,6 @@ move_map(s_char *what, coord curx, coord cury, s_char *arg)
     s_char range[128];
     s_char view[7];
     int i;
-    int vec[I_MAX + 1];
     int changed = 0;
 
     np = getnatp(player->cnum);
@@ -295,13 +295,13 @@ move_map(s_char *what, coord curx, coord cury, s_char *arg)
        writemap(player->cnum);
     if (!getsect(curx, cury, &sect))
        return RET_FAIL;
-    getvec(VT_ITEM, vec, (s_char *)&sect, EF_SECTOR);
     pr("    %c %c      eff   mob   civ  mil   uw food  work  avail\n",
        view[0], view[1]);
     pr("   %c %c %c     %3d   %3d  %4d %4d %4d %4d   %3d   %3d\n",
        view[2], view[3], view[4],
-       sect.sct_effic, sect.sct_mobil, vec[I_CIVIL], vec[I_MILIT],
-       vec[I_UW], vec[I_FOOD], sect.sct_work, sect.sct_avail);
+       sect.sct_effic, sect.sct_mobil,
+       sect.sct_item[I_CIVIL], sect.sct_item[I_MILIT], sect.sct_item[I_UW],
+       sect.sct_item[I_FOOD], sect.sct_work, sect.sct_avail);
     pr("    %c %c\n", view[5], view[6]);
     return RET_OK;
 }
@@ -347,20 +347,17 @@ int
 check_lmines(coord x, coord y, double weight)
 {
     struct sctstr sect;
-    int mines;
     int dam = 0;
 
     getsect(x, y, &sect);
-    mines = getvar(V_MINE, (s_char *)&sect, EF_SECTOR);
-    if (mines > 0 &&
+    if (sect.sct_mines > 0 &&
        sect.sct_oldown != player->cnum &&
-       chance(DMINE_LHITCHANCE(mines)) && chance(weight / 100.0)) {
+       chance(DMINE_LHITCHANCE(sect.sct_mines)) && chance(weight / 100.0)) {
        pr_beep();
        pr("Blammo! Landmines detected! in %s  ",
           xyas(sect.sct_x, sect.sct_y, player->cnum));
        dam = roll(20);
-       --mines;
-       putvar(V_MINE, mines, (s_char *)&sect, EF_SECTOR);
+       --sect.sct_mines;
        putsect(&sect);
        pr("%d damage sustained.\n", dam);
     }