double to float explicit conversions

This commit is contained in:
Arthur Dene Ice 2014-05-10 18:52:59 -07:00
parent 02a457e601
commit 6985f90477
28 changed files with 142 additions and 142 deletions

View File

@ -72,7 +72,7 @@ void EQStream::init() {
if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) { if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) {
retransmittimer = Timer::GetCurrentTime(); retransmittimer = Timer::GetCurrentTime();
retransmittimeout = (uint32)500 * RETRANSMIT_TIMEOUT_MULT; retransmittimeout = (uint32)(500 * RETRANSMIT_TIMEOUT_MULT);
} }
OpMgr = nullptr; OpMgr = nullptr;
@ -478,10 +478,10 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
if(RETRANSMIT_TIMEOUT_MULT && ntohl(Stats->average_delta)) { if(RETRANSMIT_TIMEOUT_MULT && ntohl(Stats->average_delta)) {
//recalculate retransmittimeout using the larger of the last rtt or average rtt, which is multiplied by the rule value //recalculate retransmittimeout using the larger of the last rtt or average rtt, which is multiplied by the rule value
if((ntohl(Stats->last_local_delta) + ntohl(Stats->last_remote_delta)) > (ntohl(Stats->average_delta) * 2)) { if((ntohl(Stats->last_local_delta) + ntohl(Stats->last_remote_delta)) > (ntohl(Stats->average_delta) * 2)) {
retransmittimeout = (uint32)(ntohl(Stats->last_local_delta) + ntohl(Stats->last_remote_delta)) retransmittimeout = (uint32)((ntohl(Stats->last_local_delta) + ntohl(Stats->last_remote_delta))
* RETRANSMIT_TIMEOUT_MULT; * RETRANSMIT_TIMEOUT_MULT);
} else { } else {
retransmittimeout = (uint32)ntohl(Stats->average_delta) * 2 * RETRANSMIT_TIMEOUT_MULT; retransmittimeout = (uint32)(ntohl(Stats->average_delta) * 2 * RETRANSMIT_TIMEOUT_MULT);
} }
if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX) if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX)
retransmittimeout = RETRANSMIT_TIMEOUT_MAX; retransmittimeout = RETRANSMIT_TIMEOUT_MAX;

View File

