]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/nav_util.c
Update copyright notice
[empserver] / src / lib / update / nav_util.c
index 8c3933ffc4fea803c41bafa6d614e355b3709441..58c2a6319026d2d8f7dd3dc4ddffb09f51ce0a7c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *  ---
  *
  *  nav_util.c: Utilities for autonav and sail
- * 
+ *
  *  Known contributors to this file:
- *     
+ *
  */
 
 #include <config.h>
 
-#include "misc.h"
-
-#include <ctype.h>
-#include "plague.h"
-#include "ship.h"
-#include "plane.h"
+#include "item.h"
 #include "land.h"
-#include "sect.h"
-#include "xy.h"
 #include "nsc.h"
-#include "nat.h"
 #include "path.h"
-#include "file.h"
-#include "item.h"
-#include "optlist.h"
-#include "player.h"
+#include "plague.h"
+#include "plane.h"
+#include "ship.h"
 #include "update.h"
-#include "subs.h"
-#include "common.h"
-#include "gen.h"
 
-/* load a specific ship given its 
+/* load a specific ship given its
  * location and what field to modify.
  * new autonav code
- * Chad Zabel 6/1/94 
+ * Chad Zabel 6/1/94
  */
 int
 load_it(struct shpstr *sp, struct sctstr *psect, int i)
@@ -127,13 +115,13 @@ load_it(struct shpstr *sp, struct sctstr *psect, int i)
 
 }
 
-/* unload_it 
+/* unload_it
  * A guess alot of this looks like load_it but because of its location
  * in the autonav code I had to split the 2 procedures up.
  * unload_it dumps all the goods from the ship to the harbor.
  * ONLY goods in the trade fields will be unloaded.
  * new autonav code
- * Chad Zabel 6/1/94  
+ * Chad Zabel 6/1/94
  */
 void
 unload_it(struct shpstr *sp)
@@ -190,59 +178,3 @@ unload_it(struct shpstr *sp)
            sectp->sct_pstage = PLG_EXPOSED;
     }
 }
-
-/* auto_fuel_ship 
- * Assume a check for fuel=0 has already been made and passed.  
- * Try to fill a ship using petro. and then oil.            
- * new autonav code.
- * This should be merged with the fuel command someday. 
- * Chad Zabel 6/1/94
- */
-
-void
-auto_fuel_ship(struct shpstr *sp)
-{
-    double d;
-    int totalfuel = 0;
-    int need;
-    int maxfuel;
-    int newfuel = 0;
-    int add_fuel = 0;
-
-    if (opt_FUEL == 0)
-       return;
-    getship(sp->shp_uid, sp);  /* refresh */
-    /* fill with petro */
-    maxfuel = mchr[(int)sp->shp_type].m_fuelc;
-    d = (double)maxfuel / 5.0;
-    if ((d - (int)d > 0.0))
-       d++;
-    need = (int)d;
-
-    newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
-                           I_PETROL, need);
-    add_fuel += newfuel * 5;
-    if (add_fuel > maxfuel)
-       add_fuel = maxfuel;
-    sp->shp_fuel += add_fuel;
-    totalfuel += add_fuel;
-
-    if (totalfuel == maxfuel) {
-       putship(sp->shp_uid, sp);
-       return;                 /* the ship is full */
-    }
-    add_fuel = 0;
-    /* fill with oil */
-    d = (double)(maxfuel - totalfuel) / 50.0;
-    if ((d - (int)d > 0.0))
-       d++;
-    need = (int)d;
-
-    newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
-                           I_OIL, need);
-    add_fuel = newfuel * 50;
-    if (add_fuel > maxfuel)
-       add_fuel = maxfuel;
-    sp->shp_fuel += add_fuel;
-    putship(sp->shp_uid, sp);
-}