From 5a3b10a11c3c2ee4fdcc8d0c02e0bb33096e5f2d Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 14 Feb 2015 18:10:50 -0500 Subject: [PATCH] Constant name re-alignments prior to extended bandolier/potion belt activation --- common/database_conversions.cpp | 15 ++++++----- common/eq_dictionary.cpp | 42 ++++++++++++++--------------- common/eq_dictionary.h | 12 +++++---- common/eq_packet_structs.h | 6 ++--- common/patches/rof.cpp | 16 +++++------ common/patches/rof2.cpp | 16 +++++------ common/patches/rof2_constants.h | 7 ++--- common/patches/rof2_structs.h | 15 ++++------- common/patches/rof_constants.h | 7 ++--- common/patches/rof_structs.h | 15 ++++------- common/patches/sod.cpp | 4 +-- common/patches/sod_constants.h | 7 ++--- common/patches/sod_structs.h | 9 +++---- common/patches/sof.cpp | 4 +-- common/patches/sof_constants.h | 7 ++--- common/patches/sof_structs.h | 9 +++---- common/patches/titanium.cpp | 6 ++--- common/patches/titanium_constants.h | 7 ++--- common/patches/titanium_structs.h | 8 +++--- common/patches/uf.cpp | 4 +-- common/patches/uf_constants.h | 7 ++--- common/patches/uf_structs.h | 9 +++---- zone/zonedb.cpp | 6 ++--- 23 files changed, 114 insertions(+), 124 deletions(-) diff --git a/common/database_conversions.cpp b/common/database_conversions.cpp index 7d49522a3..f6c43687f 100644 --- a/common/database_conversions.cpp +++ b/common/database_conversions.cpp @@ -158,6 +158,8 @@ namespace Convert { /*88*/ } PVPStatsEntry_Struct; + static const size_t BANDOLIERS_SIZE = 4; + static const size_t BANDOLIER_ITEM_COUNT = 4; struct BandolierItem_Struct { uint32 ID; uint32 Icon; @@ -165,16 +167,17 @@ namespace Convert { }; struct Bandolier_Struct { char Name[32]; - Convert::BandolierItem_Struct Items[EmuConstants::BANDOLIER_SIZE]; + Convert::BandolierItem_Struct Items[Convert::BANDOLIER_ITEM_COUNT]; }; + static const size_t POTION_BELT_ITEM_COUNT = 4; struct PotionBeltItem_Struct { uint32 ID; uint32 Icon; char Name[64]; }; struct PotionBelt_Struct { - Convert::PotionBeltItem_Struct Items[EmuConstants::POTION_BELT_SIZE]; + Convert::PotionBeltItem_Struct Items[Convert::POTION_BELT_ITEM_COUNT]; }; struct SuspendedMinion_Struct @@ -354,7 +357,7 @@ namespace Convert { /*12800*/ uint32 expAA; /*12804*/ uint32 aapoints; //avaliable, unspent /*12808*/ uint8 unknown12844[36]; - /*12844*/ Convert::Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT]; + /*12844*/ Convert::Bandolier_Struct bandoliers[Convert::BANDOLIERS_SIZE]; /*14124*/ uint8 unknown14160[4506]; /*18630*/ Convert::SuspendedMinion_Struct SuspendedMinion; // No longer in use /*19240*/ uint32 timeentitledonaccount; @@ -1438,9 +1441,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){ if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Bandolier Convert */ first_entry = 0; rquery = ""; - for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++){ + for (i = 0; i < Convert::BANDOLIERS_SIZE; i++){ if (strlen(pp->bandoliers[i].Name) < 32) { - for (int si = 0; si < EmuConstants::BANDOLIER_SIZE; si++){ + for (int si = 0; si < Convert::BANDOLIER_ITEM_COUNT; si++){ if (pp->bandoliers[i].Items[si].ID > 0){ if (first_entry != 1) { rquery = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%i, %u, %i, %u, %u, '%s')", character_id, i, si, pp->bandoliers[i].Items[si].ID, pp->bandoliers[i].Items[si].Icon, pp->bandoliers[i].Name); @@ -1454,7 +1457,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){ if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Potion Belt Convert */ first_entry = 0; rquery = ""; - for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){ + for (i = 0; i < Convert::POTION_BELT_ITEM_COUNT; i++){ if (pp->potionbelt.Items[i].ID > 0){ if (first_entry != 1){ rquery = StringFormat("REPLACE INTO `character_potionbelt` (id, potion_id, item_id, icon) VALUES (%i, %u, %u, %u)", character_id, i, pp->potionbelt.Items[i].ID, pp->potionbelt.Items[i].Icon); diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index 026d84a31..a87ae569a 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -924,13 +924,13 @@ uint32 EQLimits::BandoliersCount(ClientVersion clientVersion) { static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::BANDOLIERS_COUNT, -/*Titanium*/ EmuConstants::BANDOLIERS_COUNT, -/*SoF*/ EmuConstants::BANDOLIERS_COUNT, -/*SoD*/ EmuConstants::BANDOLIERS_COUNT, -/*Underfoot*/ EmuConstants::BANDOLIERS_COUNT, -/*RoF*/ EmuConstants::BANDOLIERS_COUNT, -/*RoF2*/ EmuConstants::BANDOLIERS_COUNT, +/*62*/ NOT_USED, +/*Titanium*/ EmuConstants::BANDOLIERS_SIZE, +/*SoF*/ EmuConstants::BANDOLIERS_SIZE, +/*SoD*/ EmuConstants::BANDOLIERS_SIZE, +/*Underfoot*/ EmuConstants::BANDOLIERS_SIZE, +/*RoF*/ EmuConstants::BANDOLIERS_SIZE, +/*RoF2*/ EmuConstants::BANDOLIERS_SIZE, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -945,13 +945,13 @@ uint32 EQLimits::BandolierSize(ClientVersion clientVersion) { static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::BANDOLIER_SIZE, -/*Titanium*/ EmuConstants::BANDOLIER_SIZE, -/*SoF*/ EmuConstants::BANDOLIER_SIZE, -/*SoD*/ EmuConstants::BANDOLIER_SIZE, -/*Underfoot*/ EmuConstants::BANDOLIER_SIZE, -/*RoF*/ EmuConstants::BANDOLIER_SIZE, -/*RoF2*/ EmuConstants::BANDOLIER_SIZE, +/*62*/ NOT_USED, +/*Titanium*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*SoF*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*SoD*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*Underfoot*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*RoF*/ EmuConstants::BANDOLIER_ITEM_COUNT, +/*RoF2*/ EmuConstants::BANDOLIER_ITEM_COUNT, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -966,13 +966,13 @@ uint32 EQLimits::PotionBeltSize(ClientVersion clientVersion) { static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::POTION_BELT_SIZE, -/*Titanium*/ EmuConstants::POTION_BELT_SIZE, -/*SoF*/ EmuConstants::POTION_BELT_SIZE, -/*SoD*/ EmuConstants::POTION_BELT_SIZE, -/*Underfoot*/ EmuConstants::POTION_BELT_SIZE, -/*RoF*/ EmuConstants::POTION_BELT_SIZE, -/*RoF2*/ EmuConstants::POTION_BELT_SIZE, +/*62*/ NOT_USED, +/*Titanium*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*SoF*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*SoD*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*Underfoot*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*RoF*/ EmuConstants::POTION_BELT_ITEM_COUNT, +/*RoF2*/ EmuConstants::POTION_BELT_ITEM_COUNT, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 151397dd4..501fd52cf 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -141,12 +141,14 @@ public: static const uint16 ITEM_COMMON_SIZE = RoF::consts::ITEM_COMMON_SIZE; static const uint16 ITEM_CONTAINER_SIZE = Titanium::consts::ITEM_CONTAINER_SIZE; - // BANDOLIERS_COUNT sets maximum limit..active limit will need to be handled by the appropriate AA - static const uint32 BANDOLIERS_COUNT = Titanium::consts::BANDOLIERS_COUNT; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = Titanium::consts::BANDOLIER_SIZE; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = Titanium::consts::POTION_BELT_SIZE; + // BANDOLIERS_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?) + static const size_t BANDOLIERS_SIZE = Titanium::consts::BANDOLIERS_SIZE; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = Titanium::consts::BANDOLIER_ITEM_COUNT; // number of equipment slots in bandolier instance - static const size_t TEXT_LINK_BODY_LENGTH = 56; + // POTION_BELT_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?) + static const size_t POTION_BELT_ITEM_COUNT = Titanium::consts::POTION_BELT_ITEM_COUNT; + + static const size_t TEXT_LINK_BODY_LENGTH = RoF2::consts::TEXT_LINK_BODY_LENGTH; }; class EQLimits diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 9d49a3080..17fe7e913 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -778,7 +778,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[EmuConstants::BANDOLIER_SIZE]; + BandolierItem_Struct Items[EmuConstants::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -792,7 +792,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[EmuConstants::POTION_BELT_SIZE]; + PotionBeltItem_Struct Items[EmuConstants::POTION_BELT_ITEM_COUNT]; }; struct MovePotionToBelt_Struct @@ -1121,7 +1121,7 @@ struct PlayerProfile_Struct /*12800*/ uint32 expAA; /*12804*/ uint32 aapoints; //avaliable, unspent /*12808*/ uint8 unknown12844[36]; -/*12844*/ Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT]; +/*12844*/ Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_SIZE]; /*14124*/ uint8 unknown14160[4506]; /*18630*/ SuspendedMinion_Struct SuspendedMinion; // No longer in use /*19240*/ uint32 timeentitledonaccount; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 42b588ec3..86382e7b5 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2286,13 +2286,13 @@ namespace RoF outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(structs::MAX_PLAYER_BANDOLIER); + outapp->WriteUInt32(consts::BANDOLIERS_SIZE); - for (uint32 r = 0; r < EmuConstants::BANDOLIERS_COUNT; r++) + for (uint32 r = 0; r < EmuConstants::BANDOLIERS_SIZE; r++) { outapp->WriteString(emu->bandoliers[r].Name); - for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) + for (uint32 j = 0; j < EmuConstants::BANDOLIER_ITEM_COUNT; ++j) { outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); @@ -2308,11 +2308,11 @@ namespace RoF } } - for (uint32 r = 0; r < structs::MAX_PLAYER_BANDOLIER - EmuConstants::BANDOLIERS_COUNT; r++) + for (uint32 r = 0; r < consts::BANDOLIERS_SIZE - EmuConstants::BANDOLIERS_SIZE; r++) { outapp->WriteString(""); - for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) + for (uint32 j = 0; j < EmuConstants::BANDOLIER_ITEM_COUNT; ++j) { outapp->WriteString(""); outapp->WriteUInt32(0); @@ -2320,9 +2320,9 @@ namespace RoF } } - outapp->WriteUInt32(structs::MAX_POTIONS_IN_BELT); + outapp->WriteUInt32(consts::POTION_BELT_ITEM_COUNT); - for (uint32 r = 0; r < EmuConstants::POTION_BELT_SIZE; r++) + for (uint32 r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT; r++) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); @@ -2336,7 +2336,7 @@ namespace RoF } } - for (uint32 r = 0; r < structs::MAX_POTIONS_IN_BELT - EmuConstants::POTION_BELT_SIZE; r++) + for (uint32 r = 0; r < consts::POTION_BELT_ITEM_COUNT - EmuConstants::POTION_BELT_ITEM_COUNT; r++) { outapp->WriteString(""); outapp->WriteUInt32(0); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 4aec12ba1..ba06c2742 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2360,13 +2360,13 @@ namespace RoF2 outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(structs::MAX_PLAYER_BANDOLIER); + outapp->WriteUInt32(consts::BANDOLIERS_SIZE); - for (uint32 r = 0; r < EmuConstants::BANDOLIERS_COUNT; r++) + for (uint32 r = 0; r < EmuConstants::BANDOLIERS_SIZE; r++) { outapp->WriteString(emu->bandoliers[r].Name); - for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) + for (uint32 j = 0; j < EmuConstants::BANDOLIER_ITEM_COUNT; ++j) { outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); @@ -2382,11 +2382,11 @@ namespace RoF2 } } - for (uint32 r = 0; r < structs::MAX_PLAYER_BANDOLIER - EmuConstants::BANDOLIERS_COUNT; r++) + for (uint32 r = 0; r < consts::BANDOLIERS_SIZE - EmuConstants::BANDOLIERS_SIZE; r++) { outapp->WriteString(""); - for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) + for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { outapp->WriteString(""); outapp->WriteUInt32(0); @@ -2394,9 +2394,9 @@ namespace RoF2 } } - outapp->WriteUInt32(structs::MAX_POTIONS_IN_BELT); + outapp->WriteUInt32(consts::POTION_BELT_ITEM_COUNT); - for (uint32 r = 0; r < EmuConstants::POTION_BELT_SIZE; r++) + for (uint32 r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT; r++) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); @@ -2410,7 +2410,7 @@ namespace RoF2 } } - for (uint32 r = 0; r < structs::MAX_POTIONS_IN_BELT - EmuConstants::POTION_BELT_SIZE; r++) + for (uint32 r = 0; r < consts::POTION_BELT_ITEM_COUNT - EmuConstants::POTION_BELT_ITEM_COUNT; r++) { outapp->WriteString(""); outapp->WriteUInt32(0); diff --git a/common/patches/rof2_constants.h b/common/patches/rof2_constants.h index ca59511a1..867574670 100644 --- a/common/patches/rof2_constants.h +++ b/common/patches/rof2_constants.h @@ -178,9 +178,10 @@ namespace RoF2 { static const uint16 ITEM_COMMON_SIZE = 6; static const uint16 ITEM_CONTAINER_SIZE = 255; // 255; (server max will be 255..unsure what actual client is - test) - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 56; } diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 092d12d76..94f8bf4e7 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -97,11 +97,6 @@ static const uint32 MAX_PLAYER_TRIBUTES = 5; static const uint32 MAX_TRIBUTE_TIERS = 10; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; - -static const uint32 MAX_POTIONS_IN_BELT = 5; - static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_RAID_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_LEADERSHIP_AA_ARRAY = (MAX_GROUP_LEADERSHIP_AA_ARRAY+MAX_RAID_LEADERSHIP_AA_ARRAY); @@ -924,13 +919,13 @@ struct BandolierItem_Struct_Old struct Bandolier_Struct { char Name[1]; // Variable Length - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; struct Bandolier_Struct_Old { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; struct PotionBeltItem_Struct @@ -950,12 +945,12 @@ struct PotionBeltItem_Struct_Old struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; struct PotionBelt_Struct_Old { - PotionBeltItem_Struct_Old Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct_Old Items[consts::POTION_BELT_ITEM_COUNT]; }; struct GroupLeadershipAA_Struct { @@ -1165,7 +1160,7 @@ union /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 /*12953*/ uint16 unknown_rof20; // /*12955*/ uint32 bandolier_count; // Seen 20 -/*12959*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents +/*12959*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 /*13703*/ PotionBelt_Struct potionbelt; // [5] 45 bytes potion belt - (Variable Name Sizes) /*13748*/ int32 unknown_rof21; // Seen -1 diff --git a/common/patches/rof_constants.h b/common/patches/rof_constants.h index 92c019bad..4fbf21d47 100644 --- a/common/patches/rof_constants.h +++ b/common/patches/rof_constants.h @@ -177,9 +177,10 @@ namespace RoF { static const uint16 ITEM_COMMON_SIZE = 6; static const uint16 ITEM_CONTAINER_SIZE = 255; // 255; (server max will be 255..unsure what actual client is - test) - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 55; } diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 770dd250f..05cc5a346 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -97,11 +97,6 @@ static const uint32 MAX_PLAYER_TRIBUTES = 5; static const uint32 MAX_TRIBUTE_TIERS = 10; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; - -static const uint32 MAX_POTIONS_IN_BELT = 5; - static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_RAID_LEADERSHIP_AA_ARRAY = 16; static const uint32 MAX_LEADERSHIP_AA_ARRAY = (MAX_GROUP_LEADERSHIP_AA_ARRAY+MAX_RAID_LEADERSHIP_AA_ARRAY); @@ -908,13 +903,13 @@ struct BandolierItem_Struct_Old struct Bandolier_Struct { char Name[1]; // Variable Length - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; struct Bandolier_Struct_Old { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; struct PotionBeltItem_Struct @@ -934,12 +929,12 @@ struct PotionBeltItem_Struct_Old struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; struct PotionBelt_Struct_Old { - PotionBeltItem_Struct_Old Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct_Old Items[consts::POTION_BELT_ITEM_COUNT]; }; struct GroupLeadershipAA_Struct { @@ -1149,7 +1144,7 @@ union /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 /*12953*/ uint16 unknown_rof20; // /*12955*/ uint32 bandolier_count; // Seen 20 -/*12959*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents +/*12959*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 /*13703*/ PotionBelt_Struct potionbelt; // [5] 45 bytes potion belt - (Variable Name Sizes) /*13748*/ int32 unknown_rof21; // Seen -1 diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index c2a6eeaaa..81cb49f1a 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1612,14 +1612,14 @@ namespace SoD for (r = 0; r < 4; r++) { OUT_str(bandoliers[r].Name); uint32 k; - for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { + for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); - for (r = 0; r < structs::MAX_POTIONS_IN_BELT; r++) { + for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); diff --git a/common/patches/sod_constants.h b/common/patches/sod_constants.h index 7731d1d1f..6b587b7c4 100644 --- a/common/patches/sod_constants.h +++ b/common/patches/sod_constants.h @@ -174,9 +174,10 @@ namespace SoD { static const uint16 ITEM_COMMON_SIZE = 5; static const uint16 ITEM_CONTAINER_SIZE = 10; - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 50; } diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 18f17ce62..f929ec744 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -676,9 +676,6 @@ struct Disciplines_Struct { }; static const uint32 MAX_PLAYER_TRIBUTES = 5; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; -static const uint32 MAX_POTIONS_IN_BELT = 5; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; struct Tribute_Struct { @@ -707,7 +704,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -721,7 +718,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -941,7 +938,7 @@ struct PlayerProfile_Struct /*08288*/ uint32 aapoints_spent; // Number of spent AA points /*08292*/ uint32 aapoints; // Unspent AA points /*08296*/ uint8 unknown06160[4]; -/*08300*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [6400] bandolier contents +/*08300*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [6400] bandolier contents /*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*15060*/ uint8 unknown12852[8]; /*15068*/ uint32 available_slots; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index cf19582b0..01b6abb55 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1270,14 +1270,14 @@ namespace SoF for (r = 0; r < 4; r++) { OUT_str(bandoliers[r].Name); uint32 k; - for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { + for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); - for (r = 0; r < structs::MAX_POTIONS_IN_BELT; r++) { + for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); diff --git a/common/patches/sof_constants.h b/common/patches/sof_constants.h index b20e57196..f5376cd13 100644 --- a/common/patches/sof_constants.h +++ b/common/patches/sof_constants.h @@ -174,9 +174,10 @@ namespace SoF { static const uint16 ITEM_COMMON_SIZE = 5; static const uint16 ITEM_CONTAINER_SIZE = 10; - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 50; } diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 33773e91e..1510ded59 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -653,9 +653,6 @@ struct Disciplines_Struct { }; static const uint32 MAX_PLAYER_TRIBUTES = 5; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; -static const uint32 MAX_POTIONS_IN_BELT = 5; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; struct Tribute_Struct { @@ -684,7 +681,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -698,7 +695,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -917,7 +914,7 @@ struct PlayerProfile_Struct //23576 Octets /*08288*/ uint32 aapoints_spent; // Number of spent AA points /*08292*/ uint32 aapoints; // Unspent AA points /*08296*/ uint8 unknown06160[4]; -/*08300*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [6400] bandolier contents +/*08300*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [6400] bandolier contents /*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*15060*/ uint8 unknown12852[8]; /*15068*/ uint32 available_slots; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 7528a378d..b242a48b7 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -923,17 +923,17 @@ namespace Titanium OUT(aapoints_spent); OUT(aapoints); // OUT(unknown06160[4]); - for (r = 0; r < structs::MAX_PLAYER_BANDOLIER; r++) { + for (r = 0; r < consts::BANDOLIERS_SIZE; r++) { OUT_str(bandoliers[r].Name); uint32 k; - for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { + for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); - for (r = 0; r < structs::MAX_PLAYER_BANDOLIER_ITEMS; r++) { + for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); diff --git a/common/patches/titanium_constants.h b/common/patches/titanium_constants.h index 15338e220..61da2ba59 100644 --- a/common/patches/titanium_constants.h +++ b/common/patches/titanium_constants.h @@ -173,9 +173,10 @@ namespace Titanium { static const uint16 ITEM_COMMON_SIZE = 5; static const uint16 ITEM_CONTAINER_SIZE = 10; - static const uint32 BANDOLIERS_COUNT = 4; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 4; + static const size_t BANDOLIERS_SIZE = 4; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 4; static const size_t TEXT_LINK_BODY_LENGTH = 45; } diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 8286d125c..9a165a33d 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -586,8 +586,6 @@ struct Disciplines_Struct { }; static const uint32 MAX_PLAYER_TRIBUTES = 5; -static const uint32 MAX_PLAYER_BANDOLIER = 4; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; struct Tribute_Struct { uint32 tribute; @@ -615,7 +613,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -629,7 +627,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -833,7 +831,7 @@ struct PlayerProfile_Struct /*06152*/ uint32 aapoints_spent; // Number of spent AA points /*06156*/ uint32 aapoints; // Unspent AA points /*06160*/ uint8 unknown06160[4]; -/*06164*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // bandolier contents +/*06164*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // bandolier contents /*07444*/ uint8 unknown07444[5120]; /*12564*/ PotionBelt_Struct potionbelt; // potion belt /*12852*/ uint8 unknown12852[8]; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 334a6dc88..5827c652c 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1874,14 +1874,14 @@ namespace UF for (r = 0; r < 4; r++) { OUT_str(bandoliers[r].Name); uint32 k; - for (k = 0; k < structs::MAX_PLAYER_BANDOLIER_ITEMS; k++) { + for (k = 0; k < consts::BANDOLIER_ITEM_COUNT; k++) { OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // OUT(unknown07444[5120]); - for (r = 0; r < structs::MAX_POTIONS_IN_BELT; r++) { + for (r = 0; r < consts::POTION_BELT_ITEM_COUNT; r++) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); diff --git a/common/patches/uf_constants.h b/common/patches/uf_constants.h index 70b89df18..fc14af63f 100644 --- a/common/patches/uf_constants.h +++ b/common/patches/uf_constants.h @@ -174,9 +174,10 @@ namespace UF { static const uint16 ITEM_COMMON_SIZE = 5; static const uint16 ITEM_CONTAINER_SIZE = 10; - static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances - static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance - static const uint32 POTION_BELT_SIZE = 5; + static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances + static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + static const size_t POTION_BELT_ITEM_COUNT = 5; static const size_t TEXT_LINK_BODY_LENGTH = 50; } diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index 762419a67..f33ab7b4c 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -722,9 +722,6 @@ struct Disciplines_Struct { }; static const uint32 MAX_PLAYER_TRIBUTES = 5; -static const uint32 MAX_PLAYER_BANDOLIER = 20; -static const uint32 MAX_PLAYER_BANDOLIER_ITEMS = 4; -static const uint32 MAX_POTIONS_IN_BELT = 5; static const uint32 TRIBUTE_NONE = 0xFFFFFFFF; struct Tribute_Struct { @@ -753,7 +750,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[MAX_PLAYER_BANDOLIER_ITEMS]; + BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -767,7 +764,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[MAX_POTIONS_IN_BELT]; + PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -990,7 +987,7 @@ struct PlayerProfile_Struct /*11236*/ uint32 aapoints_spent; // Number of spent AA points /*11240*/ uint32 aapoints; // Unspent AA points /*11244*/ uint8 unknown11244[4]; -/*11248*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [6400] bandolier contents +/*11248*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [6400] bandolier contents /*17648*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*18008*/ uint8 unknown18008[8]; /*18016*/ uint32 available_slots; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8a95de0f4..d409e270a 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1179,8 +1179,8 @@ bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Str { std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT 16", character_id); auto results = database.QueryDatabase(query); int i = 0; int r = 0; int si = 0; - for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++) - for (int si = 0; si < EmuConstants::BANDOLIER_SIZE; si++) + for (i = 0; i < EmuConstants::BANDOLIERS_SIZE; i++) + for (int si = 0; si < EmuConstants::BANDOLIER_ITEM_COUNT; si++) pp->bandoliers[i].Items[si].Icon = 0; for (auto row = results.begin(); row != results.end(); ++row) { @@ -1218,7 +1218,7 @@ bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struc { std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT 4", character_id); auto results = database.QueryDatabase(query); int i = 0; - for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){ + for (i = 0; i < EmuConstants::POTION_BELT_ITEM_COUNT; i++){ pp->potionbelt.Items[i].Icon = 0; pp->potionbelt.Items[i].ID = 0; strncpy(pp->potionbelt.Items[i].Name, "\0", 1);