diff options
| author | n0n4m3 <none@none> | 2009-12-17 07:46:21 +0100 |
|---|---|---|
| committer | n0n4m3 <none@none> | 2009-12-17 07:46:21 +0100 |
| commit | 2b5151f50c32d18e27edac0cce3efc26338dd323 (patch) | |
| tree | 20b48545c6021077662bb5d948a3dc0d3e176b2d /src | |
| parent | 2028f0658b2bb95e2390aba8fd995271fe4e41d6 (diff) | |
One big insert for _SaveSpellCooldowns, original autor balrok
--HG--
branch : trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Player.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 7b50c44ea16..ae3113044da 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3695,6 +3695,9 @@ void Player::_SaveSpellCooldowns() time_t curTime = time(NULL); time_t infTime = curTime + infinityCooldownDelayCheck; + bool first_round = true; + std::ostringstream ss; + // remove outdated and save active for (SpellCooldowns::iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end();) { @@ -3702,12 +3705,24 @@ void Player::_SaveSpellCooldowns() m_spellCooldowns.erase(itr++); else if(itr->second.end <= infTime) // not save locked cooldowns, it will be reset or set at reload { - CharacterDatabase.PExecute("INSERT INTO character_spell_cooldown (guid,spell,item,time) VALUES ('%u', '%u', '%u', '" UI64FMTD "')", GetGUIDLow(), itr->first, itr->second.itemid, uint64(itr->second.end)); + if (first_round) + { + ss << "INSERT INTO character_spell_cooldown (guid,spell,item,time) VALUES "; + first_round = false; + } + // next new/changed record prefix + else + ss << ", "; + ss << "(" << GetGUIDLow() << "," << itr->first << "," << itr->second.itemid << "," << uint64(itr->second.end) << ")"; ++itr; } else ++itr; + } + // if something changed execute + if (!first_round) + CharacterDatabase.Execute(ss.str().c_str()); } uint32 Player::resetTalentsCost() const |
