More numeric to constant conversions..should be most of them... Please report any inventory abnormalities.

This commit is contained in:
Uleat
2014-07-31 07:52:38 -04:00
parent e902373ce7
commit 8b14c21a24
41 changed files with 1402 additions and 1018 deletions
+29 -19
View File
@@ -3049,26 +3049,28 @@ void NPC::CalcItemBonuses(StatBonuses *newbon)
}
}
void Client::CalcItemScale()
{
void Client::CalcItemScale() {
bool changed = false;
if(CalcItemScale(0, 21))
// MainAmmo excluded in helper function below
if(CalcItemScale(EmuConstants::EQUIPMENT_BEGIN, EmuConstants::EQUIPMENT_END)) // original coding excluded MainAmmo (< 21)
changed = true;
if(CalcItemScale(22, 30))
if(CalcItemScale(EmuConstants::GENERAL_BEGIN, EmuConstants::GENERAL_END)) // original coding excluded MainCursor (< 30)
changed = true;
if(CalcItemScale(251, 341))
// I excluded cursor bag slots here because cursor was excluded above..if this is incorrect, change 'slot_y' here to CURSOR_BAG_END
// and 'slot_y' above to CURSOR from GENERAL_END above - or however it is supposed to be...
if(CalcItemScale(EmuConstants::GENERAL_BAGS_BEGIN, EmuConstants::GENERAL_BAGS_END)) // (< 341)
changed = true;
if(CalcItemScale(400, 405))
if(CalcItemScale(EmuConstants::TRIBUTE_BEGIN, EmuConstants::TRIBUTE_END)) // (< 405)
changed = true;
//Power Source Slot
if (GetClientVersion() >= EQClientSoF)
{
if(CalcItemScale(9999, 10000))
if(CalcItemScale(MainPowerSource, MainPowerSource))
changed = true;
}
@@ -3078,13 +3080,15 @@ void Client::CalcItemScale()
}
}
bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
{
bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) {
// behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1
bool changed = false;
int i;
for (i = slot_x; i < slot_y; i++) {
for (i = slot_x; i <= slot_y; i++) {
if (i == MainAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot
continue;
ItemInst* inst = m_inv.GetItem(i);
if(inst == 0)
if(inst == nullptr)
continue;
bool update_slot = false;
@@ -3101,7 +3105,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
}
//iterate all augments
for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
{
ItemInst * a_inst = inst->GetAugment(x);
if(!a_inst)
@@ -3132,22 +3136,25 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
void Client::DoItemEnterZone() {
bool changed = false;
if(DoItemEnterZone(0, 21))
// MainAmmo excluded in helper function below
if(DoItemEnterZone(EmuConstants::EQUIPMENT_BEGIN, EmuConstants::EQUIPMENT_END)) // original coding excluded MainAmmo (< 21)
changed = true;
if(DoItemEnterZone(22, 30))
if(DoItemEnterZone(EmuConstants::GENERAL_BEGIN, EmuConstants::GENERAL_END)) // original coding excluded MainCursor (< 30)
changed = true;
if(DoItemEnterZone(251, 341))
// I excluded cursor bag slots here because cursor was excluded above..if this is incorrect, change 'slot_y' here to CURSOR_BAG_END
// and 'slot_y' above to CURSOR from GENERAL_END above - or however it is supposed to be...
if(DoItemEnterZone(EmuConstants::GENERAL_BAGS_BEGIN, EmuConstants::GENERAL_BAGS_END)) // (< 341)
changed = true;
if(DoItemEnterZone(400, 405))
if(DoItemEnterZone(EmuConstants::TRIBUTE_BEGIN, EmuConstants::TRIBUTE_END)) // (< 405)
changed = true;
//Power Source Slot
if (GetClientVersion() >= EQClientSoF)
{
if(DoItemEnterZone(9999, 10000))
if(DoItemEnterZone(MainPowerSource, MainPowerSource))
changed = true;
}
@@ -3158,8 +3165,11 @@ void Client::DoItemEnterZone() {
}
bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
// behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1
bool changed = false;
for(int i = slot_x; i < slot_y; i++) {
for(int i = slot_x; i <= slot_y; i++) {
if (i == MainAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot
continue;
ItemInst* inst = m_inv.GetItem(i);
if(!inst)
continue;
@@ -3188,7 +3198,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
}
//iterate all augments
for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
{
ItemInst *a_inst = inst->GetAugment(x);
if(!a_inst)