]> git.pond.sub.org Git - empserver/commit
fire launch: Avoid "may be used uninitialized" warnings
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Jan 2021 07:48:56 +0000 (08:48 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 6 Feb 2021 15:55:37 +0000 (16:55 +0100)
commit4914daa587a25df9792013a994e5d678173fdf28
treed8f2ebeac076da050d4e3a81d377609e5266c2d0
parent1f6b79dd10c841d99d8cf5e94528edb45af19592
fire launch: Avoid "may be used uninitialized" warnings

launch_missile() initializes @n to the target ship number only when
the target is a ship.  It also uses it only then, to re-get the ship.
Clang is cool with this, but GCC gets confused and warns "ā€˜nā€™ may be
used uninitialized".

Use target_ship.shp_uid instead of @n to avoid the warning.

Similar issue in c_fire(): use vship.shp_uid instead of for @vhsipno.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/laun.c
src/lib/commands/mfir.c