1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* VCMI won't try to calculate path when clicking terrain on the other map level then that of currently selected hero (caused hangs)

* Mines / Resource Silos won't give income in the first turn
* Double click on hero slot during stack splitting won't crash
* Fixed problems with updating buttons / minimap
This commit is contained in:
Michał W. Urbańczyk 2009-05-24 23:21:55 +00:00
parent 4f12f73cb9
commit 4581c30b20
10 changed files with 37 additions and 27 deletions

View File

@ -68,7 +68,7 @@ void AdventureMapButton::clickLeft (boost::logic::tribool down)
state=1;
else
state=0;
show(screen2);
show(screenBuf);
if (actOnDown && down)
{
pressedL=state;
@ -198,7 +198,7 @@ void AdventureMapButton::block( ui8 on )
blocked = on;
state = 0;
bitmapOffset = on ? 2 : 0;
show(screen2);
show(screenBuf);
}
void CHighlightableButton::select(bool on)
@ -224,7 +224,7 @@ void CHighlightableButton::clickLeft( tribool down )
state=1;
else
state = selected ? 3 : 0;
show(screen2);
show(screenBuf);
if (pressedL && (down==false))
{
pressedL=state;
@ -350,7 +350,7 @@ void CSlider::mouseMoved (const SDL_MouseMotionEvent & sEvent)
void CSlider::redrawSlider()
{
slider.show(screen2);
slider.show(screenBuf);
}
void CSlider::moveLeft()

View File

@ -481,7 +481,7 @@ void CTerrainRect::clickLeft(tribool down)
LOCPLINT->moveHero(currentHero,*currentPath);
LOCPLINT->pim->lock();
}
else //remove old path and find a new one
else if(mp.z == currentHero->pos.z) //remove old path and find a new one if we clicked on the map level on which hero is present
{
int3 bufpos = currentHero->getPosition(false);
CPath *& pathForCurhero = LOCPLINT->adventureInt->heroList.items[LOCPLINT->adventureInt->heroList.selected].second;
@ -1282,16 +1282,16 @@ void CAdvMapInt::fswitchLevel()
{
position.z--;
underground.curimg=0;
underground.show(screen2);
underground.show(screenBuf);
}
else
{
underground.curimg=1;
position.z++;
underground.show(screen2);
underground.show(screenBuf);
}
updateScreen = true;
minimap.draw(screen2);
minimap.draw(screenBuf);
}
void CAdvMapInt::fshowQuestlog()
{
@ -1355,6 +1355,7 @@ void CAdvMapInt::activate()
active--;
return;
}
screenBuf = screen;
LOCPLINT->statusbar = &statusbar;
kingOverview.activate();
underground.activate();

View File

