1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Fixed #522 (probably), #529, #540.

Version to be released as dev build 0.81b
This commit is contained in:
Michał W. Urbańczyk 2010-07-24 11:46:04 +00:00
parent 07812116c9
commit ff078dc440
5 changed files with 33 additions and 15 deletions

View File

@ -1189,7 +1189,7 @@ heroList(ADVOPT.hlistSize),
townList(ADVOPT.tlistSize,ADVOPT.tlistX,ADVOPT.tlistY,ADVOPT.tlistAU,ADVOPT.tlistAD)//(5,&genRect(192,48,747,196),747,196,747,372),
{
spellBeingCasted = NULL;
player = 0;
player = 1;
pos.x = pos.y = 0;
pos.w = screen->w;
pos.h = screen->h;
@ -1733,7 +1733,6 @@ bool CAdvMapInt::isActive()
void CAdvMapInt::startHotSeatWait(int Player)
{
setPlayer(Player);
state = WAITING;
}

View File

@ -442,6 +442,10 @@ void processCommand(const std::string &message)
tlog0 << "\nBonuses from " << typeid(*parent).name() << std::endl << parent->bonuses << std::endl;
}
}
else if(cn == "not dialog")
{
LOCPLINT->showingDialog->setn(false);
}
else if(client && client->serv && client->serv->connected) //send to server
{
PlayerMessage pm(LOCPLINT->playerID,message);

View File

@ -183,6 +183,9 @@ void CPlayerInterface::yourTurn()
autosaveCount %= 5;
}
if(adventureInt->player != playerID)
adventureInt->setPlayer(playerID);
if(howManyPeople > 1) //hot seat message
{
adventureInt->startHotSeatWait(playerID);
@ -944,9 +947,8 @@ void CPlayerInterface::heroArtifactSetChanged(const CGHeroInstance*hero)
adventureInt->heroWindow->deactivate();
adventureInt->heroWindow->setHero(hero);
adventureInt->heroWindow->activate();
return;
}
if(CExchangeWindow* cew = dynamic_cast<CExchangeWindow*>(GH.topInt())) //exchange window is open
else if(CExchangeWindow* cew = dynamic_cast<CExchangeWindow*>(GH.topInt())) //exchange window is open
{
cew->deactivate();
for(int g=0; g<ARRAY_COUNT(cew->heroInst); ++g)
@ -970,6 +972,8 @@ void CPlayerInterface::heroArtifactSetChanged(const CGHeroInstance*hero)
caw->arts->updateState = false;
caw->activate();
}
updateInfo(hero);
}
void CPlayerInterface::availableCreaturesChanged( const CGDwelling *town )
@ -1296,7 +1300,7 @@ void CPlayerInterface::update()
return;
//if there are any waiting dialogs, show them
if(dialogs.size() && !showingDialog->get())
if((howManyPeople <= 1 || makingTurn) && dialogs.size() && !showingDialog->get())
{
showingDialog->set(true);
GH.pushInt(dialogs.front());
@ -1796,11 +1800,15 @@ void CPlayerInterface::gameOver(ui8 player, bool victory )
while(showingDialog->get() || dialogs.size()); //wait till all dialogs are displayed and closed
makingTurn = false;
//return to main menu
SDL_Event event;
event.type = SDL_USEREVENT;
event.user.code = 2;
SDL_PushEvent(&event);
howManyPeople--;
if(!howManyPeople) //all human players eliminated
{
//return to main menu
SDL_Event event;
event.type = SDL_USEREVENT;
event.user.code = 2;
SDL_PushEvent(&event);
}
}
else
{

View File

@ -686,11 +686,11 @@ void CInfoWindow::showYesNoDialog(const std::string & text, const std::vector<SC
GH.pushInt(temp);
}
CInfoWindow * CInfoWindow::create(const std::string &text, int playerID /*= 1*/, const std::vector<SComponent*> *components /*= NULL*/)
CInfoWindow * CInfoWindow::create(const std::string &text, int playerID /*= 1*/, const std::vector<SComponent*> *components /*= NULL*/, bool DelComps)
{
std::vector<std::pair<std::string,CFunctionList<void()> > > pom;
pom.push_back(std::pair<std::string,CFunctionList<void()> >("IOKAY.DEF",0));
CInfoWindow * ret = new CInfoWindow(text, playerID, 0, components ? *components : std::vector<SComponent*>(), pom, false);
CInfoWindow * ret = new CInfoWindow(text, playerID, 0, components ? *components : std::vector<SComponent*>(), pom, DelComps);
return ret;
}
@ -2366,6 +2366,7 @@ void CCreInfoWindow::init(const CCreature *cre, const CStackInstance *stack, int
}
CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount)
: type(Type), dismiss(0), upgrade(0), ok(0)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
const CCreature *cre = CGI->creh->creatures[Cid];
@ -6387,8 +6388,14 @@ void MoraleLuckBox::set(const CBonusSystemNode *hero)
int mrlt = -9;
TModDescr mrl;
hero->getModifiersWDescr(mrl, bonusType[morale]);
bonusValue = (hero->*getValue[morale])();
if(hero)
{
hero->getModifiersWDescr(mrl, bonusType[morale]);
bonusValue = (hero->*getValue[morale])();
}
else
bonusValue = 0;
mrlt = (bonusValue>0)-(bonusValue<0); //signum: -1 - bad luck / morale, 0 - neutral, 1 - good
hoverText = CGI->generaltexth->heroscrn[hoverTextBase[morale] - mrlt];
baseType = componentType[morale];

View File

@ -92,7 +92,7 @@ public:
~CInfoWindow(); //d-tor
static void showYesNoDialog( const std::string & text, const std::vector<SComponent*> *components, const CFunctionList<void( ) > &onYes, const CFunctionList<void()> &onNo, bool DelComps = true, int player = 1); //use only before the game starts! (showYesNoDialog in LOCPLINT must be used then)
static CInfoWindow *create(const std::string &text, int playerID = 1, const std::vector<SComponent*> *components = NULL);
static CInfoWindow *create(const std::string &text, int playerID = 1, const std::vector<SComponent*> *components = NULL, bool DelComps = false);
};
class CSelWindow : public CInfoWindow //component selection window
{ //warning - this window deletes its components by closing!