View Single Post
Old January 31, 2020, 06:00   #4
eastwind
Apprentice
 
Join Date: Dec 2019
Location: Mexico, undisclosed location
Posts: 79
eastwind is on a distinguished road
How would you say this one should be handled:

1>mon-make.c(744,37): warning C4244: '=': conversion from 's16b' to 'byte', possible loss of data

The line in question:

obj->origin_depth = player->depth;

the warning is correct, obj->origin_depth is type byte and player->depth is type s16b

Both are saved to the save file using their respective sizes:

save.c:127: wr_byte(obj->origin_depth);
save.c:953: wr_u16b(player->depth);

So its only not causing an error because player->depth doesn't ever use its full value range (and is checked on load vs z_info->max_depth).

If I change the type of obj->origin_depth and change load.c & save.c to read & write u16b, that breaks the save file, right?
eastwind is offline   Reply With Quote