diff options
| author | Shauren <shauren.trinity@gmail.com> | 2020-04-03 17:41:48 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2020-04-03 17:41:48 +0200 |
| commit | 5526e14bcf1efe7a4b1f96760a1816d2e0e1c1b9 (patch) | |
| tree | 48900b85a41907a03a3dbb95583e9c4adc9d26f3 /src/server/game/Entities/GameObject | |
| parent | abe4d59526fe0e7d5a96810d44c7d17fd0d0afbd (diff) | |
Core/Entities: Fixed saving spawn difficulties to db for .npc add and .gob add (and other commands that modify creature/gameobject spawns table)
Diffstat (limited to 'src/server/game/Entities/GameObject')
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 80312590101..6ff7cd66cd4 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -45,6 +45,7 @@ #include "Transport.h" #include "World.h" #include <G3D/Quat.h> +#include <sstream> void GameObjectTemplate::InitializeQueryData() { @@ -1029,7 +1030,20 @@ void GameObject::SaveToDB(uint32 mapid, std::vector<Difficulty> const& spawnDiff stmt->setUInt64(index++, m_spawnId); stmt->setUInt32(index++, GetEntry()); stmt->setUInt16(index++, uint16(mapid)); - stmt->setString(index++, StringJoin(data.spawnDifficulties, ",")); + stmt->setString(index++, [&data]() -> std::string + { + if (data.spawnDifficulties.empty()) + return ""; + + std::ostringstream os; + auto itr = data.spawnDifficulties.begin(); + os << int32(*itr++); + + for (; itr != data.spawnDifficulties.end(); ++itr) + os << ',' << int32(*itr); + + return os.str(); + }()); stmt->setUInt32(index++, data.phaseId); stmt->setUInt32(index++, data.phaseGroup); stmt->setFloat(index++, GetPositionX()); |
