remove pointer to long conversions - part 1 of 3 (trunk only)

P64 (Win64) has a 64 bit pointer size, but a 32 bit long size.
Remove some code that forced pointers into a long int, and
vice versa where information could be lost.

This part deals with light source functions and their
arguments mostly, and switches some arguments
from type genericptr_t to 'anything'.
This commit is contained in:
nethack.allison
2006-07-08 18:24:01 +00:00
parent dbc3abb226
commit 699330928d
8 changed files with 102 additions and 47 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)hack.c 3.5 2006/06/11 */
/* SCCS Id: @(#)hack.c 3.5 2006/07/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -19,6 +19,51 @@ STATIC_DCL void FDECL(move_update, (BOOLEAN_P));
#define IS_SHOP(x) (rooms[x].rtype >= SHOPBASE)
static anything tmp_anything;
anything *
uint_to_any(ui)
unsigned ui;
{
zero_anything(&tmp_anything);
tmp_anything.a_uint = ui;
return &tmp_anything;
}
anything *
long_to_any(lng)
unsigned lng;
{
zero_anything(&tmp_anything);
tmp_anything.a_long = lng;
return &tmp_anything;
}
anything *
monst_to_any(mtmp)
struct monst *mtmp;
{
zero_anything(&tmp_anything);
tmp_anything.a_monst = mtmp;
return &tmp_anything;
}
anything *
obj_to_any(obj)
struct obj *obj;
{
zero_anything(&tmp_anything);
tmp_anything.a_obj = obj;
return &tmp_anything;
}
void
zero_anything(any)
anything *any;
{
(void) memset((genericptr_t)any, 0, sizeof(anything));
}
boolean
revive_nasty(x, y, msg)
int x,y;