@ -755,7 +755,7 @@ void Client::AI_Process()
engaged = true; engaged = true;
} else { } else {
if(AImovement_timer->Check()) { if(AImovement_timer->Check()) {
animation = GetRunspeed() * 21; animation = (uint16)(GetRunspeed() * 21);
// Check if we have reached the last fear point // Check if we have reached the last fear point
if((ABS(GetX()-fear_walkto_x) < 0.1) && (ABS(GetY()-fear_walkto_y) <0.1)) { if((ABS(GetX()-fear_walkto_x) < 0.1) && (ABS(GetY()-fear_walkto_y) <0.1)) {
// Calculate a new point to run to // Calculate a new point to run to
@ -917,7 +917,7 @@ void Client::AI_Process()
{ {
if(!IsRooted()) if(!IsRooted())
{ {
animation = 21 * GetRunspeed(); animation = (uint16)(GetRunspeed() * 21);
if(!RuleB(Pathing, Aggro) || !zone->pathing) if(!RuleB(Pathing, Aggro) || !zone->pathing)
CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed());
else else
@ -974,7 +974,7 @@ void Client::AI_Process()
if (dist >= 100) if (dist >= 100)
{ {
float speed = dist >= 225 ? GetRunspeed() : GetWalkspeed(); float speed = dist >= 225 ? GetRunspeed() : GetWalkspeed();
animation = 21 * speed; animation = (uint16)(speed * 21);
CalculateNewPosition2(owner->GetX(), owner->GetY(), owner->GetZ(), speed); CalculateNewPosition2(owner->GetX(), owner->GetY(), owner->GetZ(), speed);
} }
else else
@ -1607,9 +1607,9 @@ void NPC::AI_DoMovement() {
//New coord is still invalid, ignore distance and just pick a new random coord. //New coord is still invalid, ignore distance and just pick a new random coord.
//If we're here we may have a roambox where one side is shorter than the specified distance. Commons, Wkarana, etc. //If we're here we may have a roambox where one side is shorter than the specified distance. Commons, Wkarana, etc.
if (roambox_movingto_x > roambox_max_x || roambox_movingto_x < roambox_min_x) if (roambox_movingto_x > roambox_max_x || roambox_movingto_x < roambox_min_x)
roambox_movingto_x = MakeRandomFloat(roambox_min_x+1,roambox_max_x-1); roambox_movingto_x = (float)MakeRandomFloat(roambox_min_x+1,roambox_max_x-1);
if (roambox_movingto_y > roambox_max_y || roambox_movingto_y < roambox_min_y) if (roambox_movingto_y > roambox_max_y || roambox_movingto_y < roambox_min_y)
roambox_movingto_y = MakeRandomFloat(roambox_min_y+1,roambox_max_y-1); roambox_movingto_y = (float)MakeRandomFloat(roambox_min_y+1,roambox_max_y-1);
} }
mlog(AI__WAYPOINTS, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", mlog(AI__WAYPOINTS, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)",

View File

@ -433,8 +433,8 @@ void Object::RandomSpawn(bool send_packet) {
if(!m_ground_spawn) if(!m_ground_spawn)
return; return;
m_data.x = MakeRandomFloat(m_min_x, m_max_x); m_data.x = (float)MakeRandomFloat(m_min_x, m_max_x);
m_data.y = MakeRandomFloat(m_min_y, m_max_y); m_data.y = (float)MakeRandomFloat(m_min_y, m_max_y);
respawn_timer.Disable(); respawn_timer.Disable();
if(send_packet) { if(send_packet) {
@ -651,12 +651,12 @@ Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Gro
safe_delete_array(query); safe_delete_array(query);
int i=0; int i=0;
while( (row=mysql_fetch_row(result) ) ) { while( (row=mysql_fetch_row(result) ) ) {
gs->spawn[i].max_x=atof(row[0]); gs->spawn[i].max_x=(float)atof(row[0]);
gs->spawn[i].max_y=atof(row[1]); gs->spawn[i].max_y=(float)atof(row[1]);
gs->spawn[i].max_z=atof(row[2]); gs->spawn[i].max_z=(float)atof(row[2]);
gs->spawn[i].min_x=atof(row[3]); gs->spawn[i].min_x=(float)atof(row[3]);
gs->spawn[i].min_y=atof(row[4]); gs->spawn[i].min_y=(float)atof(row[4]);
gs->spawn[i].heading=atof(row[5]); gs->spawn[i].heading=(float)atof(row[5]);
strcpy(gs->spawn[i].name,row[6]); strcpy(gs->spawn[i].name,row[6]);
gs->spawn[i].item=atoi(row[7]); gs->spawn[i].item=atoi(row[7]);
gs->spawn[i].max_allowed=atoi(row[8]); gs->spawn[i].max_allowed=atoi(row[8]);

View File

@ -4199,7 +4199,7 @@ uint16 Client::GetTotalATK()
uint16 WornCap = itembonuses.ATK; uint16 WornCap = itembonuses.ATK;
if(IsClient()) { if(IsClient()) {
AttackRating = ((WornCap * 1.342) + (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69)); AttackRating = (uint16)((WornCap * 1.342) + (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69));
AttackRating += aabonuses.ATK + GroupLeadershipAAOffenseEnhancement(); AttackRating += aabonuses.ATK + GroupLeadershipAAOffenseEnhancement();
if (AttackRating < 10) if (AttackRating < 10)
@ -4217,7 +4217,7 @@ uint16 Client::GetATKRating()
{ {
uint16 AttackRating = 0; uint16 AttackRating = 0;
if(IsClient()) { if(IsClient()) {
AttackRating = (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69); AttackRating = (uint16)((GetSkill(SkillOffense) * 1.345) + (GetSTR() - 66) * 0.9 + (GetPrimarySkillValue() * 2.69));
if (AttackRating < 10) if (AttackRating < 10)
AttackRating = 10; AttackRating = 10;

View File

@ -245,7 +245,7 @@ int32 Client::CalcMaxHP() {
//the aa description //the aa description
nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability
max_hp = (float)max_hp * (float)nd / (float)10000; //this is to fix the HP-above-495k issue max_hp = (int32)(max_hp * nd / 10000); //this is to fix the HP-above-495k issue
max_hp += spellbonuses.HP + aabonuses.HP; max_hp += spellbonuses.HP + aabonuses.HP;
max_hp += GroupLeadershipAAHealthEnhancement(); max_hp += GroupLeadershipAAHealthEnhancement();
@ -381,7 +381,7 @@ int32 Client::CalcBaseHP()
base_hp = 5; base_hp = 5;
auto base_data = database.GetBaseData(GetLevel(), GetClass()); auto base_data = database.GetBaseData(GetLevel(), GetClass());
if(base_data) { if(base_data) {
base_hp += base_data->base_hp + (base_data->hp_factor * stats); base_hp = (int32)(base_hp + base_data->base_hp + (base_data->hp_factor * stats));
base_hp += (GetHeroicSTA() * 10); base_hp += (GetHeroicSTA() * 10);
} }
} }

View File

@ -4668,7 +4668,7 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app)
if(GetClientVersion() < EQClientSoD) if(GetClientVersion() < EQClientSoD)
IntoxicationIncrease = (200 - AlcoholTolerance) * 30 / 200 + 10; IntoxicationIncrease = (200 - AlcoholTolerance) * 30 / 200 + 10;
else else
IntoxicationIncrease = (270 - AlcoholTolerance) * 0.111111108 + 10; IntoxicationIncrease = (int16)((270 - AlcoholTolerance) * 0.111111108 + 10.0);
if(IntoxicationIncrease < 0) if(IntoxicationIncrease < 0)
IntoxicationIncrease = 1; IntoxicationIncrease = 1;
@ -5597,9 +5597,9 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
int SinglePrice = 0; int SinglePrice = 0;
if (RuleB(Merchant, UsePriceMod)) if (RuleB(Merchant, UsePriceMod))
SinglePrice = (item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(tmp, false)); SinglePrice = (int)(item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(tmp, false));
else else
SinglePrice = (item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate); SinglePrice = (int)(item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate);
if(item->MaxCharges > 1) if(item->MaxCharges > 1)
mpo->price = SinglePrice; mpo->price = SinglePrice;
@ -5801,10 +5801,10 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
if(charges > 0 && (freeslot = zone->SaveTempItem(vendor->CastToNPC()->MerchantType, vendor->GetNPCTypeID(),itemid,charges,true)) > 0){ if(charges > 0 && (freeslot = zone->SaveTempItem(vendor->CastToNPC()->MerchantType, vendor->GetNPCTypeID(),itemid,charges,true)) > 0){
ItemInst* inst2 = inst->Clone(); ItemInst* inst2 = inst->Clone();
if (RuleB(Merchant, UsePriceMod)){ if (RuleB(Merchant, UsePriceMod)){
inst2->SetPrice(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(vendor,false)); inst2->SetPrice((uint32)(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(vendor,false)));
} }
else else
inst2->SetPrice(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate); inst2->SetPrice((uint32)(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate));
inst2->SetMerchantSlot(freeslot); inst2->SetMerchantSlot(freeslot);
uint32 MerchantQuantity = zone->GetTempMerchantQuantity(vendor->GetNPCTypeID(), freeslot); uint32 MerchantQuantity = zone->GetTempMerchantQuantity(vendor->GetNPCTypeID(), freeslot);
@ -11475,9 +11475,9 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
if(zoneid == StartCity) { if(zoneid == StartCity) {
ValidCity = true; ValidCity = true;
x = atof(row[2]); x = (float)atof(row[2]);
y = atof(row[3]); y = (float)atof(row[3]);
z = atof(row[4]); z = (float)atof(row[4]);
} }
} }

View File

@ -1010,10 +1010,10 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
ItemInst* inst = database.CreateItem(item, charges); ItemInst* inst = database.CreateItem(item, charges);
if (inst) { if (inst) {
if (RuleB(Merchant, UsePriceMod)){ if (RuleB(Merchant, UsePriceMod)){
inst->SetPrice((item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(merch,false))); inst->SetPrice((uint32)(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(merch,false)));
} }
else else
inst->SetPrice((item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate)); inst->SetPrice((uint32)(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate));
inst->SetMerchantSlot(ml.slot); inst->SetMerchantSlot(ml.slot);
inst->SetMerchantCount(-1); //unlimited inst->SetMerchantCount(-1); //unlimited
if(charges > 0) if(charges > 0)
@ -1048,10 +1048,10 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
ItemInst* inst = database.CreateItem(item, charges); ItemInst* inst = database.CreateItem(item, charges);
if (inst) { if (inst) {
if (RuleB(Merchant, UsePriceMod)){ if (RuleB(Merchant, UsePriceMod)){
inst->SetPrice((item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(merch,false))); inst->SetPrice((uint32)(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(merch,false)));
} }
else else
inst->SetPrice((item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate)); inst->SetPrice((uint32)(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate));
inst->SetMerchantSlot(ml.slot); inst->SetMerchantSlot(ml.slot);
inst->SetMerchantCount(ml.charges); inst->SetMerchantCount(ml.charges);
if(charges > 0) if(charges > 0)
@ -1517,11 +1517,11 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
// will say 11, but the client will have 1 left on their cursor, so we have // will say 11, but the client will have 1 left on their cursor, so we have
// to figure out the conversion ourselves // to figure out the conversion ourselves
amount_to_add = amount_to_take * ((float)CoinTypeCoppers(mc->cointype1) / (float)CoinTypeCoppers(mc->cointype2)); amount_to_add = (uint64)(amount_to_take * ((float)CoinTypeCoppers(mc->cointype1) / (float)CoinTypeCoppers(mc->cointype2)));
// the amount we're adding could be different than what was requested, so // the amount we're adding could be different than what was requested, so
// we have to adjust the amount we take as well // we have to adjust the amount we take as well
amount_to_take = amount_to_add * ((float)CoinTypeCoppers(mc->cointype2) / (float)CoinTypeCoppers(mc->cointype1)); amount_to_take = (uint64)(amount_to_add * ((float)CoinTypeCoppers(mc->cointype2) / (float)CoinTypeCoppers(mc->cointype1)));
// now we should have a from_bucket, a to_bucket, an amount_to_take // now we should have a from_bucket, a to_bucket, an amount_to_take
// and an amount_to_add // and an amount_to_add

View File

@ -1861,7 +1861,7 @@ Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) {
lengths = mysql_fetch_lengths(result); lengths = mysql_fetch_lengths(result);
if(row && lengths) if(row && lengths)
{ {
NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), atoi(row[1]), row[2], (uchar*) row[7], lengths[7], atof(row[3]), atoi(row[4]), atoi(row[5]), atoi(row[6]), row[8],atoi(row[9])==1, atoi(row[10]) != 0); NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), atoi(row[1]), row[2], (uchar*) row[7], lengths[7], (float)atof(row[3]), atoi(row[4]), atoi(row[5]), atoi(row[6]), row[8],atoi(row[9])==1, atoi(row[10]) != 0);
entity_list.AddCorpse(NewCorpse); entity_list.AddCorpse(NewCorpse);
} }
mysql_free_result(result); mysql_free_result(result);
@ -1894,7 +1894,7 @@ bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) {
safe_delete_array(query); safe_delete_array(query);
while ((row = mysql_fetch_row(result))) { while ((row = mysql_fetch_row(result))) {
lengths = mysql_fetch_lengths(result); lengths = mysql_fetch_lengths(result);
entity_list.AddCorpse(Corpse::LoadFromDBData(atoi(row[0]), atoi(row[1]), row[2], (uchar*) row[7], lengths[7], atof(row[3]), atoi(row[4]), atoi(row[5]), atoi(row[6]), row[8],atoi(row[9])==1, atoi(row[10]) != 0)); entity_list.AddCorpse(Corpse::LoadFromDBData(atoi(row[0]), atoi(row[1]), row[2], (uchar*) row[7], lengths[7], (float)atof(row[3]), atoi(row[4]), atoi(row[5]), atoi(row[6]), row[8],atoi(row[9])==1, atoi(row[10]) != 0));
} }
mysql_free_result(result); mysql_free_result(result);
} }

View File

@ -260,7 +260,7 @@ int32 Mob::GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_s
if (total_cast_time > 0 && total_cast_time <= 2500) if (total_cast_time > 0 && total_cast_time <= 2500)
extra_spell_amt = extra_spell_amt*25/100; extra_spell_amt = extra_spell_amt*25/100;
else if (total_cast_time > 2500 && total_cast_time < 7000) else if (total_cast_time > 2500 && total_cast_time < 7000)
extra_spell_amt = extra_spell_amt*(0.167*((total_cast_time - 1000)/1000)); extra_spell_amt = (int32)(extra_spell_amt*(0.167*((total_cast_time - 1000)/1000)));
else else
extra_spell_amt = extra_spell_amt * total_cast_time / 7000; extra_spell_amt = extra_spell_amt * total_cast_time / 7000;
@ -408,11 +408,11 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost)
break; break;
} }
bonus += 0.05 * GetAA(aaAdvancedSpellCastingMastery); bonus += 0.05f * GetAA(aaAdvancedSpellCastingMastery);
if(SuccessChance <= (SpecializeSkill * 0.3 * bonus)) if(SuccessChance <= (SpecializeSkill * 0.3 * bonus))
{ {
PercentManaReduction = 1 + 0.05 * SpecializeSkill; PercentManaReduction = 1.0f + 0.05f * SpecializeSkill;
switch(GetAA(aaSpellCastingMastery)) switch(GetAA(aaSpellCastingMastery))
{ {
case 1: case 1:
@ -444,7 +444,7 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost)
if(focus_redux > 0) if(focus_redux > 0)
{ {
PercentManaReduction += MakeRandomFloat(1, (double)focus_redux); PercentManaReduction += (float)MakeRandomFloat(1, (double)focus_redux);
} }
cost = (int32)(cost -(cost * (PercentManaReduction / 100))); cost = (int32)(cost -(cost * (PercentManaReduction / 100)));

View File

@ -3058,7 +3058,7 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
if (cur->CheckAggro(caster)) { if (cur->CheckAggro(caster)) {
cur->AddToHateList(caster, thedam); cur->AddToHateList(caster, thedam);
} else { } else {
cur->AddToHateList(caster, thedam * 0.33); cur->AddToHateList(caster, (uint16)(thedam * 0.33f));
} }
} }
} }
@ -4548,9 +4548,9 @@ void EntityList::GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height,
++it; ++it;
continue; continue;
} }
int32 x_diff = ptr->GetX() - start->GetX(); int32 x_diff = (int32)(ptr->GetX() - start->GetX());
int32 y_diff = ptr->GetY() - start->GetY(); int32 y_diff = (int32)(ptr->GetY() - start->GetY());
int32 z_diff = ptr->GetZ() - start->GetZ(); int32 z_diff = (int32)(ptr->GetZ() - start->GetZ());
x_diff *= x_diff; x_diff *= x_diff;
y_diff *= y_diff; y_diff *= y_diff;

View File

@ -542,11 +542,11 @@ void Group::SplitExp(uint32 exp, Mob* other) {
float groupmod; float groupmod;
if (membercount > 1 && membercount < 6) if (membercount > 1 && membercount < 6)
groupmod = 1 + .2*(membercount - 1); //2members=1.2exp, 3=1.4, 4=1.6, 5=1.8 groupmod = 1.0f + .2f*(membercount - 1); //2members=1.2exp, 3=1.4, 4=1.6, 5=1.8
else if (membercount == 6) else if (membercount == 6)
groupmod = 2.16; groupmod = 2.16f;
else else
groupmod = 1.0; groupmod = 1.0f;
groupexp += (uint32)((float)exp * groupmod * (RuleR(Character, GroupExpMultiplier))); groupexp += (uint32)((float)exp * groupmod * (RuleR(Character, GroupExpMultiplier)));

View File

@ -235,8 +235,8 @@ bool Client::CanFish() {
HeadingDegrees = (int) ((GetHeading()*360)/256); HeadingDegrees = (int) ((GetHeading()*360)/256);
HeadingDegrees = HeadingDegrees % 360; HeadingDegrees = HeadingDegrees % 360;
RodX = x_pos + RodLength * sin(HeadingDegrees * M_PI/180.0f); RodX = (float)(x_pos + RodLength * sin(HeadingDegrees * M_PI/180.0f));
RodY = y_pos + RodLength * cos(HeadingDegrees * M_PI/180.0f); RodY = (float)(y_pos + RodLength * cos(HeadingDegrees * M_PI/180.0f));
// Do BestZ to find where the line hanging from the rod intersects the water (if it is water). // Do BestZ to find where the line hanging from the rod intersects the water (if it is water).
// and go 1 unit into the water. // and go 1 unit into the water.

View File

@ -99,7 +99,7 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
npc_type->loottable_id = 0; npc_type->loottable_id = 0;
npc_type->texture = atoi(row[2]); npc_type->texture = atoi(row[2]);
npc_type->helmtexture = atoi(row[2]); npc_type->helmtexture = atoi(row[2]);
npc_type->runspeed = atof(row[3]); npc_type->runspeed = (float)atof(row[3]);
mount_color = atoi(row[2]); mount_color = atoi(row[2]);

View File

@ -91,7 +91,7 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite
float drop_chance = 0.0f; float drop_chance = 0.0f;
if(ltchance > 0.0 && ltchance < 100.0) { if(ltchance > 0.0 && ltchance < 100.0) {
drop_chance = MakeRandomFloat(0.0, 100.0); drop_chance = (float)MakeRandomFloat(0.0, 100.0);
} }
if (ltchance != 0.0 && (ltchance == 100.0 || drop_chance < ltchance)) { if (ltchance != 0.0 && (ltchance == 100.0 || drop_chance < ltchance)) {
@ -136,7 +136,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml
float drop_chance = 0.0; float drop_chance = 0.0;
if(thischance != 100.0) if(thischance != 100.0)
drop_chance = MakeRandomFloat(0.0, 100.0); drop_chance = (float)MakeRandomFloat(0.0, 100.0);
#if EQDEBUG>=11 #if EQDEBUG>=11
LogFile->write(EQEMuLog::Debug, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); LogFile->write(EQEMuLog::Debug, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance);

View File

@ -907,7 +907,7 @@ int32 Merc::CalcMaxHP() {
//the aa description //the aa description
nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability
max_hp = (float)max_hp * (float)nd / (float)10000; //this is to fix the HP-above-495k issue max_hp = (int32)(max_hp * nd / 10000); //this is to fix the HP-above-495k issue
max_hp += spellbonuses.HP + aabonuses.HP; max_hp += spellbonuses.HP + aabonuses.HP;
max_hp += GroupLeadershipAAHealthEnhancement(); max_hp += GroupLeadershipAAHealthEnhancement();
@ -1584,7 +1584,7 @@ void Merc::AI_Process() {
float meleeDistance = GetMaxMeleeRangeToTarget(GetTarget()); float meleeDistance = GetMaxMeleeRangeToTarget(GetTarget());
if(GetClass() == SHADOWKNIGHT || GetClass() == PALADIN || GetClass() == WARRIOR) { if(GetClass() == SHADOWKNIGHT || GetClass() == PALADIN || GetClass() == WARRIOR) {
meleeDistance = meleeDistance * .30; meleeDistance = meleeDistance * .30f;
} }
else { else {
meleeDistance *= (float)MakeRandomFloat(.50, .85); meleeDistance *= (float)MakeRandomFloat(.50, .85);
@ -2128,7 +2128,7 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) {
if(g->members[i]->HasPet() && g->members[i]->GetPet()->GetHPRatio() < checkHPR) { if(g->members[i]->HasPet() && g->members[i]->GetPet()->GetHPRatio() < checkHPR) {
if(!tar || ((g->members[i]->GetPet()->GetHPRatio() + 25) < tar->GetHPRatio())) { if(!tar || ((g->members[i]->GetPet()->GetHPRatio() + 25) < tar->GetHPRatio())) {
tar = g->members[i]->GetPet(); tar = g->members[i]->GetPet();
checkPetHPR = g->members[i]->GetPet()->GetHPRatio() + 25; checkPetHPR = (int8)(g->members[i]->GetPet()->GetHPRatio() + 25);
} }
} }
@ -2822,7 +2822,7 @@ int32 Merc::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5)
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value)*ratio/100; value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value)*ratio/100;
value = (value * GetSpellScale() / 100); value = (int32)(value * GetSpellScale() / 100);
entity_list.MessageClose_StringID(this, false, 100, MT_SpellCrits, entity_list.MessageClose_StringID(this, false, 100, MT_SpellCrits,
OTHER_CRIT_BLAST, GetName(), itoa(-value)); OTHER_CRIT_BLAST, GetName(), itoa(-value));
@ -2849,7 +2849,7 @@ int32 Merc::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5)
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value); value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value);
value = (value * GetSpellScale() / 100); value = (int32)(value * GetSpellScale() / 100);
return value; return value;
} }
@ -2940,7 +2940,7 @@ int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost)
if(focus_redux > 0) if(focus_redux > 0)
{ {
PercentManaReduction += MakeRandomFloat(1, (double)focus_redux); PercentManaReduction += (float)MakeRandomFloat(1, (double)focus_redux);
} }
cost = (int32)(cost - (cost * (PercentManaReduction / 100))); cost = (int32)(cost - (cost * (PercentManaReduction / 100)));
@ -4344,7 +4344,7 @@ bool Merc::CheckAETaunt() {
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
NPC* npc = *itr; NPC* npc = *itr;
float dist = npc->DistNoRootNoZ(*this); float dist = npc->DistNoRootNoZ(*this);
int range = GetActSpellRange(mercSpell.spellid, spells[mercSpell.spellid].range); int range = (int)GetActSpellRange(mercSpell.spellid, spells[mercSpell.spellid].range);
range *= range; range *= range;
if(dist <= range) { if(dist <= range) {

View File

@ -4383,7 +4383,7 @@ void Mob::SpellProjectileEffect()
dist = target->CalculateDistance(projectile_x[i], projectile_y[i], projectile_z[i]); dist = target->CalculateDistance(projectile_x[i], projectile_y[i], projectile_z[i]);
int increment_end = 0; int increment_end = 0;
increment_end = (dist / 10) - 1; //This pretty accurately determines end time for speed for 1.5 and timer of 250 ms increment_end = (int)(dist / 10) - 1; //This pretty accurately determines end time for speed for 1.5 and timer of 250 ms
if (increment_end <= projectile_increment[i]){ if (increment_end <= projectile_increment[i]){

View File

@ -1993,13 +1993,13 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
if(id == "aggro") if(id == "aggro")
{ {
pAggroRange = atof(val.c_str()); pAggroRange = (float)atof(val.c_str());
return; return;
} }
if(id == "assist") if(id == "assist")
{ {
pAssistRange = atof(val.c_str()); pAssistRange = (float)atof(val.c_str());
return; return;
} }
@ -2015,12 +2015,12 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
} }
if(id == "healscale") if(id == "healscale")
{ {
healscale = atof(val.c_str()); healscale = (float)atof(val.c_str());
return; return;
} }
if(id == "spellscale") if(id == "spellscale")
{ {
spellscale = atof(val.c_str()); spellscale = (float)atof(val.c_str());
return; return;
} }
} }

View File

@ -275,8 +275,8 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
npc_type->cur_hp = npc_type->max_hp; npc_type->cur_hp = npc_type->max_hp;
npc_type->AC = (int16)(npc_type->AC * (1 + scale_power)); npc_type->AC = (int16)(npc_type->AC * (1 + scale_power));
npc_type->level += 1 + ((int)act_power / 25); // gains an additional level for every 25 pet power npc_type->level += 1 + ((int)act_power / 25); // gains an additional level for every 25 pet power
npc_type->min_dmg = (npc_type->min_dmg * (1 + (scale_power / 2))); npc_type->min_dmg = (uint32)(npc_type->min_dmg * (1 + (scale_power / 2)));
npc_type->max_dmg = (npc_type->max_dmg * (1 + (scale_power / 2))); npc_type->max_dmg = (uint32)(npc_type->max_dmg * (1 + (scale_power / 2)));
npc_type->size *= (1 + (scale_power / 2)); npc_type->size *= (1 + (scale_power / 2));
} }
record.petpower = act_power; record.petpower = act_power;

View File

@ -1705,9 +1705,9 @@ void QuestManager::showgrid(int grid) {
{ {
while((row = mysql_fetch_row(result))) while((row = mysql_fetch_row(result)))
{ {
pt.x = atof(row[0]); pt.x = (float)atof(row[0]);
pt.y = atof(row[1]); pt.y = (float)atof(row[1]);
pt.z = atof(row[2]); pt.z = (float)atof(row[2]);
pts.push_back(pt); pts.push_back(pt);
} }
mysql_free_result(result); mysql_free_result(result);

View File

@ -371,7 +371,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
bool perl_enabled = atoi(row[11]) == 1 ? true : false; bool perl_enabled = atoi(row[11]) == 1 ? true : false;
uint32 spawnLeft = (GetSpawnTimeLeft(atoi(row[0]), zone->GetInstanceID()) * 1000); uint32 spawnLeft = (GetSpawnTimeLeft(atoi(row[0]), zone->GetInstanceID()) * 1000);
newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), spawnLeft, atoi(row[8]), atoi(row[9]), atoi(row[10]), perl_enabled, (EmuAppearance)atoi(row[12])); newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), (float)atof(row[2]), (float)atof(row[3]), (float)atof(row[4]), (float)atof(row[5]), atoi(row[6]), atoi(row[7]), spawnLeft, atoi(row[8]), atoi(row[9]), atoi(row[10]), perl_enabled, (EmuAppearance)atoi(row[12]));
spawn2_list.Insert( newSpawn ); spawn2_list.Insert( newSpawn );
} }
mysql_free_result(result); mysql_free_result(result);
@ -398,7 +398,7 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList<Spawn2*> &spawn2_list, uint32 spawn2
{ {
row = mysql_fetch_row(result); row = mysql_fetch_row(result);
bool perl_enabled = atoi(row[11]) == 1 ? true : false; bool perl_enabled = atoi(row[11]) == 1 ? true : false;
Spawn2* newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), timeleft, atoi(row[8]), atoi(row[9]), atoi(row[10]), perl_enabled, (EmuAppearance)atoi(row[12])); Spawn2* newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), (float)atof(row[2]), (float)atof(row[3]), (float)atof(row[4]), (float)atof(row[5]), atoi(row[6]), atoi(row[7]), timeleft, atoi(row[8]), atoi(row[9]), atoi(row[10]), perl_enabled, (EmuAppearance)atoi(row[12]));
spawn2_list.Insert( newSpawn ); spawn2_list.Insert( newSpawn );
mysql_free_result(result); mysql_free_result(result);
safe_delete_array(query); safe_delete_array(query);

View File

@ -155,7 +155,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG
{ {
safe_delete_array(query); safe_delete_array(query);
while((row = mysql_fetch_row(result))) { while((row = mysql_fetch_row(result))) {
SpawnGroup* newSpawnGroup = new SpawnGroup( atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atoi(row[8]), atoi(row[9]), atoi(row[10]), atoi(row[11])); SpawnGroup* newSpawnGroup = new SpawnGroup( atoi(row[0]), row[1], atoi(row[2]), (float)atof(row[3]), (float)atof(row[4]), (float)atof(row[5]), (float)atof(row[6]), (float)atof(row[7]), atoi(row[8]), atoi(row[9]), atoi(row[10]), atoi(row[11]));
spawn_group_list->AddSpawnGroup(newSpawnGroup); spawn_group_list->AddSpawnGroup(newSpawnGroup);
} }
mysql_free_result(result); mysql_free_result(result);
@ -210,7 +210,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g
{ {
safe_delete_array(query); safe_delete_array(query);
while((row = mysql_fetch_row(result))) { while((row = mysql_fetch_row(result))) {
SpawnGroup* newSpawnGroup = new SpawnGroup( atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atoi(row[8]), atoi(row[9]), atoi(row[10]), atoi(row[11])); SpawnGroup* newSpawnGroup = new SpawnGroup( atoi(row[0]), row[1], atoi(row[2]), (float)atof(row[3]), (float)atof(row[4]), (float)atof(row[5]), (float)atof(row[6]), (float)atof(row[7]), atoi(row[8]), atoi(row[9]), atoi(row[10]), atoi(row[11]));
spawn_group_list->AddSpawnGroup(newSpawnGroup); spawn_group_list->AddSpawnGroup(newSpawnGroup);
} }
mysql_free_result(result); mysql_free_result(result);

View File

@ -884,7 +884,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item
WDmg = 0; WDmg = 0;
if(ADmg < 0) if(ADmg < 0)
ADmg = 0; ADmg = 0;
uint32 MaxDmg = (RuleR(Combat, ArcheryBaseDamageBonus)*(WDmg+ADmg)*GetDamageTable(SkillArchery)) / 100; uint32 MaxDmg = (uint32)((RuleR(Combat, ArcheryBaseDamageBonus)*(WDmg+ADmg)*GetDamageTable(SkillArchery)) / 100);
int32 hate = ((WDmg+ADmg)); int32 hate = ((WDmg+ADmg));
uint16 bonusArcheryDamageModifier = aabonuses.ArcheryDamageModifier + itembonuses.ArcheryDamageModifier + spellbonuses.ArcheryDamageModifier; uint16 bonusArcheryDamageModifier = aabonuses.ArcheryDamageModifier + itembonuses.ArcheryDamageModifier + spellbonuses.ArcheryDamageModifier;
@ -1046,8 +1046,8 @@ void NPC::RangedAttack(Mob* other)
mlog(COMBAT__RANGED, "Ranged attack hit %s.", GetTarget()->GetName()); mlog(COMBAT__RANGED, "Ranged attack hit %s.", GetTarget()->GetName());
int32 TotalDmg = 0; int32 TotalDmg = 0;
int32 MaxDmg = max_dmg * RuleR(Combat, ArcheryNPCMultiplier); // should add a field to npc_types int32 MaxDmg = (int32)(max_dmg * RuleR(Combat, ArcheryNPCMultiplier)); // should add a field to npc_types
int32 MinDmg = min_dmg * RuleR(Combat, ArcheryNPCMultiplier); int32 MinDmg = (int32)(min_dmg * RuleR(Combat, ArcheryNPCMultiplier));
if(RuleB(Combat, UseIntervalAC)) if(RuleB(Combat, UseIntervalAC))
TotalDmg = MaxDmg; TotalDmg = MaxDmg;
@ -1622,7 +1622,7 @@ void NPC::DoClassAttacks(Mob *target) {
} }
} }
classattack_timer.Start(reuse*HasteModifier/100); classattack_timer.Start((uint32)(reuse*HasteModifier/100));
} }
void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte)

