diff --git a/CCallback.cpp b/CCallback.cpp index 8155d3897..09dbb59eb 100644 --- a/CCallback.cpp +++ b/CCallback.cpp @@ -676,6 +676,11 @@ std::vector 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 lock(*gs->mx); return &gs->map->getTile(tile); diff --git a/client/CAdvmapInterface.cpp b/client/CAdvmapInterface.cpp index b8991ccd8..2f4ac1320 100644 --- a/client/CAdvmapInterface.cpp +++ b/client/CAdvmapInterface.cpp @@ -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(selection); if(h && key.state == SDL_PRESSED) { diff --git a/client/CGameInfo.h b/client/CGameInfo.h index 17e97a9dc..93b59f74e 100644 --- a/client/CGameInfo.h +++ b/client/CGameInfo.h @@ -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; diff --git a/client/CHeroWindow.cpp b/client/CHeroWindow.cpp index 6b6a203f7..a4a6c832a 100644 --- a/client/CHeroWindow.cpp +++ b/client/CHeroWindow.cpp @@ -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<mana<<'/'<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; diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 566a3af5f..c44803f01 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -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); diff --git a/mapHandler.h b/mapHandler.h index 0adb3c175..434d7c81c 100644 --- a/mapHandler.h +++ b/mapHandler.h @@ -4,7 +4,7 @@ #include #include -const int Woff = 13; //width of map's frame +const int Woff = 14; //width of map's frame const int Hoff = 10; /* diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index dc2f581a3..38620e52f 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -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;