Remove dead code.

Fix docu.
Replace unsigned short *VisibleTable by std::vector..
This commit is contained in:
joris 2013-04-21 15:34:33 +02:00
parent 805ee08cdf
commit 888fe50184
2 changed files with 13 additions and 71 deletions

View file

@ -243,7 +243,6 @@ void CViewport::DrawMapBackgroundInViewport() const
int sy = this->MapPos.y;
int dy = this->TopLeftPos.y - this->Offset.y;
const int map_max = Map.Info.MapWidth * Map.Info.MapHeight;
unsigned short int tile;
while (sy < 0) {
sy++;
@ -252,14 +251,6 @@ void CViewport::DrawMapBackgroundInViewport() const
sy *= Map.Info.MapWidth;
while (dy <= ey && sy < map_max) {
/*
if (sy / Map.Info.MapWidth < 0) {
sy += Map.Info.MapWidth;
dy += PixelTileSize.y;
continue;
}
*/
int sx = this->MapPos.x + sy;
int dx = this->TopLeftPos.x - this->Offset.x;
while (dx <= ex && (sx - sy < Map.Info.MapWidth)) {
@ -268,49 +259,14 @@ void CViewport::DrawMapBackgroundInViewport() const
dx += PixelTileSize.x;
continue;
}
const CMapField &mf = Map.Fields[sx];
unsigned short int tile;
if (ReplayRevealMap) {
tile = Map.Fields[sx].Tile;
tile = mf.Tile;
} else {
tile = Map.Fields[sx].playerInfo.SeenTile;
tile = mf.playerInfo.SeenTile;
}
Map.TileGraphic->DrawFrameClip(tile, dx, dy);
#ifdef DEBUG
#ifdef DEBUGMAPDRAW
int my_mask = 0;
unsigned int color = 0;
if (Map.CheckMask(sx, MapFieldUnpassable)) {
my_mask = 1;
}
if (Map.CheckMask(sx, MapFieldNoBuilding)) {
my_mask |= 2;
}
switch (my_mask) {
case 1://tile only Unpassable
color = 0xFF0000;
break;
case 2://tile only NoBuilding
color = 0x00FF00;
break;
case 3://tile Unpassable and NoBuilding
color = 0xFF;
break;
default:
break;
}
Video.DrawHLineClip(color, dx, dy, PixelTileSize.x);
Video.DrawVLineClip(color, dx, dy, PixelTileSize.y);
if (0 && my_mask) {
CLabel label(GetSmallFont());
label.Draw(dx + 2, dy + 2, tile);
label.Draw(dx + 2, dy + GetSmallFont()->Height() + 4,
Map.Fields[sx].TilesetTile);
}
#endif
#endif
++sx;
dx += PixelTileSize.x;
}

View file

@ -48,10 +48,6 @@
#include "video.h"
#include "../video/intern_video.h"
/*----------------------------------------------------------------------------
-- Declarations
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
-- Variables
----------------------------------------------------------------------------*/
@ -69,7 +65,7 @@ static const int FogTable[16] = {
0, 11, 10, 2, 13, 6, 14, 3, 12, 15, 4, 1, 8, 9, 7, 0,
};
static unsigned short *VisibleTable;
static std::vector<unsigned short> VisibleTable;
static SDL_Surface *OnlyFogSurface;
static CGraphic *AlphaFogG;
@ -78,7 +74,6 @@ static CGraphic *AlphaFogG;
-- Functions
----------------------------------------------------------------------------*/
class _filter_flags
{
public:
@ -100,8 +95,7 @@ private:
** Find out what the tile flags are a tile is covered by fog
**
** @param player player who is doing operation
** @param x X map location
** @param y Y map location
** @param index map location
** @param mask input mask to filter
**
** @return Filtered mask after taking fog into account
@ -214,8 +208,7 @@ static void UnitsOnTileUnmarkSeen(const CPlayer &player, CMapField &mf, int cloa
** Mark a tile's sight. (Explore and make visible.)
**
** @param player Player to mark sight.
** @param x X tile to mark.
** @param y Y tile to mark.
** @param index tile to mark.
*/
void MapMarkTileSight(const CPlayer &player, const unsigned int index)
{
@ -242,13 +235,11 @@ void MapMarkTileSight(const CPlayer &player, const Vec2i &pos)
MapMarkTileSight(player, Map.getIndex(pos));
}
/**
** Unmark a tile's sight. (Explore and make visible.)
**
** @param player Player to mark sight.
** @param x X tile to mark.
** @param y Y tile to mark.
** @param indexx tile to mark.
*/
void MapUnmarkTileSight(const CPlayer &player, const unsigned int index)
{
@ -280,13 +271,11 @@ void MapUnmarkTileSight(const CPlayer &player, const Vec2i &pos)
MapUnmarkTileSight(player, Map.getIndex(pos));
}
/**
** Mark a tile for cloak detection.
**
** @param player Player to mark sight.
** @param x X tile to mark.
** @param y Y tile to mark.
** @param index Tile to mark.
*/
void MapMarkTileDetectCloak(const CPlayer &player, const unsigned int index)
{
@ -304,13 +293,11 @@ void MapMarkTileDetectCloak(const CPlayer &player, const Vec2i &pos)
MapMarkTileDetectCloak(player, Map.getIndex(pos));
}
/**
** Unmark a tile for cloak detection.
**
** @param player Player to mark sight.
** @param x X tile to mark.
** @param y Y tile to mark.
** @param index tile to mark.
*/
void MapUnmarkTileDetectCloak(const CPlayer &player, const unsigned int index)
{
@ -753,8 +740,8 @@ void CMap::InitFogOfWar()
AlphaFogG->UseDisplayFormat();
}
delete[] VisibleTable;
VisibleTable = new unsigned short[Info.MapWidth * Info.MapHeight];
VisibleTable.clear();
VisibleTable.resize(Info.MapWidth * Info.MapHeight);
}
/**
@ -762,8 +749,7 @@ void CMap::InitFogOfWar()
*/
void CMap::CleanFogOfWar()
{
delete[] VisibleTable;
VisibleTable = NULL;
VisibleTable.clear();
CGraphic::Free(Map.FogGraphic);
FogGraphic = NULL;