1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Fixed #577. New BlockingDialog functionality - only accept.

This commit is contained in:
DjWarmonger 2010-08-17 16:26:48 +00:00
parent 6c3ad7fcae
commit 48b262756b
5 changed files with 39 additions and 34 deletions

View File

@ -1,22 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCMI_client", "client\VCMI_client.vcproj", "{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}"
ProjectSection(ProjectDependencies) = postProject
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F} = {B952FFC5-3039-4DE1-9F08-90ACDA483D8F}
EndProjectSection
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCMI_client", "client\VCMI_client.vcxproj", "{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCMI_lib", "lib\VCMI_lib.vcproj", "{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCMI_lib", "lib\VCMI_lib.vcxproj", "{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCMI_server", "server\VCMI_server.vcproj", "{8AF697C3-465E-4910-B31B-576A9ECDB309}"
ProjectSection(ProjectDependencies) = postProject
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F} = {B952FFC5-3039-4DE1-9F08-90ACDA483D8F}
EndProjectSection
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCMI_server", "server\VCMI_server.vcxproj", "{8AF697C3-465E-4910-B31B-576A9ECDB309}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genius", "AI\GeniusAI\genius.vcproj", "{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}"
ProjectSection(ProjectDependencies) = postProject
{B952FFC5-3039-4DE1-9F08-90ACDA483D8F} = {B952FFC5-3039-4DE1-9F08-90ACDA483D8F}
EndProjectSection
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genius", "AI\GeniusAI\genius.vcxproj", "{B6A14ED9-E7C1-411B-A596-2FE90B3145B4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -914,6 +914,14 @@ void CPlayerInterface::showBlockingDialog( const std::string &text, const std::v
GH.pushInt(temp);
intComps[0]->clickLeft(true, false);
}
else //only accept
{
std::vector<SComponent*> intComps;
for(int i=0;i<components.size();i++)
intComps.push_back(new SComponent(components[i])); //will be deleted by close in window
showYesNoDialog(text,intComps,boost::bind(&CCallback::selectionMade,cb,1,askID),NULL,true);
}
}

View File

@ -679,12 +679,16 @@ void CInfoWindow::showYesNoDialog(const std::string & text, const std::vector<SC
assert(!LOCPLINT || LOCPLINT->showingDialog->get());
std::vector<std::pair<std::string,CFunctionList<void()> > > pom;
pom.push_back(std::pair<std::string,CFunctionList<void()> >("IOKAY.DEF",0));
pom.push_back(std::pair<std::string,CFunctionList<void()> >("ICANCEL.DEF",0));
if (onNo)
pom.push_back(std::pair<std::string,CFunctionList<void()> >("ICANCEL.DEF",0));
CInfoWindow * temp = new CInfoWindow(text, player, components ? *components : std::vector<SComponent*>(), pom, DelComps);
for(int i=0;i<onYes.funcs.size();i++)
temp->buttons[0]->callback += onYes.funcs[i];
for(int i=0;i<onNo.funcs.size();i++)
temp->buttons[1]->callback += onNo.funcs[i];
if (onNo)
{
for(int i=0;i<onNo.funcs.size();i++)
temp->buttons[1]->callback += onNo.funcs[i];
}
GH.pushInt(temp);
}

View File

@ -6050,17 +6050,26 @@ void CGMagi::initObj()
void CGMagi::onHeroVisit(const CGHeroInstance * h) const
{
if (ID == 37)
{
BlockingDialog bd (false, false); //only accept
bd.soundID = soundBase::LIGHTHOUSE;
bd.player = h->tempOwner;
bd.text.addTxt (MetaString::ADVOB_TXT, 61);
cb->showBlockingDialog (&bd, boost::bind (&CGMagi::showEyes, this, h, _1));
}
else if (ID == 27)
{
InfoWindow iw;
iw.player = h->tempOwner;
iw.text.addTxt (MetaString::ADVOB_TXT, 48);
cb->showInfoDialog(&iw);
}
}
void CGMagi::showEyes(const CGHeroInstance * h, ui32 accept) const
{
CenterView cv;
FoWChange fw;
cv.player = iw.player = fw.player = h->tempOwner;
iw.soundID = soundBase::LIGHTHOUSE;
iw.player = h->tempOwner;
iw.text.addTxt (MetaString::ADVOB_TXT, 61);
cb->showInfoDialog(&iw);
cv.player = fw.player = h->tempOwner;
fw.mode = 1;
std::vector<si32>::iterator it;
for (it = eyelist[subID].begin(); it < eyelist[subID].end(); it++)
@ -6075,16 +6084,8 @@ void CGMagi::onHeroVisit(const CGHeroInstance * h) const
}
cv.pos = h->getPosition(false);
cb->sendAndApply(&cv);
}
else if (ID == 27)
{
InfoWindow iw;
iw.player = h->tempOwner;
iw.text.addTxt (MetaString::ADVOB_TXT, 48);
cb->showInfoDialog(&iw);
}
}
void CGBoat::initObj()
{
hero = NULL;

View File

@ -1110,6 +1110,7 @@ public:
void initObj();
void onHeroVisit(const CGHeroInstance * h) const;
void showEyes(const CGHeroInstance * h, ui32 accept) const;
template <typename Handler> void serialize(Handler &h, const int version)
{