View File

@ -3501,12 +3501,12 @@ bool TaskProximityManager::LoadProximities(int ZoneID) {
while((row = mysql_fetch_row(result))) { while((row = mysql_fetch_row(result))) {
Proximity.ExploreID = atoi(row[0]); Proximity.ExploreID = atoi(row[0]);
Proximity.MinX = atof(row[1]); Proximity.MinX = (float)atof(row[1]);
Proximity.MaxX = atof(row[2]); Proximity.MaxX = (float)atof(row[2]);
Proximity.MinY = atof(row[3]); Proximity.MinY = (float)atof(row[3]);
Proximity.MaxY = atof(row[4]); Proximity.MaxY = (float)atof(row[4]);
Proximity.MinZ = atof(row[5]); Proximity.MinZ = (float)atof(row[5]);
Proximity.MaxZ = atof(row[6]); Proximity.MaxZ = (float)atof(row[6]);
TaskProximities.push_back(Proximity); TaskProximities.push_back(Proximity);

View File

@ -894,9 +894,9 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
// For trivials over 68 the chance is (skill - 0.75*trivial) +51.5 // For trivials over 68 the chance is (skill - 0.75*trivial) +51.5
// For trivial up to 68 the chance is (skill - trivial) + 66 // For trivial up to 68 the chance is (skill - trivial) + 66
if (spec->trivial >= 68) { if (spec->trivial >= 68) {
chance = (user_skill - (0.75*spec->trivial)) + 51.5; chance = (user_skill - (0.75f*spec->trivial)) + 51.5f;
} else { } else {
chance = (user_skill - spec->trivial) + 66; chance = (user_skill - spec->trivial) + 66.0f;
} }
int16 over_trivial = (int16)GetRawSkill(spec->tradeskill) - (int16)spec->trivial; int16 over_trivial = (int16)GetRawSkill(spec->tradeskill) - (int16)spec->trivial;
@ -1146,10 +1146,10 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float
chance_stage2 = 100; chance_stage2 = 100;
} else if (current_raw_skill < 175) { } else if (current_raw_skill < 175) {
//From skill 16 to 174 your chance of success falls linearly from 92% to 13%. //From skill 16 to 174 your chance of success falls linearly from 92% to 13%.
chance_stage2 = (200 - current_raw_skill) / 2; chance_stage2 = (200 - current_raw_skill) / 2.0f;
} else { } else {
//At skill 175, your chance of success falls linearly from 12.5% to 2.5% at skill 300. //At skill 175, your chance of success falls linearly from 12.5% to 2.5% at skill 300.
chance_stage2 = 12.5 - (.08 * (current_raw_skill - 175)); chance_stage2 = 12.5f - (.08f * (current_raw_skill - 175));
} }
} }

