]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/ship.c
Update copyright notice
[empserver] / src / lib / subs / ship.c
index 9111176fbe1ff156a01bc848b2f5c28fe40615ce..43a0a200b6dff3b9dff1505e990f371f02bbd822 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2008, 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
  *  ---
  *
  *  ship.c: Ship pre-write data massage
- * 
+ *
  *  Known contributors to this file:
  *     Dave Pare, 1989
  *     Steve McClure, 1996
+ *     Markus Armbruster, 2004-2008
  */
 
 #include <config.h>
@@ -64,14 +65,14 @@ shp_prewrite(int n, void *old, void *new)
 {
     struct shpstr *oldsp = old;
     struct shpstr *sp = new;
-    natid own = sp->shp_own;
+    natid own = sp->shp_effic < SHIP_MINEFF ? 0 : sp->shp_own;
 
-    if (own && sp->shp_effic < SHIP_MINEFF) {
-       mpr(own, "\t%s sunk!\n", prship(sp));
-       own = 0;
-    } else {
-       item_prewrite(sp->shp_item);
+    if (!own) {
+       sp->shp_effic = 0;
+       if (sp->shp_own)
+           mpr(sp->shp_own, "\t%s sunk!\n", prship(sp));
     }
+    item_prewrite(sp->shp_item);
 
     /* We've avoided assigning to sp->shp_own, in case oldsp == sp */
     if (oldsp->shp_own != own)