mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +00:00
crash and log fix
This commit is contained in:
parent
bb79528c0e
commit
79bc6e73ff
@ -16,7 +16,7 @@ Writer::~Writer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Writer::Log(const char* time, const char* message) {
|
void Writer::Log(const char* time, const char* message) {
|
||||||
if (!m_Outfile) return;
|
if (!m_Outfile || !m_Enabled) return;
|
||||||
|
|
||||||
fputs(time, m_Outfile);
|
fputs(time, m_Outfile);
|
||||||
fputs(message, m_Outfile);
|
fputs(message, m_Outfile);
|
||||||
|
@ -95,10 +95,16 @@ void BuffComponent::Update(float deltaTime) {
|
|||||||
|
|
||||||
if (buff.second.time <= 0.0f) {
|
if (buff.second.time <= 0.0f) {
|
||||||
RemoveBuff(buff.first);
|
RemoveBuff(buff.first);
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_BuffsToRemove.empty()) return;
|
||||||
|
|
||||||
|
for (const auto& buff : m_BuffsToRemove) {
|
||||||
|
m_Buffs.erase(buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_BuffsToRemove.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& GetFxName(const std::string& buffname) {
|
const std::string& GetFxName(const std::string& buffname) {
|
||||||
@ -216,7 +222,7 @@ void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity
|
|||||||
|
|
||||||
GameMessages::SendRemoveBuff(m_Parent, fromUnEquip, removeImmunity, id);
|
GameMessages::SendRemoveBuff(m_Parent, fromUnEquip, removeImmunity, id);
|
||||||
|
|
||||||
m_Buffs.erase(iter);
|
m_BuffsToRemove.push_back(id);
|
||||||
|
|
||||||
RemoveBuffEffect(id);
|
RemoveBuffEffect(id);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,9 @@ private:
|
|||||||
*/
|
*/
|
||||||
std::map<int32_t, Buff> m_Buffs;
|
std::map<int32_t, Buff> m_Buffs;
|
||||||
|
|
||||||
|
// Buffs to remove at the end of the update frame.
|
||||||
|
std::vector<int32_t> m_BuffsToRemove;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parameters (=effects) for each buff
|
* Parameters (=effects) for each buff
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user