mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-19 04:01:29 +00:00
Hopefully this is a fix for issue #100 -- Uninitialized alt currency variable causing db corruption.
This commit is contained in:
parent
646e1f541c
commit
30e8eac46e
@ -322,6 +322,7 @@ Client::Client(EQStreamInterface* ieqs)
|
|||||||
LoadAccountFlags();
|
LoadAccountFlags();
|
||||||
|
|
||||||
initial_respawn_selection = 0;
|
initial_respawn_selection = 0;
|
||||||
|
alternate_currency_loaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::~Client() {
|
Client::~Client() {
|
||||||
@ -6741,6 +6742,11 @@ void Client::AddAlternateCurrencyValue(uint32 currency_id, int32 amount)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!alternate_currency_loaded) {
|
||||||
|
alternate_currency_queued_operations.push(std::make_pair(currency_id, amount));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int new_value = 0;
|
int new_value = 0;
|
||||||
std::map<uint32, uint32>::iterator iter = alternate_currency.find(currency_id);
|
std::map<uint32, uint32>::iterator iter = alternate_currency.find(currency_id);
|
||||||
if(iter == alternate_currency.end()) {
|
if(iter == alternate_currency.end()) {
|
||||||
@ -6793,6 +6799,16 @@ uint32 Client::GetAlternateCurrencyValue(uint32 currency_id) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::ProcessAlternateCurrencyQueue() {
|
||||||
|
while(!alternate_currency_queued_operations.empty()) {
|
||||||
|
std::pair<uint32, int32> op = alternate_currency_queued_operations.front();
|
||||||
|
|
||||||
|
AddAlternateCurrencyValue(op.first, op.second);
|
||||||
|
|
||||||
|
alternate_currency_queued_operations.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Client::OpenLFGuildWindow()
|
void Client::OpenLFGuildWindow()
|
||||||
{
|
{
|
||||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, 8);
|
EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, 8);
|
||||||
|
|||||||
@ -1087,6 +1087,7 @@ public:
|
|||||||
void SendAlternateCurrencyValues();
|
void SendAlternateCurrencyValues();
|
||||||
void SendAlternateCurrencyValue(uint32 currency_id, bool send_if_null = true);
|
void SendAlternateCurrencyValue(uint32 currency_id, bool send_if_null = true);
|
||||||
uint32 GetAlternateCurrencyValue(uint32 currency_id) const;
|
uint32 GetAlternateCurrencyValue(uint32 currency_id) const;
|
||||||
|
void ProcessAlternateCurrencyQueue();
|
||||||
void OpenLFGuildWindow();
|
void OpenLFGuildWindow();
|
||||||
void HandleLFGuildResponse(ServerPacket *pack);
|
void HandleLFGuildResponse(ServerPacket *pack);
|
||||||
void SendLFGuildStatus();
|
void SendLFGuildStatus();
|
||||||
@ -1448,7 +1449,9 @@ private:
|
|||||||
bool m_KnockBackExemption;
|
bool m_KnockBackExemption;
|
||||||
bool m_PortExemption;
|
bool m_PortExemption;
|
||||||
bool m_SenseExemption;
|
bool m_SenseExemption;
|
||||||
|
bool alternate_currency_loaded;
|
||||||
std::map<uint32, uint32> alternate_currency;
|
std::map<uint32, uint32> alternate_currency;
|
||||||
|
std::queue<std::pair<uint32, int32>> alternate_currency_queued_operations;
|
||||||
|
|
||||||
//Connecting debug code.
|
//Connecting debug code.
|
||||||
enum { //connecting states, used for debugging only
|
enum { //connecting states, used for debugging only
|
||||||
|
|||||||
@ -9571,6 +9571,9 @@ void Client::CompleteConnect()
|
|||||||
SendAltCurrencies();
|
SendAltCurrencies();
|
||||||
database.LoadAltCurrencyValues(CharacterID(), alternate_currency);
|
database.LoadAltCurrencyValues(CharacterID(), alternate_currency);
|
||||||
SendAlternateCurrencyValues();
|
SendAlternateCurrencyValues();
|
||||||
|
alternate_currency_loaded = true;
|
||||||
|
ProcessAlternateCurrencyQueue();
|
||||||
|
|
||||||
CalcItemScale();
|
CalcItemScale();
|
||||||
DoItemEnterZone();
|
DoItemEnterZone();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user