mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Common changes.
for changes see http://vcmi.antypika.aplus.pl/forum/viewtopic.php?p=2576#2576
This commit is contained in:
@@ -676,6 +676,11 @@ std::vector<const CGHeroInstance *> CCallback::getAvailableHeroes(const CGTownIn
|
||||
|
||||
const TerrainTile * CCallback::getTileInfo( int3 tile ) const
|
||||
{
|
||||
if(!gs->map->isInTheMap(tile))
|
||||
{
|
||||
tlog1 << tile << "is outside the map! (call to getTileInfo)\n";
|
||||
return NULL;
|
||||
}
|
||||
if(!isVisible(tile, player)) return NULL;
|
||||
boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
||||
return &gs->map->getTile(tile);
|
||||
|
@@ -1522,6 +1522,8 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
|
||||
break;
|
||||
case SDLK_SPACE: //space - try to revisit current object with selected hero
|
||||
{
|
||||
if(!active)
|
||||
return;
|
||||
const CGHeroInstance *h = dynamic_cast<const CGHeroInstance*>(selection);
|
||||
if(h && key.state == SDL_PRESSED)
|
||||
{
|
||||
|
@@ -27,7 +27,6 @@ class CBuildingHandler;
|
||||
class CObjectHandler;
|
||||
class CSoundHandler;
|
||||
class CMusicHandler;
|
||||
class CSemiLodHandler;
|
||||
class CDefObjInfoHandler;
|
||||
class CTownHandler;
|
||||
class CLodHandler;
|
||||
@@ -58,11 +57,8 @@ public:
|
||||
CObjectHandler * objh;
|
||||
CSoundHandler * soundh;
|
||||
CMusicHandler * musich;
|
||||
CSemiLodHandler * sspriteh;
|
||||
CDefObjInfoHandler * dobjinfo;
|
||||
CTownHandler * townh;
|
||||
//CLodHandler * spriteh;
|
||||
//CLodHandler * bitmaph;
|
||||
CGeneralTextHandler * generaltexth;
|
||||
CConsoleHandler * consoleh;
|
||||
CCursorHandler * curh;
|
||||
|
@@ -676,7 +676,7 @@ void CHeroWindow::redrawCurBack()
|
||||
CSDL_Ext::printAt(expstr.str(), 69, 247, GEOR16, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->jktexts[7].substr(1, CGI->generaltexth->jktexts[7].size()-2), 212, 231, GEOR13, tytulowy, curBack);
|
||||
std::stringstream manastr;
|
||||
manastr<<curHero->mana<<'/'<<curHero->getPrimSkillLevel(3)*10;
|
||||
manastr << curHero->mana << '/' << curHero->manaLimit();
|
||||
CSDL_Ext::printAt(manastr.str(), 212, 247, GEOR16, zwykly, curBack);
|
||||
}
|
||||
|
||||
@@ -728,19 +728,19 @@ void CArtPlace::clickLeft(boost::logic::tribool down)
|
||||
|
||||
LOCPLINT->cb->swapArtifacts(ourWindow->curHero,destSlot,ourWindow->curHero,srcSlot);
|
||||
|
||||
const CArtifact * pmh = ourArt;
|
||||
ourArt = ourWindow->activeArtPlace->ourArt;
|
||||
ourWindow->activeArtPlace->ourArt = pmh;
|
||||
//const CArtifact * pmh = ourArt;
|
||||
//ourArt = ourWindow->activeArtPlace->ourArt;
|
||||
//ourWindow->activeArtPlace->ourArt = pmh;
|
||||
|
||||
//set texts
|
||||
if(pmh)
|
||||
ourWindow->activeArtPlace->text = pmh->Description();
|
||||
else
|
||||
ourWindow->activeArtPlace->text = std::string();
|
||||
if(ourArt)
|
||||
text = ourArt->Description();
|
||||
else
|
||||
text = std::string();
|
||||
////set texts
|
||||
//if(pmh)
|
||||
// ourWindow->activeArtPlace->text = pmh->Description();
|
||||
//else
|
||||
// ourWindow->activeArtPlace->text = std::string();
|
||||
//if(ourArt)
|
||||
// text = ourArt->Description();
|
||||
//else
|
||||
// text = std::string();
|
||||
|
||||
ourWindow->activeArtPlace->clicked = false;
|
||||
ourWindow->activeArtPlace = NULL;
|
||||
|
@@ -1595,7 +1595,7 @@ bool CPlayerInterface::moveHero( const CGHeroInstance *h, CPath path )
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
newTerrain = cb->getTileInfo(path.nodes[i].coord)->tertype;
|
||||
newTerrain = cb->getTileInfo(CGHeroInstance::convertPosition(path.nodes[i].coord, false))->tertype;
|
||||
|
||||
if (newTerrain != currentTerrain) {
|
||||
CGI->soundh->stopSound(sh);
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
const int Woff = 13; //width of map's frame
|
||||
const int Woff = 14; //width of map's frame
|
||||
const int Hoff = 10;
|
||||
|
||||
/*
|
||||
|
@@ -1869,16 +1869,16 @@ bool CGameHandler::swapArtifacts( si32 hid1, si32 hid2, ui16 slot1, ui16 slot2 )
|
||||
const CArtifact *a1 = h1->getArt(slot1),
|
||||
*a2=h2->getArt(slot2);
|
||||
|
||||
if(a1 && slot2<19 && !vstd::contains(a1->possibleSlots,slot2)
|
||||
|| a2 && slot1<19 && !vstd::contains(a2->possibleSlots,slot1)
|
||||
//check if
|
||||
// 1) slots are appropriate for that artifacts
|
||||
// 2) they are not war machine
|
||||
if((a1 && slot2<19 && !vstd::contains(a1->possibleSlots,slot2) || (a2 && slot1<19 && !vstd::contains(a2->possibleSlots,slot1))) && complain("Cannot swap artifacts!")
|
||||
|| (slot1>=13 && slot1<=16 || slot2>=13 && slot2<=16) && complain("Cannot move war machine!")
|
||||
)
|
||||
{
|
||||
//artifact doesn't fit dst slot
|
||||
complain("Cannot swap artifacts!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
SetHeroArtifacts sha;
|
||||
sha.hid = hid1;
|
||||
sha.artifacts = h1->artifacts;
|
||||
|
Reference in New Issue
Block a user