]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/load.c
Update copyright notice
[empserver] / src / lib / commands / load.c
index ae70cbff0ac7f0a3065a2bbef43252f83371e4b2..fb32f5b6dabd3b86414e24fa6d939d346beb2e5d 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-2014, 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-2011
+ *     Markus Armbruster, 2004-2013
  */
 
 #include <config.h>
@@ -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)
 {
@@ -461,7 +455,7 @@ load_plane_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
        } else if (sp->shp_x != pln.pln_x || sp->shp_y != pln.pln_y)
            continue;
 
-       if (!could_be_on_ship(&pln, sp, 0, 0, 0, 0)) {
+       if (!could_be_on_ship(&pln, sp)) {
            if (noisy) {
                if (plchr[(int)pln.pln_type].pl_flags & P_K)
                    p = "choppers";