some coordxy and other conversion warnings

When dist2() got changed to use coordxy parameters, a macro that uses
it in its definition was overlooked and it had (int) casts in it.
That caused a warning about possible data loss when the int
then got converted to coordxy for the dist2() call.

Give online2() coordxy parameters instead of int, like its bretheren.

Avoid a couple of implicit conversion warnings where ints were being assigned
to smaller uchar or ints being assigned to smaller short.

A couple of signed vs unsigned warnings on some rumor processing.

Avoid some signed vs unsigned warnings in mdlib/makedefs where a signed int
param eventually got used in an external call that took size_t.
Eliminate all of it by just having the outer NetHack routine also take
a size_t.

Lastly, insert some default C99 alternative time-related code
in mdlib/makedefs since asctime() and ctime() are being flagged as
deprecated in the upcoming C23 standard and will now start to trigger
warnings for anyone using a C23-compliant compiler.
This commit is contained in:
nhmall
2022-11-23 17:47:49 -05:00
parent 4b9044f053
commit 937355038d
6 changed files with 30 additions and 15 deletions

View File

@@ -709,9 +709,9 @@ enum optset_restrictions {
- min((int) greatest_erosion(obj), objects[(obj)->otyp].a_ac))
#define makeknown(x) discover_object((x), TRUE, TRUE)
#define distu(xx, yy) dist2((int) (xx), (int) (yy), (int) u.ux, (int) u.uy)
#define distu(xx, yy) dist2((coordxy) (xx), (coordxy) (yy), (coordxy) u.ux, (coordxy) u.uy)
#define mdistu(mon) distu((mon)->mx, (mon)->my)
#define onlineu(xx, yy) online2((int)(xx), (int)(yy), (int) u.ux, (int) u.uy)
#define onlineu(xx, yy) online2((coordxy)(xx), (coordxy)(yy), (coordxy) u.ux, (coordxy) u.uy)
#define rn1(x, y) (rn2(x) + (y))