mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Rumors meta string
This commit is contained in:
@@ -456,8 +456,7 @@ CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj)
|
|||||||
heroDescription = std::make_shared<CTextBox>("", Rect(30, 373, 233, 35), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
|
heroDescription = std::make_shared<CTextBox>("", Rect(30, 373, 233, 35), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
|
||||||
heroesForHire = std::make_shared<CLabel>(145, 283, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[38]);
|
heroesForHire = std::make_shared<CLabel>(145, 283, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[38]);
|
||||||
|
|
||||||
auto rumorText = boost::str(boost::format(CGI->generaltexth->allTexts[216]) % LOCPLINT->cb->getTavernRumor(tavernObj));
|
rumor = std::make_shared<CTextBox>(LOCPLINT->cb->getTavernRumor(tavernObj), Rect(32, 188, 330, 66), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
|
||||||
rumor = std::make_shared<CTextBox>(rumorText, Rect(32, 188, 330, 66), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
|
|
||||||
|
|
||||||
statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
|
statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
|
||||||
cancel = std::make_shared<CButton>(Point(310, 428), AnimationPath::builtin("ICANCEL.DEF"), CButton::tooltip(CGI->generaltexth->tavernInfo[7]), std::bind(&CTavernWindow::close, this), EShortcut::GLOBAL_CANCEL);
|
cancel = std::make_shared<CButton>(Point(310, 428), AnimationPath::builtin("ICANCEL.DEF"), CButton::tooltip(CGI->generaltexth->tavernInfo[7]), std::bind(&CTavernWindow::close, this), EShortcut::GLOBAL_CANCEL);
|
||||||
|
@@ -649,33 +649,34 @@ EPlayerStatus CGameInfoCallback::getPlayerStatus(PlayerColor player, bool verbos
|
|||||||
|
|
||||||
std::string CGameInfoCallback::getTavernRumor(const CGObjectInstance * townOrTavern) const
|
std::string CGameInfoCallback::getTavernRumor(const CGObjectInstance * townOrTavern) const
|
||||||
{
|
{
|
||||||
std::string text;
|
MetaString text;
|
||||||
|
text.appendLocalString(EMetaText::GENERAL_TXT, 216);
|
||||||
|
|
||||||
std::string extraText;
|
std::string extraText;
|
||||||
if(gs->rumor.type == RumorState::TYPE_NONE)
|
if(gs->rumor.type == RumorState::TYPE_NONE)
|
||||||
return text;
|
return text.toString();
|
||||||
|
|
||||||
auto rumor = gs->rumor.last[gs->rumor.type];
|
auto rumor = gs->rumor.last[gs->rumor.type];
|
||||||
switch(gs->rumor.type)
|
switch(gs->rumor.type)
|
||||||
{
|
{
|
||||||
case RumorState::TYPE_SPECIAL:
|
case RumorState::TYPE_SPECIAL:
|
||||||
|
text.replaceLocalString(EMetaText::GENERAL_TXT, rumor.first);
|
||||||
if(rumor.first == RumorState::RUMOR_GRAIL)
|
if(rumor.first == RumorState::RUMOR_GRAIL)
|
||||||
extraText = VLC->generaltexth->arraytxt[158 + rumor.second];
|
text.replaceTextID(TextIdentifier("core", "genrltxt", "arraytxt", 158 + rumor.second).get());
|
||||||
else
|
else
|
||||||
extraText = VLC->generaltexth->capColors[rumor.second];
|
text.replaceTextID(TextIdentifier("core", "genrltxt", "capitalColors", rumor.second).get());
|
||||||
|
|
||||||
text = boost::str(boost::format(VLC->generaltexth->allTexts[rumor.first]) % extraText);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case RumorState::TYPE_MAP:
|
case RumorState::TYPE_MAP:
|
||||||
text = gs->map->rumors[rumor.first].text;
|
text.replaceRawString(gs->map->rumors[rumor.first].text.toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RumorState::TYPE_RAND:
|
case RumorState::TYPE_RAND:
|
||||||
text = VLC->generaltexth->tavernRumors[rumor.first];
|
text.replaceTextID(TextIdentifier("core", "genrltxt", "randtvrn", rumor.first).get());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
return text.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerRelations CGameInfoCallback::getPlayerRelations( PlayerColor color1, PlayerColor color2 ) const
|
PlayerRelations CGameInfoCallback::getPlayerRelations( PlayerColor color1, PlayerColor color2 ) const
|
||||||
|
@@ -32,7 +32,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
void Rumor::serializeJson(JsonSerializeFormat & handler)
|
void Rumor::serializeJson(JsonSerializeFormat & handler)
|
||||||
{
|
{
|
||||||
handler.serializeString("name", name);
|
handler.serializeString("name", name);
|
||||||
handler.serializeString("text", text);
|
handler.serializeStruct("text", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
DisposedHero::DisposedHero() : heroId(0), portrait(255)
|
DisposedHero::DisposedHero() : heroId(0), portrait(255)
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CMapHeader.h"
|
#include "CMapHeader.h"
|
||||||
|
#include "../MetaString.h"
|
||||||
#include "../mapObjects/MiscObjects.h" // To serialize static props
|
#include "../mapObjects/MiscObjects.h" // To serialize static props
|
||||||
#include "../mapObjects/CQuest.h" // To serialize static props
|
#include "../mapObjects/CQuest.h" // To serialize static props
|
||||||
#include "../mapObjects/CGTownInstance.h" // To serialize static props
|
#include "../mapObjects/CGTownInstance.h" // To serialize static props
|
||||||
@@ -36,7 +37,7 @@ struct TeleportChannel;
|
|||||||
struct DLL_LINKAGE Rumor
|
struct DLL_LINKAGE Rumor
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string text;
|
MetaString text;
|
||||||
|
|
||||||
Rumor() = default;
|
Rumor() = default;
|
||||||
~Rumor() = default;
|
~Rumor() = default;
|
||||||
|
@@ -807,7 +807,7 @@ void CMapLoaderH3M::readRumors()
|
|||||||
{
|
{
|
||||||
Rumor ourRumor;
|
Rumor ourRumor;
|
||||||
ourRumor.name = readBasicString();
|
ourRumor.name = readBasicString();
|
||||||
ourRumor.text = readLocalizedString(TextIdentifier("header", "rumor", it, "text"));
|
ourRumor.text.appendTextID(readLocalizedString(TextIdentifier("header", "rumor", it, "text")));
|
||||||
map->rumors.push_back(ourRumor);
|
map->rumors.push_back(ourRumor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user