]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/boar.c
Update copyright notice
[empserver] / src / lib / commands / boar.c
index 72f95dd0d25a6aafe9375452d0b18a125b564b03..8edf5d9dcf7e18ad5fea4f44a89ee2b04dc8f638 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2015, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
@@ -28,6 +28,7 @@
  *
  *  Known contributors to this file:
  *     Ken Stevens, 1995
+ *     Markus Armbruster, 2011-2015
  */
 
 #include <config.h>
@@ -52,7 +53,8 @@ boar(void)
     struct sctstr sect;
     struct lndstr land;
     struct nstr_item ni;
-    int foundland;
+    int foundland, def_uid;
+    natid def_own;
     char *p;
     char buf[1024];
 
@@ -155,11 +157,17 @@ boar(void)
      * Death, carnage, and destruction.
      */
 
+    /*
+     * Careful: when the fight sinks the ship, put_combat() clobbers
+     * *def (see FIXME there).
+     */
+    def_uid = def->shp_uid;
+    def_own = def->own;
     if (!(att_fight(A_BOARD, off, &olist, 1.0, def, &dlist, 1.0))) {
-       getship(def->shp_uid, &ship);
+       getship(def_uid, &ship);
        if (ship.shp_rflags & RET_BOARDED) {
-           retreat_ship(&ship, 'u');
-           putship(def->shp_uid, &ship);
+           retreat_ship(&ship, def_own, 'u');
+           putship(def_uid, &ship);
        }
     }