mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
* Patch from Ubuntux: fix to avoid resources becoming negative [on handling timed events]
* improvements for Garrison Window * some changes towards Events support * minor fixes
This commit is contained in:
parent
ece364f735
commit
38b680ed30
@ -2015,7 +2015,7 @@ void CPlayerInterface::heroMovePointsChanged(const CGHeroInstance * hero)
|
||||
void CPlayerInterface::receivedResource(int type, int val)
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
||||
//LOCPLINT->totalRedraw();
|
||||
LOCPLINT->totalRedraw();
|
||||
}
|
||||
|
||||
void CPlayerInterface::heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16>& skills, boost::function<void(ui32)> &callback)
|
||||
@ -2053,9 +2053,8 @@ void CPlayerInterface::heroInGarrisonChange(const CGTownInstance *town)
|
||||
c->garr->odown = c->hslotdown.hero = town->visitingHero;
|
||||
c->garr->set2 = town->visitingHero ? &town->visitingHero->army : NULL;
|
||||
c->garr->recreateSlots();
|
||||
LOCPLINT->totalRedraw();
|
||||
//c->showAll();
|
||||
}
|
||||
LOCPLINT->totalRedraw();
|
||||
}
|
||||
void CPlayerInterface::heroVisitsTown(const CGHeroInstance* hero, const CGTownInstance * town)
|
||||
{
|
||||
@ -2136,6 +2135,10 @@ void CPlayerInterface::buildChanged(const CGTownInstance *town, int buildingID,
|
||||
void CPlayerInterface::battleStart(CCreatureSet *army1, CCreatureSet *army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, bool side) //called by engine when battle starts; side=0 - left, side=1 - right
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
||||
|
||||
while(showingDialog->get())
|
||||
SDL_Delay(20);
|
||||
|
||||
battleInt = new CBattleInterface(army1, army2, hero1, hero2, genRect(600, 800, (conf.cc.resx - 800)/2, (conf.cc.resy - 600)/2));
|
||||
pushInt(battleInt);
|
||||
}
|
||||
@ -2501,7 +2504,7 @@ void CPlayerInterface::redrawHeroWin(const CGHeroInstance * hero)
|
||||
SDL_FreeSurface(graphics->heroWins[hero->subID]);
|
||||
graphics->heroWins[hero->subID] = infoWin(hero);
|
||||
if (adventureInt->selection == hero)
|
||||
adventureInt->infoBar.draw(screen2);
|
||||
adventureInt->infoBar.draw(screen);
|
||||
}
|
||||
|
||||
bool CPlayerInterface::moveHero( const CGHeroInstance *h, CPath * path )
|
||||
@ -4747,6 +4750,10 @@ void CGarrisonWindow::deactivate()
|
||||
|
||||
void CGarrisonWindow::show(SDL_Surface * to)
|
||||
{
|
||||
blitAt(graphics->flags->ourImages[garr->odown->getOwner()].bitmap,pos.x+29,pos.y+125,to);
|
||||
blitAt(graphics->portraitLarge[static_cast<const CGHeroInstance*>(garr->odown)->portrait],pos.x+29,pos.y+222,to);
|
||||
printAtMiddle(CGI->generaltexth->allTexts[709],pos.x+275,pos.y+30,GEOR16,tytulowy,to);
|
||||
|
||||
blitAt(bg,pos,to);
|
||||
split->show(to);
|
||||
quit->show(to);
|
||||
|
@ -1254,7 +1254,7 @@ int CArmedInstance::getArmyStrength() const
|
||||
{
|
||||
int ret = 0;
|
||||
for(std::map<si32,std::pair<ui32,si32> >::const_iterator i=army.slots.begin(); i!=army.slots.end(); i++)
|
||||
ret += VLC->creh->creatures[i->second.first].AIValue;
|
||||
ret += VLC->creh->creatures[i->second.first].AIValue * i->second.second;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2184,7 +2184,7 @@ const std::string & CGMagicWell::getHoverText() const
|
||||
|
||||
void CGEvent::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
/*if(!(availableFor & (1 << h->tempOwner)))
|
||||
if(!(availableFor & (1 << h->tempOwner)))
|
||||
return;
|
||||
if(cb->getPlayerSettings(h->tempOwner)->human)
|
||||
{
|
||||
@ -2192,7 +2192,7 @@ void CGEvent::onHeroVisit( const CGHeroInstance * h ) const
|
||||
activated(h);
|
||||
}
|
||||
else if(computerActivate)
|
||||
activated(h);*/
|
||||
activated(h);
|
||||
}
|
||||
|
||||
void CGEvent::endBattle( BattleResult *result ) const
|
||||
@ -2215,16 +2215,16 @@ void CGEvent::activated( const CGHeroInstance * h ) const
|
||||
|
||||
void CGObservatory::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
InfoWindow iw;
|
||||
iw.player = h->tempOwner;
|
||||
iw.text.addTxt(MetaString::ADVOB_TXT,98 + (ID==60));
|
||||
cb->showInfoDialog(&iw);
|
||||
|
||||
FoWChange fw;
|
||||
fw.player = h->tempOwner;
|
||||
fw.mode = 1;
|
||||
cb->getTilesInRange(fw.tiles,pos,20,h->tempOwner,1);
|
||||
cb->sendAndApply(&fw);
|
||||
|
||||
InfoWindow iw;
|
||||
iw.player = h->tempOwner;
|
||||
iw.text.addTxt(MetaString::ADVOB_TXT,98 + (ID==60));
|
||||
cb->showInfoDialog(&iw);
|
||||
}
|
||||
|
||||
void CGShrine::onHeroVisit( const CGHeroInstance * h ) const
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <fstream>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include "../lib/RegisterTypes.cpp"
|
||||
|
||||
#endif
|
||||
|
||||
using namespace boost;
|
||||
using namespace boost::asio::ip;
|
||||
|
@ -1205,6 +1205,7 @@ bool CMapHandler::printObject(const CGObjectInstance *obj)
|
||||
bool CMapHandler::hideObject(const CGObjectInstance *obj)
|
||||
{
|
||||
CDefHandler * curd = obj->defInfo->handler;
|
||||
if(!curd) return false;
|
||||
for(int fx=0; fx<curd->ourImages[0].bitmap->w/32; ++fx)
|
||||
{
|
||||
for(int fy=0; fy<curd->ourImages[0].bitmap->h/32; ++fy)
|
||||
|
@ -2379,6 +2379,9 @@ void CGameHandler::handleTimeEvents()
|
||||
{
|
||||
iw.components.push_back(Component(Component::RESOURCE,i,ev->resources[i],0));
|
||||
sr.res[i] += ev->resources[i];
|
||||
// Don't let resources becoming negative
|
||||
if (sr.res[i] < 0)
|
||||
sr.res[i] = 0;
|
||||
}
|
||||
}
|
||||
if (iw.components.size())
|
||||
|
@ -44,8 +44,8 @@ void MoveHero::applyGh( CGameHandler *gh )
|
||||
|
||||
void ArrangeStacks::applyGh( CGameHandler *gh )
|
||||
{
|
||||
ERROR_IF_NOT_OWNS(id1);
|
||||
ERROR_IF_NOT_OWNS(id2);
|
||||
//ERROR_IF_NOT_OWNS(id1);
|
||||
//ERROR_IF_NOT_OWNS(id2);
|
||||
gh->arrangeStacks(id1,id2,what,p1,p2,val);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user