mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
explicit double to float conversions
This commit is contained in:
+1
-1
@@ -1591,7 +1591,7 @@ void NPC::AI_DoMovement() {
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
float movedist = roambox_distance*roambox_distance;
|
float movedist = roambox_distance*roambox_distance;
|
||||||
float movex = MakeRandomFloat(0, movedist);
|
float movex = (float)MakeRandomFloat(0, movedist);
|
||||||
float movey = movedist - movex;
|
float movey = movedist - movex;
|
||||||
movex = sqrtf(movex);
|
movex = sqrtf(movex);
|
||||||
movey = sqrtf(movey);
|
movey = sqrtf(movey);
|
||||||
|
|||||||
+1
-1
@@ -3865,7 +3865,7 @@ void Bot::AI_Process() {
|
|||||||
int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance;
|
int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance;
|
||||||
DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f;
|
DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f;
|
||||||
|
|
||||||
float random = MakeRandomFloat(0, 1);
|
float random = (float)MakeRandomFloat(0, 1);
|
||||||
|
|
||||||
if (random < DualWieldProbability){ // Max 78% of DW
|
if (random < DualWieldProbability){ // Max 78% of DW
|
||||||
|
|
||||||
|
|||||||
+21
-21
@@ -1576,7 +1576,7 @@ void Client::SetStats(uint8 type,int16 set_val){
|
|||||||
switch(type){
|
switch(type){
|
||||||
case STAT_STR:
|
case STAT_STR:
|
||||||
if(set_val>0)
|
if(set_val>0)
|
||||||
iss->str=set_val;
|
iss->str=(uint8)set_val;
|
||||||
if(set_val<0)
|
if(set_val<0)
|
||||||
m_pp.STR=0;
|
m_pp.STR=0;
|
||||||
else if(set_val>255)
|
else if(set_val>255)
|
||||||
@@ -1586,7 +1586,7 @@ void Client::SetStats(uint8 type,int16 set_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_STA:
|
case STAT_STA:
|
||||||
if(set_val>0)
|
if(set_val>0)
|
||||||
iss->sta=set_val;
|
iss->sta=(uint8)set_val;
|
||||||
if(set_val<0)
|
if(set_val<0)
|
||||||
m_pp.STA=0;
|
m_pp.STA=0;
|
||||||
else if(set_val>255)
|
else if(set_val>255)
|
||||||
@@ -1596,7 +1596,7 @@ void Client::SetStats(uint8 type,int16 set_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_AGI:
|
case STAT_AGI:
|
||||||
if(set_val>0)
|
if(set_val>0)
|
||||||
iss->agi=set_val;
|
iss->agi=(uint8)set_val;
|
||||||
if(set_val<0)
|
if(set_val<0)
|
||||||
m_pp.AGI=0;
|
m_pp.AGI=0;
|
||||||
else if(set_val>255)
|
else if(set_val>255)
|
||||||
@@ -1606,7 +1606,7 @@ void Client::SetStats(uint8 type,int16 set_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_DEX:
|
case STAT_DEX:
|
||||||
if(set_val>0)
|
if(set_val>0)
|
||||||
iss->dex=set_val;
|
iss->dex=(uint8)set_val;
|
||||||
if(set_val<0)
|
if(set_val<0)
|
||||||
m_pp.DEX=0;
|
m_pp.DEX=0;
|
||||||
else if(set_val>255)
|
else if(set_val>255)
|
||||||
@@ -1616,7 +1616,7 @@ void Client::SetStats(uint8 type,int16 set_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_INT:
|
case STAT_INT:
|
||||||
if(set_val>0)
|
if(set_val>0)
|
||||||
iss->int_=set_val;
|
iss->int_=(uint8)set_val;
|
||||||
if(set_val<0)
|
if(set_val<0)
|
||||||
m_pp.INT=0;
|
m_pp.INT=0;
|
||||||
else if(set_val>255)
|
else if(set_val>255)
|
||||||
@@ -1626,7 +1626,7 @@ void Client::SetStats(uint8 type,int16 set_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_WIS:
|
case STAT_WIS:
|
||||||
if(set_val>0)
|
if(set_val>0)
|
||||||
iss->wis=set_val;
|
iss->wis=(uint8)set_val;
|
||||||
if(set_val<0)
|
if(set_val<0)
|
||||||
m_pp.WIS=0;
|
m_pp.WIS=0;
|
||||||
else if(set_val>255)
|
else if(set_val>255)
|
||||||
@@ -1636,7 +1636,7 @@ void Client::SetStats(uint8 type,int16 set_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_CHA:
|
case STAT_CHA:
|
||||||
if(set_val>0)
|
if(set_val>0)
|
||||||
iss->cha=set_val;
|
iss->cha=(uint8)set_val;
|
||||||
if(set_val<0)
|
if(set_val<0)
|
||||||
m_pp.CHA=0;
|
m_pp.CHA=0;
|
||||||
else if(set_val>255)
|
else if(set_val>255)
|
||||||
@@ -1659,7 +1659,7 @@ void Client::IncStats(uint8 type,int16 increase_val){
|
|||||||
switch(type){
|
switch(type){
|
||||||
case STAT_STR:
|
case STAT_STR:
|
||||||
if(increase_val>0)
|
if(increase_val>0)
|
||||||
iss->str=increase_val;
|
iss->str=(uint8)increase_val;
|
||||||
if((m_pp.STR+increase_val*2)<0)
|
if((m_pp.STR+increase_val*2)<0)
|
||||||
m_pp.STR=0;
|
m_pp.STR=0;
|
||||||
else if((m_pp.STR+increase_val*2)>255)
|
else if((m_pp.STR+increase_val*2)>255)
|
||||||
@@ -1669,7 +1669,7 @@ void Client::IncStats(uint8 type,int16 increase_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_STA:
|
case STAT_STA:
|
||||||
if(increase_val>0)
|
if(increase_val>0)
|
||||||
iss->sta=increase_val;
|
iss->sta=(uint8)increase_val;
|
||||||
if((m_pp.STA+increase_val*2)<0)
|
if((m_pp.STA+increase_val*2)<0)
|
||||||
m_pp.STA=0;
|
m_pp.STA=0;
|
||||||
else if((m_pp.STA+increase_val*2)>255)
|
else if((m_pp.STA+increase_val*2)>255)
|
||||||
@@ -1679,7 +1679,7 @@ void Client::IncStats(uint8 type,int16 increase_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_AGI:
|
case STAT_AGI:
|
||||||
if(increase_val>0)
|
if(increase_val>0)
|
||||||
iss->agi=increase_val;
|
iss->agi=(uint8)increase_val;
|
||||||
if((m_pp.AGI+increase_val*2)<0)
|
if((m_pp.AGI+increase_val*2)<0)
|
||||||
m_pp.AGI=0;
|
m_pp.AGI=0;
|
||||||
else if((m_pp.AGI+increase_val*2)>255)
|
else if((m_pp.AGI+increase_val*2)>255)
|
||||||
@@ -1689,7 +1689,7 @@ void Client::IncStats(uint8 type,int16 increase_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_DEX:
|
case STAT_DEX:
|
||||||
if(increase_val>0)
|
if(increase_val>0)
|
||||||
iss->dex=increase_val;
|
iss->dex=(uint8)increase_val;
|
||||||
if((m_pp.DEX+increase_val*2)<0)
|
if((m_pp.DEX+increase_val*2)<0)
|
||||||
m_pp.DEX=0;
|
m_pp.DEX=0;
|
||||||
else if((m_pp.DEX+increase_val*2)>255)
|
else if((m_pp.DEX+increase_val*2)>255)
|
||||||
@@ -1699,7 +1699,7 @@ void Client::IncStats(uint8 type,int16 increase_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_INT:
|
case STAT_INT:
|
||||||
if(increase_val>0)
|
if(increase_val>0)
|
||||||
iss->int_=increase_val;
|
iss->int_=(uint8)increase_val;
|
||||||
if((m_pp.INT+increase_val*2)<0)
|
if((m_pp.INT+increase_val*2)<0)
|
||||||
m_pp.INT=0;
|
m_pp.INT=0;
|
||||||
else if((m_pp.INT+increase_val*2)>255)
|
else if((m_pp.INT+increase_val*2)>255)
|
||||||
@@ -1709,7 +1709,7 @@ void Client::IncStats(uint8 type,int16 increase_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_WIS:
|
case STAT_WIS:
|
||||||
if(increase_val>0)
|
if(increase_val>0)
|
||||||
iss->wis=increase_val;
|
iss->wis=(uint8)increase_val;
|
||||||
if((m_pp.WIS+increase_val*2)<0)
|
if((m_pp.WIS+increase_val*2)<0)
|
||||||
m_pp.WIS=0;
|
m_pp.WIS=0;
|
||||||
else if((m_pp.WIS+increase_val*2)>255)
|
else if((m_pp.WIS+increase_val*2)>255)
|
||||||
@@ -1719,7 +1719,7 @@ void Client::IncStats(uint8 type,int16 increase_val){
|
|||||||
break;
|
break;
|
||||||
case STAT_CHA:
|
case STAT_CHA:
|
||||||
if(increase_val>0)
|
if(increase_val>0)
|
||||||
iss->cha=increase_val;
|
iss->cha=(uint8)increase_val;
|
||||||
if((m_pp.CHA+increase_val*2)<0)
|
if((m_pp.CHA+increase_val*2)<0)
|
||||||
m_pp.CHA=0;
|
m_pp.CHA=0;
|
||||||
else if((m_pp.CHA+increase_val*2)>255)
|
else if((m_pp.CHA+increase_val*2)>255)
|
||||||
@@ -5106,7 +5106,7 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co
|
|||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
float delta = (x-(-713.6));
|
float delta = (x-(-713.6f));
|
||||||
delta *= delta;
|
delta *= delta;
|
||||||
float distance = delta;
|
float distance = delta;
|
||||||
delta = (y-(-160.2));
|
delta = (y-(-160.2));
|
||||||
@@ -5136,13 +5136,13 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co
|
|||||||
}
|
}
|
||||||
case 9:
|
case 9:
|
||||||
{
|
{
|
||||||
float delta = (x-(-682.5));
|
float delta = (x-(-682.5f));
|
||||||
delta *= delta;
|
delta *= delta;
|
||||||
float distance = delta;
|
float distance = delta;
|
||||||
delta = (y-(147.0));
|
delta = (y-(147.0f));
|
||||||
delta *= delta;
|
delta *= delta;
|
||||||
distance += delta;
|
distance += delta;
|
||||||
delta = (z-(-9.9));
|
delta = (z-(-9.9f));
|
||||||
delta *= delta;
|
delta *= delta;
|
||||||
distance += delta;
|
distance += delta;
|
||||||
|
|
||||||
@@ -5179,13 +5179,13 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co
|
|||||||
|
|
||||||
case 24:
|
case 24:
|
||||||
{
|
{
|
||||||
float delta = (x-(-183.0));
|
float delta = (x-(-183.0f));
|
||||||
delta *= delta;
|
delta *= delta;
|
||||||
float distance = delta;
|
float distance = delta;
|
||||||
delta = (y-(-773.3));
|
delta = (y-(-773.3f));
|
||||||
delta *= delta;
|
delta *= delta;
|
||||||
distance += delta;
|
distance += delta;
|
||||||
delta = (z-(54.1));
|
delta = (z-(54.1f));
|
||||||
delta *= delta;
|
delta *= delta;
|
||||||
distance += delta;
|
distance += delta;
|
||||||
|
|
||||||
|
|||||||
@@ -3417,7 +3417,7 @@ void Client::Handle_OP_Sneak(const EQApplicationPacket *app)
|
|||||||
CheckIncreaseSkill(SkillSneak, nullptr, 5);
|
CheckIncreaseSkill(SkillSneak, nullptr, 5);
|
||||||
}
|
}
|
||||||
float hidechance = ((GetSkill(SkillSneak)/300.0f) + .25) * 100;
|
float hidechance = ((GetSkill(SkillSneak)/300.0f) + .25) * 100;
|
||||||
float random = MakeRandomFloat(0, 99);
|
float random = (float)MakeRandomFloat(0, 99);
|
||||||
if(!was && random < hidechance) {
|
if(!was && random < hidechance) {
|
||||||
sneaking = true;
|
sneaking = true;
|
||||||
}
|
}
|
||||||
@@ -3458,8 +3458,8 @@ void Client::Handle_OP_Hide(const EQApplicationPacket *app)
|
|||||||
int reuse = HideReuseTime - GetAA(209);
|
int reuse = HideReuseTime - GetAA(209);
|
||||||
p_timers.Start(pTimerHide, reuse-1);
|
p_timers.Start(pTimerHide, reuse-1);
|
||||||
|
|
||||||
float hidechance = ((GetSkill(SkillHide)/250.0f) + .25) * 100;
|
float hidechance = ((GetSkill(SkillHide)/250.0f) + .25f) * 100.0f;
|
||||||
float random = MakeRandomFloat(0, 100);
|
float random = (float)MakeRandomFloat(0, 100);
|
||||||
CheckIncreaseSkill(SkillHide, nullptr, 5);
|
CheckIncreaseSkill(SkillHide, nullptr, 5);
|
||||||
if (random < hidechance) {
|
if (random < hidechance) {
|
||||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
|
EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
|
||||||
@@ -11679,9 +11679,9 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
uint32 ZoneID = atoi(Row[1]);
|
uint32 ZoneID = atoi(Row[1]);
|
||||||
|
|
||||||
float CorpseX = atof(Row[2]);
|
float CorpseX = (float)atof(Row[2]);
|
||||||
float CorpseY = atof(Row[3]);
|
float CorpseY = (float)atof(Row[3]);
|
||||||
float CorpseZ = atof(Row[4]);
|
float CorpseZ = (float)atof(Row[4]);
|
||||||
|
|
||||||
strn0cpy(TimeOfDeath, Row[5], sizeof(TimeOfDeath));
|
strn0cpy(TimeOfDeath, Row[5], sizeof(TimeOfDeath));
|
||||||
|
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ bool Client::Process() {
|
|||||||
int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance;
|
int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance;
|
||||||
DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f;
|
DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f;
|
||||||
|
|
||||||
float random = MakeRandomFloat(0, 1);
|
float random = (float)MakeRandomFloat(0, 1);
|
||||||
CheckIncreaseSkill(SkillDualWield, auto_attack_target, -10);
|
CheckIncreaseSkill(SkillDualWield, auto_attack_target, -10);
|
||||||
if (random < DualWieldProbability){ // Max 78% of DW
|
if (random < DualWieldProbability){ // Max 78% of DW
|
||||||
if(CheckAAEffect(aaEffectRampage)) {
|
if(CheckAAEffect(aaEffectRampage)) {
|
||||||
|
|||||||
+1
-1
@@ -2347,7 +2347,7 @@ void command_size(Client *c, const Seperator *sep)
|
|||||||
if (!sep->IsNumber(1))
|
if (!sep->IsNumber(1))
|
||||||
c->Message(0, "Usage: #size [0 - 255] (Decimal increments are allowed)");
|
c->Message(0, "Usage: #size [0 - 255] (Decimal increments are allowed)");
|
||||||
else {
|
else {
|
||||||
float newsize = atof(sep->arg[1]);
|
float newsize = (float)atof(sep->arg[1]);
|
||||||
if (newsize > 255)
|
if (newsize > 255)
|
||||||
c->Message(0, "Error: #size: Size can not be greater than 255.");
|
c->Message(0, "Error: #size: Size can not be greater than 255.");
|
||||||
else if (newsize < 0)
|
else if (newsize < 0)
|
||||||
|
|||||||
+1
-1
@@ -1723,7 +1723,7 @@ void Merc::AI_Process() {
|
|||||||
int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance;
|
int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance;
|
||||||
DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f;
|
DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f;
|
||||||
|
|
||||||
float random = MakeRandomFloat(0, 1);
|
float random = (float)MakeRandomFloat(0, 1);
|
||||||
|
|
||||||
if (random < DualWieldProbability){ // Max 78% of DW
|
if (random < DualWieldProbability){ // Max 78% of DW
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5081,7 +5081,7 @@ float Mob::HeadingAngleToMob(Mob *other)
|
|||||||
if (y_diff < 0.0000009999999974752427)
|
if (y_diff < 0.0000009999999974752427)
|
||||||
y_diff = 0.0000009999999974752427;
|
y_diff = 0.0000009999999974752427;
|
||||||
|
|
||||||
float angle = atan2(x_diff, y_diff) * 180.0 * 0.3183099014828645; // angle, nice "pi"
|
float angle = atan2(x_diff, y_diff) * 180.0f * 0.3183099014828645f; // angle, nice "pi"
|
||||||
|
|
||||||
// return the right thing based on relative quadrant
|
// return the right thing based on relative quadrant
|
||||||
// I'm sure this could be improved for readability, but whatever
|
// I'm sure this could be improved for readability, but whatever
|
||||||
|
|||||||
@@ -927,7 +927,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
|
|||||||
_log(TRADESKILLS__TRACE, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance);
|
_log(TRADESKILLS__TRACE, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance);
|
||||||
_log(TRADESKILLS__TRACE, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR());
|
_log(TRADESKILLS__TRACE, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR());
|
||||||
|
|
||||||
float res = MakeRandomFloat(0, 99);
|
float res = (float)MakeRandomFloat(0, 99);
|
||||||
int AAChance = 0;
|
int AAChance = 0;
|
||||||
|
|
||||||
//AA modifiers
|
//AA modifiers
|
||||||
|
|||||||
+2
-2
@@ -641,8 +641,8 @@ void Zone::LoadLevelEXPMods(){
|
|||||||
else {
|
else {
|
||||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||||
uint32 index = atoi(DataRow[0]);
|
uint32 index = atoi(DataRow[0]);
|
||||||
float exp_mod = atof(DataRow[1]);
|
float exp_mod = (float)atof(DataRow[1]);
|
||||||
float aa_exp_mod = atof(DataRow[2]);
|
float aa_exp_mod = (float)atof(DataRow[2]);
|
||||||
level_exp_mod[index].ExpMod = exp_mod;
|
level_exp_mod[index].ExpMod = exp_mod;
|
||||||
level_exp_mod[index].AAExpMod = aa_exp_mod;
|
level_exp_mod[index].AAExpMod = aa_exp_mod;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -2408,12 +2408,12 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked
|
|||||||
if(row){
|
if(row){
|
||||||
into[r].spellid = atoi(row[1]);
|
into[r].spellid = atoi(row[1]);
|
||||||
into[r].type = atoi(row[2]);
|
into[r].type = atoi(row[2]);
|
||||||
into[r].x = atof(row[3]);
|
into[r].x = (float)atof(row[3]);
|
||||||
into[r].y = atof(row[4]);
|
into[r].y = (float)atof(row[4]);
|
||||||
into[r].z = atof(row[5]);
|
into[r].z = (float)atof(row[5]);
|
||||||
into[r].xdiff = atof(row[6]);
|
into[r].xdiff = (float)atof(row[6]);
|
||||||
into[r].ydiff = atof(row[7]);
|
into[r].ydiff = (float)atof(row[7]);
|
||||||
into[r].zdiff = atof(row[8]);
|
into[r].zdiff = (float)atof(row[8]);
|
||||||
strn0cpy(into[r].message, row[9], 255);
|
strn0cpy(into[r].message, row[9], 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2848,7 +2848,7 @@ void ZoneDatabase::LoadPetInfo(Client *c) {
|
|||||||
pi->SpellID = atoi(row[3]);
|
pi->SpellID = atoi(row[3]);
|
||||||
pi->HP = atoul(row[4]);
|
pi->HP = atoul(row[4]);
|
||||||
pi->Mana = atoul(row[5]);
|
pi->Mana = atoul(row[5]);
|
||||||
pi->size = atof(row[6]);
|
pi->size = (float)atof(row[6]);
|
||||||
}
|
}
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user