From 590e354030f4b00825f4e6d16a664399fa00bde8 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Tue, 17 Jan 2023 07:52:30 +0000 Subject: [PATCH] Reduce the size of SpellData 56 bytes -> 40 bytes Can be optimized further by reordering the fields and merging some flags. --- Source/spelldat.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/spelldat.h b/Source/spelldat.h index d36d73b11..f46623595 100644 --- a/Source/spelldat.h +++ b/Source/spelldat.h @@ -203,19 +203,19 @@ struct SpellData { uint8_t sManaCost; MagicType sType; const char *sNameText; - int sBookLvl; - int sStaffLvl; + int8_t sBookLvl; + int8_t sStaffLvl; bool sTargeted; bool sTownSpell; - int sMinInt; + int16_t sMinInt; _sfx_id sSFX; missile_id sMissiles[3]; uint8_t sManaAdj; uint8_t sMinMana; - int sStaffMin; - int sStaffMax; - int sBookCost; - int sStaffCost; + uint8_t sStaffMin; + uint8_t sStaffMax; + uint32_t sBookCost; + uint16_t sStaffCost; }; extern const SpellData spelldata[];