diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index 1b2fbfdc8..cb4e04fa1 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include @@ -339,13 +339,11 @@ namespace MWMechanics if (projectileEffects.mList.size() > 1) // add a VFX_Multiple projectile if there are multiple projectile effects { + std::ostringstream ID; + ID << "VFX_Multiple" << projectileEffects.mList.size(); std::vector::iterator it; it = projectileIDs.begin(); - char numstr[8]; - sprintf(numstr, "%d", (int)(effects.mList.size())); - std::string ID = "VFX_Multiple"; - ID = ID + numstr; - it = projectileIDs.insert(it, ID); + it = projectileIDs.insert(it, ID.str()); } // Fall back to a "caster to target" direction if we have no other means of determining it diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp index a7b4be9c9..ec4ee6941 100644 --- a/apps/openmw/mwworld/projectilemanager.cpp +++ b/apps/openmw/mwworld/projectilemanager.cpp @@ -1,6 +1,6 @@ #include "projectilemanager.hpp" -#include +#include #include @@ -99,10 +99,8 @@ namespace MWWorld if (state.mIdMagic.size() > 1) for (size_t iter = 1; iter != state.mIdMagic.size(); ++iter) { - char numstr[8]; - sprintf(numstr, "%d", (int)iter); - std::string node = "Dummy0"; - node = node + numstr; + std::ostringstream nodeName; + nodeName << "Dummy" << std::setw(2) << std::setfill('0') << iter; const ESM::Weapon* weapon = MWBase::Environment::get().getWorld()->getStore().get().find (state.mIdMagic.at(iter)); mResourceSystem->getSceneManager()->getInstance("meshes\\" + weapon->mModel, attachTo); }