cast int64 to smaller types (trunk only)
The devteam feedback was to place casts in the code in question. This puts explicit casts on some code that was being compiled into 'int64' then stuffed into smaller types with VC2005.
This commit is contained in:
@@ -212,7 +212,7 @@ register boolean mod;
|
||||
if (otmp && *name)
|
||||
for (a = artilist+1; a->otyp; a++)
|
||||
if (a->otyp == otmp->otyp && !strcmp(a->name, name)) {
|
||||
register int m = a - artilist;
|
||||
register int m = (int)(a - artilist);
|
||||
otmp->oartifact = (char)(mod ? m : 0);
|
||||
otmp->age = 0;
|
||||
if(otmp->otyp == RIN_INCREASE_DAMAGE)
|
||||
|
||||
@@ -327,7 +327,7 @@ char *defquery;
|
||||
char *dop = index(disclosure_options, category);
|
||||
|
||||
if (dop && defquery) {
|
||||
idx = dop - disclosure_options;
|
||||
idx = (int)(dop - disclosure_options);
|
||||
if (idx < 0 || idx > (NUM_DISCLOSURE_OPTIONS - 1)) {
|
||||
impossible(
|
||||
"should_query_disclose_option: bad disclosure index %d %c",
|
||||
|
||||
@@ -957,7 +957,7 @@ topologize(croom)
|
||||
register struct mkroom *croom;
|
||||
#endif
|
||||
{
|
||||
register int x, y, roomno = (croom - rooms) + ROOMOFFSET;
|
||||
register int x, y, roomno = (int)((croom - rooms) + ROOMOFFSET);
|
||||
register int lowx = croom->lx, lowy = croom->ly;
|
||||
register int hix = croom->hx, hiy = croom->hy;
|
||||
#ifdef SPECIALIZATION
|
||||
|
||||
@@ -534,7 +534,7 @@ register const char *s;
|
||||
char *ep = getenv("SPLEVTYPE"); /* not nh_getenv */
|
||||
if (ep) {
|
||||
/* rindex always succeeds due to code in prior block */
|
||||
int len = (rindex(protofile, '-') - protofile) + 1;
|
||||
int len = (int)((rindex(protofile, '-') - protofile) + 1);
|
||||
|
||||
while (ep && *ep) {
|
||||
if (!strncmp(ep, protofile, len)) {
|
||||
|
||||
@@ -227,7 +227,7 @@ struct mkroom *sroom;
|
||||
struct monst *mon;
|
||||
register int sx,sy,i;
|
||||
int sh, tx, ty, goldlim, type = sroom->rtype;
|
||||
int rmno = (sroom - rooms) + ROOMOFFSET;
|
||||
int rmno = (int)((sroom - rooms) + ROOMOFFSET);
|
||||
coord mm;
|
||||
|
||||
#ifdef GCC_WARN
|
||||
@@ -518,7 +518,7 @@ mktemple()
|
||||
* In temples, shrines are blessed altars
|
||||
* located in the center of the room
|
||||
*/
|
||||
shrine_spot = shrine_pos((sroom - rooms) + ROOMOFFSET);
|
||||
shrine_spot = shrine_pos((int)((sroom - rooms) + ROOMOFFSET));
|
||||
lev = &levl[shrine_spot->x][shrine_spot->y];
|
||||
lev->typ = ALTAR;
|
||||
lev->altarmask = induced_align(80);
|
||||
@@ -596,7 +596,7 @@ coord *c;
|
||||
int i;
|
||||
|
||||
if (croom->irregular) {
|
||||
i = (croom - rooms) + ROOMOFFSET;
|
||||
i = (int)((croom - rooms) + ROOMOFFSET);
|
||||
|
||||
while(try_cnt++ < 100) {
|
||||
c->x = somex(croom);
|
||||
|
||||
@@ -2500,9 +2500,9 @@ struct monst *mon;
|
||||
struct obj *m_armr = which_armor(mon, W_ARM);
|
||||
|
||||
if (m_armr && Is_dragon_scales(m_armr))
|
||||
mndx = Dragon_scales_to_pm(m_armr) - mons;
|
||||
mndx = (int)(Dragon_scales_to_pm(m_armr) - mons);
|
||||
else if (m_armr && Is_dragon_mail(m_armr))
|
||||
mndx = Dragon_mail_to_pm(m_armr) - mons;
|
||||
mndx = (int)(Dragon_mail_to_pm(m_armr) - mons);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -702,7 +702,7 @@ char *tp;
|
||||
cp++;
|
||||
if (*cp == 'x' || *cp == 'X')
|
||||
for (++cp; (dp = index(hex, *cp)) && (dcount++ < 2); cp++)
|
||||
cval = (cval * 16) + (dp - hex) / 2;
|
||||
cval = (int)((cval * 16) + (dp - hex) / 2);
|
||||
else if (*cp == 'o' || *cp == 'O')
|
||||
for (++cp; (index("01234567",*cp)) && (dcount++ < 3); cp++)
|
||||
cval = (cval * 8) + (*cp - '0');
|
||||
@@ -1933,7 +1933,7 @@ goodfruit:
|
||||
if (c == 'k') c = 'v'; /* killed -> vanquished */
|
||||
dop = index(disclosure_options, c);
|
||||
if (dop) {
|
||||
idx = dop - disclosure_options;
|
||||
idx = (int)(dop - disclosure_options);
|
||||
if (idx < 0 || idx > NUM_DISCLOSURE_OPTIONS - 1) {
|
||||
impossible("bad disclosure index %d %c",
|
||||
idx, c);
|
||||
@@ -2538,7 +2538,7 @@ map_menu_cmd(ch)
|
||||
{
|
||||
char *found = index(mapped_menu_cmds, ch);
|
||||
if (found) {
|
||||
int idx = found - mapped_menu_cmds;
|
||||
int idx = (int)(found - mapped_menu_cmds);
|
||||
ch = mapped_menu_op[idx];
|
||||
}
|
||||
return ch;
|
||||
|
||||
@@ -223,7 +223,7 @@ boolean sanctum; /* is it the seat of the high priest? */
|
||||
priest = makemon(&mons[sanctum ? PM_HIGH_PRIEST : PM_ALIGNED_PRIEST],
|
||||
sx + 1, sy, MM_EPRI);
|
||||
if (priest) {
|
||||
EPRI(priest)->shroom = (sroom - rooms) + ROOMOFFSET;
|
||||
EPRI(priest)->shroom = (schar)((sroom - rooms) + ROOMOFFSET);
|
||||
EPRI(priest)->shralign = Amask2align(levl[sx][sy].altarmask);
|
||||
EPRI(priest)->shrpos.x = sx;
|
||||
EPRI(priest)->shrpos.y = sy;
|
||||
|
||||
@@ -370,7 +370,7 @@ int sx, sy;
|
||||
mtmp->mappearance = STRANGE_OBJECT;
|
||||
}
|
||||
} else {
|
||||
atype = get_shop_item(shp - shtypes);
|
||||
atype = get_shop_item((int)(shp - shtypes));
|
||||
if (atype == VEGETARIAN_CLASS)
|
||||
mkveggy_at(sx, sy);
|
||||
else if (atype < 0)
|
||||
@@ -486,7 +486,7 @@ struct mkroom *sroom;
|
||||
|
||||
/* check that the shopkeeper placement is sane */
|
||||
if(sroom->irregular) {
|
||||
int rmno = (sroom - rooms) + ROOMOFFSET;
|
||||
int rmno = (int)((sroom - rooms) + ROOMOFFSET);
|
||||
if (isok(sx-1,sy) && !levl[sx-1][sy].edge &&
|
||||
(int) levl[sx-1][sy].roomno == rmno) sx--;
|
||||
else if (isok(sx+1,sy) && !levl[sx+1][sy].edge &&
|
||||
@@ -534,7 +534,7 @@ struct mkroom *sroom;
|
||||
set_malign(shk);
|
||||
shk->msleeping = 0;
|
||||
shk->mtrapseen = ~0; /* we know all the traps already */
|
||||
ESHK(shk)->shoproom = (sroom - rooms) + ROOMOFFSET;
|
||||
ESHK(shk)->shoproom = (schar)((sroom - rooms) + ROOMOFFSET);
|
||||
sroom->resident = shk;
|
||||
ESHK(shk)->shoptype = sroom->rtype;
|
||||
assign_level(&(ESHK(shk)->shoplevel), &u.uz);
|
||||
@@ -574,7 +574,7 @@ register struct mkroom *sroom;
|
||||
*/
|
||||
register int sx, sy, sh;
|
||||
char buf[BUFSZ];
|
||||
int rmno = (sroom - rooms) + ROOMOFFSET;
|
||||
int rmno = (int)((sroom - rooms) + ROOMOFFSET);
|
||||
const struct shclass *shp = &shtypes[shp_indx];
|
||||
|
||||
/* first, try to place a shopkeeper in the room */
|
||||
|
||||
@@ -224,7 +224,7 @@ dosounds()
|
||||
return;
|
||||
}
|
||||
if (tended_shop(sroom) &&
|
||||
!index(u.ushops, ROOM_INDEX(sroom) + ROOMOFFSET)) {
|
||||
!index(u.ushops, (int)(ROOM_INDEX(sroom) + ROOMOFFSET))) {
|
||||
static const char * const shop_msg[3] = {
|
||||
"someone cursing shoplifters.",
|
||||
"the chime of a cash register.",
|
||||
|
||||
@@ -227,7 +227,7 @@ nh_timeout()
|
||||
|
||||
for(upp = u.uprops; upp < u.uprops+SIZE(u.uprops); upp++)
|
||||
if((upp->intrinsic & TIMEOUT) && !(--upp->intrinsic & TIMEOUT)) {
|
||||
kptr = find_delayed_killer(upp - u.uprops);
|
||||
kptr = find_delayed_killer((int)(upp - u.uprops));
|
||||
switch(upp - u.uprops){
|
||||
case STONED:
|
||||
if (kptr && kptr->name[0]) {
|
||||
|
||||
Reference in New Issue
Block a user