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>
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;
}
}
/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
/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
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
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
/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
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
/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