rewrite CreateShore(), resolved shore auto connection issues (#132)

---------

Co-authored-by: Zero Fanker <zcyfksn@vip.qq.com>
This commit is contained in:
handama 2024-12-31 09:04:35 +08:00 committed by GitHub
parent 6b62120f74
commit 2688690b78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 419 additions and 804 deletions

View file

@ -173,6 +173,7 @@
#define TERRAINTYPE_BUILDING 0x07
#define TERRAINTYPE_DIRT_ROAD 0x0c
#define TERRAINTYPE_ICE 0x01
#define TERRAINTYPE_BEACH 0x0a
#endif

File diff suppressed because it is too large Load diff

View file

@ -126,6 +126,8 @@ struct FIELDDATA
unsigned bRedrawTerrain : 1; // force redraw
unsigned bCliffHack : 1;
unsigned bRNDImage : 4; // for using a,b,c of tmp tiles
bool bShoreProcessed;
bool bShoreLATNeeded;
};
struct SNAPSHOTDATA
@ -283,6 +285,10 @@ public:
void DeleteWaypoint(DWORD id);
void DeleteInfantry(DWORD dwIndex);
bool IsTileIntact(int x, int y, int startX = -1, int startY = -1, int right = -1, int bottom = -1);
std::vector<MapCoords> GetIntactTileCoords(int x, int y, bool oriIntact);
char GetHackedTerrainType(int tileIndex, int TileSubIndex);
INT GetCelltagAt(DWORD dwPos) const
{
return fielddata[dwPos].celltag;
@ -383,6 +389,11 @@ public:
return &fielddata[dwPos];
};
FIELDDATA* GetFielddataAt(int X, int Y)
{
return GetFielddataAt(GetCoordIndex(X, Y));
};
const FIELDDATA* GetFielddataAt(const MapCoords& pos) const
{
auto dwPos = GetMapPos(pos);
@ -458,6 +469,8 @@ public:
ProjectedCoords ProjectCoords(MapCoords xy) const;
ProjectedCoords ProjectCoords3d(MapCoords xy) const;
ProjectedCoords ProjectCoords3d(MapCoords xy, int z) const;
bool IsCoordInMap(int X, int Y) const;
inline int GetCoordIndex(int X, int Y) const { return X + Y * GetIsoSize(); }
bool isInside(MapCoords xy) const;
__forceinline CPoint GetMiniMapPos(MapCoords mapCoords)
@ -661,6 +674,16 @@ public:
CTube* GetTube(std::uint16_t wID);
};
inline bool CMapData::IsCoordInMap(int X, int Y) const
{
return
X > 0 && Y > 0 &&
X + Y > GetWidth() &&
X + Y <= GetWidth() + 2 * GetHeight() &&
(Y < GetWidth() || X > Y - GetWidth()) &&
(X < GetWidth() || X < Y + GetWidth());
}
inline bool CMapData::isInside(MapCoords xy) const
{
return xy.x >= 0 && xy.y >= 0 && xy.x < m_IsoSize&& xy.y < m_IsoSize;

View file

@ -206,6 +206,7 @@ int dirttunnelset;
int dirttracktunnelset;
int waterset;
int shoreset;
int greenset;
int ramp2set_start;
int pave2set_start;
int rampset_start;

View file

@ -148,6 +148,7 @@ extern int rampsmoothset;
extern int slopesetpiecesset;
extern int waterset;
extern int shoreset;
extern int greenset;
extern int ramp2set;
extern int pave2set;
extern int ramp2set_start;