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;
static_assert(sizeof(STRUCT_530014) == 3240, "wrong size");
typedef Object* PathBuilderCallback(Object* object, int tile, int elevation);
extern int _curr_sad;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,11 +8,6 @@
#include <stdlib.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.
//
// 0x4E4F58

View File

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

View File

@ -7,12 +7,6 @@
#include <stdlib.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.
//
// 0x518E9C

View File

@ -2198,11 +2198,9 @@ int objectGetCarriedQuantityByPid(Object* object, int pid)
void inventoryRenderSummary()
{
int v56[7];
static_assert(sizeof(v56) == sizeof(dword_46E6D0), "wrong size");
memcpy(v56, dword_46E6D0, sizeof(v56));
int v57[7];
static_assert(sizeof(v57) == sizeof(dword_46E6EC), "wrong size");
memcpy(v57, dword_46E6EC, sizeof(v57));
char formattedText[80];
@ -3278,7 +3276,6 @@ int inventoryOpenLooting(Object* a1, Object* a2)
CacheEntry* arrowFrmHandles[INVENTORY_ARROW_FRM_COUNT];
MessageListItem messageListItem;
static_assert(sizeof(arrowFrmIds) == sizeof(gInventoryArrowFrmIds), "wrong size");
memcpy(arrowFrmIds, gInventoryArrowFrmIds, sizeof(gInventoryArrowFrmIds));
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++) {
InventoryItem* prev = &(inventory->items[index - 1]);
InventoryItem* curr = &(inventory->items[index]);
static_assert(sizeof(*prev) == sizeof(*curr), "wrong size");
memcpy(prev, curr, sizeof(*prev));
}
inventory->length--;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -76,8 +76,6 @@ typedef enum ScriptProc {
SCRIPT_PROC_COUNT,
} ScriptProc;
static_assert(SCRIPT_PROC_COUNT == 28, "wrong count");
typedef struct ScriptsListEntry {
char name[16];
int local_vars_num;
@ -150,8 +148,6 @@ typedef struct Script {
int field_DC;
} Script;
static_assert(sizeof(Script) == 0xE0, "wrong size");
typedef struct ScriptListExtent {
Script scripts[SCRIPT_LIST_EXTENT_SIZE];
// Number of scripts in the extent
@ -159,8 +155,6 @@ typedef struct ScriptListExtent {
struct ScriptListExtent* next;
} ScriptListExtent;
static_assert(sizeof(ScriptListExtent) == 0xE08, "wrong size");
typedef struct ScriptList {
ScriptListExtent* head;
ScriptListExtent* tail;
@ -169,8 +163,6 @@ typedef struct ScriptList {
int nextScriptId;
} ScriptList;
static_assert(sizeof(ScriptList) == 0x10, "wrong size");
extern char _Error_2[];
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)) {
int flags[HEALABLE_DAMAGE_FLAGS_LENGTH];
static_assert(sizeof(flags) == sizeof(gHealableDamageFlags), "wrong size");
memcpy(flags, gHealableDamageFlags, sizeof(gHealableDamageFlags));
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)) {
int flags[REPAIRABLE_DAMAGE_FLAGS_LENGTH];
static_assert(sizeof(flags) == sizeof(gRepairableDamageFlags), "wrong size");
memcpy(flags, gRepairableDamageFlags, sizeof(gRepairableDamageFlags));
paletteFadeTo(gPaletteBlack);

View File

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

View File

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

View File

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

View File

@ -70,7 +70,6 @@ int textFontsInit()
int currentFont = -1;
FontManager fontManager;
static_assert(sizeof(fontManager) == sizeof(gTextFontManager), "wrong size");
memcpy(&fontManager, &gTextFontManager, sizeof(fontManager));
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));
gFontManagersCount++;

View File

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

View File

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

View File

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

View File

@ -12,10 +12,6 @@
#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
char _path_patches[] = "";

View File

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