Remove static assertions

They were aid to decompilation, now they are source of complaints when compiling for x64.
This commit is contained in:
Alexander Batalov 2022-05-28 07:34:29 +03:00
parent 7a1119bac0
commit 119cfe8212
32 changed files with 0 additions and 95 deletions

View File

@ -194,8 +194,6 @@ typedef struct STRUCT_530014 {
}; };
} STRUCT_530014; } STRUCT_530014;
static_assert(sizeof(STRUCT_530014) == 3240, "wrong size");
typedef Object* PathBuilderCallback(Object* object, int tile, int elevation); typedef Object* PathBuilderCallback(Object* object, int tile, int elevation);
extern int _curr_sad; extern int _curr_sad;

View File

@ -80,8 +80,6 @@ typedef struct Art {
} Art; } Art;
#pragma pack() #pragma pack()
static_assert(sizeof(Art) == 62, "wrong size");
typedef struct ArtFrame { typedef struct ArtFrame {
short width; short width;
short height; short height;

View File

@ -12,8 +12,6 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
static_assert(sizeof(AudioFile) == 28, "wrong size");
// 0x5108C0 // 0x5108C0
AudioFileIsCompressedProc* _queryCompressedFunc_2 = _defaultCompressionFunc__; AudioFileIsCompressedProc* _queryCompressedFunc_2 = _defaultCompressionFunc__;

View File

@ -260,8 +260,6 @@ int _automapDisplayMap(int map)
void automapShow(bool isInGame, bool isUsingScanner) void automapShow(bool isInGame, bool isUsingScanner)
{ {
int frmIds[AUTOMAP_FRM_COUNT]; int frmIds[AUTOMAP_FRM_COUNT];
static_assert(sizeof(frmIds) == sizeof(gAutomapFrmIds), "wrong size");
memcpy(frmIds, gAutomapFrmIds, sizeof(gAutomapFrmIds)); memcpy(frmIds, gAutomapFrmIds, sizeof(gAutomapFrmIds));
unsigned char* frmData[AUTOMAP_FRM_COUNT]; unsigned char* frmData[AUTOMAP_FRM_COUNT];

View File

@ -8,9 +8,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
static_assert(sizeof(CacheEntry) == 32, "wrong size");
static_assert(sizeof(Cache) == 84, "wrong size");
// 0x510938 // 0x510938
int _lock_sound_ticker = 0; int _lock_sound_ticker = 0;

View File

@ -4477,7 +4477,6 @@ void _RestorePlayer()
char* _itostndn(int value, char* dest) char* _itostndn(int value, char* dest)
{ {
int v16[7]; int v16[7];
static_assert(sizeof(v16) == sizeof(dword_431DD4), "wrong size");
memcpy(v16, dword_431DD4, sizeof(v16)); memcpy(v16, dword_431DD4, sizeof(v16));
char* savedDest = dest; char* savedDest = dest;

View File

@ -104,8 +104,6 @@ typedef struct STRUCT_664980 {
int field_24; // flags on defender int field_24; // flags on defender
} STRUCT_664980; } STRUCT_664980;
static_assert(sizeof(STRUCT_664980) == 40, "wrong size");
typedef struct Attack { typedef struct Attack {
Object* attacker; Object* attacker;
int hitMode; int hitMode;
@ -130,8 +128,6 @@ typedef struct Attack {
int extrasKnockback[EXPLOSION_TARGET_COUNT]; int extrasKnockback[EXPLOSION_TARGET_COUNT];
} Attack; } Attack;
static_assert(sizeof(Attack) == 184, "wrong size");
// Provides metadata about critical hit effect. // Provides metadata about critical hit effect.
typedef struct CriticalHitDescription { typedef struct CriticalHitDescription {
int damageMultiplier; int damageMultiplier;

View File

@ -404,8 +404,6 @@ typedef struct STRUCT_51E2F0 {
}; };
} STRUCT_51E2F0; } STRUCT_51E2F0;
static_assert(sizeof(STRUCT_51E2F0) == 24, "wrong size");
typedef struct LogicalKeyEntry { typedef struct LogicalKeyEntry {
short field_0; short field_0;
short unmodified; short unmodified;

View File

@ -8,11 +8,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
static_assert(sizeof(DBase) == 20, "wrong size");
static_assert(sizeof(DBaseEntry) == 20, "wrong size");
static_assert(sizeof(DFile) == 44, "wrong size");
static_assert(sizeof(DFileFindData) == 524, "wrong size");
// Reads .DAT file contents. // Reads .DAT file contents.
// //
// 0x4E4F58 // 0x4E4F58

View File

@ -3410,7 +3410,6 @@ void gameDialogCombatControlButtonOnMouseUp(int btn, int keyCode)
int _gdPickAIUpdateMsg(Object* critter) int _gdPickAIUpdateMsg(Object* critter)
{ {
int pids[3]; int pids[3];
static_assert(sizeof(pids) == sizeof(_Dogs), "wrong size");
memcpy(pids, _Dogs, sizeof(pids)); memcpy(pids, _Dogs, sizeof(pids));
for (int index = 0; index < 3; index++) { for (int index = 0; index < 3; index++) {

View File

@ -7,12 +7,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
static_assert(sizeof(HeapBlockHeader) == 16, "wrong size");
static_assert(sizeof(HeapBlockFooter) == 4, "wrong size");
static_assert(sizeof(HeapMoveableExtent) == 16, "wrong size");
static_assert(sizeof(HeapHandle) == 8, "wrong size");
static_assert(sizeof(Heap) == 48, "wrong size");
// An array of pointers to free heap blocks. // An array of pointers to free heap blocks.
// //
// 0x518E9C // 0x518E9C

View File

@ -2198,11 +2198,9 @@ int objectGetCarriedQuantityByPid(Object* object, int pid)
void inventoryRenderSummary() void inventoryRenderSummary()
{ {
int v56[7]; int v56[7];
static_assert(sizeof(v56) == sizeof(dword_46E6D0), "wrong size");
memcpy(v56, dword_46E6D0, sizeof(v56)); memcpy(v56, dword_46E6D0, sizeof(v56));
int v57[7]; int v57[7];
static_assert(sizeof(v57) == sizeof(dword_46E6EC), "wrong size");
memcpy(v57, dword_46E6EC, sizeof(v57)); memcpy(v57, dword_46E6EC, sizeof(v57));
char formattedText[80]; char formattedText[80];
@ -3278,7 +3276,6 @@ int inventoryOpenLooting(Object* a1, Object* a2)
CacheEntry* arrowFrmHandles[INVENTORY_ARROW_FRM_COUNT]; CacheEntry* arrowFrmHandles[INVENTORY_ARROW_FRM_COUNT];
MessageListItem messageListItem; MessageListItem messageListItem;
static_assert(sizeof(arrowFrmIds) == sizeof(gInventoryArrowFrmIds), "wrong size");
memcpy(arrowFrmIds, gInventoryArrowFrmIds, sizeof(gInventoryArrowFrmIds)); memcpy(arrowFrmIds, gInventoryArrowFrmIds, sizeof(gInventoryArrowFrmIds));
if (a1 != _inven_dude) { if (a1 != _inven_dude) {

View File

@ -372,7 +372,6 @@ void _item_compact(int inventoryItemIndex, Inventory* inventory)
for (int index = inventoryItemIndex + 1; index < inventory->length; index++) { for (int index = inventoryItemIndex + 1; index < inventory->length; index++) {
InventoryItem* prev = &(inventory->items[index - 1]); InventoryItem* prev = &(inventory->items[index - 1]);
InventoryItem* curr = &(inventory->items[index]); InventoryItem* curr = &(inventory->items[index]);
static_assert(sizeof(*prev) == sizeof(*curr), "wrong size");
memcpy(prev, curr, sizeof(*prev)); memcpy(prev, curr, sizeof(*prev));
} }
inventory->length--; inventory->length--;

View File

@ -6,8 +6,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
static_assert(sizeof(Nevs) == 60, "wrong size");
// 0x6391C8 // 0x6391C8
Nevs* _nevs; Nevs* _nevs;

View File

@ -245,10 +245,6 @@ typedef struct Object {
int field_80; int field_80;
} Object; } Object;
#ifdef _WIN32
static_assert(sizeof(Object) == 132, "wrong size");
#endif
typedef struct ObjectListNode { typedef struct ObjectListNode {
Object* obj; Object* obj;
struct ObjectListNode* next; struct ObjectListNode* next;

View File

@ -599,7 +599,6 @@ int showPause(bool a1)
CacheEntry* frmHandles[PAUSE_WINDOW_FRM_COUNT]; CacheEntry* frmHandles[PAUSE_WINDOW_FRM_COUNT];
Size frmSizes[PAUSE_WINDOW_FRM_COUNT]; Size frmSizes[PAUSE_WINDOW_FRM_COUNT];
static_assert(sizeof(graphicIds) == sizeof(gPauseWindowFrmIds), "wrong size");
memcpy(graphicIds, gPauseWindowFrmIds, sizeof(gPauseWindowFrmIds)); memcpy(graphicIds, gPauseWindowFrmIds, sizeof(gPauseWindowFrmIds));
bool gameMouseWasVisible; bool gameMouseWasVisible;

View File

@ -99,8 +99,6 @@ typedef struct PreferenceDescription {
} PreferenceDescription; } PreferenceDescription;
#pragma pack() #pragma pack()
static_assert(sizeof(PreferenceDescription) == 76, "wrong size");
extern const int _row1Ytab[5]; extern const int _row1Ytab[5];
extern const int _row2Ytab[6]; extern const int _row2Ytab[6];
extern const int _row3Ytab[8]; extern const int _row3Ytab[8];

View File

@ -916,7 +916,6 @@ int _obj_use_power_on_car(Object* item)
MessageListItem messageListItem; MessageListItem messageListItem;
int messageNum; int messageNum;
static_assert(sizeof(messageListItem) == sizeof(stru_49A990), "wrong size");
memcpy(&messageListItem, &stru_49A990, sizeof(messageListItem)); memcpy(&messageListItem, &stru_49A990, sizeof(messageListItem));
bool isEnergy = false; bool isEnergy = false;

View File

@ -324,8 +324,6 @@ typedef struct ItemProto {
unsigned char field_80; unsigned char field_80;
} ItemProto; } ItemProto;
static_assert(sizeof(ItemProto) == 0x84, "wrong size");
typedef struct CritterProtoData { typedef struct CritterProtoData {
int flags; // d.flags int flags; // d.flags
int baseStats[35]; // d.stat_base int baseStats[35]; // d.stat_base
@ -353,8 +351,6 @@ typedef struct CritterProto {
int team; // team_num int team; // team_num
} CritterProto; } CritterProto;
static_assert(sizeof(CritterProto) == 0x1A0, "wrong size");
typedef struct { typedef struct {
int openFlags; // d.open_flags int openFlags; // d.open_flags
int keyCode; // d.key_code int keyCode; // d.key_code
@ -404,8 +400,6 @@ typedef struct SceneryProto {
unsigned char field_34; unsigned char field_34;
} SceneryProto; } SceneryProto;
static_assert(sizeof(SceneryProto) == 0x38, "wrong size");
typedef struct WallProto { typedef struct WallProto {
int pid; // id int pid; // id
int messageId; // message_num int messageId; // message_num
@ -418,8 +412,6 @@ typedef struct WallProto {
int material; // material int material; // material
} WallProto; } WallProto;
static_assert(sizeof(WallProto) == 0x24, "wrong size");
typedef struct TileProto { typedef struct TileProto {
int pid; // id int pid; // id
int messageId; // message_num int messageId; // message_num
@ -430,8 +422,6 @@ typedef struct TileProto {
int material; // material int material; // material
} TileProto; } TileProto;
static_assert(sizeof(TileProto) == 0x1C, "wrong size");
typedef struct MiscProto { typedef struct MiscProto {
int pid; // id int pid; // id
int messageId; // message_num int messageId; // message_num
@ -442,8 +432,6 @@ typedef struct MiscProto {
int extendedFlags; // flags_ext int extendedFlags; // flags_ext
} MiscProto; } MiscProto;
static_assert(sizeof(MiscProto) == 0x1C, "wrong size");
typedef union Proto { typedef union Proto {
struct { struct {
int pid; // pid int pid; // pid

View File

@ -6,8 +6,6 @@
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
static_assert(sizeof(Region) == 140, "wrong size");
char _aNull[] = "<null>"; char _aNull[] = "<null>";
// Probably recalculates bounding box of the region. // Probably recalculates bounding box of the region.

View File

@ -1040,7 +1040,6 @@ int scriptsRequestCombat(STRUCT_664980* a1)
} }
if (a1) { if (a1) {
static_assert(sizeof(stru_664958) == sizeof(*a1), "wrong size");
memcpy(&stru_664958, a1, sizeof(stru_664958)); memcpy(&stru_664958, a1, sizeof(stru_664958));
} else { } else {
gScriptsRequests |= SCRIPT_REQUEST_0x40; gScriptsRequests |= SCRIPT_REQUEST_0x40;

View File

@ -76,8 +76,6 @@ typedef enum ScriptProc {
SCRIPT_PROC_COUNT, SCRIPT_PROC_COUNT,
} ScriptProc; } ScriptProc;
static_assert(SCRIPT_PROC_COUNT == 28, "wrong count");
typedef struct ScriptsListEntry { typedef struct ScriptsListEntry {
char name[16]; char name[16];
int local_vars_num; int local_vars_num;
@ -150,8 +148,6 @@ typedef struct Script {
int field_DC; int field_DC;
} Script; } Script;
static_assert(sizeof(Script) == 0xE0, "wrong size");
typedef struct ScriptListExtent { typedef struct ScriptListExtent {
Script scripts[SCRIPT_LIST_EXTENT_SIZE]; Script scripts[SCRIPT_LIST_EXTENT_SIZE];
// Number of scripts in the extent // Number of scripts in the extent
@ -159,8 +155,6 @@ typedef struct ScriptListExtent {
struct ScriptListExtent* next; struct ScriptListExtent* next;
} ScriptListExtent; } ScriptListExtent;
static_assert(sizeof(ScriptListExtent) == 0xE08, "wrong size");
typedef struct ScriptList { typedef struct ScriptList {
ScriptListExtent* head; ScriptListExtent* head;
ScriptListExtent* tail; ScriptListExtent* tail;
@ -169,8 +163,6 @@ typedef struct ScriptList {
int nextScriptId; int nextScriptId;
} ScriptList; } ScriptList;
static_assert(sizeof(ScriptList) == 0x10, "wrong size");
extern char _Error_2[]; extern char _Error_2[];
extern char byte_50D6C0[]; extern char byte_50D6C0[];

View File

@ -667,7 +667,6 @@ int skillUse(Object* obj, Object* a2, int skill, int criticalChanceModifier)
if (critterGetBodyType(a2) != BODY_TYPE_ROBOTIC && critterIsCrippled(a2)) { if (critterGetBodyType(a2) != BODY_TYPE_ROBOTIC && critterIsCrippled(a2)) {
int flags[HEALABLE_DAMAGE_FLAGS_LENGTH]; int flags[HEALABLE_DAMAGE_FLAGS_LENGTH];
static_assert(sizeof(flags) == sizeof(gHealableDamageFlags), "wrong size");
memcpy(flags, gHealableDamageFlags, sizeof(gHealableDamageFlags)); memcpy(flags, gHealableDamageFlags, sizeof(gHealableDamageFlags));
for (int index = 0; index < HEALABLE_DAMAGE_FLAGS_LENGTH; index++) { for (int index = 0; index < HEALABLE_DAMAGE_FLAGS_LENGTH; index++) {
@ -852,7 +851,6 @@ int skillUse(Object* obj, Object* a2, int skill, int criticalChanceModifier)
if (currentHp < maximumHp || critterIsCrippled(a2)) { if (currentHp < maximumHp || critterIsCrippled(a2)) {
int flags[REPAIRABLE_DAMAGE_FLAGS_LENGTH]; int flags[REPAIRABLE_DAMAGE_FLAGS_LENGTH];
static_assert(sizeof(flags) == sizeof(gRepairableDamageFlags), "wrong size");
memcpy(flags, gRepairableDamageFlags, sizeof(gRepairableDamageFlags)); memcpy(flags, gRepairableDamageFlags, sizeof(gRepairableDamageFlags));
paletteFadeTo(gPaletteBlack); paletteFadeTo(gPaletteBlack);

View File

@ -9,8 +9,6 @@
#include <mmsystem.h> #include <mmsystem.h>
#include <stdlib.h> #include <stdlib.h>
static_assert(sizeof(Sound) == 156, "wrong size");
// 0x51D478 // 0x51D478
STRUCT_51D478* _fadeHead = NULL; STRUCT_51D478* _fadeHead = NULL;

View File

@ -39,10 +39,6 @@ typedef struct SoundDecoder {
int field_50; int field_50;
} SoundDecoder; } SoundDecoder;
#if _WIN32
static_assert(sizeof(SoundDecoder) == 84, "wrong size");
#endif
typedef int (*DECODINGPROC)(SoundDecoder* soundDecoder, int offset, int bits); typedef int (*DECODINGPROC)(SoundDecoder* soundDecoder, int offset, int bits);
extern int gSoundDecodersCount; extern int gSoundDecodersCount;

View File

@ -12,8 +12,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
static_assert(sizeof(SoundEffect) == 32, "wrong size");
// 0x50DE04 // 0x50DE04
const char* off_50DE04 = ""; const char* off_50DE04 = "";

View File

@ -70,7 +70,6 @@ int textFontsInit()
int currentFont = -1; int currentFont = -1;
FontManager fontManager; FontManager fontManager;
static_assert(sizeof(fontManager) == sizeof(gTextFontManager), "wrong size");
memcpy(&fontManager, &gTextFontManager, sizeof(fontManager)); memcpy(&fontManager, &gTextFontManager, sizeof(fontManager));
for (int font = 0; font < TEXT_FONT_MAX; font++) { for (int font = 0; font < TEXT_FONT_MAX; font++) {
@ -192,7 +191,6 @@ int fontManagerAdd(FontManager* fontManager)
} }
} }
static_assert(sizeof(*gFontManagers) == sizeof(*fontManager), "wrong size");
memcpy(&(gFontManagers[gFontManagersCount]), fontManager, sizeof(*fontManager)); memcpy(&(gFontManagers[gFontManagersCount]), fontManager, sizeof(*fontManager));
gFontManagersCount++; gFontManagersCount++;

View File

@ -31,8 +31,6 @@ typedef struct FontManager {
FontManagerGetMonospacedCharacterWidth* getMonospacedCharacterWidthProc; FontManagerGetMonospacedCharacterWidth* getMonospacedCharacterWidthProc;
} FontManager; } FontManager;
static_assert(sizeof(FontManager) == 44, "wrong size");
typedef struct TextFontGlyph { typedef struct TextFontGlyph {
// The width of the glyph in pixels. // The width of the glyph in pixels.
int width; int width;

View File

@ -10,8 +10,6 @@
#include "tile.h" #include "tile.h"
#include "word_wrap.h" #include "word_wrap.h"
static_assert(sizeof(TextObject) == 48, "wrong size");
// 0x51D944 // 0x51D944
int gTextObjectsCount = 0; int gTextObjectsCount = 0;

View File

@ -42,7 +42,6 @@ typedef struct ManagedButton {
int field_74; int field_74;
int field_78; int field_78;
} ManagedButton; } ManagedButton;
static_assert(sizeof(ManagedButton) == 0x7C, "wrong size");
typedef struct ManagedWindow { typedef struct ManagedWindow {
char name[32]; char name[32];

View File

@ -12,10 +12,6 @@
#include <SDL.h> #include <SDL.h>
static_assert(sizeof(struc_177) == 572, "wrong size");
static_assert(sizeof(Window) == 68, "wrong size");
static_assert(sizeof(Button) == 124, "wrong size");
// 0x50FA30 // 0x50FA30
char _path_patches[] = ""; char _path_patches[] = "";

View File

@ -37,10 +37,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
static_assert(sizeof(Terrain) == 128, "wrong size");
static_assert(sizeof(ENC_BASE_TYPE) == 3056, "wrong size");
static_assert(sizeof(EncounterTable) == 7460, "wrong size");
#define WM_TILE_WIDTH (350) #define WM_TILE_WIDTH (350)
#define WM_TILE_HEIGHT (300) #define WM_TILE_HEIGHT (300)
@ -2693,7 +2689,6 @@ bool _wmMapCanRestHere(int elevation)
int flags[3]; int flags[3];
// NOTE: I'm not sure why they're copied. // NOTE: I'm not sure why they're copied.
static_assert(sizeof(flags) == sizeof(_can_rest_here), "wrong size");
memcpy(flags, _can_rest_here, sizeof(flags)); memcpy(flags, _can_rest_here, sizeof(flags));
MapInfo* map = &(gMaps[gMapHeader.field_34]); MapInfo* map = &(gMaps[gMapHeader.field_34]);
@ -3250,7 +3245,6 @@ int _wmRndEncounterOccurred()
int modifiers[DAY_PART_COUNT]; int modifiers[DAY_PART_COUNT];
// NOTE: I'm not sure why they're copied. // NOTE: I'm not sure why they're copied.
static_assert(sizeof(modifiers) == sizeof(gDayPartEncounterFrequencyModifiers), "wrong size");
memcpy(modifiers, gDayPartEncounterFrequencyModifiers, sizeof(gDayPartEncounterFrequencyModifiers)); memcpy(modifiers, gDayPartEncounterFrequencyModifiers, sizeof(gDayPartEncounterFrequencyModifiers));
frequency -= modifiers[dayPart]; frequency -= modifiers[dayPart];
@ -5958,7 +5952,6 @@ int carGetCity()
int _wmCarGiveToParty() int _wmCarGiveToParty()
{ {
MessageListItem messageListItem; MessageListItem messageListItem;
static_assert(sizeof(messageListItem) == sizeof(stru_4BC880), "wrong size");
memcpy(&messageListItem, &stru_4BC880, sizeof(MessageListItem)); memcpy(&messageListItem, &stru_4BC880, sizeof(MessageListItem));
if (gWorldmapCarFuel <= 0) { if (gWorldmapCarFuel <= 0) {