1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

* bug 492 fixed

* boost::filesystem version set to 2 (should work with all relatively new versions of boost)
This commit is contained in:
mateuszb 2011-02-24 15:05:21 +00:00
parent 91d0ea64de
commit ba7eb6ce49
4 changed files with 23 additions and 1 deletions

View File

@ -532,8 +532,10 @@ void CMapHandler::terrainRect( int3 top_tile, unsigned char anim, const std::vec
if(obj->ID != HEROI_TYPE && !obj->coveringAt(obj->pos.x - (top_tile.x + bx), top_tile.y + by - obj->pos.y + 5))
continue;
static const int notBlittedInPuzzleMode[] = {124};
//don't print flaggable objects in puzzle mode
if(puzzleMode && obj->tempOwner != 254)
if(puzzleMode && (obj->isVisitable() || vstd::contains(notBlittedInPuzzleMode, obj->ID)))
continue;
SDL_Rect sr2(sr);

View File

@ -9,6 +9,8 @@
using boost::logic::tribool;
#include <boost/cstdint.hpp>
#include <assert.h>
//filesystem version 3 causes problems (and it's default as of boost 1.46)
#define BOOST_FILESYSTEM_VERSION 2
typedef boost::uint64_t ui64; //unsigned int 64 bits (8 bytes)
typedef boost::uint32_t ui32; //unsigned int 32 bits (4 bytes)
typedef boost::uint16_t ui16; //unsigned int 16 bits (2 bytes)
@ -426,6 +428,11 @@ namespace vstd
{
return c.find(i)!=c.end();
}
template <typename Item, size_t N>
bool contains(const Item (&c)[N], const Item &i) //returns true if given array contains item i
{
return std::find(c, c+N, i) != c+N;
}
template <typename Container1, typename Container2>
typename Container2::iterator findFirstNot(Container1 &c1, Container2 &c2)//returns first element of c2 not present in c1
{

View File

@ -518,6 +518,18 @@ int3 CGObjectInstance::visitablePos() const
return pos - getVisitableOffset();
}
bool CGObjectInstance::isVisitable() const
{
for(int g=0; g<ARRAY_COUNT(defInfo->visitMap); ++g)
{
if(defInfo->visitMap[g] != 0)
{
return true;
}
}
return false;
}
static int lowestSpeed(const CGHeroInstance * chi)
{
if(!chi->Slots().size())

View File

@ -171,6 +171,7 @@ public:
bool coveringAt(int x, int y) const; //returns true if object covers with picture location (x, y) form left top tile of maximal possible image (8 x 6 tiles) (x, y in tiles)
bool hasShadowAt(int x, int y) const;//returns true if object covers with shadow location (x, y) form left top tile of maximal possible image (8 x 6 tiles) (x, y in tiles)
std::set<int3> getBlockedPos() const; //returns set of positions blocked by this object
bool isVisitable() const; //returns true if object is visitable
bool operator<(const CGObjectInstance & cmp) const; //screen printing priority comparing
void hideTiles(int ourplayer, int radius) const;
CGObjectInstance();