mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +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();
|
||||
|
||||
initial_respawn_selection = 0;
|
||||
alternate_currency_loaded = false;
|
||||
}
|
||||
|
||||
Client::~Client() {
|
||||
@ -6741,6 +6742,11 @@ void Client::AddAlternateCurrencyValue(uint32 currency_id, int32 amount)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!alternate_currency_loaded) {
|
||||
alternate_currency_queued_operations.push(std::make_pair(currency_id, amount));
|
||||
return;
|
||||
}
|
||||
|
||||
int new_value = 0;
|
||||
std::map<uint32, uint32>::iterator iter = alternate_currency.find(currency_id);
|
||||
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()
|
||||
{
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, 8);
|
||||
|
||||
@ -1087,6 +1087,7 @@ public:
|
||||
void SendAlternateCurrencyValues();
|
||||
void SendAlternateCurrencyValue(uint32 currency_id, bool send_if_null = true);
|
||||
uint32 GetAlternateCurrencyValue(uint32 currency_id) const;
|
||||
void ProcessAlternateCurrencyQueue();
|
||||
void OpenLFGuildWindow();
|
||||
void HandleLFGuildResponse(ServerPacket *pack);
|
||||
void SendLFGuildStatus();
|
||||
@ -1448,7 +1449,9 @@ private:
|
||||
bool m_KnockBackExemption;
|
||||
bool m_PortExemption;
|
||||
bool m_SenseExemption;
|
||||
bool alternate_currency_loaded;
|
||||
std::map<uint32, uint32> alternate_currency;
|
||||
std::queue<std::pair<uint32, int32>> alternate_currency_queued_operations;
|
||||
|
||||
//Connecting debug code.
|
||||
enum { //connecting states, used for debugging only
|
||||
|
||||
@ -9571,6 +9571,9 @@ void Client::CompleteConnect()
|
||||
SendAltCurrencies();
|
||||
database.LoadAltCurrencyValues(CharacterID(), alternate_currency);
|
||||
SendAlternateCurrencyValues();
|
||||
alternate_currency_loaded = true;
|
||||
ProcessAlternateCurrencyQueue();
|
||||
|
||||
CalcItemScale();
|
||||
DoItemEnterZone();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user