mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 01:10:10 +00:00
refactor saveGame to use string_view instead of a const standard string reference
This commit is contained in:
parent
935a7a2a57
commit
7d0caf9eec
@ -55,7 +55,7 @@ namespace MWBase
|
|||||||
|
|
||||||
virtual void deleteGame(const MWState::Character* character, const MWState::Slot* slot) = 0;
|
virtual void deleteGame(const MWState::Character* character, const MWState::Slot* slot) = 0;
|
||||||
|
|
||||||
virtual void saveGame(const std::string& description, const MWState::Slot* slot = nullptr) = 0;
|
virtual void saveGame(std::string_view description, const MWState::Slot* slot = nullptr) = 0;
|
||||||
///< Write a saved game to \a slot or create a new slot if \a slot == 0.
|
///< Write a saved game to \a slot or create a new slot if \a slot == 0.
|
||||||
///
|
///
|
||||||
/// \note Slot must belong to the current character.
|
/// \note Slot must belong to the current character.
|
||||||
|
@ -301,7 +301,8 @@ namespace MWGui
|
|||||||
|
|
||||||
if (mSaving)
|
if (mSaving)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getStateManager()->saveGame(mSaveNameEdit->getCaption(), mCurrentSlot);
|
std::string_view nameAsStringView = std::basic_string_view(mSaveNameEdit->getCaption().asUTF8().c_str());
|
||||||
|
MWBase::Environment::get().getStateManager()->saveGame(nameAsStringView, mCurrentSlot);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -188,7 +188,7 @@ void MWState::StateManager::resumeGame()
|
|||||||
mState = State_Running;
|
mState = State_Running;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWState::StateManager::saveGame(const std::string& description, const Slot* slot)
|
void MWState::StateManager::saveGame(std::string_view description, const Slot* slot)
|
||||||
{
|
{
|
||||||
MWState::Character* character = getCurrentCharacter();
|
MWState::Character* character = getCurrentCharacter();
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace MWState
|
|||||||
///< Delete a saved game slot from this character. If all save slots are deleted, the character will be deleted
|
///< Delete a saved game slot from this character. If all save slots are deleted, the character will be deleted
|
||||||
///< too.
|
///< too.
|
||||||
|
|
||||||
void saveGame(const std::string& description, const Slot* slot = nullptr) override;
|
void saveGame(std::string_view description, const Slot* slot = nullptr) override;
|
||||||
///< Write a saved game to \a slot or create a new slot if \a slot == 0.
|
///< Write a saved game to \a slot or create a new slot if \a slot == 0.
|
||||||
///
|
///
|
||||||
/// \note Slot must belong to the current character.
|
/// \note Slot must belong to the current character.
|
||||||
|
Loading…
Reference in New Issue
Block a user