/*
* 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
* David Sharnoff, 1987
* Ken Stevens, 1995 (rewritten)
* Steve McClure, 1998-2000
- * Markus Armbruster, 2004-2012
+ * Markus Armbruster, 2004-2013
*/
#include <config.h>
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)
{