1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 01:15:35 +00:00

Replace empty std::string assignments

This commit is contained in:
Evil Eye 2022-05-04 22:33:39 +02:00
parent bbec296891
commit a64979e25d
30 changed files with 63 additions and 65 deletions

View file

@ -145,7 +145,7 @@ void CSMDoc::WriteDialogueCollectionStage::perform (int stage, Messages& message
ESM::DialInfo info = (*iter)->get();
info.mId = info.mId.substr (info.mId.find_last_of ('#')+1);
info.mPrev = "";
info.mPrev.clear();
if (iter!=range.first)
{
CSMWorld::InfoCollection::RecordConstIterator prev = iter;
@ -157,7 +157,7 @@ void CSMDoc::WriteDialogueCollectionStage::perform (int stage, Messages& message
CSMWorld::InfoCollection::RecordConstIterator next = iter;
++next;
info.mNext = "";
info.mNext.clear();
if (next!=range.second)
{
info.mNext = (*next)->get().mId.substr ((*next)->get().mId.find_last_of ('#')+1);

View file

@ -163,7 +163,7 @@ namespace CSMWorld
std::vector<std::string>& spells = raceOrBthSgn.mPowers.mList;
// blank row
std::string spell = "";
std::string spell;
spells.insert(spells.begin()+position, spell);

View file

@ -1527,7 +1527,7 @@ namespace CSMWorld
ESM::Transport::Dest newRow;
newRow.mPos = newPos;
newRow.mCellName = "";
newRow.mCellName.clear();
if (position >= (int)list.size())
list.push_back(newRow);
@ -1679,7 +1679,7 @@ namespace CSMWorld
for (int i = 0; i < 8; ++i)
newRow.mWander.mIdle[i] = 0;
newRow.mWander.mShouldRepeat = 1;
newRow.mCellName = "";
newRow.mCellName.clear();
if (position >= (int)list.size())
list.push_back(newRow);
@ -2013,8 +2013,8 @@ namespace CSMWorld
ESM::PartReference newPart;
newPart.mPart = 0; // 0 == head
newPart.mMale = "";
newPart.mFemale = "";
newPart.mMale.clear();
newPart.mFemale.clear();
if (position >= (int)list.size())
list.push_back(newPart);
@ -2362,7 +2362,7 @@ namespace CSMWorld
std::vector<ESM::LevelledListBase::LevelItem>& list = leveled.mList;
ESM::LevelledListBase::LevelItem newItem;
newItem.mId = "";
newItem.mId.clear();
newItem.mLevel = 0;
if (position >= (int)list.size())

View file

@ -44,7 +44,7 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f)
//ds->setNumMultiSamples(8);
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->windowName = "";
traits->windowName.clear();
traits->windowDecoration = true;
traits->x = 0;
traits->y = 0;

View file

@ -185,7 +185,7 @@ void CSVWidget::TextureBrushWindow::setBrushTexture(std::string brushTexture)
mSelectedBrush->setText(QString::fromStdString(mBrushTextureLabel) + landtexturesCollection.getData(rowInNew, landTextureFilename).value<QString>());
} else
{
newBrushTextureId = "";
newBrushTextureId.clear();
mBrushTextureLabel = "No selected texture or invalid texture";
mSelectedBrush->setText(QString::fromStdString(mBrushTextureLabel));
}

View file

@ -770,19 +770,15 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/gamecontrollerdb.txt";
std::string userGameControllerdb;
if (boost::filesystem::exists(userdefault)){
if (boost::filesystem::exists(userdefault))
userGameControllerdb = userdefault;
}
else
userGameControllerdb = "";
std::string gameControllerdb;
if (boost::filesystem::exists(localdefault))
gameControllerdb = localdefault;
else if (boost::filesystem::exists(globaldefault))
gameControllerdb = globaldefault;
else
gameControllerdb = ""; //if it doesn't exist, pass in an empty string
//else if it doesn't exist, pass in an empty string
// gui needs our shaders path before everything else
mResourceSystem->getSceneManager()->setShaderPath((mResDir / "shaders").string());

View file

@ -205,7 +205,9 @@ namespace MWClass
// get armor type string (light/medium/heavy)
std::string typeText;
if (ref->mBase->mData.mWeight == 0)
typeText = "";
{
// no type
}
else
{
int armorType = getEquipmentSkill(ptr);
@ -255,7 +257,7 @@ namespace MWClass
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
ESM::Armor newItem = *ref->mBase;
newItem.mId="";
newItem.mId.clear();
newItem.mName=newName;
newItem.mData.mEnchant=enchCharge;
newItem.mEnchant=enchId;

View file

@ -140,7 +140,7 @@ namespace MWClass
const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>();
ESM::Book newItem = *ref->mBase;
newItem.mId="";
newItem.mId.clear();
newItem.mName=newName;
newItem.mData.mIsScroll = 1;
newItem.mData.mEnchant=enchCharge;

View file

@ -189,7 +189,7 @@ namespace MWClass
const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
ESM::Clothing newItem = *ref->mBase;
newItem.mId="";
newItem.mId.clear();
newItem.mName=newName;
newItem.mData.mEnchant=enchCharge;
newItem.mEnchant=enchId;

View file

@ -266,7 +266,7 @@ namespace MWClass
const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
ESM::Weapon newItem = *ref->mBase;
newItem.mId="";
newItem.mId.clear();
newItem.mName=newName;
newItem.mData.mEnchant=enchCharge;
newItem.mEnchant=enchId;

View file

@ -135,7 +135,7 @@ namespace MWDialogue
if (actor.getClass().getCreatureStats(actor).isDead())
return false;
mLastTopic = "";
mLastTopic.clear();
// Note that we intentionally don't reset mPermanentDispositionChange
mChoice = -1;

View file

@ -249,7 +249,7 @@ namespace MWGui
break;
case GM_ClassGenerate:
mGenerateClassStep = 0;
mGenerateClass = "";
mGenerateClass.clear();
mGenerateClassSpecializations[0] = 0;
mGenerateClassSpecializations[1] = 0;
mGenerateClassSpecializations[2] = 0;

View file

@ -146,7 +146,7 @@ namespace MWGui
if (state == None)
{
if (!isMagic)
backgroundTex = "";
backgroundTex.clear();
}
else if (state == Equip)
{

View file

@ -142,8 +142,8 @@ namespace MWGui
else
{
key->type = Type_Unassigned;
key->id = "";
key->name = "";
key->id.clear();
key->name.clear();
MyGUI::TextBox* textBox = key->button->createWidgetReal<MyGUI::TextBox>("SandText",
MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);

View file

@ -122,7 +122,7 @@ namespace MWGui
info.caption = mFocusObject.getClass().getName(mFocusObject);
if (info.caption.empty())
info.caption=mFocusObject.getCellRef().getRefId();
info.icon="";
info.icon.clear();
tooltipSize = createToolTip(info, checkOwned());
}
else
@ -371,7 +371,7 @@ namespace MWGui
ToolTipInfo info = object.getToolTipInfo(mFocusObject, count);
if (!image)
info.icon = "";
info.icon.clear();
tooltipSize = createToolTip(info, isOwned);
}

View file

@ -1313,7 +1313,7 @@ namespace MWGui
void WindowManager::setSelectedEnchantItem(const MWWorld::Ptr& item)
{
mSelectedEnchantItem = item;
mSelectedSpell = "";
mSelectedSpell.clear();
const ESM::Enchantment* ench = mStore->get<ESM::Enchantment>()
.find(item.getClass().getEnchantment(item));
@ -1346,7 +1346,7 @@ namespace MWGui
void WindowManager::unsetSelectedSpell()
{
mSelectedSpell = "";
mSelectedSpell.clear();
mSelectedEnchantItem = MWWorld::Ptr();
mHud->unsetSelectedSpell();

View file

@ -759,19 +759,19 @@ void CharacterController::playDeath(float startpoint, CharacterState death)
// However, they could still trigger text keys, such as Hit events, or sounds.
mMovementState = CharState_None;
mAnimation->disable(mCurrentMovement);
mCurrentMovement = "";
mCurrentMovement.clear();
mUpperBodyState = UpperCharState_Nothing;
mAnimation->disable(mCurrentWeapon);
mCurrentWeapon = "";
mCurrentWeapon.clear();
mHitState = CharState_None;
mAnimation->disable(mCurrentHit);
mCurrentHit = "";
mCurrentHit.clear();
mIdleState = CharState_None;
mAnimation->disable(mCurrentIdle);
mCurrentIdle = "";
mCurrentIdle.clear();
mJumpState = JumpState_None;
mAnimation->disable(mCurrentJump);
mCurrentJump = "";
mCurrentJump.clear();
mMovementAnimationControlled = true;
mAnimation->play(mCurrentDeath, Priority_Death, MWRender::Animation::BlendMask_All,

View file

@ -553,7 +553,7 @@ namespace MWScript
{
MWWorld::ConstPtr actor = R()(runtime, false);
std::string factionID = "";
std::string factionID;
if(arg0==0)
{
@ -585,7 +585,7 @@ namespace MWScript
{
MWWorld::ConstPtr actor = R()(runtime, false);
std::string factionID = "";
std::string factionID;
if(arg0==0)
{
@ -624,7 +624,7 @@ namespace MWScript
{
MWWorld::ConstPtr actor = R()(runtime, false);
std::string factionID = "";
std::string factionID;
if(arg0==0)
{
@ -656,7 +656,7 @@ namespace MWScript
{
MWWorld::ConstPtr ptr = R()(runtime, false);
std::string factionID = "";
std::string factionID;
if(arg0 >0)
{
factionID = runtime.getStringLiteral (runtime[0].mInteger);
@ -922,7 +922,7 @@ namespace MWScript
{
MWWorld::ConstPtr ptr = R()(runtime, false);
std::string factionID = "";
std::string factionID;
if(arg0 >0 )
{
factionID = runtime.getStringLiteral (runtime[0].mInteger);
@ -954,7 +954,7 @@ namespace MWScript
{
MWWorld::ConstPtr ptr = R()(runtime, false);
std::string factionID = "";
std::string factionID;
if(arg0 >0 )
{
factionID = runtime.getStringLiteral (runtime[0].mInteger);
@ -981,7 +981,7 @@ namespace MWScript
{
MWWorld::ConstPtr ptr = R()(runtime, false);
std::string factionID = "";
std::string factionID;
if(arg0 >0 )
{
factionID = runtime.getStringLiteral (runtime[0].mInteger);

View file

@ -945,7 +945,7 @@ namespace MWWorld
{
stopSounds();
mCurrentRegion = "";
mCurrentRegion.clear();
mTimePassed = 0.0f;
mWeatherUpdateTime = 0.0f;
forceWeather(0);

View file

@ -59,7 +59,7 @@ void InventoryState::load (ESMReader &esm)
//Get its name
std::string id = esm.getHString();
int count;
std::string parentGroup = "";
std::string parentGroup;
//Then get its count
esm.getHNT (count, "COUN");
//Old save formats don't have information about parent group; check for that

View file

@ -85,7 +85,7 @@ void ESM4::Cell::load(ESM4::Reader& reader)
if (!reader.getZString(mEditorId))
throw std::runtime_error ("CELL EDID data read error");
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "CELL Editor ID: " << mEditorId << std::endl;
#endif
@ -108,7 +108,7 @@ void ESM4::Cell::load(ESM4::Reader& reader)
reader.get(mX);
reader.get(mY);
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "CELL group " << ESM4::printLabel(reader.grp().label, reader.grp().type) << std::endl;
std::cout << padding << "CELL formId " << std::hex << reader.hdr().record.id << std::endl;
@ -143,7 +143,7 @@ void ESM4::Cell::load(ESM4::Reader& reader)
reader.get((std::uint8_t&)mCellFlags); // 8 bits in Obvlivion
}
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "flags: " << std::hex << mCellFlags << std::endl;
#endif
@ -156,7 +156,7 @@ void ESM4::Cell::load(ESM4::Reader& reader)
{
reader.getFormId(*it);
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "region: " << std::hex << *it << std::endl;
#endif

View file

@ -68,7 +68,7 @@ void ESM4::Navigation::IslandInfo::load(ESM4::Reader& reader)
reader.get(*it);
// FIXME: debugging only
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "NVMI vert " << std::dec << (*it).x << ", " << (*it).y << ", " << (*it).z << std::endl;
#endif
@ -88,7 +88,7 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
// FIXME: for debugging only
#if 0
std::string padding = "";
std::string padding;
if (flags == ESM4::FLG_Modified)
padding.insert(0, 2, '-');
else if (flags == ESM4::FLG_Unmodified)
@ -157,7 +157,7 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
reader.get(cellGrid.grid.x);
// FIXME: debugging only
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
if (worldSpaceId == ESM4::FLG_Morrowind)
std::cout << padding << "NVMI MW: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y << std::endl;

View file

@ -69,7 +69,7 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
reader.get(cellGrid.grid.x);
// FIXME: debugging only
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
if (worldSpaceId == ESM4::FLG_Morrowind)
std::cout << padding << "NVNM MW: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y << std::endl;
@ -82,7 +82,7 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
reader.get(cellGrid.cellId);
#if 0
std::string padding = ""; // FIXME
std::string padding; // FIXME
padding.insert(0, reader.stackSize()*2, ' ');
if (worldSpaceId == 0) // interior
std::cout << padding << "NVNM Interior: cellId " << std::hex << cellGrid.cellId << std::endl;
@ -194,7 +194,7 @@ void ESM4::NavMesh::load(ESM4::Reader& reader)
// FIXME: debugging only
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "NAVM flags 0x" << std::hex << reader.hdr().record.flags << std::endl;
std::cout << padding << "NAVM id 0x" << std::hex << reader.hdr().record.id << std::endl;

View file

@ -62,7 +62,7 @@ void ESM4::Region::load(ESM4::Reader& reader)
{
reader.get(*it);
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "RPLD: 0x" << std::hex << *it << std::endl;
#endif

View file

@ -58,7 +58,7 @@ void ESM4::Static::load(ESM4::Reader& reader)
{
reader.get(*it);
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "MODT: " << std::hex << *it << std::endl;
#endif

View file

@ -85,7 +85,7 @@ void ESM4::Header::load(ESM4::Reader& reader)
if (!reader.getExact(mOverride))
throw std::runtime_error("TES4 ONAM data read error");
#if 0
std::string padding = "";
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "ESM4::Header::ONAM overrides: " << formIdToString(mOverride) << std::endl;
#endif

View file

@ -423,7 +423,7 @@ void Reader::skipSubRecordData(std::uint32_t size)
void Reader::enterGroup()
{
#ifdef DEBUG_GROUPSTACK
std::string padding = ""; // FIXME: debugging only
std::string padding; // FIXME: debugging only
padding.insert(0, mCtx.groupStack.size()*2, ' ');
std::cout << padding << "Starting record group "
<< printLabel(mCtx.recordHeader.group.label, mCtx.recordHeader.group.type) << std::endl;
@ -473,7 +473,7 @@ void Reader::exitGroupCheck()
mCtx.groupStack.pop_back();
#ifdef DEBUG_GROUPSTACK
std::string padding = ""; // FIXME: debugging only
std::string padding; // FIXME: debugging only
padding.insert(0, mCtx.groupStack.size()*2, ' ');
std::cout << padding << "Finished record group " << printLabel(grp.label, grp.type) << std::endl;
#endif
@ -521,7 +521,7 @@ void Reader::skipGroupData()
void Reader::skipGroup()
{
#ifdef DEBUG_GROUPSTACK
std::string padding = ""; // FIXME: debugging only
std::string padding; // FIXME: debugging only
padding.insert(0, mCtx.groupStack.size()*2, ' ');
std::cout << padding << "Skipping record group "
<< printLabel(mCtx.recordHeader.group.label, mCtx.recordHeader.group.type) << std::endl;

View file

@ -106,7 +106,7 @@ Profiler::Profiler(bool offlineCollect):
if (osgDB::Registry::instance()->getReaderWriterForExtension("ttf"))
_font = osgMyGUI::DataManager::getInstance().getDataPath("DejaVuLGCSansMono.ttf");
else
_font = "";
_font.clear();
_characterSize = 18;

View file

@ -28,8 +28,8 @@ std::string Manager::load(const Files::ConfigurationManager& cfgMgr, bool loadEd
throw std::runtime_error("No config dirs! ConfigurationManager::readConfiguration must be called first.");
// Create file name strings for either the engine or the editor.
std::string defaultSettingsFile = "";
std::string userSettingsFile = "";
std::string defaultSettingsFile;
std::string userSettingsFile;
if (!loadEditorSettings)
{

View file

@ -193,7 +193,7 @@ namespace Shader
}
lineNumber += std::count(source.begin() + lineDirectivePosition, source.begin() + overallEnd, '\n');
std::string replacement = "";
std::string replacement;
for (std::vector<std::string>::const_iterator element = listElements.cbegin(); element != listElements.cend(); element++)
{
std::string contentInstance = content;
@ -247,7 +247,7 @@ namespace Shader
condition = !condition;
if (!condition)
linkTarget = "";
linkTarget.clear();
}
source.replace(foundPos, lineEnd - foundPos, "");