Move CMapField::SeenTile into CMapFieldPlayerInfo::SeenTile.
This commit is contained in:
parent
1bfedc3116
commit
b9e8edebb7
9 changed files with 32 additions and 32 deletions
|
@ -1934,9 +1934,8 @@ void CEditor::Init()
|
|||
const int defaultTile = 0x50;
|
||||
|
||||
for (int i = 0; i < Map.Info.MapWidth * Map.Info.MapHeight; ++i) {
|
||||
Map.Fields[i].Tile = Map.Fields[i].SeenTile = 0;
|
||||
Map.Fields[i].Tile = Map.Fields[i].SeenTile =
|
||||
Map.Tileset.Table[defaultTile];
|
||||
Map.Fields[i].Tile = Map.Tileset.Table[defaultTile];
|
||||
Map.Fields[i].playerInfo.SeenTile = Map.Fields[i].Tile;
|
||||
Map.Fields[i].Flags = Map.Tileset.FlagsTable[defaultTile];
|
||||
}
|
||||
GameSettings.Resources = SettingsPresetMapDefault;
|
||||
|
|
|
@ -393,7 +393,8 @@ void ChangeTile(const Vec2i &pos, int tile)
|
|||
Assert(tile >= 0 && tile < Map.Tileset.NumTiles);
|
||||
|
||||
CMapField *mf = Map.Field(pos);
|
||||
mf->Tile = mf->SeenTile = Map.Tileset.Table[tile];
|
||||
mf->Tile = Map.Tileset.Table[tile];
|
||||
mf->playerInfo.SeenTile = mf->Tile;
|
||||
}
|
||||
|
||||
#define DIR_UP 8 /// Go up allowed
|
||||
|
|
|
@ -41,7 +41,12 @@
|
|||
** @class CMapField tile.h
|
||||
**
|
||||
** \#include "tile.h"
|
||||
*
|
||||
**
|
||||
** CMapFieldPlayerInfo::SeenTile
|
||||
**
|
||||
** This is the tile number, that the player sitting on the computer
|
||||
** currently knows. Idea: Can be uses for illusions.
|
||||
**
|
||||
** CMapFieldPlayerInfo::Visible[]
|
||||
**
|
||||
** Counter how many units of the player can see this field. 0 the
|
||||
|
@ -78,11 +83,6 @@
|
|||
** currently 32x32 pixels. In the future is planned to support
|
||||
** animated tiles.
|
||||
**
|
||||
** CMapField::SeenTile
|
||||
**
|
||||
** This is the tile number, that the player sitting on the computer
|
||||
** currently knows. Idea: Can be uses for illusions.
|
||||
**
|
||||
** CMapField::Flags
|
||||
**
|
||||
** Contains special information of that tile. What units are
|
||||
|
@ -144,7 +144,7 @@
|
|||
class CMapFieldPlayerInfo
|
||||
{
|
||||
public:
|
||||
CMapFieldPlayerInfo()
|
||||
CMapFieldPlayerInfo() : SeenTile(0)
|
||||
{
|
||||
memset(Visible, 0, sizeof(Visible));
|
||||
memset(VisCloak, 0, sizeof(VisCloak));
|
||||
|
@ -158,6 +158,7 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
unsigned short SeenTile; /// last seen tile (FOW)
|
||||
unsigned short Visible[PlayerMax]; /// Seen counter 0 unexplored
|
||||
unsigned char VisCloak[PlayerMax]; /// Visiblity for cloaking.
|
||||
unsigned char Radar[PlayerMax]; /// Visiblity for radar.
|
||||
|
@ -169,14 +170,13 @@ public:
|
|||
class CMapField
|
||||
{
|
||||
public:
|
||||
CMapField() : Tile(0), SeenTile(0), Flags(0), Cost(0), Value(0), UnitCache()
|
||||
CMapField() : Tile(0), Flags(0), Cost(0), Value(0), UnitCache()
|
||||
#ifdef DEBUG
|
||||
, TilesetTile(0)
|
||||
#endif
|
||||
{}
|
||||
|
||||
unsigned short Tile; /// graphic tile number
|
||||
unsigned short SeenTile; /// last seen tile (FOW)
|
||||
unsigned short Flags; /// field flags
|
||||
unsigned char Cost; /// unit cost to move in this tile
|
||||
// FIXME: Value should be removed, walls and regeneration can be handled differently.
|
||||
|
|
|
@ -68,7 +68,7 @@ void CMap::MarkSeenTile(const unsigned int index)
|
|||
{
|
||||
CMapField &mf = *this->Field(index);
|
||||
const int tile = mf.Tile;
|
||||
const int seentile = mf.SeenTile;
|
||||
const int seentile = mf.playerInfo.SeenTile;
|
||||
|
||||
//
|
||||
// Nothing changed? Seeing already the correct tile.
|
||||
|
@ -76,7 +76,7 @@ void CMap::MarkSeenTile(const unsigned int index)
|
|||
if (tile == seentile) {
|
||||
return;
|
||||
}
|
||||
mf.SeenTile = tile;
|
||||
mf.playerInfo.SeenTile = tile;
|
||||
|
||||
#ifdef MINIMAP_UPDATE
|
||||
//rb - GRRRRRRRRRRRR
|
||||
|
@ -331,7 +331,7 @@ void PreprocessMap()
|
|||
for (int ix = 0; ix < Map.Info.MapWidth; ++ix) {
|
||||
for (int iy = 0; iy < Map.Info.MapHeight; ++iy) {
|
||||
CMapField *mf = Map.Field(ix, iy);
|
||||
mf->SeenTile = mf->Tile;
|
||||
mf->playerInfo.SeenTile = mf->Tile;
|
||||
}
|
||||
}
|
||||
// it is required for fixing the wood that all tiles are marked as seen!
|
||||
|
@ -422,7 +422,7 @@ void CMap::FixTile(unsigned short type, int seen, const Vec2i &pos)
|
|||
unsigned int index = getIndex(pos);
|
||||
CMapField *mf = this->Field(index);
|
||||
|
||||
if (seen && !Tileset.IsSeenTile(type, mf->SeenTile)) {
|
||||
if (seen && !Tileset.IsSeenTile(type, mf->playerInfo.SeenTile)) {
|
||||
return;
|
||||
} else if (!seen && !(mf->Flags & type)) {
|
||||
return;
|
||||
|
@ -462,7 +462,7 @@ void CMap::FixTile(unsigned short type, int seen, const Vec2i &pos)
|
|||
} else {
|
||||
CMapField *new_mf = (mf - this->Info.MapWidth);
|
||||
if (seen) {
|
||||
ttup = this->Tileset.MixedLookupTable[new_mf->SeenTile];
|
||||
ttup = this->Tileset.MixedLookupTable[new_mf->playerInfo.SeenTile];
|
||||
} else {
|
||||
ttup = this->Tileset.MixedLookupTable[new_mf->Tile];
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ void CMap::FixTile(unsigned short type, int seen, const Vec2i &pos)
|
|||
} else {
|
||||
CMapField *new_mf = (mf + 1);
|
||||
if (seen) {
|
||||
ttright = this->Tileset.MixedLookupTable[new_mf->SeenTile];
|
||||
ttright = this->Tileset.MixedLookupTable[new_mf->playerInfo.SeenTile];
|
||||
} else {
|
||||
ttright = this->Tileset.MixedLookupTable[new_mf->Tile];
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ void CMap::FixTile(unsigned short type, int seen, const Vec2i &pos)
|
|||
} else {
|
||||
CMapField *new_mf = (mf + this->Info.MapWidth);
|
||||
if (seen) {
|
||||
ttdown = this->Tileset.MixedLookupTable[new_mf->SeenTile];
|
||||
ttdown = this->Tileset.MixedLookupTable[new_mf->playerInfo.SeenTile];
|
||||
} else {
|
||||
ttdown = this->Tileset.MixedLookupTable[new_mf->Tile];
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ void CMap::FixTile(unsigned short type, int seen, const Vec2i &pos)
|
|||
} else {
|
||||
CMapField *new_mf = (mf - 1);
|
||||
if (seen) {
|
||||
ttleft = this->Tileset.MixedLookupTable[new_mf->SeenTile];
|
||||
ttleft = this->Tileset.MixedLookupTable[new_mf->playerInfo.SeenTile];
|
||||
} else {
|
||||
ttleft = this->Tileset.MixedLookupTable[new_mf->Tile];
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ void CMap::FixTile(unsigned short type, int seen, const Vec2i &pos)
|
|||
//Update seen tile.
|
||||
if (tile == -1) { // No valid wood remove it.
|
||||
if (seen) {
|
||||
mf->SeenTile = removedtile;
|
||||
mf->playerInfo.SeenTile = removedtile;
|
||||
this->FixNeighbors(type, seen, pos);
|
||||
} else {
|
||||
mf->Tile = removedtile;
|
||||
|
@ -545,12 +545,12 @@ void CMap::FixTile(unsigned short type, int seen, const Vec2i &pos)
|
|||
mf->Value = 0;
|
||||
UI.Minimap.UpdateXY(pos);
|
||||
}
|
||||
} else if (seen && this->Tileset.MixedLookupTable[mf->SeenTile] ==
|
||||
} else if (seen && this->Tileset.MixedLookupTable[mf->playerInfo.SeenTile] ==
|
||||
this->Tileset.MixedLookupTable[tile]) { //Same Type
|
||||
return;
|
||||
} else {
|
||||
if (seen) {
|
||||
mf->SeenTile = tile;
|
||||
mf->playerInfo.SeenTile = tile;
|
||||
} else {
|
||||
mf->Tile = tile;
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ void CViewport::DrawMapBackgroundInViewport() const
|
|||
if (ReplayRevealMap) {
|
||||
tile = Map.Fields[sx].Tile;
|
||||
} else {
|
||||
tile = Map.Fields[sx].SeenTile;
|
||||
tile = Map.Fields[sx].playerInfo.SeenTile;
|
||||
}
|
||||
Map.TileGraphic->DrawFrameClip(tile, dx, dy);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ void CMap::Save(CFile &file) const
|
|||
for (int w = 0; w < this->Info.MapWidth; ++w) {
|
||||
const CMapField &mf = *this->Field(w, h);
|
||||
|
||||
file.printf(" {%3d, %3d, %2d, %2d,", mf.Tile, mf.SeenTile, mf.Value, mf.Cost);
|
||||
file.printf(" {%3d, %3d, %2d, %2d,", mf.Tile, mf.playerInfo.SeenTile, mf.Value, mf.Cost);
|
||||
for (int i = 0; i < PlayerMax; ++i) {
|
||||
if (mf.playerInfo.Visible[i] == 1) {
|
||||
file.printf(" \"explored\", %d,", i);
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
*/
|
||||
static int MapIsSeenTileWall(int x, int y, int walltype)
|
||||
{
|
||||
int t = Map.Tileset.TileTypeTable[Map.Field(x, y)->SeenTile];
|
||||
int t = Map.Tileset.TileTypeTable[Map.Field(x, y)->playerInfo.SeenTile];
|
||||
|
||||
if (walltype == -1) {
|
||||
return t == TileTypeHumanWall || t == TileTypeOrcWall;
|
||||
|
@ -97,7 +97,7 @@ void MapFixSeenWallTile(const Vec2i &pos)
|
|||
return;
|
||||
}
|
||||
CMapField *mf = Map.Field(pos);
|
||||
int t = Map.Tileset.TileTypeTable[mf->SeenTile];
|
||||
int t = Map.Tileset.TileTypeTable[mf->playerInfo.SeenTile];
|
||||
if (t != TileTypeHumanWall && t != TileTypeOrcWall) {
|
||||
return;
|
||||
}
|
||||
|
@ -150,8 +150,8 @@ void MapFixSeenWallTile(const Vec2i &pos)
|
|||
}
|
||||
tile = Map.Tileset.Table[tile];
|
||||
|
||||
if (mf->SeenTile != tile) { // Already there!
|
||||
mf->SeenTile = tile;
|
||||
if (mf->playerInfo.SeenTile != tile) { // Already there!
|
||||
mf->playerInfo.SeenTile = tile;
|
||||
|
||||
// FIXME: can this only happen if seen?
|
||||
if (Map.IsFieldVisible(*ThisPlayer, pos)) {
|
||||
|
|
|
@ -346,7 +346,7 @@ void CMinimap::UpdateXY(const Vec2i &pos)
|
|||
break;
|
||||
}
|
||||
|
||||
int tile = Map.Fields[x + y].SeenTile;
|
||||
int tile = Map.Fields[x + y].playerInfo.SeenTile;
|
||||
if (!tile) {
|
||||
tile = Map.Fields[x + y].Tile;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ static int CclStratagusMap(lua_State *l)
|
|||
lua_pop(l, 1);
|
||||
++j2;
|
||||
lua_rawgeti(l, -1, j2 + 1);
|
||||
Map.Fields[i].SeenTile = LuaToNumber(l, -1);
|
||||
Map.Fields[i].playerInfo.SeenTile = LuaToNumber(l, -1);
|
||||
lua_pop(l, 1);
|
||||
++j2;
|
||||
lua_rawgeti(l, -1, j2 + 1);
|
||||
|
|
Loading…
Reference in a new issue