]> git.pond.sub.org Git - empserver/commitdiff
lost: Fix to track more than one lost sector per owner
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 18 Jul 2016 19:14:30 +0000 (21:14 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:18 +0000 (20:09 +0200)
makelost() overwrites an existing entry for the same thing, else
creates a new one.  It calls findlost() to find existing entries.
findlost() means to look up by coordinates if it's looking for a
sector entry, and by ID if it's looking for a ship, plane, land unit
or nuke entry.  It actually does both for sectors.  Since callers pass
zero ID for sectors, sector entries always match, so at most one gets
created, and additional ones overwrite it.

Broken since the lost table was introduced in 4.0.7.  Fix the flawed
comparison in findlost().

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/lostsub.c
tests/actofgod/final.xdump
tests/bridgefall/final.xdump
tests/smoke/final.xdump
tests/smoke/journal.log
tests/update/final.xdump

index 31b44331bddafa24710b3230cc01bb644142f0b0..613ce2b1d5154a3bc9f67db36fd679de5400ad50 100644 (file)
@@ -109,7 +109,7 @@ findlost(int type, natid owner, int id, coord x, coord y, int free)
        if (lost.lost_owner == owner && type == lost.lost_type) {
            if (type == EF_SECTOR && lost.lost_x == x && lost.lost_y == y)
                return n;
-           else if (lost.lost_id == id)
+           if (type != EF_SECTOR && lost.lost_id == id)
                return n;
        }
     }
index 4a539346df6831313bf2fdb04334ab85ecfd4a6d..717bf6346df63867c7dd2ff9f810d6bdaea995db 100644 (file)
@@ -252,7 +252,14 @@ uid owner type amount price maxbidder markettime xbuy ybuy xsell ysell
 /config
 config lost
 timestamp owner type id x y
+0 1 0 0 1 7
+0 1 0 0 3 7
+0 1 0 0 5 7
+0 1 0 0 7 7
+0 1 0 0 9 7
 0 1 0 0 11 7
+0 3 0 0 5 -7
+0 2 0 0 -2 2
 0 3 0 0 2 -2
 0 3 1 0 1 -1
 0 3 1 1 1 -1
index 9c702e1836f34354a4e6e89445f387c3c07dd028..6ed660dbfda8459ada5e539de43d9332cfd48ec9 100644 (file)
@@ -67,7 +67,7 @@ uid owner type amount price maxbidder markettime xbuy ybuy xsell ysell
 /config
 config lost
 timestamp owner type id x y
-0 2 0 0 -1 1
+0 2 0 0 -1 -1
 0 1 3 0 0 -2
 0 1 2 0 0 -2
 0 1 3 1 0 -2
@@ -75,7 +75,7 @@ timestamp owner type id x y
 0 1 2 2 0 -2
 0 1 4 2 0 -2
 0 1 4 0 0 -2
-0 1 0 0 3 1
+0 1 0 0 0 -2
 0 2 3 10 1 -3
 0 2 2 10 1 -3
 0 2 3 11 1 -3
@@ -83,6 +83,15 @@ timestamp owner type id x y
 0 2 2 12 1 -3
 0 2 4 12 1 -3
 0 2 4 10 1 -3
+0 2 0 0 3 -3
+0 2 0 0 1 -3
+0 1 0 0 3 1
+0 2 0 0 2 2
+0 2 0 0 1 3
+0 2 0 0 -2 2
+0 2 0 0 -3 1
+0 2 0 0 0 2
+0 2 0 0 -1 1
 /config
 config realm
 cnum realm xl xh yl yh
index ff5a30c60e7f6231ae55f84b047c23cdc6f70392..1e956e0cd6af9cc90f02c2dad3bf79a7da029458 100644 (file)
@@ -1108,6 +1108,7 @@ uid owner type amount price maxbidder markettime xbuy ybuy xsell ysell
 /config
 config lost
 timestamp owner type id x y
+0 8 0 0 16 -14
 0 0 1 2 11 -13
 0 1 3 1 11 -13
 0 1 3 2 10 -14
index 809ef4973ea421606b145dca8da154d50e936522..4013e02d67f2512e9d87d4ae5bc94e1e240e3cb7 100644 (file)
     Play#0 input xdump lost *
     Play#0 command xdump
     Play#0 output Play#0 1 XDUMP lost 0
+    Play#0 output Play#0 1 0 8 0 0 16 -14
     Play#0 output Play#0 1 0 1 3 1 11 -13
     Play#0 output Play#0 1 0 1 3 2 10 -14
-    Play#0 output Play#0 1 /2
+    Play#0 output Play#0 1 /3
     Play#0 output Play#0 6 0 640
     Play#0 input xdump realm 0
     Play#0 command xdump
index 787f039920192ab8d9fab5a7069c97a4f54f372a..d0816588a784ca95831e2d08ff6be5614398f00a 100644 (file)
@@ -427,6 +427,9 @@ uid owner type amount price maxbidder markettime xbuy ybuy xsell ysell
 /config
 config lost
 timestamp owner type id x y
+0 4 0 0 -16 -8
+0 4 0 0 -14 -8
+0 4 0 0 -16 -6
 0 4 0 0 -8 -6
 /config
 config realm