mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merged Ivan's changes from trunk (r1921)
This commit is contained in:
commit
15011e611d
@ -295,7 +295,7 @@ void CHeroWindow::showAll(SDL_Surface * to)
|
||||
printAtMiddleLoc(CGI->generaltexth->jktexts[4], 262, 99, FONT_SMALL, tytulowy, to);
|
||||
|
||||
//dismiss / quest log
|
||||
std::vector<std::string> toPrin = CMessage::breakText(CGI->generaltexth->jktexts[8].substr(1, CGI->generaltexth->jktexts[8].size()-2));
|
||||
std::vector<std::string> toPrin = CMessage::breakText(CGI->generaltexth->jktexts[8]);
|
||||
if(toPrin.size()==1)
|
||||
{
|
||||
printAtLoc(toPrin[0], 372, 439, FONT_SMALL, zwykly, to);
|
||||
@ -306,7 +306,7 @@ void CHeroWindow::showAll(SDL_Surface * to)
|
||||
printAtLoc(toPrin[1], 372, 446, FONT_SMALL, zwykly, to);
|
||||
}
|
||||
|
||||
toPrin = CMessage::breakText(CGI->generaltexth->jktexts[9].substr(1, CGI->generaltexth->jktexts[9].size()-2));
|
||||
toPrin = CMessage::breakText(CGI->generaltexth->jktexts[9]);
|
||||
if(toPrin.size()==1)
|
||||
{
|
||||
printAtLoc(toPrin[0], 512, 439, FONT_SMALL, zwykly, to);
|
||||
|
@ -149,27 +149,14 @@ std::vector<std::string> CMessage::breakText( std::string text, size_t maxLineSi
|
||||
{
|
||||
/* We have a long line. Try to do a nice line break, if
|
||||
* possible. We backtrack on the line until we find a
|
||||
* suitable character. */
|
||||
* suitable character.
|
||||
* Note: Cyrillic symbols have indexes 220-255 so we need
|
||||
* to use unsigned char for comparison
|
||||
*/
|
||||
int pos = z-1;
|
||||
while(pos > 0 && ((unsigned char)text[pos]) > ' ' )
|
||||
pos --;
|
||||
|
||||
// Do not break an ellipsis, backtrack until whitespace.
|
||||
if (text[pos] == '.' && text[z] == '.')
|
||||
{
|
||||
while (pos != 0 && text[pos] != ' ')
|
||||
pos--;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: boost should have a nice method to do that. */
|
||||
while(pos > 0 && text[pos]>' ')
|
||||
/* text[pos] != ' ' &&
|
||||
text[pos] != ',' &&
|
||||
text[pos] != '.' &&
|
||||
text[pos] != ';' &&
|
||||
text[pos] != '!' &&
|
||||
text[pos] != '?')*/
|
||||
pos --;
|
||||
}
|
||||
if (pos > 0)
|
||||
z = pos+1;
|
||||
}
|
||||
|
@ -226,8 +226,8 @@ CMenuScreen::CMenuScreen( EState which )
|
||||
{
|
||||
bgAd = new CPicture(BitmapHandler::loadBitmap("ZNEWGAM.bmp"), 114, 312, true);
|
||||
buttons[0] = new AdventureMapButton("", CGI->generaltexth->zelp[10].second, bind(&CGPreGame::openSel, CGP, newGame, SINGLE_PLAYER), 545, 4, "ZTSINGL.DEF", SDLK_s);
|
||||
buttons[1] = new AdventureMapButton("", CGI->generaltexth->zelp[11].second, &pushIntT<CMultiMode>, 568, 120, "ZTMULTI.DEF", SDLK_m);
|
||||
buttons[2] = new AdventureMapButton("", CGI->generaltexth->zelp[12].second, bind(&CMenuScreen::moveTo, this, ref(CGP->scrs[campaignMain])), 541, 233, "ZTCAMPN.DEF", SDLK_c);
|
||||
buttons[1] = new AdventureMapButton("", CGI->generaltexth->zelp[12].second, &pushIntT<CMultiMode>, 568, 120, "ZTMULTI.DEF", SDLK_m);
|
||||
buttons[2] = new AdventureMapButton("", CGI->generaltexth->zelp[11].second, bind(&CMenuScreen::moveTo, this, ref(CGP->scrs[campaignMain])), 541, 233, "ZTCAMPN.DEF", SDLK_c);
|
||||
buttons[3] = new AdventureMapButton("", CGI->generaltexth->zelp[13].second, 0 /*cb*/, 545, 358, "ZTTUTOR.DEF", SDLK_t);
|
||||
buttons[4] = new AdventureMapButton("", CGI->generaltexth->zelp[14].second, bind(&CMenuScreen::moveTo, this, CGP->scrs[mainMenu]), 582, 464, "ZTBACK.DEF", SDLK_ESCAPE);
|
||||
}
|
||||
@ -236,8 +236,8 @@ CMenuScreen::CMenuScreen( EState which )
|
||||
{
|
||||
bgAd = new CPicture(BitmapHandler::loadBitmap("ZLOADGAM.bmp"), 114, 312, true);
|
||||
buttons[0] = new AdventureMapButton("", CGI->generaltexth->zelp[10].second, bind(&CGPreGame::openSel, CGP, loadGame, SINGLE_PLAYER), 545, 4, "ZTSINGL.DEF", SDLK_s);
|
||||
buttons[1] = new AdventureMapButton("", CGI->generaltexth->zelp[11].second, bind(&CGPreGame::openSel, CGP, loadGame, MULTI_HOT_SEAT), 568, 120, "ZTMULTI.DEF", SDLK_m);
|
||||
buttons[2] = new AdventureMapButton("", CGI->generaltexth->zelp[12].second, 0 /*cb*/, 541, 233, "ZTCAMPN.DEF", SDLK_c);
|
||||
buttons[1] = new AdventureMapButton("", CGI->generaltexth->zelp[12].second, bind(&CGPreGame::openSel, CGP, loadGame, MULTI_HOT_SEAT), 568, 120, "ZTMULTI.DEF", SDLK_m);
|
||||
buttons[2] = new AdventureMapButton("", CGI->generaltexth->zelp[11].second, 0 /*cb*/, 541, 233, "ZTCAMPN.DEF", SDLK_c);
|
||||
buttons[3] = new AdventureMapButton("", CGI->generaltexth->zelp[13].second, 0 /*cb*/, 545, 358, "ZTTUTOR.DEF", SDLK_t);
|
||||
buttons[4] = new AdventureMapButton("", CGI->generaltexth->zelp[14].second, bind(&CMenuScreen::moveTo, this, CGP->scrs[mainMenu]), 582, 464, "ZTBACK.DEF", SDLK_ESCAPE);
|
||||
}
|
||||
@ -328,6 +328,7 @@ void CGPreGame::update()
|
||||
{
|
||||
if (GH.listInt.size() == 0)
|
||||
{
|
||||
CCS->musich->playMusic(musicBase::mainMenu, -1);
|
||||
#ifdef _WIN32
|
||||
CCS->videoh->open("ACREDIT.SMK");
|
||||
#else
|
||||
@ -1574,7 +1575,10 @@ void InfoCard::showAll( SDL_Surface * to )
|
||||
printToLoc((static_cast<const CMapInfo*>(SEL->current))->date,308,34, FONT_SMALL, zwykly, to);
|
||||
|
||||
//print flags
|
||||
int fx=64, ex=244, myT;
|
||||
int fx = 34 + graphics->fonts[FONT_SMALL]->getWidth(CGI->generaltexth->allTexts[390].c_str());
|
||||
int ex = 200 + graphics->fonts[FONT_SMALL]->getWidth(CGI->generaltexth->allTexts[391].c_str());
|
||||
|
||||
int myT;
|
||||
|
||||
if(playerColor >= 0)
|
||||
myT = SEL->current->mapHeader->players[playerColor].team;
|
||||
@ -1712,7 +1716,8 @@ void InfoCard::setChat(bool activateChat)
|
||||
GH.totalRedraw();
|
||||
}
|
||||
|
||||
OptionsTab::OptionsTab()
|
||||
OptionsTab::OptionsTab():
|
||||
turnDuration(NULL)
|
||||
{
|
||||
OBJ_CONSTRUCTION;
|
||||
bg = new CPicture(BitmapHandler::loadBitmap("ADVOPTBK.bmp"), 0, 0, true);
|
||||
@ -1737,16 +1742,8 @@ void OptionsTab::showAll( SDL_Surface * to )
|
||||
printAtMiddleWBLoc(CGI->generaltexth->allTexts[519], 273, 102, FONT_SMALL, 10, tytulowy, to); //Starting Hero
|
||||
printAtMiddleWBLoc(CGI->generaltexth->allTexts[520], 349, 102, FONT_SMALL, 10, tytulowy, to); //Starting Bonus
|
||||
printAtMiddleLoc(CGI->generaltexth->allTexts[521], 222, 538, FONT_SMALL, tytulowy, to); // Player Turn Duration
|
||||
|
||||
|
||||
if(SEL->sInfo.turnTime)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << (int)SEL->sInfo.turnTime << " Minutes";
|
||||
printAtMiddleLoc(os.str(), 319,559, FONT_SMALL, zwykly, to);
|
||||
}
|
||||
else
|
||||
printAtMiddleLoc("Unlimited",319,559, FONT_SMALL, zwykly, to);
|
||||
if (turnDuration)
|
||||
printAtMiddleLoc(CGI->generaltexth->turnDurations[turnDuration->value], 319,559, FONT_SMALL, zwykly, to);//Turn duration value
|
||||
}
|
||||
|
||||
void OptionsTab::nextCastle( int player, int dir )
|
||||
@ -2089,7 +2086,7 @@ void OptionsTab::PlayerOptionsEntry::showAll( SDL_Surface * to )
|
||||
{
|
||||
CIntObject::showAll(to);
|
||||
printAtMiddleLoc(s.name, 55, 10, FONT_SMALL, zwykly, to);
|
||||
printAtMiddleWBLoc(CGI->generaltexth->arraytxt[206+whoCanPlay], 28, 34, FONT_TINY, 6, zwykly, to);
|
||||
printAtMiddleWBLoc(CGI->generaltexth->arraytxt[206+whoCanPlay], 28, 34, FONT_TINY, 8, zwykly, to);
|
||||
}
|
||||
|
||||
void OptionsTab::PlayerOptionsEntry::selectButtons(bool onlyHero)
|
||||
@ -2622,7 +2619,7 @@ CBonusSelection::CBonusSelection( CCampaignState * _ourCampaign )
|
||||
mapDesc = new CTextBox("", Rect(480, 280, 286, 117), 1);
|
||||
|
||||
//bonus choosing
|
||||
printAtLoc(CGI->generaltexth->allTexts[71], 510, 431, FONT_MEDIUM, zwykly, background); //Choose a bonus:
|
||||
printAtMiddleLoc(CGI->generaltexth->allTexts[71], 562, 438, FONT_MEDIUM, zwykly, background); //Choose a bonus:
|
||||
bonuses = new CHighlightableButtonsGroup(bind(&CBonusSelection::selectBonus, this, _1));
|
||||
|
||||
//set left part of window
|
||||
@ -2658,7 +2655,7 @@ CBonusSelection::CBonusSelection( CCampaignState * _ourCampaign )
|
||||
SDL_FreeSurface(panel);
|
||||
|
||||
//difficulty
|
||||
printAtLoc("Difficulty", 691, 431, FONT_MEDIUM, zwykly, background); //Difficulty
|
||||
printAtMiddleLoc(CGI->generaltexth->allTexts[492], 715, 438, FONT_MEDIUM, zwykly, background); //Difficulty
|
||||
{//difficulty pics
|
||||
for (int b=0; b<ARRAY_COUNT(diffPics); ++b)
|
||||
{
|
||||
@ -2805,7 +2802,9 @@ void CBonusSelection::show( SDL_Surface * to )
|
||||
blitAtLoc(sizes->ourImages[temp].bitmap, 735, 26, to);
|
||||
|
||||
//flags
|
||||
int fx=530, ex=674, myT;
|
||||
int fx = 496 + graphics->fonts[FONT_SMALL]->getWidth(CGI->generaltexth->allTexts[390].c_str());
|
||||
int ex = 629 + graphics->fonts[FONT_SMALL]->getWidth(CGI->generaltexth->allTexts[391].c_str());
|
||||
int myT;
|
||||
myT = ourHeader->players[playerColor].team;
|
||||
for (std::map<int, PlayerSettings>::const_iterator i = sInfo.playerInfos.begin(); i != sInfo.playerInfos.end(); i++)
|
||||
{
|
||||
|
@ -106,6 +106,8 @@ const char * CMediaHandler::extract (int index, int & size)
|
||||
const char * CMediaHandler::extract (std::string srcName, int &size)
|
||||
{
|
||||
int index;
|
||||
srcName.erase(srcName.find_last_of('.'));
|
||||
|
||||
std::map<std::string, int>::iterator fit;
|
||||
if ((fit = fimap.find(srcName)) != fimap.end())
|
||||
{
|
||||
@ -125,15 +127,15 @@ CSndHandler::CSndHandler(std::string fname) : CMediaHandler(fname)
|
||||
for (unsigned int i=0; i<numFiles; i++, se++)
|
||||
{
|
||||
Entry entry;
|
||||
char *p;
|
||||
// char *p;
|
||||
|
||||
// Reassemble the filename and its extension
|
||||
// Reassemble the filename, drop extension
|
||||
entry.name = se->filename;
|
||||
entry.name += '.';
|
||||
p = se->filename;
|
||||
while(*p) p++;
|
||||
p++;
|
||||
entry.name += p;
|
||||
// entry.name += '.';
|
||||
// p = se->filename;
|
||||
// while(*p) p++;
|
||||
// p++;
|
||||
// entry.name += p;
|
||||
|
||||
entry.offset = SDL_SwapLE32(se->offset);
|
||||
entry.size = SDL_SwapLE32(se->size);
|
||||
@ -155,6 +157,7 @@ CVidHandler::CVidHandler(std::string fname) : CMediaHandler(fname)
|
||||
|
||||
entry.name = ve->filename;
|
||||
entry.offset = SDL_SwapLE32(ve->offset);
|
||||
entry.name.erase(entry.name.find_last_of('.'));
|
||||
|
||||
// There is no size, so check where the next file is
|
||||
if (i == numFiles - 1) {
|
||||
|
@ -215,7 +215,9 @@ void CClient::endGame( bool closeConnection /*= true*/ )
|
||||
const_cast<CGameInfo*>(CGI)->state.dellNull();
|
||||
tlog0 << "Deleted mapHandler and gameState." << std::endl;
|
||||
|
||||
CPlayerInterface * oldInt = LOCPLINT;
|
||||
LOCPLINT = NULL;
|
||||
oldInt->pim->unlock();
|
||||
while (!playerint.empty())
|
||||
{
|
||||
CGameInterface *pint = playerint.begin()->second;
|
||||
@ -520,20 +522,15 @@ void CClient::stopConnection()
|
||||
{
|
||||
terminate = true;
|
||||
|
||||
if (serv)
|
||||
if (serv) //request closing connection
|
||||
{
|
||||
tlog0 << "Connection has been requested to be closed.\n";
|
||||
boost::unique_lock<boost::mutex>(*serv->wmx);
|
||||
*serv << &CloseServer();
|
||||
tlog0 << "Sent closing signal to the server\n";
|
||||
|
||||
serv->close();
|
||||
delete serv;
|
||||
serv = NULL;
|
||||
tlog3 << "Our socket has been closed." << std::endl;
|
||||
}
|
||||
|
||||
if(connectionHandler)
|
||||
if(connectionHandler)//end connection handler
|
||||
{
|
||||
if(connectionHandler->get_id() != boost::this_thread::get_id())
|
||||
connectionHandler->join();
|
||||
@ -543,6 +540,14 @@ void CClient::stopConnection()
|
||||
delete connectionHandler;
|
||||
connectionHandler = NULL;
|
||||
}
|
||||
|
||||
if (serv) //and delete connection
|
||||
{
|
||||
serv->close();
|
||||
delete serv;
|
||||
serv = NULL;
|
||||
tlog3 << "Our socket has been closed." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::battleStarted(const BattleInfo * info)
|
||||
|
@ -6559,7 +6559,7 @@ CThievesGuildWindow::~CThievesGuildWindow()
|
||||
void MoraleLuckBox::set(const CBonusSystemNode *node)
|
||||
{
|
||||
const int textId[] = {62, 88}; //eg %s \n\n\n {Current Luck Modifiers:}
|
||||
const int noneTxtId[] = {77, 108}; //I don't know why we have separate "none" texts for luck and morale...
|
||||
const int noneTxtId = 108; //Russian version uses same text for neutral morale\luck
|
||||
const int neutralDescr[] = {60, 86}; //eg {Neutral Morale} \n\n Neutral morale means your armies will neither be blessed with extra attacks or freeze in combat.
|
||||
const int componentType[] = {SComponent::luck, SComponent::morale};
|
||||
const int hoverTextBase[] = {7, 4};
|
||||
@ -6584,7 +6584,7 @@ void MoraleLuckBox::set(const CBonusSystemNode *node)
|
||||
text = CGI->generaltexth->arraytxt[textId[morale]];
|
||||
boost::algorithm::replace_first(text,"%s",CGI->generaltexth->arraytxt[neutralDescr[morale]-mrlt]);
|
||||
if (!mrl.size())
|
||||
text += CGI->generaltexth->arraytxt[noneTxtId[morale]];
|
||||
text += CGI->generaltexth->arraytxt[noneTxtId];
|
||||
else
|
||||
{
|
||||
if (node->nodeType == CBonusSystemNode::STACK &&
|
||||
|
@ -393,6 +393,7 @@ void CGeneralTextHandler::load()
|
||||
for(int hh=0; hh<45; ++hh)
|
||||
{
|
||||
loadToIt(tmp, strin, itr, 3);
|
||||
trimQuotation(tmp);
|
||||
jktexts.push_back(tmp);
|
||||
}
|
||||
|
||||
@ -404,6 +405,14 @@ void CGeneralTextHandler::load()
|
||||
tavernInfo.push_back(tmp);
|
||||
}
|
||||
|
||||
itr = 0;
|
||||
strin = bitmaph->getTextFile("TURNDUR.TXT");
|
||||
for(int hh=0; hh<11; ++hh)
|
||||
{
|
||||
loadToIt(tmp, strin, itr, 3);
|
||||
turnDurations.push_back(tmp);
|
||||
}
|
||||
|
||||
itr = 0;
|
||||
strin = bitmaph->getTextFile("HEROSCRN.TXT");
|
||||
for(int hh=0; hh<33; ++hh)
|
||||
@ -491,13 +500,7 @@ void CGeneralTextHandler::load()
|
||||
for (i = 0; i < 2; ++i) //gap description
|
||||
loadToIt(dump,buf,it,3);
|
||||
seerNames.resize(48);
|
||||
for (i = 0; i < 14; ++i) //additional tabs
|
||||
{
|
||||
loadToIt(seerNames[i], buf, it, 4);
|
||||
loadToIt(dump, buf, it, 3);
|
||||
}
|
||||
|
||||
for (i = 14; i < 48; ++i)
|
||||
for (i = 0; i < 48; ++i)
|
||||
loadToIt(seerNames[i], buf, it, 3);
|
||||
|
||||
//campaigns
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
std::vector<std::string> overview;//text for Kingdom Overview window
|
||||
std::vector<std::string> colors; //names of player colors ("red",...)
|
||||
std::vector<std::string> capColors; //names of player colors with first letter capitalized ("Red",...)
|
||||
std::vector<std::string> turnDurations; //turn durations for pregame (1 Minute ... Unlimited)
|
||||
|
||||
//artifacts
|
||||
std::vector<std::string> artifEvents;
|
||||
|
Loading…
Reference in New Issue
Block a user