game: reset queued commands list when changing wallets

This commit is contained in:
Crypto City 2020-10-31 21:47:30 +00:00
parent af1558329d
commit 36f93c0c9d
3 changed files with 15 additions and 0 deletions

View File

@ -5199,6 +5199,7 @@ void CryptoCityUrho3D::HandleNewWallet(StringHash eventType, VariantMap& eventDa
gameState.update(wallet, snapshot ? snapshot->height : 0, snapshot ? snapshot->top_hash : "");
RebuildMap();
ui->ClearQueuedCommands();
gameState.on_new_wallet(wallet);
std::string s;

View File

@ -729,6 +729,19 @@ void UIUrho3D::RemoveQueuedCommand(const std::string &txid)
queuedCommandsDialog->RemoveCancelledNonce(txid);
}
void UIUrho3D::ClearQueuedCommands()
{
for (const auto &e: queued_commands)
{
if (tradeDialog)
tradeDialog->RemoveCancelledNonce(e.first);
if (queuedCommandsDialog)
queuedCommandsDialog->RemoveCancelledNonce(e.first);
}
queued_commands.clear();
queued_commands_except_unmatched_trades.clear();
}
void UIUrho3D::UpdateMining(const std::shared_ptr<GameWallet> &w)
{
uint32_t sync_percent = 0, mining_hash_rate = 0;

View File

@ -207,6 +207,7 @@ public:
void ShowPlayerInfo(uint32_t player_id);
void AddQueuedCommand(const std::string &txid, const cryptonote::cc_command_t &cmd);
void RemoveQueuedCommand(const std::string &txid);
void ClearQueuedCommands();
void OnNewBlock();
void Configure();
void OnModelBackupAvailable();