CBonusSelection.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. /*
  2. * CBonusSelection.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "CBonusSelection.h"
  12. #include <vcmi/spells/Spell.h>
  13. #include <vcmi/spells/Service.h>
  14. #include "CSelectionBase.h"
  15. #include "../CGameInfo.h"
  16. #include "../CMessage.h"
  17. #include "../CMusicHandler.h"
  18. #include "../CVideoHandler.h"
  19. #include "../CPlayerInterface.h"
  20. #include "../CServerHandler.h"
  21. #include "../gui/CAnimation.h"
  22. #include "../gui/CGuiHandler.h"
  23. #include "../mainmenu/CMainMenu.h"
  24. #include "../mainmenu/CPrologEpilogVideo.h"
  25. #include "../widgets/CComponent.h"
  26. #include "../widgets/Buttons.h"
  27. #include "../widgets/MiscWidgets.h"
  28. #include "../widgets/ObjectLists.h"
  29. #include "../widgets/TextControls.h"
  30. #include "../windows/GUIClasses.h"
  31. #include "../windows/InfoWindows.h"
  32. #include "../../lib/filesystem/Filesystem.h"
  33. #include "../../lib/CGeneralTextHandler.h"
  34. #include "../../lib/CBuildingHandler.h"
  35. #include "../../lib/CSkillHandler.h"
  36. #include "../../lib/CTownHandler.h"
  37. #include "../../lib/CHeroHandler.h"
  38. #include "../../lib/CCreatureHandler.h"
  39. #include "../../lib/StartInfo.h"
  40. #include "../../lib/mapping/CCampaignHandler.h"
  41. #include "../../lib/mapping/CMapService.h"
  42. #include "../../lib/mapping/CMapInfo.h"
  43. #include "../../lib/mapObjects/CGHeroInstance.h"
  44. std::shared_ptr<CCampaignState> CBonusSelection::getCampaign()
  45. {
  46. return CSH->si->campState;
  47. }
  48. CBonusSelection::CBonusSelection()
  49. : CWindowObject(BORDERED)
  50. {
  51. OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
  52. static const std::string bgNames[] =
  53. {
  54. "E1_BG.BMP", "G2_BG.BMP", "E2_BG.BMP", "G1_BG.BMP", "G3_BG.BMP", "N1_BG.BMP",
  55. "S1_BG.BMP", "BR_BG.BMP", "IS_BG.BMP", "KR_BG.BMP", "NI_BG.BMP", "TA_BG.BMP", "AR_BG.BMP", "HS_BG.BMP",
  56. "BB_BG.BMP", "NB_BG.BMP", "EL_BG.BMP", "RN_BG.BMP", "UA_BG.BMP", "SP_BG.BMP"
  57. };
  58. loadPositionsOfGraphics();
  59. setBackground(bgNames[getCampaign()->camp->header.mapVersion]);
  60. panelBackground = std::make_shared<CPicture>("CAMPBRF.BMP", 456, 6);
  61. buttonStart = std::make_shared<CButton>(Point(475, 536), "CBBEGIB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::startMap, this), SDLK_RETURN);
  62. buttonRestart = std::make_shared<CButton>(Point(475, 536), "CBRESTB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::restartMap, this), SDLK_RETURN);
  63. buttonBack = std::make_shared<CButton>(Point(624, 536), "CBCANCB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::goBack, this), SDLK_ESCAPE);
  64. campaignName = std::make_shared<CLabel>(481, 28, FONT_BIG, ETextAlignment::TOPLEFT, Colors::YELLOW, CSH->si->getCampaignName());
  65. iconsMapSizes = std::make_shared<CAnimImage>("SCNRMPSZ", 4, 0, 735, 26);
  66. labelCampaignDescription = std::make_shared<CLabel>(481, 63, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[38]);
  67. campaignDescription = std::make_shared<CTextBox>(getCampaign()->camp->header.description, Rect(480, 86, 286, 117), 1);
  68. mapName = std::make_shared<CLabel>(481, 219, FONT_BIG, ETextAlignment::TOPLEFT, Colors::YELLOW, CSH->mi->getName());
  69. labelMapDescription = std::make_shared<CLabel>(481, 253, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::YELLOW, CGI->generaltexth->allTexts[496]);
  70. mapDescription = std::make_shared<CTextBox>("", Rect(480, 280, 286, 117), 1);
  71. labelChooseBonus = std::make_shared<CLabel>(511, 432, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[71]);
  72. groupBonuses = std::make_shared<CToggleGroup>(std::bind(&IServerAPI::setCampaignBonus, CSH, _1));
  73. flagbox = std::make_shared<CFlagBox>(Rect(486, 407, 335, 23));
  74. std::vector<std::string> difficulty;
  75. std::string difficultyString = CGI->generaltexth->allTexts[492];
  76. boost::split(difficulty, difficultyString, boost::is_any_of(" "));
  77. labelDifficulty = std::make_shared<CLabel>(689, 432, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, difficulty.back());
  78. for(size_t b = 0; b < difficultyIcons.size(); ++b)
  79. {
  80. difficultyIcons[b] = std::make_shared<CAnimImage>("GSPBUT" + boost::lexical_cast<std::string>(b + 3) + ".DEF", 0, 0, 709, 455);
  81. }
  82. if(getCampaign()->camp->header.difficultyChoosenByPlayer)
  83. {
  84. buttonDifficultyLeft = std::make_shared<CButton>(Point(694, 508), "SCNRBLF.DEF", CButton::tooltip(), std::bind(&CBonusSelection::decreaseDifficulty, this));
  85. buttonDifficultyRight = std::make_shared<CButton>(Point(738, 508), "SCNRBRT.DEF", CButton::tooltip(), std::bind(&CBonusSelection::increaseDifficulty, this));
  86. }
  87. for(int g = 0; g < getCampaign()->camp->scenarios.size(); ++g)
  88. {
  89. if(getCampaign()->camp->conquerable(g))
  90. regions.push_back(std::make_shared<CRegion>(g, true, true, campDescriptions[getCampaign()->camp->header.mapVersion]));
  91. else if(getCampaign()->camp->scenarios[g].conquered) //display as striped
  92. regions.push_back(std::make_shared<CRegion>(g, false, false, campDescriptions[getCampaign()->camp->header.mapVersion]));
  93. }
  94. }
  95. void CBonusSelection::loadPositionsOfGraphics()
  96. {
  97. const JsonNode config(ResourceID("config/campaign_regions.json"));
  98. for(const JsonNode & campaign : config["campaign_regions"].Vector())
  99. {
  100. SCampPositions sc;
  101. sc.campPrefix = campaign["prefix"].String();
  102. sc.colorSuffixLength = static_cast<int>(campaign["color_suffix_length"].Float());
  103. for(const JsonNode & desc : campaign["desc"].Vector())
  104. {
  105. SCampPositions::SRegionDesc rd;
  106. rd.infix = desc["infix"].String();
  107. rd.xpos = static_cast<int>(desc["x"].Float());
  108. rd.ypos = static_cast<int>(desc["y"].Float());
  109. sc.regions.push_back(rd);
  110. }
  111. campDescriptions.push_back(sc);
  112. }
  113. }
  114. void CBonusSelection::createBonusesIcons()
  115. {
  116. OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
  117. const CCampaignScenario & scenario = getCampaign()->camp->scenarios[CSH->campaignMap];
  118. const std::vector<CScenarioTravel::STravelBonus> & bonDescs = scenario.travelOptions.bonusesToChoose;
  119. groupBonuses = std::make_shared<CToggleGroup>(std::bind(&IServerAPI::setCampaignBonus, CSH, _1));
  120. static const char * bonusPics[] =
  121. {
  122. "SPELLBON.DEF", // Spell
  123. "TWCRPORT.DEF", // Monster
  124. "", // Building - BO*.BMP
  125. "ARTIFBON.DEF", // Artifact
  126. "SPELLBON.DEF", // Spell scroll
  127. "PSKILBON.DEF", // Primary skill
  128. "SSKILBON.DEF", // Secondary skill
  129. "BORES.DEF", // Resource
  130. "PORTRAITSLARGE", // Hero HPL*.BMP
  131. "PORTRAITSLARGE"
  132. // Player - CREST58.DEF
  133. };
  134. for(int i = 0; i < bonDescs.size(); i++)
  135. {
  136. std::string picName = bonusPics[bonDescs[i].type];
  137. size_t picNumber = bonDescs[i].info2;
  138. std::string desc;
  139. switch(bonDescs[i].type)
  140. {
  141. case CScenarioTravel::STravelBonus::SPELL:
  142. desc = CGI->generaltexth->allTexts[715];
  143. boost::algorithm::replace_first(desc, "%s", CGI->spells()->getByIndex(bonDescs[i].info2)->getNameTranslated());
  144. break;
  145. case CScenarioTravel::STravelBonus::MONSTER:
  146. picNumber = bonDescs[i].info2 + 2;
  147. desc = CGI->generaltexth->allTexts[717];
  148. boost::algorithm::replace_first(desc, "%d", boost::lexical_cast<std::string>(bonDescs[i].info3));
  149. boost::algorithm::replace_first(desc, "%s", CGI->creatures()->getByIndex(bonDescs[i].info2)->getNamePluralTranslated());
  150. break;
  151. case CScenarioTravel::STravelBonus::BUILDING:
  152. {
  153. int faction = -1;
  154. for(auto & elem : CSH->si->playerInfos)
  155. {
  156. if(elem.second.isControlledByHuman())
  157. {
  158. faction = elem.second.castle;
  159. break;
  160. }
  161. }
  162. assert(faction != -1);
  163. BuildingID buildID = CBuildingHandler::campToERMU(bonDescs[i].info1, faction, std::set<BuildingID>());
  164. picName = graphics->ERMUtoPicture[faction][buildID];
  165. picNumber = -1;
  166. if(vstd::contains((*CGI->townh)[faction]->town->buildings, buildID))
  167. desc = (*CGI->townh)[faction]->town->buildings.find(buildID)->second->getNameTranslated();
  168. break;
  169. }
  170. case CScenarioTravel::STravelBonus::ARTIFACT:
  171. desc = CGI->generaltexth->allTexts[715];
  172. boost::algorithm::replace_first(desc, "%s", CGI->artifacts()->getByIndex(bonDescs[i].info2)->getNameTranslated());
  173. break;
  174. case CScenarioTravel::STravelBonus::SPELL_SCROLL:
  175. desc = CGI->generaltexth->allTexts[716];
  176. boost::algorithm::replace_first(desc, "%s", CGI->spells()->getByIndex(bonDescs[i].info2)->getNameTranslated());
  177. break;
  178. case CScenarioTravel::STravelBonus::PRIMARY_SKILL:
  179. {
  180. int leadingSkill = -1;
  181. std::vector<std::pair<int, int>> toPrint; //primary skills to be listed <num, val>
  182. const ui8 * ptr = reinterpret_cast<const ui8 *>(&bonDescs[i].info2);
  183. for(int g = 0; g < GameConstants::PRIMARY_SKILLS; ++g)
  184. {
  185. if(leadingSkill == -1 || ptr[g] > ptr[leadingSkill])
  186. {
  187. leadingSkill = g;
  188. }
  189. if(ptr[g] != 0)
  190. {
  191. toPrint.push_back(std::make_pair(g, ptr[g]));
  192. }
  193. }
  194. picNumber = leadingSkill;
  195. desc = CGI->generaltexth->allTexts[715];
  196. std::string substitute; //text to be printed instead of %s
  197. for(int v = 0; v < toPrint.size(); ++v)
  198. {
  199. substitute += boost::lexical_cast<std::string>(toPrint[v].second);
  200. substitute += " " + CGI->generaltexth->primarySkillNames[toPrint[v].first];
  201. if(v != toPrint.size() - 1)
  202. {
  203. substitute += ", ";
  204. }
  205. }
  206. boost::algorithm::replace_first(desc, "%s", substitute);
  207. break;
  208. }
  209. case CScenarioTravel::STravelBonus::SECONDARY_SKILL:
  210. desc = CGI->generaltexth->allTexts[718];
  211. boost::algorithm::replace_first(desc, "%s", CGI->generaltexth->levels[bonDescs[i].info3 - 1]); //skill level
  212. boost::algorithm::replace_first(desc, "%s", CGI->skillh->getByIndex(bonDescs[i].info2)->getNameTranslated()); //skill name
  213. picNumber = bonDescs[i].info2 * 3 + bonDescs[i].info3 - 1;
  214. break;
  215. case CScenarioTravel::STravelBonus::RESOURCE:
  216. {
  217. int serialResID = 0;
  218. switch(bonDescs[i].info1)
  219. {
  220. case 0:
  221. case 1:
  222. case 2:
  223. case 3:
  224. case 4:
  225. case 5:
  226. case 6:
  227. serialResID = bonDescs[i].info1;
  228. break;
  229. case 0xFD: //wood + ore
  230. serialResID = 7;
  231. break;
  232. case 0xFE: //rare resources
  233. serialResID = 8;
  234. break;
  235. }
  236. picNumber = serialResID;
  237. desc = CGI->generaltexth->allTexts[717];
  238. boost::algorithm::replace_first(desc, "%d", boost::lexical_cast<std::string>(bonDescs[i].info2));
  239. std::string replacement;
  240. if(serialResID <= 6)
  241. {
  242. replacement = CGI->generaltexth->restypes[serialResID];
  243. }
  244. else
  245. {
  246. replacement = CGI->generaltexth->allTexts[714 + serialResID];
  247. }
  248. boost::algorithm::replace_first(desc, "%s", replacement);
  249. break;
  250. }
  251. case CScenarioTravel::STravelBonus::HEROES_FROM_PREVIOUS_SCENARIO:
  252. {
  253. auto superhero = getCampaign()->camp->scenarios[bonDescs[i].info2].strongestHero(PlayerColor(bonDescs[i].info1));
  254. if(!superhero)
  255. logGlobal->warn("No superhero! How could it be transferred?");
  256. picNumber = superhero ? superhero->portrait : 0;
  257. desc = CGI->generaltexth->allTexts[719];
  258. boost::algorithm::replace_first(desc, "%s", getCampaign()->camp->scenarios[bonDescs[i].info2].scenarioName);
  259. break;
  260. }
  261. case CScenarioTravel::STravelBonus::HERO:
  262. desc = CGI->generaltexth->allTexts[718];
  263. boost::algorithm::replace_first(desc, "%s", CGI->generaltexth->capColors[bonDescs[i].info1]); //hero's color
  264. if(bonDescs[i].info2 == 0xFFFF)
  265. {
  266. boost::algorithm::replace_first(desc, "%s", CGI->generaltexth->allTexts[101]); //hero's name
  267. picNumber = -1;
  268. picName = "CBONN1A3.BMP";
  269. }
  270. else
  271. {
  272. boost::algorithm::replace_first(desc, "%s", CGI->heroh->objects[bonDescs[i].info2]->getNameTranslated());
  273. }
  274. break;
  275. }
  276. std::shared_ptr<CToggleButton> bonusButton = std::make_shared<CToggleButton>(Point(475 + i * 68, 455), "", CButton::tooltip(desc, desc));
  277. if(picNumber != -1)
  278. picName += ":" + boost::lexical_cast<std::string>(picNumber);
  279. auto anim = std::make_shared<CAnimation>();
  280. anim->setCustom(picName, 0);
  281. bonusButton->setImage(anim);
  282. if(CSH->campaignBonus == i)
  283. bonusButton->setBorderColor(Colors::BRIGHT_YELLOW);
  284. groupBonuses->addToggle(i, bonusButton);
  285. }
  286. if(vstd::contains(getCampaign()->chosenCampaignBonuses, CSH->campaignMap))
  287. {
  288. groupBonuses->setSelected(getCampaign()->chosenCampaignBonuses[CSH->campaignMap]);
  289. }
  290. }
  291. void CBonusSelection::updateAfterStateChange()
  292. {
  293. if(CSH->state != EClientState::GAMEPLAY)
  294. {
  295. buttonRestart->disable();
  296. buttonStart->enable();
  297. if(!getCampaign()->mapsConquered.empty())
  298. buttonBack->block(true);
  299. else
  300. buttonBack->block(false);
  301. }
  302. else
  303. {
  304. buttonStart->disable();
  305. buttonRestart->enable();
  306. buttonBack->block(false);
  307. if(buttonDifficultyLeft)
  308. buttonDifficultyLeft->disable();
  309. if(buttonDifficultyRight)
  310. buttonDifficultyRight->disable();
  311. }
  312. if(CSH->campaignBonus == -1)
  313. {
  314. buttonStart->block(getCampaign()->camp->scenarios[CSH->campaignMap].travelOptions.bonusesToChoose.size());
  315. }
  316. else if(buttonStart->isBlocked())
  317. {
  318. buttonStart->block(false);
  319. }
  320. for(auto region : regions)
  321. region->updateState();
  322. if(!CSH->mi)
  323. return;
  324. iconsMapSizes->setFrame(CSH->mi->getMapSizeIconId());
  325. mapDescription->setText(CSH->mi->getDescription());
  326. for(size_t i = 0; i < difficultyIcons.size(); i++)
  327. {
  328. if(i == CSH->si->difficulty)
  329. difficultyIcons[i]->enable();
  330. else
  331. difficultyIcons[i]->disable();
  332. }
  333. flagbox->recreate();
  334. createBonusesIcons();
  335. }
  336. void CBonusSelection::goBack()
  337. {
  338. if(CSH->state != EClientState::GAMEPLAY)
  339. {
  340. GH.popInts(2);
  341. }
  342. else
  343. {
  344. close();
  345. }
  346. // TODO: we can actually only pop bonus selection interface for custom campaigns
  347. // Though this would require clearing CLobbyScreen::bonusSel pointer when poping this interface
  348. /*
  349. else
  350. {
  351. close();
  352. CSH->state = EClientState::LOBBY;
  353. }
  354. */
  355. }
  356. void CBonusSelection::startMap()
  357. {
  358. auto showPrologVideo = [=]()
  359. {
  360. auto exitCb = [=]()
  361. {
  362. logGlobal->info("Starting scenario %d", CSH->campaignMap);
  363. CSH->sendStartGame();
  364. };
  365. const CCampaignScenario & scenario = getCampaign()->camp->scenarios[CSH->campaignMap];
  366. if(scenario.prolog.hasPrologEpilog)
  367. {
  368. GH.pushIntT<CPrologEpilogVideo>(scenario.prolog, exitCb);
  369. }
  370. else
  371. {
  372. exitCb();
  373. }
  374. };
  375. //block buttons immediately
  376. buttonStart->block(true);
  377. buttonRestart->block(true);
  378. buttonBack->block(true);
  379. if(LOCPLINT) // we're currently ingame, so ask for starting new map and end game
  380. {
  381. close();
  382. LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [=]()
  383. {
  384. showPrologVideo();
  385. }, 0);
  386. }
  387. else
  388. {
  389. showPrologVideo();
  390. }
  391. }
  392. void CBonusSelection::restartMap()
  393. {
  394. close();
  395. LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [=]()
  396. {
  397. LOCPLINT->sendCustomEvent(EUserEvent::RESTART_GAME);
  398. }, 0);
  399. }
  400. void CBonusSelection::increaseDifficulty()
  401. {
  402. CSH->setDifficulty(CSH->si->difficulty + 1);
  403. }
  404. void CBonusSelection::decreaseDifficulty()
  405. {
  406. // avoid negative overflow (0 - 1 = 255)
  407. if (CSH->si->difficulty > 0)
  408. CSH->setDifficulty(CSH->si->difficulty - 1);
  409. }
  410. CBonusSelection::CRegion::CRegion(int id, bool accessible, bool selectable, const SCampPositions & campDsc)
  411. : CIntObject(LCLICK | RCLICK), idOfMapAndRegion(id), accessible(accessible), selectable(selectable)
  412. {
  413. OBJ_CONSTRUCTION;
  414. static const std::string colors[2][8] =
  415. {
  416. {"R", "B", "N", "G", "O", "V", "T", "P"},
  417. {"Re", "Bl", "Br", "Gr", "Or", "Vi", "Te", "Pi"}
  418. };
  419. const SCampPositions::SRegionDesc & desc = campDsc.regions[idOfMapAndRegion];
  420. pos.x += desc.xpos;
  421. pos.y += desc.ypos;
  422. std::string prefix = campDsc.campPrefix + desc.infix + "_";
  423. std::string suffix = colors[campDsc.colorSuffixLength - 1][CSH->si->campState->camp->scenarios[idOfMapAndRegion].regionColor];
  424. graphicsNotSelected = std::make_shared<CPicture>(prefix + "En" + suffix + ".BMP");
  425. graphicsNotSelected->disable();
  426. graphicsSelected = std::make_shared<CPicture>(prefix + "Se" + suffix + ".BMP");
  427. graphicsSelected->disable();
  428. graphicsStriped = std::make_shared<CPicture>(prefix + "Co" + suffix + ".BMP");
  429. graphicsStriped->disable();
  430. pos.w = graphicsNotSelected->pos.w;
  431. pos.h = graphicsNotSelected->pos.h;
  432. }
  433. void CBonusSelection::CRegion::updateState()
  434. {
  435. if(!accessible)
  436. {
  437. graphicsNotSelected->disable();
  438. graphicsSelected->disable();
  439. graphicsStriped->enable();
  440. }
  441. else if(CSH->campaignMap == idOfMapAndRegion)
  442. {
  443. graphicsNotSelected->disable();
  444. graphicsSelected->enable();
  445. graphicsStriped->disable();
  446. }
  447. else
  448. {
  449. graphicsNotSelected->enable();
  450. graphicsSelected->disable();
  451. graphicsStriped->disable();
  452. }
  453. }
  454. void CBonusSelection::CRegion::clickLeft(tribool down, bool previousState)
  455. {
  456. //select if selectable & clicked inside our graphic
  457. if(indeterminate(down))
  458. return;
  459. if(!down && selectable && !graphicsNotSelected->getSurface()->isTransparent(GH.getCursorPosition() - pos.topLeft()))
  460. {
  461. CSH->setCampaignMap(idOfMapAndRegion);
  462. }
  463. }
  464. void CBonusSelection::CRegion::clickRight(tribool down, bool previousState)
  465. {
  466. // FIXME: For some reason "down" is only ever contain indeterminate_value
  467. auto text = CSH->si->campState->camp->scenarios[idOfMapAndRegion].regionText;
  468. if(!graphicsNotSelected->getSurface()->isTransparent(GH.getCursorPosition() - pos.topLeft()) && text.size())
  469. {
  470. CRClickPopup::createAndPush(text);
  471. }
  472. }