Skip to content

Commit

Permalink
fix: crash and mopo light bug
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed Apr 26, 2022
1 parent 3c52139 commit 76ccb07
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Code/client/Services/Generic/CharacterService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ void CharacterService::OnActorRemoved(const ActorRemovedEvent& acEvent) noexcept
return;
}

auto& formIdComponent = m_world.get<FormIdComponent>(*entityIt);
CancelServerAssignment(*entityIt, formIdComponent.Id);

if (m_world.all_of<FormIdComponent>(*entityIt))
m_world.remove<FormIdComponent>(*entityIt);

if (m_world.orphan(*entityIt))
m_world.destroy(*entityIt);

auto& formIdComponent = m_world.get<FormIdComponent>(*entityIt);
CancelServerAssignment(*entityIt, formIdComponent.Id);
}

void CharacterService::OnUpdate(const UpdateEvent& acUpdateEvent) noexcept
Expand Down
2 changes: 1 addition & 1 deletion Code/client/Services/Generic/ObjectService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void ObjectService::OnActivate(const ActivateEvent& acEvent) noexcept

if (pEntity == std::end(view))
{
spdlog::error("Activator entity not found for form id {:X}", acEvent.pActivator->formID);
//spdlog::error("Activator entity not found for form id {:X}", acEvent.pActivator->formID);
return;
}

Expand Down
2 changes: 2 additions & 0 deletions Code/client/Services/Generic/TransportService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ void TransportService::OnConnected()

auto& entry = request.UserMods.ModList.emplace_back();
entry.Id = pMod->GetId();
if (pMod->IsLite())
entry.Id |= 0xE000;
entry.Filename = pMod->filename;
}

Expand Down
2 changes: 0 additions & 2 deletions Code/client/Systems/ModSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,5 @@ void ModSystem::HandleMods(const Mods& acMods) noexcept
m_standardToServer[pMod->GetId() & 0xFF] = mod.Id;
}
}

// this should never get hit.
}
}
2 changes: 1 addition & 1 deletion Code/client/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ uint64_t World::GetTick() const noexcept

void World::Create() noexcept
{
if(entt::locator<World>::has_value())
if (!entt::locator<World>::has_value())
{
entt::locator<World>::emplace();
}
Expand Down
6 changes: 3 additions & 3 deletions Code/encoding/Structs/Mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void Mods::Serialize(TiltedPhoques::Buffer::Writer& aWriter) const noexcept

for (auto& entry : ModList)
{
aWriter.WriteBits(entry.Id, 12);
aWriter.WriteBits(entry.Id, 16);
Serialization::WriteString(aWriter, entry.Filename);
}
}
Expand All @@ -35,8 +35,8 @@ void Mods::Deserialize(TiltedPhoques::Buffer::Reader& aReader) noexcept
ModList.resize(modCount);
for (size_t i = 0; i < modCount; ++i)
{
aReader.ReadBits(data, 12);
ModList[i].Id = data & 0xFFF;
aReader.ReadBits(data, 16);
ModList[i].Id = data;
ModList[i].Filename = Serialization::ReadString(aReader);
}
}

0 comments on commit 76ccb07

Please sign in to comment.