mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 10:14:06 +00:00
chore: Eradicate C-style casts and further clean up some code (#1361)
* cast and code cleanup * cast cleanup * bug fixes and improvements * no getBoolField method exists * fixes * unbroke sg cannon scoring * removing comments * Remove the c-style cast warning I added from CMakeLists now that they're gone (it triggers on 3rd party dependencies and slows down compilation) * (Hopefully) fix MacOS compilation error * partially-implemented feedback * more updates to account for feedback * change bool default --------- Co-authored-by: jadebenn <jonahebenn@yahoo.com>
This commit is contained in:
@@ -40,7 +40,7 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id):
|
||||
//Grab the aggro information from BaseCombatAI:
|
||||
auto componentQuery = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT aggroRadius, tetherSpeed, pursuitSpeed, softTetherRadius, hardTetherRadius FROM BaseCombatAIComponent WHERE id = ?;");
|
||||
componentQuery.bind(1, (int)id);
|
||||
componentQuery.bind(1, static_cast<int>(id));
|
||||
|
||||
auto componentResult = componentQuery.execQuery();
|
||||
|
||||
@@ -77,7 +77,7 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id):
|
||||
*/
|
||||
auto skillQuery = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT skillID, cooldown, behaviorID FROM SkillBehavior WHERE skillID IN (SELECT skillID FROM ObjectSkills WHERE objectTemplate = ?);");
|
||||
skillQuery.bind(1, (int)parent->GetLOT());
|
||||
skillQuery.bind(1, static_cast<int>(parent->GetLOT()));
|
||||
|
||||
auto result = skillQuery.execQuery();
|
||||
|
||||
@@ -523,7 +523,7 @@ bool BaseCombatAIComponent::IsMech() {
|
||||
void BaseCombatAIComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
|
||||
outBitStream->Write(m_DirtyStateOrTarget || bIsInitialUpdate);
|
||||
if (m_DirtyStateOrTarget || bIsInitialUpdate) {
|
||||
outBitStream->Write(uint32_t(m_State));
|
||||
outBitStream->Write(m_State);
|
||||
outBitStream->Write(m_Target);
|
||||
m_DirtyStateOrTarget = false;
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ class Entity;
|
||||
/**
|
||||
* The current state of the AI
|
||||
*/
|
||||
enum class AiState : int {
|
||||
enum class AiState : uint32_t {
|
||||
idle = 0, // Doing nothing
|
||||
aggro, // Waiting for an enemy to cross / running back to spawn
|
||||
tether, // Chasing an enemy
|
||||
|
@@ -41,7 +41,7 @@ void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUp
|
||||
for (const auto& [id, buff] : m_Buffs) {
|
||||
outBitStream->Write<uint32_t>(id);
|
||||
outBitStream->Write(buff.time != 0.0f);
|
||||
if (buff.time != 0.0f) outBitStream->Write(static_cast<uint32_t>(buff.time * 1000.0f));
|
||||
if (buff.time != 0.0f) outBitStream->Write<uint32_t>(buff.time * 1000.0f);
|
||||
outBitStream->Write(buff.cancelOnDeath);
|
||||
outBitStream->Write(buff.cancelOnZone);
|
||||
outBitStream->Write(buff.cancelOnDamaged);
|
||||
@@ -147,8 +147,8 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO
|
||||
addedByTeammate = std::count(team->members.begin(), team->members.end(), m_Parent->GetObjectID()) > 0;
|
||||
}
|
||||
|
||||
GameMessages::SendAddBuff(const_cast<LWOOBJID&>(m_Parent->GetObjectID()), source, (uint32_t)id,
|
||||
(uint32_t)duration * 1000, addImmunity, cancelOnDamaged, cancelOnDeath,
|
||||
GameMessages::SendAddBuff(const_cast<LWOOBJID&>(m_Parent->GetObjectID()), source, static_cast<uint32_t>(id),
|
||||
static_cast<uint32_t>(duration) * 1000, addImmunity, cancelOnDamaged, cancelOnDeath,
|
||||
cancelOnLogout, cancelOnRemoveBuff, cancelOnUi, cancelOnUnequip, cancelOnZone, addedByTeammate, applyOnTeammates);
|
||||
|
||||
float tick = 0;
|
||||
@@ -431,7 +431,7 @@ const std::vector<BuffParameter>& BuffComponent::GetBuffParameters(int32_t buffI
|
||||
}
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM BuffParameters WHERE BuffID = ?;");
|
||||
query.bind(1, (int)buffId);
|
||||
query.bind(1, static_cast<int>(buffId));
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
|
@@ -135,7 +135,7 @@ void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInit
|
||||
outBitStream->Write0();
|
||||
outBitStream->Write(m_IsLanding);
|
||||
if (m_IsLanding) {
|
||||
outBitStream->Write(uint16_t(m_LastRocketConfig.size()));
|
||||
outBitStream->Write<uint16_t>(m_LastRocketConfig.size());
|
||||
for (uint16_t character : m_LastRocketConfig) {
|
||||
outBitStream->Write(character);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInit
|
||||
outBitStream->Write(m_DirtySocialInfo);
|
||||
if (m_DirtySocialInfo) {
|
||||
outBitStream->Write(m_GuildID);
|
||||
outBitStream->Write<unsigned char>(static_cast<unsigned char>(m_GuildName.size()));
|
||||
outBitStream->Write<unsigned char>(m_GuildName.size());
|
||||
if (!m_GuildName.empty())
|
||||
outBitStream->WriteBits(reinterpret_cast<const unsigned char*>(m_GuildName.c_str()), static_cast<unsigned char>(m_GuildName.size()) * sizeof(wchar_t) * 8);
|
||||
|
||||
@@ -229,7 +229,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
uint32_t mapID;
|
||||
child->QueryAttribute("map", &mapID);
|
||||
|
||||
m_ZoneStatistics.insert({ (LWOMAPID)mapID, statistics });
|
||||
m_ZoneStatistics.insert({ static_cast<LWOMAPID>(mapID), statistics });
|
||||
|
||||
child = child->NextSiblingElement();
|
||||
}
|
||||
@@ -515,9 +515,9 @@ void CharacterComponent::TrackPositionUpdate(const NiPoint3& newPosition) {
|
||||
const auto distance = NiPoint3::Distance(newPosition, m_Parent->GetPosition());
|
||||
|
||||
if (m_IsRacing) {
|
||||
UpdatePlayerStatistic(DistanceDriven, (uint64_t)distance);
|
||||
UpdatePlayerStatistic(DistanceDriven, static_cast<uint64_t>(distance));
|
||||
} else {
|
||||
UpdatePlayerStatistic(MetersTraveled, (uint64_t)distance);
|
||||
UpdatePlayerStatistic(MetersTraveled, static_cast<uint64_t>(distance));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -154,7 +154,7 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
|
||||
outBitStream->Write(m_fMaxArmor);
|
||||
outBitStream->Write(m_fMaxImagination);
|
||||
|
||||
outBitStream->Write(uint32_t(m_FactionIDs.size()));
|
||||
outBitStream->Write<uint32_t>(m_FactionIDs.size());
|
||||
for (size_t i = 0; i < m_FactionIDs.size(); ++i) {
|
||||
outBitStream->Write(m_FactionIDs[i]);
|
||||
}
|
||||
@@ -380,7 +380,7 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT enemyList FROM Factions WHERE faction = ?;");
|
||||
query.bind(1, (int)factionID);
|
||||
query.bind(1, static_cast<int>(factionID));
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
|
@@ -458,7 +458,7 @@ const std::vector<uint32_t>& MissionComponent::QueryAchievements(eMissionTaskTyp
|
||||
bool MissionComponent::RequiresItem(const LOT lot) {
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT type FROM Objects WHERE id = ?;");
|
||||
query.bind(1, (int)lot);
|
||||
query.bind(1, static_cast<int>(lot));
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
|
@@ -57,7 +57,7 @@ void ModuleAssemblyComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
|
||||
|
||||
outBitStream->Write(m_UseOptionalParts);
|
||||
|
||||
outBitStream->Write(static_cast<uint16_t>(m_AssemblyPartsLOTs.size()));
|
||||
outBitStream->Write<uint16_t>(m_AssemblyPartsLOTs.size());
|
||||
for (char16_t character : m_AssemblyPartsLOTs) {
|
||||
outBitStream->Write(character);
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ MoverSubComponent::~MoverSubComponent() = default;
|
||||
void MoverSubComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) {
|
||||
outBitStream->Write<bool>(true);
|
||||
|
||||
outBitStream->Write<uint32_t>(static_cast<uint32_t>(mState));
|
||||
outBitStream->Write(mState);
|
||||
outBitStream->Write<int32_t>(mDesiredWaypointIndex);
|
||||
outBitStream->Write(mShouldStopAtDesiredWaypoint);
|
||||
outBitStream->Write(mInReverse);
|
||||
@@ -90,9 +90,9 @@ void MovingPlatformComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
|
||||
// Is on rail
|
||||
outBitStream->Write1();
|
||||
|
||||
outBitStream->Write(static_cast<uint16_t>(m_PathName.size()));
|
||||
outBitStream->Write<uint16_t>(m_PathName.size());
|
||||
for (const auto& c : m_PathName) {
|
||||
outBitStream->Write(static_cast<uint16_t>(c));
|
||||
outBitStream->Write<uint16_t>(c);
|
||||
}
|
||||
|
||||
// Starting point
|
||||
@@ -107,7 +107,7 @@ void MovingPlatformComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
|
||||
|
||||
if (hasPlatform) {
|
||||
auto* mover = static_cast<MoverSubComponent*>(m_MoverSubComponent);
|
||||
outBitStream->Write<uint32_t>(static_cast<uint32_t>(m_MoverSubComponentType));
|
||||
outBitStream->Write(m_MoverSubComponentType);
|
||||
|
||||
if (m_MoverSubComponentType == eMoverSubComponentType::simpleMover) {
|
||||
// TODO
|
||||
|
@@ -113,8 +113,8 @@ void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpd
|
||||
|
||||
outBitStream->Write1(); // Always serialize as dirty for now
|
||||
|
||||
outBitStream->Write<uint32_t>(static_cast<unsigned int>(m_Status));
|
||||
outBitStream->Write<uint32_t>(static_cast<uint32_t>(tamed ? m_Ability : PetAbilityType::Invalid)); // Something with the overhead icon?
|
||||
outBitStream->Write<uint32_t>(m_Status);
|
||||
outBitStream->Write(tamed ? m_Ability : PetAbilityType::Invalid); // Something with the overhead icon?
|
||||
|
||||
const bool interacting = m_Interaction != LWOOBJID_EMPTY;
|
||||
|
||||
@@ -136,12 +136,12 @@ void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpd
|
||||
const auto nameData = GeneralUtils::UTF8ToUTF16(m_Name);
|
||||
const auto ownerNameData = GeneralUtils::UTF8ToUTF16(m_OwnerName);
|
||||
|
||||
outBitStream->Write(static_cast<uint8_t>(nameData.size()));
|
||||
outBitStream->Write<uint8_t>(nameData.size());
|
||||
for (const auto c : nameData) {
|
||||
outBitStream->Write(c);
|
||||
}
|
||||
|
||||
outBitStream->Write(static_cast<uint8_t>(ownerNameData.size()));
|
||||
outBitStream->Write<uint8_t>(ownerNameData.size());
|
||||
for (const auto c : ownerNameData) {
|
||||
outBitStream->Write(c);
|
||||
}
|
||||
@@ -190,7 +190,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
if (cached == buildCache.end()) {
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT ValidPiecesLXF, PuzzleModelLot, Timelimit, NumValidPieces, imagCostPerBuild FROM TamingBuildPuzzles WHERE NPCLot = ?;");
|
||||
query.bind(1, (int)m_Parent->GetLOT());
|
||||
query.bind(1, static_cast<int>(m_Parent->GetLOT()));
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include "Preconditions.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
enum class PetAbilityType
|
||||
enum class PetAbilityType : uint32_t
|
||||
{
|
||||
Invalid,
|
||||
GoToObject,
|
||||
|
@@ -163,7 +163,7 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
|
||||
const auto modApproved = playerPropertyLookupResults->getBoolean(10);
|
||||
const auto dateLastUpdated = playerPropertyLookupResults->getInt64(11);
|
||||
const auto reputation = playerPropertyLookupResults->getUInt(14);
|
||||
const auto performanceCost = (float)playerPropertyLookupResults->getDouble(16);
|
||||
const auto performanceCost = playerPropertyLookupResults->getFloat(16);
|
||||
|
||||
playerEntry = SetPropertyValues(playerEntry, cloneId, character->GetName(), propertyName, propertyDescription, reputation, true, true, modApproved, true, true, privacyOption, dateLastUpdated, performanceCost);
|
||||
} else {
|
||||
@@ -187,7 +187,7 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
|
||||
propertyLookup->setString(2, searchString.c_str());
|
||||
propertyLookup->setString(3, searchString.c_str());
|
||||
propertyLookup->setString(4, searchString.c_str());
|
||||
propertyLookup->setInt(5, sortMethod == SORT_TYPE_FEATURED || sortMethod == SORT_TYPE_FRIENDS ? (uint32_t)PropertyPrivacyOption::Friends : (uint32_t)PropertyPrivacyOption::Public);
|
||||
propertyLookup->setInt(5, sortMethod == SORT_TYPE_FEATURED || sortMethod == SORT_TYPE_FRIENDS ? static_cast<uint32_t>(PropertyPrivacyOption::Friends) : static_cast<uint32_t>(PropertyPrivacyOption::Public));
|
||||
propertyLookup->setInt(6, numResults);
|
||||
propertyLookup->setInt(7, startIndex);
|
||||
|
||||
@@ -203,7 +203,7 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
|
||||
const auto modApproved = propertyEntry->getBoolean(10);
|
||||
const auto dateLastUpdated = propertyEntry->getInt(11);
|
||||
const float reputation = propertyEntry->getInt(14);
|
||||
const auto performanceCost = (float)propertyEntry->getDouble(16);
|
||||
const auto performanceCost = propertyEntry->getFloat(16);
|
||||
|
||||
PropertySelectQueryProperty entry{};
|
||||
|
||||
|
@@ -92,7 +92,7 @@ std::vector<NiPoint3> PropertyManagementComponent::GetPaths() const {
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT path FROM PropertyTemplate WHERE mapID = ?;");
|
||||
query.bind(1, (int)zoneId);
|
||||
query.bind(1, static_cast<int>(zoneId));
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
|
@@ -401,18 +401,18 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu
|
||||
|
||||
if (missionComponent == nullptr) return;
|
||||
|
||||
missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::COMPETED_IN_RACE); // Progress task for competing in a race
|
||||
missionComponent->Progress(eMissionTaskType::RACING, data->smashedTimes, (LWOOBJID)eRacingTaskParam::SAFE_DRIVER); // Finish a race without being smashed.
|
||||
missionComponent->Progress(eMissionTaskType::RACING, 0, static_cast<LWOOBJID>(eRacingTaskParam::COMPETED_IN_RACE)); // Progress task for competing in a race
|
||||
missionComponent->Progress(eMissionTaskType::RACING, data->smashedTimes, static_cast<LWOOBJID>(eRacingTaskParam::SAFE_DRIVER)); // Finish a race without being smashed.
|
||||
|
||||
// If solo racing is enabled OR if there are 3 players in the race, progress placement tasks.
|
||||
if (m_SoloRacing || m_LoadedPlayers > 2) {
|
||||
missionComponent->Progress(eMissionTaskType::RACING, data->finished, (LWOOBJID)eRacingTaskParam::FINISH_WITH_PLACEMENT); // Finish in 1st place on a race
|
||||
missionComponent->Progress(eMissionTaskType::RACING, data->finished, static_cast<LWOOBJID>(eRacingTaskParam::FINISH_WITH_PLACEMENT)); // Finish in 1st place on a race
|
||||
if (data->finished == 1) {
|
||||
missionComponent->Progress(eMissionTaskType::RACING, Game::zoneManager->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks.
|
||||
missionComponent->Progress(eMissionTaskType::RACING, Game::zoneManager->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::WIN_RACE_IN_WORLD); // Finished first place in specific world.
|
||||
missionComponent->Progress(eMissionTaskType::RACING, Game::zoneManager->GetZone()->GetWorldID(), static_cast<LWOOBJID>(eRacingTaskParam::FIRST_PLACE_MULTIPLE_TRACKS)); // Finish in 1st place on multiple tracks.
|
||||
missionComponent->Progress(eMissionTaskType::RACING, Game::zoneManager->GetZone()->GetWorldID(), static_cast<LWOOBJID>(eRacingTaskParam::WIN_RACE_IN_WORLD)); // Finished first place in specific world.
|
||||
}
|
||||
if (data->finished == m_LoadedPlayers) {
|
||||
missionComponent->Progress(eMissionTaskType::RACING, Game::zoneManager->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::LAST_PLACE_FINISH); // Finished first place in specific world.
|
||||
missionComponent->Progress(eMissionTaskType::RACING, Game::zoneManager->GetZone()->GetWorldID(), static_cast<LWOOBJID>(eRacingTaskParam::LAST_PLACE_FINISH)); // Finished first place in specific world.
|
||||
}
|
||||
}
|
||||
} else if ((id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") && button == m_ActivityExitConfirm) {
|
||||
@@ -439,7 +439,7 @@ void RacingControlComponent::Serialize(RakNet::BitStream* outBitStream, bool bIs
|
||||
// BEGIN Scripted Activity
|
||||
outBitStream->Write1();
|
||||
|
||||
outBitStream->Write(static_cast<uint32_t>(m_RacingPlayers.size()));
|
||||
outBitStream->Write<uint32_t>(m_RacingPlayers.size());
|
||||
for (const auto& player : m_RacingPlayers) {
|
||||
outBitStream->Write(player.playerID);
|
||||
|
||||
@@ -461,7 +461,7 @@ void RacingControlComponent::Serialize(RakNet::BitStream* outBitStream, bool bIs
|
||||
// END Scripted Activity
|
||||
|
||||
outBitStream->Write1();
|
||||
outBitStream->Write(static_cast<uint16_t>(m_RacingPlayers.size()));
|
||||
outBitStream->Write<uint16_t>(m_RacingPlayers.size());
|
||||
|
||||
outBitStream->Write(!m_AllPlayersReady);
|
||||
if (!m_AllPlayersReady) {
|
||||
@@ -495,7 +495,7 @@ void RacingControlComponent::Serialize(RakNet::BitStream* outBitStream, bool bIs
|
||||
outBitStream->Write(bIsInitialUpdate);
|
||||
if (bIsInitialUpdate) {
|
||||
outBitStream->Write(m_RemainingLaps);
|
||||
outBitStream->Write(static_cast<uint16_t>(m_PathName.size()));
|
||||
outBitStream->Write<uint16_t>(m_PathName.size());
|
||||
for (const auto character : m_PathName) {
|
||||
outBitStream->Write(character);
|
||||
}
|
||||
@@ -794,7 +794,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
|
||||
const auto& position = waypoint.position;
|
||||
|
||||
if (std::abs((int)respawnIndex - (int)player.respawnIndex) > 10 &&
|
||||
if (std::abs(static_cast<int>(respawnIndex) - static_cast<int>(player.respawnIndex)) > 10 &&
|
||||
player.respawnIndex != path->pathWaypoints.size() - 1) {
|
||||
++respawnIndex;
|
||||
|
||||
@@ -848,7 +848,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
if (missionComponent != nullptr) {
|
||||
|
||||
// Progress lap time tasks
|
||||
missionComponent->Progress(eMissionTaskType::RACING, (lapTime) * 1000, (LWOOBJID)eRacingTaskParam::LAP_TIME);
|
||||
missionComponent->Progress(eMissionTaskType::RACING, (lapTime) * 1000, static_cast<LWOOBJID>(eRacingTaskParam::LAP_TIME));
|
||||
|
||||
if (player.lap == 3) {
|
||||
m_Finished++;
|
||||
@@ -864,7 +864,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
||||
|
||||
LeaderboardManager::SaveScore(playerEntity->GetObjectID(), m_ActivityID, static_cast<float>(player.raceTime), static_cast<float>(player.bestLapTime), static_cast<float>(player.finished == 1));
|
||||
// Entire race time
|
||||
missionComponent->Progress(eMissionTaskType::RACING, (raceTime) * 1000, (LWOOBJID)eRacingTaskParam::TOTAL_TRACK_TIME);
|
||||
missionComponent->Progress(eMissionTaskType::RACING, (raceTime) * 1000, static_cast<LWOOBJID>(eRacingTaskParam::TOTAL_TRACK_TIME));
|
||||
|
||||
auto* characterComponent = playerEntity->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
|
@@ -81,14 +81,14 @@ void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitia
|
||||
Entity* builder = GetBuilder();
|
||||
|
||||
if (builder) {
|
||||
outBitStream->Write((uint32_t)1);
|
||||
outBitStream->Write<uint32_t>(1);
|
||||
outBitStream->Write(builder->GetObjectID());
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
outBitStream->Write(0.0f);
|
||||
}
|
||||
} else {
|
||||
outBitStream->Write((uint32_t)0);
|
||||
outBitStream->Write<uint32_t>(0);
|
||||
}
|
||||
// END Scripted Activity
|
||||
|
||||
|
@@ -468,7 +468,7 @@ float_t ScriptedActivityComponent::GetActivityValue(LWOOBJID playerID, uint32_t
|
||||
|
||||
auto* data = GetActivityPlayerData(playerID);
|
||||
if (data != nullptr) {
|
||||
value = data->values[std::min(index, (uint32_t)9)];
|
||||
value = data->values[std::min(index, static_cast<uint32_t>(9))];
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -477,7 +477,7 @@ float_t ScriptedActivityComponent::GetActivityValue(LWOOBJID playerID, uint32_t
|
||||
void ScriptedActivityComponent::SetActivityValue(LWOOBJID playerID, uint32_t index, float_t value) {
|
||||
auto* data = AddActivityPlayerData(playerID);
|
||||
if (data != nullptr) {
|
||||
data->values[std::min(index, (uint32_t)9)] = value;
|
||||
data->values[std::min(index, static_cast<uint32_t>(9))] = value;
|
||||
}
|
||||
|
||||
Game::entityManager->SerializeEntity(m_Parent);
|
||||
|
@@ -89,7 +89,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT behaviorID FROM SkillBehavior WHERE skillID = (SELECT skillID FROM ObjectSkills WHERE objectTemplate = ?);");
|
||||
query.bind(1, (int)sync_entry.lot);
|
||||
query.bind(1, static_cast<int>(sync_entry.lot));
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
@@ -299,7 +299,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
}
|
||||
//start.optionalTargetID = target;
|
||||
|
||||
start.sBitStream.assign((char*)bitStream->GetData(), bitStream->GetNumberOfBytesUsed());
|
||||
start.sBitStream.assign(reinterpret_cast<char*>(bitStream->GetData()), bitStream->GetNumberOfBytesUsed());
|
||||
|
||||
// Write message
|
||||
RakNet::BitStream message;
|
||||
@@ -409,7 +409,7 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT behaviorID FROM SkillBehavior WHERE skillID = (SELECT skillID FROM ObjectSkills WHERE objectTemplate = ?);");
|
||||
query.bind(1, (int)entry.lot);
|
||||
query.bind(1, static_cast<int>(entry.lot));
|
||||
auto result = query.execQuery();
|
||||
|
||||
if (result.eof()) {
|
||||
@@ -430,7 +430,7 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
|
||||
|
||||
DoClientProjectileImpact projectileImpact;
|
||||
|
||||
projectileImpact.sBitStream.assign((char*)bitStream->GetData(), bitStream->GetNumberOfBytesUsed());
|
||||
projectileImpact.sBitStream.assign(reinterpret_cast<char*>(bitStream->GetData()), bitStream->GetNumberOfBytesUsed());
|
||||
projectileImpact.i64OwnerID = this->m_Parent->GetObjectID();
|
||||
projectileImpact.i64OrgID = entry.id;
|
||||
projectileImpact.i64TargetID = entry.branchContext.target;
|
||||
|
Reference in New Issue
Block a user