@ -260,6 +260,8 @@ void CHeroGSlot::clickLeft(boost::logic::tribool down)
CHeroGSlot *other = upg ? &owner->hslotup : &owner->hslotdown;
if(!down)
{
owner->garr->splitting = false;
owner->garr->highlighted = NULL;
if(hero && highlight)
{
highlight = false;

View File

@ -57,7 +57,9 @@
*/
std::string NAME = NAME_VER + std::string(" (client)"); //application name
SDL_Surface *screen = NULL, *screen2 = NULL; //main screen surface and hlp surface (used to store not-active interfaces layer)
SDL_Surface *screen = NULL, //main screen surface
*screen2 = NULL,//and hlp surface (used to store not-active interfaces layer)
*screenBuf = screen; //points to screen (if only advmapint is present) or screen2 (else) - should be used when updating controls which are not regularly redrawed
std::queue<SDL_Event*> events;
boost::mutex eventsM;

View File

@ -1663,6 +1663,9 @@ void CPlayerInterface::popIntTotally( IShowActivable *top )
void CPlayerInterface::pushInt( IShowActivable *newInt )
{
//a new interface will be present, we'll need to use buffer surface (unless it's advmapint that will alter screenBuf on activate anyway)
screenBuf = screen2;
if(listInt.size())
listInt.front()->deactivate();
listInt.push_front(newInt);

View File

@ -31,7 +31,7 @@
#include <boost/assign/std/vector.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread.hpp>
//#include <boost/thread.hpp>
#include <cmath>
#include <queue>
#include <sstream>
@ -1425,7 +1425,6 @@ void CTownList::mouseMoved (const SDL_MouseMotionEvent & sEvent)
void CTownList::clickLeft(tribool down)
{
SDL_Surface *dst = (LOCPLINT->topInt()==LOCPLINT->adventureInt ? screen : screen2);
if (down)
{
/***************************ARROWS*****************************************/
@ -1433,7 +1432,7 @@ void CTownList::clickLeft(tribool down)
{
if(from>0)
{
blitAt(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y,dst);
blitAt(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y,screenBuf);
pressed = true;
}
return;
@ -1442,7 +1441,7 @@ void CTownList::clickLeft(tribool down)
{
if(items.size()-from > SIZE)
{
blitAt(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y,dst);
blitAt(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y,screenBuf);
pressed = false;
}
return;
@ -1468,7 +1467,7 @@ void CTownList::clickLeft(tribool down)
return;
if (pressed) //up
{
blitAt(arrup->ourImages[0].bitmap,arrupp.x,arrupp.y,dst);
blitAt(arrup->ourImages[0].bitmap,arrupp.x,arrupp.y,screenBuf);
pressed = indeterminate;
if (!down)
{
@ -1476,12 +1475,12 @@ void CTownList::clickLeft(tribool down)
if (from<0)
from=0;
draw(dst);
draw(screenBuf);
}
}
else if (!pressed) //down
{
blitAt(arrdo->ourImages[0].bitmap,arrdop.x,arrdop.y,dst);
blitAt(arrdo->ourImages[0].bitmap,arrdop.x,arrdop.y,screenBuf);
pressed = indeterminate;
if (!down)
{
@ -1489,7 +1488,7 @@ void CTownList::clickLeft(tribool down)
//if (from<items.size()-5)
// from=items.size()-5;
draw(dst);
draw(screenBuf);
}
}
else

View File

@ -16,7 +16,7 @@
*
*/
extern SDL_Surface * screen, *screen2;
extern SDL_Surface * screen, *screen2, *screenBuf;
extern SDL_Color tytulowy, tlo, zwykly ;
extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;
void blitAtWR(SDL_Surface * src, int x, int y, SDL_Surface * dst=screen);

View File

@ -1664,6 +1664,9 @@ void CGMine::onHeroVisit( const CGHeroInstance * h ) const
void CGMine::newTurn() const
{
if(cb->getDate() == 1)
return;
if (tempOwner == NEUTRAL_PLAYER)
return;
int vv = 1;

View File

@ -41,7 +41,7 @@ public:
virtual int getOwner(int heroID);
virtual int getResource(int player, int which);
virtual int getDate(int mode=0);
virtual int getDate(int mode=0); ////mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
virtual const CGObjectInstance* getObj(int objid);
virtual const CGHeroInstance* getHero(int objid);
virtual const CGTownInstance* getTown(int objid);

View File

@ -282,6 +282,10 @@
RelativePath="..\hch\CDefObjInfoHandler.cpp"
>
</File>
<File
RelativePath=".\CGameState.cpp"
>
</File>
<File
RelativePath="..\hch\CGeneralTextHandler.cpp"
>
@ -314,6 +318,10 @@
RelativePath=".\IGameCallback.cpp"
>
</File>
<File
RelativePath=".\map.cpp"
>
</File>
<File
RelativePath=".\NetPacksLib.cpp"
>
@ -429,14 +437,6 @@
>
</File>
</Filter>
<File
RelativePath=".\CGameState.cpp"
>
</File>
<File
RelativePath=".\map.cpp"
>
</File>
</Files>
<Globals>
</Globals>