| 26 | const std::vector<Tile*> EMPTY_TILES; |
| 27 | |
| 28 | class TileDistance |
| 29 | { |
| 30 | public: |
| 31 | enum TileDistanceType |
| 32 | { |
| 33 | Horizontal, |
| 34 | Diagonal, |
| 35 | Other |
| 36 | }; |
| 37 | |
| 38 | TileDistance(int diffX, int diffY, TileDistanceType type, int distSquared): |
| 39 | mDiffX(diffX), |
| 40 | mDiffY(diffY), |
| 41 | mType(type), |
| 42 | mDistSquared(distSquared) |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | inline int getDiffX() const |
| 47 | { return mDiffX; } |
| 48 | |
| 49 | inline int getDiffY() const |
| 50 | { return mDiffY; } |
| 51 | |
| 52 | inline TileDistanceType getType() const |
| 53 | { return mType; } |
| 54 | |
| 55 | inline int getDistSquared() const |
| 56 | { return mDistSquared; } |
| 57 | |
| 58 | void computeTileDistances(double coefNorth, double coefSouth, const TileDistance& tileDistance, |
| 59 | uint32_t indexTileDistance) |
| 60 | { |
| 61 | // A tile can only hide tiles behind (x > tile.x and y > tile.y) |
| 62 | if(tileDistance.getDiffX() < getDiffX()) |
| 63 | return; |
| 64 | if(tileDistance.getDiffY() < getDiffY()) |
| 65 | return; |
| 66 | |
| 67 | // We don't want a tile to hide itself |
| 68 | if((tileDistance.getDiffX() == getDiffX()) && |
| 69 | (tileDistance.getDiffY() == getDiffY())) |
| 70 | { |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | if(getType() == TileDistance::TileDistanceType::Horizontal) |
| 75 | { |
| 76 | // For horizontal tiles, we hide following tiles (x > tile.x). But we process |
| 77 | // north tiles normally |
| 78 | if(tileDistance.getType() == TileDistance::TileDistanceType::Horizontal) |
| 79 | { |
| 80 | addHiddenTileSouth(indexTileDistance, 1.0); |
| 81 | return; |
| 82 | } |
| 83 | |
| 84 | double xTileDeb = static_cast<double>(tileDistance.getDiffX()) - 0.5; |
| 85 | double xTileEnd = xTileDeb + 1.0; |