View File

@ -277,15 +277,15 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) {
lengths = mysql_fetch_lengths(result); lengths = mysql_fetch_lengths(result);
Trap* trap = new Trap(); Trap* trap = new Trap();
trap->trap_id = atoi(row[0]); trap->trap_id = atoi(row[0]);
trap->x = atof(row[1]); trap->x = (float)atof(row[1]);
trap->y = atof(row[2]); trap->y = (float)atof(row[2]);
trap->z = atof(row[3]); trap->z = (float)atof(row[3]);
trap->effect = atoi(row[4]); trap->effect = atoi(row[4]);
trap->effectvalue = atoi(row[5]); trap->effectvalue = atoi(row[5]);
trap->effectvalue2 = atoi(row[6]); trap->effectvalue2 = atoi(row[6]);
trap->skill = atoi(row[7]); trap->skill = atoi(row[7]);
trap->maxzdiff = atof(row[8]); trap->maxzdiff = (float)atof(row[8]);
trap->radius = atof(row[9]); trap->radius = (float)atof(row[9]);
trap->chance = atoi(row[10]); trap->chance = atoi(row[10]);
trap->message = row[11]; trap->message = row[11];
trap->respawn_time = atoi(row[12]); trap->respawn_time = atoi(row[12]);

View File

@ -498,9 +498,9 @@ float Mob::CalculateHeadingToTarget(float in_x, float in_y) {
float angle; float angle;
if (in_x-x_pos > 0) if (in_x-x_pos > 0)
angle = - 90 + atan((float)(in_y-y_pos) / (float)(in_x-x_pos)) * 180 / M_PI; angle = (float)(-90.0f + atan((in_y-y_pos) / (in_x-x_pos)) * 180.0f / M_PI);
else if (in_x-x_pos < 0) else if (in_x-x_pos < 0)
angle = + 90 + atan((float)(in_y-y_pos) / (float)(in_x-x_pos)) * 180 / M_PI; angle = (float)(+90.0f + atan((in_y-y_pos) / (in_x-x_pos)) * 180.0f / M_PI);
else // Added? else // Added?
{ {
if (in_y-y_pos > 0) if (in_y-y_pos > 0)
@ -924,9 +924,9 @@ void NPC::AssignWaypoints(int32 grid) {
{ {
wplist newwp; wplist newwp;
newwp.index = ++max_wp; newwp.index = ++max_wp;
newwp.x = atof(row[0]); newwp.x = (float)atof(row[0]);
newwp.y = atof(row[1]); newwp.y = (float)atof(row[1]);
newwp.z = atof(row[2]); newwp.z = (float)atof(row[2]);
if(zone->HasMap() && RuleB(Map, FixPathingZWhenLoading) ) if(zone->HasMap() && RuleB(Map, FixPathingZWhenLoading) )
{ {
@ -943,7 +943,7 @@ void NPC::AssignWaypoints(int32 grid) {
} }
newwp.pause = atoi(row[3]); newwp.pause = atoi(row[3]);
newwp.heading = atof(row[4]); newwp.heading = (float)atof(row[4]);
Waypoints.push_back(newwp); Waypoints.push_back(newwp);
} }
} }
@ -1004,12 +1004,12 @@ void Mob::SendTo(float new_x, float new_y, float new_z) {
void Mob::SendToFixZ(float new_x, float new_y, float new_z) { void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
if(IsNPC()) { if(IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z + 0.1); entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z + 0.1f);
} }
x_pos = new_x; x_pos = new_x;
y_pos = new_y; y_pos = new_y;
z_pos = new_z + 0.1; z_pos = new_z + 0.1f;
//fix up pathing Z, this shouldent be needed IF our waypoints //fix up pathing Z, this shouldent be needed IF our waypoints
//are corrected instead //are corrected instead
@ -1085,11 +1085,11 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist*
if (mysql_num_rows(result) == 1) { if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result); row = mysql_fetch_row(result);
if ( wp ) { if ( wp ) {
wp->x = atof( row[0] ); wp->x = (float)atof( row[0] );
wp->y = atof( row[1] ); wp->y = (float)atof( row[1] );
wp->z = atof( row[2] ); wp->z = (float)atof( row[2] );
wp->pause = atoi( row[3] ); wp->pause = atoi( row[3] );
wp->heading = atof( row[4] ); wp->heading = (float)atof( row[4] );
} }
mysql_free_result(result); mysql_free_result(result);
return true; return true;
@ -1166,8 +1166,8 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
{ {
row = mysql_fetch_row(result); row = mysql_fetch_row(result);
spawn2id = atoi(row[0]); spawn2id = atoi(row[0]);
dbx = atof(row[1]); dbx = (float)atof(row[1]);
dby = atof(row[2]); dby = (float)atof(row[2]);
if(!RunQuery( if(!RunQuery(
query, query,
MakeAnyLenString( MakeAnyLenString(

View File

@ -184,10 +184,10 @@ bool Zone::LoadZoneObjects() {
strn0cpy(d.zone_name, shortname, sizeof(d.zone_name)); strn0cpy(d.zone_name, shortname, sizeof(d.zone_name));
d.db_id = 1000000000 + atoi(row[0]); // Out of range of normal use for doors.id d.db_id = 1000000000 + atoi(row[0]); // Out of range of normal use for doors.id
d.door_id = -1; // Client doesn't care if these are all the same door_id d.door_id = -1; // Client doesn't care if these are all the same door_id
d.pos_x = atof(row[2]); // xpos d.pos_x = (float)atof(row[2]); // xpos
d.pos_y = atof(row[3]); // ypos d.pos_y = (float)atof(row[3]); // ypos
d.pos_z = atof(row[4]); // zpos d.pos_z = (float)atof(row[4]); // zpos
d.heading = atof(row[5]); // heading d.heading = (float)atof(row[5]); // heading
strn0cpy(d.door_name, row[8], sizeof(d.door_name)); // objectname strn0cpy(d.door_name, row[8], sizeof(d.door_name)); // objectname
// Strip trailing "_ACTORDEF" if present. Client won't accept it for doors. // Strip trailing "_ACTORDEF" if present. Client won't accept it for doors.
@ -233,10 +233,10 @@ bool Zone::LoadZoneObjects() {
id = (uint32)atoi(row[0]); id = (uint32)atoi(row[0]);
data.zone_id = atoi(row[1]); data.zone_id = atoi(row[1]);
data.x = atof(row[2]); data.x = (float)atof(row[2]);
data.y = atof(row[3]); data.y = (float)atof(row[3]);
data.z = atof(row[4]); data.z = (float)atof(row[4]);
data.heading = atof(row[5]); data.heading = (float)atof(row[5]);
itemid = (uint32)atoi(row[6]); itemid = (uint32)atoi(row[6]);
charges = (int16)atoi(row[7]); charges = (int16)atoi(row[7]);
strcpy(data.object_name, row[8]); strcpy(data.object_name, row[8]);
@ -1731,15 +1731,15 @@ bool ZoneDatabase::LoadStaticZonePoints(LinkedList<ZonePoint*>* zone_point_list,
while((row = mysql_fetch_row(result))) while((row = mysql_fetch_row(result)))
{ {
ZonePoint* zp = new ZonePoint; ZonePoint* zp = new ZonePoint;
zp->x = atof(row[0]); zp->x = (float)atof(row[0]);
zp->y = atof(row[1]); zp->y = (float)atof(row[1]);
zp->z = atof(row[2]); zp->z = (float)atof(row[2]);
zp->target_x = atof(row[3]); zp->target_x = (float)atof(row[3]);
zp->target_y = atof(row[4]); zp->target_y = (float)atof(row[4]);
zp->target_z = atof(row[5]); zp->target_z = (float)atof(row[5]);
zp->target_zone_id = atoi(row[6]); zp->target_zone_id = atoi(row[6]);
zp->heading = atof(row[7]); zp->heading = (float)atof(row[7]);
zp->target_heading = atof(row[8]); zp->target_heading = (float)atof(row[8]);
zp->number = atoi(row[9]); zp->number = atoi(row[9]);
zp->target_zone_instance = atoi(row[10]); zp->target_zone_instance = atoi(row[10]);
zp->client_version_mask = (uint32)strtoul(row[11], nullptr, 0); zp->client_version_mask = (uint32)strtoul(row[11], nullptr, 0);

View File

@ -123,19 +123,19 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct
zone_data->fog_red[i]=atoi(row[r++]); zone_data->fog_red[i]=atoi(row[r++]);
zone_data->fog_green[i]=atoi(row[r++]); zone_data->fog_green[i]=atoi(row[r++]);
zone_data->fog_blue[i]=atoi(row[r++]); zone_data->fog_blue[i]=atoi(row[r++]);
zone_data->fog_minclip[i]=atof(row[r++]); zone_data->fog_minclip[i]=(float)atof(row[r++]);
zone_data->fog_maxclip[i]=atof(row[r++]); zone_data->fog_maxclip[i]=(float)atof(row[r++]);
} }
zone_data->fog_density = atof(row[r++]);; zone_data->fog_density = (float)atof(row[r++]);;
zone_data->sky=atoi(row[r++]); zone_data->sky=atoi(row[r++]);
zone_data->zone_exp_multiplier=atof(row[r++]); zone_data->zone_exp_multiplier=(float)atof(row[r++]);
zone_data->safe_x=atof(row[r++]); zone_data->safe_x=(float)atof(row[r++]);
zone_data->safe_y=atof(row[r++]); zone_data->safe_y=(float)atof(row[r++]);
zone_data->safe_z=atof(row[r++]); zone_data->safe_z=(float)atof(row[r++]);
zone_data->underworld=atof(row[r++]); zone_data->underworld=(float)atof(row[r++]);
zone_data->minclip=atof(row[r++]); zone_data->minclip=(float)atof(row[r++]);
zone_data->maxclip=atof(row[r++]); zone_data->maxclip=(float)atof(row[r++]);
zone_data->time_type=atoi(row[r++]); zone_data->time_type=atoi(row[r++]);
//not in the DB yet: //not in the DB yet:
@ -171,7 +171,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct
zone_data->snow_chance[i]=atoi(row[r++]); zone_data->snow_chance[i]=atoi(row[r++]);
} }
for(i=0;i<4;i++){ for(i=0;i<4;i++){
zone_data->snow_duration[i]=atof(row[r++]); zone_data->snow_duration[i]=(uint8)atof(row[r++]);
} }
good = true; good = true;
} }
@ -918,9 +918,9 @@ bool ZoneDatabase::GetCharacterInfoForLogin_result(MYSQL_RES* result,
pp->zone_id = GetZoneID(row[2]); pp->zone_id = GetZoneID(row[2]);
pp->zoneInstance = atoi(row[13]); pp->zoneInstance = atoi(row[13]);
pp->x = atof(row[3]); pp->x = (float)atof(row[3]);
pp->y = atof(row[4]); pp->y = (float)atof(row[4]);
pp->z = atof(row[5]); pp->z = (float)atof(row[5]);
pp->lastlogin = time(nullptr); pp->lastlogin = time(nullptr);
@ -1137,13 +1137,13 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
tmpNPCType->gender = atoi(row[r++]); tmpNPCType->gender = atoi(row[r++]);
tmpNPCType->texture = atoi(row[r++]); tmpNPCType->texture = atoi(row[r++]);
tmpNPCType->helmtexture = atoi(row[r++]); tmpNPCType->helmtexture = atoi(row[r++]);
tmpNPCType->size = atof(row[r++]); tmpNPCType->size = (float)atof(row[r++]);
tmpNPCType->loottable_id = atoi(row[r++]); tmpNPCType->loottable_id = atoi(row[r++]);
tmpNPCType->merchanttype = atoi(row[r++]); tmpNPCType->merchanttype = atoi(row[r++]);
tmpNPCType->alt_currency_type = atoi(row[r++]); tmpNPCType->alt_currency_type = atoi(row[r++]);
tmpNPCType->adventure_template = atoi(row[r++]); tmpNPCType->adventure_template = atoi(row[r++]);
tmpNPCType->trap_template = atoi(row[r++]); tmpNPCType->trap_template = atoi(row[r++]);
tmpNPCType->attack_speed = atof(row[r++]); tmpNPCType->attack_speed = (float)atof(row[r++]);
tmpNPCType->STR = atoi(row[r++]); tmpNPCType->STR = atoi(row[r++]);
tmpNPCType->STA = atoi(row[r++]); tmpNPCType->STA = atoi(row[r++]);
tmpNPCType->DEX = atoi(row[r++]); tmpNPCType->DEX = atoi(row[r++]);
@ -1168,7 +1168,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
tmpNPCType->d_meele_texture2 = atoi(row[r++]); tmpNPCType->d_meele_texture2 = atoi(row[r++]);
tmpNPCType->prim_melee_type = atoi(row[r++]); tmpNPCType->prim_melee_type = atoi(row[r++]);
tmpNPCType->sec_melee_type = atoi(row[r++]); tmpNPCType->sec_melee_type = atoi(row[r++]);
tmpNPCType->runspeed= atof(row[r++]); tmpNPCType->runspeed= (float)atof(row[r++]);
tmpNPCType->findable = atoi(row[r++]) == 0? false : true; tmpNPCType->findable = atoi(row[r++]) == 0? false : true;
tmpNPCType->trackable = atoi(row[r++]) == 0? false : true; tmpNPCType->trackable = atoi(row[r++]) == 0? false : true;
tmpNPCType->hp_regen = atoi(row[r++]); tmpNPCType->hp_regen = atoi(row[r++]);
@ -1459,7 +1459,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
//tmpNPCType->alt_currency_type = atoi(row[r++]); //tmpNPCType->alt_currency_type = atoi(row[r++]);
//tmpNPCType->adventure_template = atoi(row[r++]); //tmpNPCType->adventure_template = atoi(row[r++]);
//tmpNPCType->trap_template = atoi(row[r++]); //tmpNPCType->trap_template = atoi(row[r++]);
tmpNPCType->attack_speed = atof(row[r++]); tmpNPCType->attack_speed = (float)atof(row[r++]);
tmpNPCType->STR = atoi(row[r++]); tmpNPCType->STR = atoi(row[r++]);
tmpNPCType->STA = atoi(row[r++]); tmpNPCType->STA = atoi(row[r++]);
tmpNPCType->DEX = atoi(row[r++]); tmpNPCType->DEX = atoi(row[r++]);
@ -1482,7 +1482,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
tmpNPCType->d_meele_texture2 = atoi(row[r++]); tmpNPCType->d_meele_texture2 = atoi(row[r++]);
tmpNPCType->prim_melee_type = atoi(row[r++]); tmpNPCType->prim_melee_type = atoi(row[r++]);
tmpNPCType->sec_melee_type = atoi(row[r++]); tmpNPCType->sec_melee_type = atoi(row[r++]);
tmpNPCType->runspeed= atof(row[r++]); tmpNPCType->runspeed= (float)atof(row[r++]);
//tmpNPCType->findable = atoi(row[r++]) == 0? false : true; //tmpNPCType->findable = atoi(row[r++]) == 0? false : true;
//tmpNPCType->trackable = atoi(row[r++]) == 0? false : true; //tmpNPCType->trackable = atoi(row[r++]) == 0? false : true;
tmpNPCType->hp_regen = atoi(row[r++]); tmpNPCType->hp_regen = atoi(row[r++]);