edit: Don't permit putting a land unit or plane on two carriers
Only one of struct lndstr members lnd_ship, lnd_land may be non-negative. When a deity screws that up, the server oopses. Be nice: when setting one, zap the other. Same for struct plnstr members pln_ship, pln_land. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
2b80ce93da
commit
546e1220e0
3 changed files with 10 additions and 4 deletions
|
@ -852,6 +852,8 @@ edit_land(struct lndstr *land, char op, int arg, char *p)
|
|||
case 'Y':
|
||||
if (arg < -1 || arg >= ef_nelem(EF_LAND))
|
||||
return RET_SYN;
|
||||
if (arg >= 0 && arg != land->lnd_land)
|
||||
land->lnd_ship = -1;
|
||||
land->lnd_land = arg;
|
||||
break;
|
||||
case 'U':
|
||||
|
@ -901,6 +903,8 @@ edit_land(struct lndstr *land, char op, int arg, char *p)
|
|||
case 'S':
|
||||
if (arg < -1 || arg >= ef_nelem(EF_SHIP))
|
||||
return RET_SYN;
|
||||
if (arg >= 0 && arg != land->lnd_ship)
|
||||
land->lnd_land = -1;
|
||||
land->lnd_ship = arg;
|
||||
break;
|
||||
case 'Z':
|
||||
|
@ -1027,11 +1031,15 @@ edit_plane(struct plnstr *plane, char op, int arg, char *p)
|
|||
case 's':
|
||||
if (arg < -1 || arg >= ef_nelem(EF_SHIP))
|
||||
return RET_SYN;
|
||||
if (arg >= 0 && arg != plane->pln_ship)
|
||||
plane->pln_land = -1;
|
||||
plane->pln_ship = arg;
|
||||
break;
|
||||
case 'y':
|
||||
if (arg < -1 || arg >= ef_nelem(EF_LAND))
|
||||
return RET_SYN;
|
||||
if (arg >= 0 && arg != plane->pln_land)
|
||||
plane->pln_ship = -1;
|
||||
plane->pln_land = arg;
|
||||
break;
|
||||
case 'f':
|
||||
|
|
|
@ -252,7 +252,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius wing range
|
|||
1 98 1 -1 0 10 0 0 100 0 0 none 0 "" 9 0 -1 -1 () 0 0.00000
|
||||
2 2 3 -1 0 10 -127 0 50 0 0 none 0 "" 0 0 -1 -1 (airburst) 0 0.00000
|
||||
3 3 1 -1 0 10 -127 0 50 0 0 none 0 "a" 0 0 3 -1 () 0 0.00000
|
||||
4 3 1 -1 0 100 127 0 32767 0 0 none 0 "" 18 0 4 -1 () 0 0.00000
|
||||
4 3 1 -1 0 100 127 0 32767 0 0 none 0 "" 18 0 -1 4 () 0 0.00000
|
||||
5 3 1 -1 0 100 127 0 32767 0 0 none 0 "" 18 0 -1 -1 () 0 0.00000
|
||||
6 0 0 0 0 0 0 0 0 0 0 none 0 "" 0 0 -1 -1 () 0 0.00000
|
||||
7 0 0 0 0 0 0 0 0 0 0 none 0 "" 0 0 -1 -1 () 0 0.00000
|
||||
|
@ -305,7 +305,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
|
|||
1 98 1 -1 6 10 0 0 100 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||
2 2 3 -1 6 10 -127 0 50 0 0 none 0 "" -1 0 0 (group) "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||
3 3 1 -1 6 10 -127 0 50 0 0 none 0 "a" 3 0 0 (injured) "jj" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||
4 3 1 -1 6 100 127 0 32767 0 0 none 0 "" 4 127 100 () "" 0 25 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||
4 3 1 -1 6 100 127 0 32767 0 0 none 0 "" -1 127 100 () "" 0 25 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 4 0
|
||||
5 3 1 -1 6 100 127 0 32767 0 0 none 0 "" -1 127 100 () "" 0 25 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||
6 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 0 0 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||
7 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 0 0 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
|
||||
|
|
|
@ -10,8 +10,6 @@ tester@127.0.0.1 logged in as country #0
|
|||
Oops: id < 0 in ../src/lib/common/file.c:973
|
||||
Oops: id < 0 in ../src/lib/common/file.c:973
|
||||
Oops: id < 0 in ../src/lib/common/file.c:973
|
||||
Oops: ship >= 0 && land >= 0 in ../src/lib/subs/plane.c:77
|
||||
Oops: ship >= 0 && land >= 0 in ../src/lib/subs/land.c:78
|
||||
tester@127.0.0.1 logged out, country #0
|
||||
Shutdown commencing (cleaning up threads.)
|
||||
Server shutting down on signal 15
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue