]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/load.c
Update copyright notice
[empserver] / src / lib / commands / load.c
index fe4615570eb01856aff1d092c24b99845e0a9272..04abbbfaa68a00d64f8fb4c4b166d24071ce00a3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2012, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2016, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
@@ -30,7 +30,7 @@
  *     David Sharnoff, 1987
  *     Ken Stevens, 1995 (rewritten)
  *     Steve McClure, 1998-2000
- *     Markus Armbruster, 2004-2012
+ *     Markus Armbruster, 2004-2014
  */
 
 #include <config.h>
@@ -130,7 +130,7 @@ load(void)
                continue;
            if (load_unload == LOAD) {
                if (noisy)
-                   pr("You don't own %s \n",
+                   pr("You don't own %s\n",
                       xyas(sect.sct_x, sect.sct_y, player->cnum));
                continue;
            }
@@ -326,18 +326,12 @@ move_amount(int sect_amt, int unit_amt, int unit_max,
        move_amt = -amount - unit_amt;
     else
        move_amt = load_unload == LOAD ? amount : -amount;
-    if (move_amt > unit_max - unit_amt)
-       move_amt = unit_max - unit_amt;
-    if (move_amt < -unit_amt)
-       move_amt = -unit_amt;
-    if (move_amt > sect_amt)
-       move_amt = sect_amt;
-    if (move_amt < sect_amt - ITEM_MAX)
-       move_amt = sect_amt - ITEM_MAX;
+    move_amt = LIMIT_TO(move_amt, -unit_amt, unit_max - unit_amt);
+    move_amt = LIMIT_TO(move_amt, sect_amt - ITEM_MAX, sect_amt);
     return move_amt;
 }
 
-static int
+int
 load_comm_ok(struct sctstr *sectp, natid unit_own,
             i_type item, int move_amt)
 {
@@ -698,7 +692,7 @@ load_comm_ship(struct sctstr *sectp, struct shpstr *sp,
                           load_unload, atoi(p));
     if (!load_comm_ok(sectp, sp->shp_own, item, move_amt))
        return RET_OK;
-    if (!want_to_abandon(sectp, item, move_amt, NULL))
+    if (!abandon_askyn(sectp, item, move_amt, NULL))
        return RET_FAIL;
     if (!still_ok_ship(sectp, sp))
        return RET_SYN;