1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
/****************************************************************
**
** Attal : Lords of Doom
**
** genericMap.h
** generic class for managing (not graphical) map
**
** Version : $Id: genericMap.h,v 1.5 2004/12/18 11:43:59 audoux Exp $
**
** Author(s) : Pascal Audoux - Cyrille Verrier
**
** Date : 02/08/2000
**
** Licence :
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2, or (at your option)
** any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
****************************************************************/
#ifndef GENERICMAP_H
#define GENERICMAP_H
// generic include files
// include files for QT
// application specific includes
#include "libCommon/genericCell.h"
#include "libCommon/log.h"
class QString;
class QTextStream;
class PathFinder;
class GenericBase;
class GenericLord;
/* ------------------------------
* GenericMap
* ------------------------------ */
/** generic class for managing (not graphical) cells */
class GenericMap
{
public:
/** Constructor */
GenericMap();
/** Destructor */
virtual ~GenericMap();
/** Return heigth of the map */
uint getHeight() { return _height; }
/** Return width of the map */
uint getWidth() { return _width; }
/** Return cell of the map */
GenericCell * at( uint i, uint j )
{ return _theCells[i][j]; }
/** */
virtual void newUnknownMap( int h, int w );
/** Return the path finder */
PathFinder * getPath() { return _path; }
/** Load a map file */
virtual bool load( QTextStream *, int width, int heigth );
/** Load a map */
virtual bool load( const QString filename );
virtual void changeCell( int i, int j, int typ,
int transition, int typtra, uint decorationGroup, uint decorationItem );
/** Save a map */
void save( QTextStream * );
/** Clear map */
virtual void clear();
void cleanData();
/** Compute the tiles where we can't stop because of this base */
void computeStoppable( GenericBase * base );
/** Compute the tiles where we can't stop because of this base */
void computeStoppable( GenericBuilding * building );
/** Compute the tiles where we can't stop because there is a base on it */
void computeStoppable();
/** Returns the minimal cost for the next movement of this lord */
int computeMinimalNextCost( GenericLord * lord );
protected:
uint _height, _width;
GenericCell *** _theCells;
PathFinder * _path;
};
#endif // GENERICMAP_H
|