TheAssemblyArmada / Vanilla-Conquer

Vanilla Conquer provides clean, cross-platform builds of the C&C Remastered Collection and the standalone legacy games.
Other
351 stars 53 forks source link

Build failure with SDL1 and enabling MAP_EDITOR{TD|RA} #941

Closed th-otto closed 6 months ago

th-otto commented 7 months ago

When configuring with SDL1 and enabling MAP_EDITORTD and/or MAP_EDITORRA, compilation fails for tiberiandawn/mapedit.cpp rsp. redalert/mapedit.cpp:

../Vanilla-Conquer/tiberiandawn/mapedit.cpp: In member function 'virtual void MapEditClass::AI(KeyNumType&, int, int)':
../Vanilla-Conquer/tiberiandawn/mapedit.cpp:864:5: error: duplicate case value
     case ((int)KN_HOME | (int)KN_SHIFT_BIT):
     ^~~~
../Vanilla-Conquer/tiberiandawn/mapedit.cpp:839:5: note: previously used here
     case KN_HOME:
     ^~~~

This is because KN_HOME is defined to SDLK_HOME, which is 278 (0x116), and KN_SHIFT_BIT is 0x100, so KN_HOME and KN_HOME| KN_SHIFT_BIT are the same value.

Root cause of the problem seems to be the definition of KN_SHIFTBIT, which implies that all VK* values are less than 256, which is not the case for SDL1.

th-otto commented 6 months ago

Fixed by https://github.com/TheAssemblyArmada/Vanilla-Conquer/commit/61196b3c6011a37694ea583ff42599f2bb7720e2