I'm trying to write a roguelike using SDL and C++. However, I'm running into a snag. I have a header that has all of my initializing stuff like screen attributes, color identifiers, and some functions that get called all over the place. One of the tiles I want to display is not a basic ascii character, and I'm trying to declare a const char to the ascii value. When I try to compile it kicks me out, and I get the error: "init.h(46): warning C4309: 'initializing' : truncation of constant value" Is there something I'm missing, or can I not assign an ascii value to a const char? I've been searching for a solution to this problem for about an hour and a half, but nothing seems to help.
It's warning you about this: const char CLOSE_DOOR_SYM = 0xDB; Implicitly, all chars are signed by default, which means their range is: -128 to +127. Therefore, 0xDB in decimal is 219; thus, exceeding the positive range, and ultimately, truncation. To fix this, declare CLOSE_DOOR_SYM as unsigned char. The range for this is: 0 to +255.