brentjohnson / xconq

Xconq is a general strategy game system. It is a complete system that includes all the components: a portable engine, graphical interfaces for Unix/Linux/X11, Macintosh, and Windows, multiple AIs, networking for multi-player games, and an extensive games library.
GNU General Public License v2.0
31 stars 11 forks source link

Set BMAP_BYTE to unsigned char always #9

Closed kazarmy closed 3 years ago

kazarmy commented 3 years ago

This pr sets BMAP_BYTE to unsigned char always for the following reasons:

  1. Bitmap bytes are bytes and not characters.
  2. C++ does have an unsigned char type (https://en.cppreference.com/w/cpp/language/types#Character_types).
  3. The current code is causing compilation errors on modern Ubuntu C++ compilers. E.g. with g++ 9.3.0:
    g++ -c -g -O2 -fpermissive -Wno-write-strings -g    -DHAVE_ACDEFS_H -I. -I./.. -I./../kernel -I/usr/include/tcl8.6 -I/usr/include/tcl8.6     tkinit.c
    In file included from tkinit.c:51:
    ./../bitmaps/lookglass.b:8:50: error: narrowing conversion of ‘248’ from ‘int’ to ‘char’ [-Wnarrowing]
    8 |    0x00, 0x0c, 0x00, 0x18, 0x00, 0x30, 0x00, 0x20};
      |

    and with clang++ 10.0:

    clang++ -c -g -O2 -fpermissive -Wno-write-strings -g    -DHAVE_ACDEFS_H -I. -I./.. -I./../kernel -I/usr/include/tcl8.6 -I/usr/include/tcl8.6     tkinit.c
    clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
    In file included from tkinit.c:51:
    ./../bitmaps/lookglass.b:6:4: error: constant expression evaluates to 248 which cannot be narrowed to type 'char' [-Wc++11-narrowing]
    0xf8, 0x00, 0x04, 0x01, 0x02, 0x02, 0x01, 0x04, 0x01, 0x04, 0x01, 0x04,
    ^~~~