mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[Cleanup] Cleanup excessive type casting: string -> char * -> string (#3169)
* [Cleanup] Cleanup excessive type casting: string -> char * -> string * [Cleanup] Cleanup excessive type casting: string -> char * -> string
This commit is contained in:
+2
-2
@@ -1978,10 +1978,10 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
|
||||
database.GetVariable("ServerType", tmp);
|
||||
if (tmp[0] == '1' && tmp[1] == '\0' && killerMob && killerMob->IsClient()) {
|
||||
database.GetVariable("PvPreward", tmp);
|
||||
auto reward = Strings::ToInt(tmp.c_str());
|
||||
auto reward = Strings::ToInt(tmp);
|
||||
if (reward == 3) {
|
||||
database.GetVariable("PvPitem", tmp);
|
||||
auto pvp_item_id = Strings::ToInt(tmp.c_str());
|
||||
auto pvp_item_id = Strings::ToInt(tmp);
|
||||
const auto* item = database.GetItem(pvp_item_id);
|
||||
if (item) {
|
||||
new_corpse->SetPlayerKillItemID(pvp_item_id);
|
||||
|
||||
+1
-1
@@ -10446,7 +10446,7 @@ void Client::SendToInstance(std::string instance_type, std::string zone_short_na
|
||||
uint16 instance_id = 0;
|
||||
|
||||
if (current_bucket_value.length() > 0) {
|
||||
instance_id = Strings::ToInt(current_bucket_value.c_str());
|
||||
instance_id = Strings::ToInt(current_bucket_value);
|
||||
} else {
|
||||
if(!database.GetUnusedInstanceID(instance_id)) {
|
||||
Message(Chat::White, "Server was unable to find a free instance id.");
|
||||
|
||||
+2
-2
@@ -203,8 +203,8 @@ enum eInnateSkill {
|
||||
InnateDisabled = 255
|
||||
};
|
||||
|
||||
const std::string DIAWIND_RESPONSE_ONE_KEY = "diawind_npc_response_one";
|
||||
const std::string DIAWIND_RESPONSE_TWO_KEY = "diawind_npc_response_two";
|
||||
inline const std::string DIAWIND_RESPONSE_ONE_KEY = "diawind_npc_response_one";
|
||||
inline const std::string DIAWIND_RESPONSE_TWO_KEY = "diawind_npc_response_two";
|
||||
const uint32 POPUPID_DIAWIND_ONE = 99999;
|
||||
const uint32 POPUPID_DIAWIND_TWO = 100000;
|
||||
const uint32 POPUPID_UPDATE_SHOWSTATSWINDOW = 1000000;
|
||||
|
||||
@@ -23,7 +23,7 @@ void DataBucket::SetData(const std::string& bucket_key, const std::string& bucke
|
||||
if (isalpha(expires_time[0]) || isalpha(expires_time[expires_time.length() - 1])) {
|
||||
expires_time_unix = (long long) std::time(nullptr) + Strings::TimeToSeconds(expires_time);
|
||||
} else {
|
||||
expires_time_unix = (long long) std::time(nullptr) + Strings::ToInt(expires_time.c_str());
|
||||
expires_time_unix = (long long) std::time(nullptr) + Strings::ToInt(expires_time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
|
||||
|
||||
// set the popup id
|
||||
if (!popupid.empty()) {
|
||||
popup_id = (Strings::IsNumber(popupid) ? Strings::ToInt(popupid.c_str()) : 0);
|
||||
popup_id = (Strings::IsNumber(popupid) ? Strings::ToInt(popupid) : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
|
||||
Strings::FindReplace(output, fmt::format("secondresponseid:{}", secondresponseid), "");
|
||||
|
||||
if (!secondresponseid.empty()) {
|
||||
negative_id = (Strings::IsNumber(secondresponseid) ? Strings::ToInt(secondresponseid.c_str()) : 0);
|
||||
negative_id = (Strings::IsNumber(secondresponseid) ? Strings::ToInt(secondresponseid) : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -410,7 +410,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
|
||||
|
||||
// click response
|
||||
// window type response
|
||||
uint32 window_type = (Strings::IsNumber(wintype) ? Strings::ToInt(wintype.c_str()) : 0);
|
||||
uint32 window_type = (Strings::IsNumber(wintype) ? Strings::ToInt(wintype) : 0);
|
||||
std::string click_response_button = (window_type == 1 ? "Yes" : "OK");
|
||||
std::string click_response = fmt::format(
|
||||
"<c \"#F07F00\">Click [{}] to continue...</c>",
|
||||
|
||||
@@ -55,23 +55,23 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
float set_size = 0.0f;
|
||||
|
||||
if (arg2 == move_x_action) {
|
||||
x_move = Strings::ToFloat(arg3.c_str());
|
||||
x_move = Strings::ToFloat(arg3);
|
||||
}
|
||||
|
||||
if (arg2 == move_y_action) {
|
||||
y_move = Strings::ToFloat(arg3.c_str());
|
||||
y_move = Strings::ToFloat(arg3);
|
||||
}
|
||||
|
||||
if (arg2 == move_z_action) {
|
||||
z_move = Strings::ToFloat(arg3.c_str());
|
||||
z_move = Strings::ToFloat(arg3);
|
||||
}
|
||||
|
||||
if (arg2 == move_h_action) {
|
||||
h_move = Strings::ToFloat(arg3.c_str());
|
||||
h_move = Strings::ToFloat(arg3);
|
||||
}
|
||||
|
||||
if (arg2 == set_size_action) {
|
||||
set_size = Strings::ToFloat(arg3.c_str());
|
||||
set_size = Strings::ToFloat(arg3);
|
||||
}
|
||||
|
||||
door->SetLocation(
|
||||
@@ -370,7 +370,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
if (arg1 == "opentype" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||
if (door) {
|
||||
door->SetOpenType(Strings::ToInt(arg2.c_str()));
|
||||
door->SetOpenType(Strings::ToInt(arg2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
if (arg1 == "setincline" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||
if (door) {
|
||||
door->SetIncline(Strings::ToInt(arg2.c_str()));
|
||||
door->SetIncline(Strings::ToInt(arg2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
if (arg1 == "setinvertstate" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||
if (door) {
|
||||
door->SetInvertState(Strings::ToInt(arg2.c_str()));
|
||||
door->SetInvertState(Strings::ToInt(arg2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
if (arg1 == "setinclineinc" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||
if (door) {
|
||||
door->SetIncline(door->GetIncline() + Strings::ToInt(arg2.c_str()));
|
||||
door->SetIncline(door->GetIncline() + Strings::ToInt(arg2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ void command_faction(Client *c, const Seperator *sep)
|
||||
)
|
||||
) {
|
||||
uint32 character_id = target->CharacterID();
|
||||
uint32 faction_id = Strings::ToUnsignedInt(faction_filter.c_str());
|
||||
uint32 faction_id = Strings::ToUnsignedInt(faction_filter);
|
||||
if (target->ReloadCharacterFaction(target, faction_id, character_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
@@ -170,7 +170,7 @@ bool HealRotation::ClearMemberPool()
|
||||
if (!ClearTargetPool())
|
||||
LogError("failed to clear m_target_pool (size: [{}])", m_target_pool.size());
|
||||
|
||||
auto clear_list = const_cast<const std::list<Bot*>&>(m_member_pool);
|
||||
auto& clear_list = const_cast<const std::list<Bot*>&>(m_member_pool);
|
||||
for (auto member_iter : clear_list)
|
||||
member_iter->LeaveHealRotationMemberPool();
|
||||
|
||||
@@ -183,7 +183,7 @@ bool HealRotation::ClearTargetPool()
|
||||
m_hot_active = false;
|
||||
m_is_active = false;
|
||||
|
||||
auto clear_list = const_cast<const std::list<Mob*>&>(m_target_pool);
|
||||
auto& clear_list = const_cast<const std::list<Mob*>&>(m_target_pool);
|
||||
for (auto target_iter : clear_list)
|
||||
target_iter->LeaveHealRotationTargetPool();
|
||||
|
||||
|
||||
@@ -907,12 +907,12 @@ std::string lua_say_link(const char *phrase) {
|
||||
}
|
||||
|
||||
void lua_set_rule(std::string rule_name, std::string rule_value) {
|
||||
RuleManager::Instance()->SetRule(rule_name.c_str(), rule_value.c_str());
|
||||
RuleManager::Instance()->SetRule(rule_name, rule_value);
|
||||
}
|
||||
|
||||
std::string lua_get_rule(std::string rule_name) {
|
||||
std::string rule_value;
|
||||
RuleManager::Instance()->GetRule(rule_name.c_str(), rule_value);
|
||||
RuleManager::Instance()->GetRule(rule_name, rule_value);
|
||||
return rule_value;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -172,7 +172,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
if (zone_port.size() > 1) {
|
||||
std::string p_name = zone_port[1];
|
||||
Config->SetZonePort(Strings::ToInt(p_name.c_str()));
|
||||
Config->SetZonePort(Strings::ToInt(p_name));
|
||||
}
|
||||
|
||||
worldserver.SetLaunchedName(z_name.c_str());
|
||||
@@ -193,7 +193,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
if (zone_port.size() > 1) {
|
||||
std::string p_name = zone_port[1];
|
||||
Config->SetZonePort(Strings::ToInt(p_name.c_str()));
|
||||
Config->SetZonePort(Strings::ToInt(p_name));
|
||||
}
|
||||
|
||||
worldserver.SetLaunchedName(z_name.c_str());
|
||||
@@ -214,7 +214,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
if (zone_port.size() > 1) {
|
||||
std::string p_name = zone_port[1];
|
||||
Config->SetZonePort(Strings::ToInt(p_name.c_str()));
|
||||
Config->SetZonePort(Strings::ToInt(p_name));
|
||||
}
|
||||
|
||||
worldserver.SetLaunchedName(z_name.c_str());
|
||||
@@ -380,7 +380,7 @@ int main(int argc, char** argv) {
|
||||
std::string tmp;
|
||||
if (database.GetVariable("RuleSet", tmp)) {
|
||||
LogInfo("Loading rule set [{}]", tmp.c_str());
|
||||
if (!RuleManager::Instance()->LoadRules(&database, tmp.c_str(), false)) {
|
||||
if (!RuleManager::Instance()->LoadRules(&database, tmp, false)) {
|
||||
LogError("Failed to load ruleset [{}], falling back to defaults", tmp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -6976,9 +6976,9 @@ std::string Mob::GetBucketKey() {
|
||||
std::string Mob::GetBucketRemaining(std::string bucket_name) {
|
||||
std::string full_bucket_name = fmt::format("{}-{}", GetBucketKey(), bucket_name);
|
||||
std::string bucket_remaining = DataBucket::GetDataRemaining(full_bucket_name);
|
||||
if (!bucket_remaining.empty() && Strings::ToInt(bucket_remaining.c_str()) > 0) {
|
||||
if (!bucket_remaining.empty() && Strings::ToInt(bucket_remaining) > 0) {
|
||||
return bucket_remaining;
|
||||
} else if (Strings::ToInt(bucket_remaining.c_str()) == 0) {
|
||||
} else if (Strings::ToInt(bucket_remaining) == 0) {
|
||||
return "0";
|
||||
}
|
||||
return std::string();
|
||||
|
||||
+24
-24
@@ -3535,71 +3535,71 @@ std::string QuestManager::GetEncounter() const {
|
||||
|
||||
void QuestManager::UpdateZoneHeader(std::string type, std::string value) {
|
||||
if (strcasecmp(type.c_str(), "ztype") == 0)
|
||||
zone->newzone_data.ztype = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.ztype = Strings::ToInt(value);
|
||||
else if (strcasecmp(type.c_str(), "fog_red") == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
zone->newzone_data.fog_red[i] = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.fog_red[i] = Strings::ToInt(value);
|
||||
}
|
||||
} else if (strcasecmp(type.c_str(), "fog_green") == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
zone->newzone_data.fog_green[i] = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.fog_green[i] = Strings::ToInt(value);
|
||||
}
|
||||
} else if (strcasecmp(type.c_str(), "fog_blue") == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
zone->newzone_data.fog_blue[i] = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.fog_blue[i] = Strings::ToInt(value);
|
||||
}
|
||||
} else if (strcasecmp(type.c_str(), "fog_minclip") == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
zone->newzone_data.fog_minclip[i] = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.fog_minclip[i] = Strings::ToFloat(value);
|
||||
}
|
||||
} else if (strcasecmp(type.c_str(), "fog_maxclip") == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
zone->newzone_data.fog_maxclip[i] = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.fog_maxclip[i] = Strings::ToFloat(value);
|
||||
}
|
||||
} else if (strcasecmp(type.c_str(), "gravity") == 0) {
|
||||
zone->newzone_data.gravity = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.gravity = Strings::ToFloat(value);
|
||||
} else if (strcasecmp(type.c_str(), "time_type") == 0) {
|
||||
zone->newzone_data.time_type = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.time_type = Strings::ToInt(value);
|
||||
} else if (strcasecmp(type.c_str(), "rain_chance") == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
zone->newzone_data.rain_chance[i] = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.rain_chance[i] = Strings::ToInt(value);
|
||||
}
|
||||
} else if (strcasecmp(type.c_str(), "rain_duration") == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
zone->newzone_data.rain_duration[i] = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.rain_duration[i] = Strings::ToInt(value);
|
||||
}
|
||||
} else if (strcasecmp(type.c_str(), "snow_chance") == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
zone->newzone_data.snow_chance[i] = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.snow_chance[i] = Strings::ToInt(value);
|
||||
}
|
||||
} else if (strcasecmp(type.c_str(), "snow_duration") == 0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
zone->newzone_data.snow_duration[i] = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.snow_duration[i] = Strings::ToInt(value);
|
||||
}
|
||||
} else if (strcasecmp(type.c_str(), "sky") == 0) {
|
||||
zone->newzone_data.sky = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.sky = Strings::ToInt(value);
|
||||
} else if (strcasecmp(type.c_str(), "safe_x") == 0) {
|
||||
zone->newzone_data.safe_x = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.safe_x = Strings::ToFloat(value);
|
||||
} else if (strcasecmp(type.c_str(), "safe_y") == 0) {
|
||||
zone->newzone_data.safe_y = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.safe_y = Strings::ToFloat(value);
|
||||
} else if (strcasecmp(type.c_str(), "safe_z") == 0) {
|
||||
zone->newzone_data.safe_z = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.safe_z = Strings::ToFloat(value);
|
||||
} else if (strcasecmp(type.c_str(), "max_z") == 0) {
|
||||
zone->newzone_data.max_z = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.max_z = Strings::ToFloat(value);
|
||||
} else if (strcasecmp(type.c_str(), "underworld") == 0) {
|
||||
zone->newzone_data.underworld = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.underworld = Strings::ToFloat(value);
|
||||
} else if (strcasecmp(type.c_str(), "minclip") == 0) {
|
||||
zone->newzone_data.minclip = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.minclip = Strings::ToFloat(value);
|
||||
} else if (strcasecmp(type.c_str(), "maxclip") == 0) {
|
||||
zone->newzone_data.maxclip = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.maxclip = Strings::ToFloat(value);
|
||||
} else if (strcasecmp(type.c_str(), "fog_density") == 0) {
|
||||
zone->newzone_data.fog_density = Strings::ToFloat(value.c_str());
|
||||
zone->newzone_data.fog_density = Strings::ToFloat(value);
|
||||
} else if (strcasecmp(type.c_str(), "suspendbuffs") == 0) {
|
||||
zone->newzone_data.suspend_buffs = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.suspend_buffs = Strings::ToInt(value);
|
||||
} else if (strcasecmp(type.c_str(), "lavadamage") == 0) {
|
||||
zone->newzone_data.lava_damage = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.lava_damage = Strings::ToInt(value);
|
||||
} else if (strcasecmp(type.c_str(), "minlavadamage") == 0) {
|
||||
zone->newzone_data.min_lava_damage = Strings::ToInt(value.c_str());
|
||||
zone->newzone_data.min_lava_damage = Strings::ToInt(value);
|
||||
}
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
||||
|
||||
+2
-2
@@ -116,7 +116,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool is_static) {
|
||||
std::string tmp;
|
||||
if (database.GetVariable("loglevel", tmp)) {
|
||||
int log_levels[4];
|
||||
int tmp_i = Strings::ToInt(tmp.c_str());
|
||||
int tmp_i = Strings::ToInt(tmp);
|
||||
if (tmp_i>9){ //Server is using the new code
|
||||
for(int i=0;i<4;i++){
|
||||
if (((int)tmp[i]>=48) && ((int)tmp[i]<=57))
|
||||
@@ -1113,7 +1113,7 @@ bool Zone::Init(bool is_static) {
|
||||
if (RuleManager::Instance()->GetActiveRulesetID() != default_ruleset) {
|
||||
std::string r_name = RuleSetsRepository::GetRuleSetName(database, default_ruleset);
|
||||
if (r_name.size() > 0) {
|
||||
RuleManager::Instance()->LoadRules(&database, r_name.c_str(), false);
|
||||
RuleManager::Instance()->LoadRules(&database, r_name, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ void ZoneEventScheduler::Process(Zone *zone, WorldContentService *content_servic
|
||||
rule_key,
|
||||
rule_value
|
||||
);
|
||||
RuleManager::Instance()->SetRule(rule_key.c_str(), rule_value.c_str(), nullptr, false, true);
|
||||
RuleManager::Instance()->SetRule(rule_key, rule_value, nullptr, false, true);
|
||||
}
|
||||
m_active_events.push_back(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user