diff --git a/VisualStudio/fheroes2/sources.props b/VisualStudio/fheroes2/sources.props
index a3278108bdc..9413fd4029f 100644
--- a/VisualStudio/fheroes2/sources.props
+++ b/VisualStudio/fheroes2/sources.props
@@ -140,6 +140,7 @@
+
@@ -343,6 +344,7 @@
+
diff --git a/src/fheroes2/castle/castle_tavern.cpp b/src/fheroes2/castle/castle_tavern.cpp
index e9322bac55a..91c721d634a 100644
--- a/src/fheroes2/castle/castle_tavern.cpp
+++ b/src/fheroes2/castle/castle_tavern.cpp
@@ -29,6 +29,7 @@
#include "castle.h" // IWYU pragma: associated
#include "dialog.h"
#include "game_delays.h"
+#include "game_string.h"
#include "icn.h"
#include "translations.h"
#include "ui_dialog.h"
@@ -37,14 +38,14 @@
void Castle::_openTavern() const
{
- auto [rumor, language] = world.getCurrentRumor();
+ auto rumor = world.getCurrentRumor();
std::string body( _( "A generous tip for the barkeep yields the following rumor:" ) );
body += "\n\n";
auto text = std::make_shared();
text->add( fheroes2::Text{ std::move( body ), fheroes2::FontType::normalWhite() } );
- text->add( fheroes2::Text{ std::move( rumor ), fheroes2::FontType::normalWhite(), language } );
+ text->add( fheroes2::Text{ std::move( rumor.text ), fheroes2::FontType::normalWhite(), rumor.language } );
const fheroes2::AnimationDialogElement imageUI( ICN::TAVWIN, { 0, 1 }, 0, Game::getAnimationDelayValue( Game::CASTLE_TAVERN_DELAY ) );
const fheroes2::TextDialogElement textBodyUI( text );
diff --git a/src/fheroes2/game/game_string.cpp b/src/fheroes2/game/game_string.cpp
new file mode 100644
index 00000000000..be4107b098c
--- /dev/null
+++ b/src/fheroes2/game/game_string.cpp
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * fheroes2: https://github.com/ihhub/fheroes2 *
+ * Copyright (C) 2024 *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "game_string.h"
+
+#include "serialize.h"
+
+OStreamBase & operator<<( OStreamBase & stream, const fheroes2::LocalizedString & string )
+{
+ stream << string.text;
+
+ stream << string.language.has_value();
+
+ if ( string.language.has_value() ) {
+ stream << string.language.value();
+ }
+
+ return stream;
+}
+
+IStreamBase & operator>>( IStreamBase & stream, fheroes2::LocalizedString & string )
+{
+ stream >> string.text;
+
+ bool hasValue = false;
+ stream >> hasValue;
+
+ if ( hasValue ) {
+ fheroes2::SupportedLanguage language;
+
+ stream >> language;
+ string.language = language;
+ }
+ else {
+ string.language.reset();
+ }
+
+ return stream;
+}
diff --git a/src/fheroes2/game/game_string.h b/src/fheroes2/game/game_string.h
new file mode 100644
index 00000000000..3faa213b47b
--- /dev/null
+++ b/src/fheroes2/game/game_string.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * fheroes2: https://github.com/ihhub/fheroes2 *
+ * Copyright (C) 2024 *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#pragma once
+
+#include
+#include
+#include
+
+class IStreamBase;
+class OStreamBase;
+
+namespace fheroes2
+{
+
+ enum class SupportedLanguage : uint8_t;
+
+ struct LocalizedString
+ {
+ std::string text;
+
+ std::optional language;
+ };
+}
+
+OStreamBase & operator<<( OStreamBase & stream, const fheroes2::LocalizedString & string );
+IStreamBase & operator>>( IStreamBase & stream, fheroes2::LocalizedString & string );
diff --git a/src/fheroes2/world/world.cpp b/src/fheroes2/world/world.cpp
index b0262ba2f76..6d6c7cb69fc 100644
--- a/src/fheroes2/world/world.cpp
+++ b/src/fheroes2/world/world.cpp
@@ -27,6 +27,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -707,7 +708,7 @@ void World::MonthOfMonstersAction( const Monster & mons )
}
}
-std::pair> World::getCurrentRumor() const
+fheroes2::LocalizedString World::getCurrentRumor() const
{
const uint32_t standardRumorCount = 10;
const uint32_t totalRumorCount = static_cast( _customRumors.size() ) + standardRumorCount;
diff --git a/src/fheroes2/world/world.h b/src/fheroes2/world/world.h
index 6c5e55874c6..966ce8e0f59 100644
--- a/src/fheroes2/world/world.h
+++ b/src/fheroes2/world/world.h
@@ -28,7 +28,6 @@
#include
#include