[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Camino-devel] camino/src/common Tile.cpp Tile.h
From: |
Pascal Audoux |
Subject: |
[Camino-devel] camino/src/common Tile.cpp Tile.h |
Date: |
Thu, 27 Feb 2003 18:22:02 -0500 |
CVSROOT: /cvsroot/camino
Module name: camino
Changes by: Pascal Audoux <address@hidden> 03/02/27 18:22:02
Modified files:
src/common : Tile.cpp Tile.h
Log message:
Tile has to be inherited by TileSprite... so must be virtualized
Patches:
Index: camino/src/common/Tile.cpp
diff -u camino/src/common/Tile.cpp:1.4 camino/src/common/Tile.cpp:1.5
--- camino/src/common/Tile.cpp:1.4 Tue Feb 18 18:12:07 2003
+++ camino/src/common/Tile.cpp Thu Feb 27 18:22:02 2003
@@ -2,7 +2,7 @@
**
** Camino
**
-** Version : $Id: Tile.cpp,v 1.4 2003/02/18 23:12:07 pfremy Exp $
+** Version : $Id: Tile.cpp,v 1.5 2003/02/27 23:22:02 Audoux Exp $
**
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 14/01/2003
@@ -27,6 +27,61 @@
// application specific include files
#include "Tile.h"
+QString computeTileName( int type )
+{
+ QString name = "unknown";
+ switch( type ) {
+ case (int)Tile::TILE_ROAD_STRAIGHT:
+ name = "road_straight";
+ break;
+ case (int)Tile::TILE_ROAD_T:
+ name = "road_t";
+ break;
+ case Tile::TILE_ROAD_DEADEND:
+ name = "road_dead_end";
+ break;
+ case Tile::TILE_ROAD_TURN:
+ name = "road_turn";
+ break;
+ case Tile::TILE_ROAD_CROSS:
+ name = "road_cross";
+ break;
+ case Tile::TILE_RAIL_TURN:
+ name = "rail_turn";
+ break;
+ case Tile::TILE_RAIL_STRAIGHT:
+ name = "rail_straight";
+ break;
+ case Tile::TILE_RAIL_DEADEND:
+ name = "rail_dead_end";
+ break;
+ case Tile::TILE_RIVER_STRAIGHT:
+ name = "river_straight";
+ break;
+ case Tile::TILE_RIVER_TURN:
+ name = "river_turn";
+ break;
+ case Tile::TILE_CROSS_ROAD_RAIL:
+ name = "cross_road_rail";
+ break;
+ case Tile::TILE_CROSS_ROAD_RIVER:
+ name = "cross_road_river";
+ break;
+ case Tile::TILE_FOREST:
+ name = "forest";
+ break;
+ case Tile::TILE_PLAIN:
+ name = "field";
+ break;
+ case Tile::TILE_UNKNOWN:
+ default:
+ name = "unknown";
+ break;
+ }
+ return name;
+
+}
+
/** add comments here */
Tile::Tile( TileType t )
{
@@ -37,6 +92,10 @@
_isRotationKnown = false;
}
+Tile::~Tile()
+{
+}
+
void Tile::setPosition( int row, int col )
{
setRow( row );
@@ -45,7 +104,7 @@
void Tile::cancelRotation()
{
+ setRotation( 0 );
_isRotationKnown = false;
- _rotation = 0;
}
Index: camino/src/common/Tile.h
diff -u camino/src/common/Tile.h:1.5 camino/src/common/Tile.h:1.6
--- camino/src/common/Tile.h:1.5 Thu Feb 27 05:23:50 2003
+++ camino/src/common/Tile.h Thu Feb 27 18:22:02 2003
@@ -5,7 +5,7 @@
** Tile.h
** Manage a tile on the board game
**
-** Version : $Id: Tile.h,v 1.5 2003/02/27 10:23:50 pfremy Exp $
+** Version : $Id: Tile.h,v 1.6 2003/02/27 23:22:02 Audoux Exp $
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 16/01/2003
** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -29,8 +29,10 @@
// generic include files
// include files for QT
+#include <qstring.h>
// application specific include files
+QString computeTileName( int type );
/* ------------------------------
* Tile
@@ -68,16 +70,17 @@
};
/** Constructor */
- Tile( TileType t = TILE_UNKNOWN);
+ Tile( TileType t = TILE_UNKNOWN );
+ virtual ~Tile();
TileType getType() { return _type; }
- void setType( TileType type ) { _type = type; }
+ virtual void setType( TileType type ) { _type = type; }
int getRotation() { return _rotation; }
- void setRotation( int rotation ) { _rotation = rotation; }
+ virtual void setRotation( int rotation ) { _rotation = rotation; }
void cancelRotation();
@@ -87,11 +90,11 @@
int getCol() { return _col; }
- void setPosition( int row, int col );
+ virtual void setPosition( int row, int col );
- void setRow( int row ) { _row = row; }
+ virtual void setRow( int row ) { _row = row; }
- void setCol( int col ) { _col = col; }
+ virtual void setCol( int col ) { _col = col; }
protected:
int _row, _col;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Camino-devel] camino/src/common Tile.cpp Tile.h,
Pascal Audoux <=