1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-13 06:13:06 +00:00

Merge branch 'save-game-string-view' into 'master'

Refactor saveGame to use string_view

See merge request OpenMW/openmw!3271
This commit is contained in:
psi29a 2023-07-25 11:14:51 +00:00
commit b9460afdfd
4 changed files with 4 additions and 4 deletions

View file

@ -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.

View file

@ -301,7 +301,7 @@ namespace MWGui
if (mSaving) if (mSaving)
{ {
MWBase::Environment::get().getStateManager()->saveGame(mSaveNameEdit->getCaption(), mCurrentSlot); MWBase::Environment::get().getStateManager()->saveGame(mSaveNameEdit->getCaption().asUTF8(), mCurrentSlot);
} }
else else
{ {

View file

@ -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();

View file

@ -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.