2007-06-26 15:38:58 +03:00
# ifndef CAMBARCENDAMO_H
# define CAMBARCENDAMO_H
2007-06-06 19:12:12 +03:00
# include <iostream>
# include <fstream>
# include <string>
# include <vector>
# include "global.h"
# include "SDL.h"
# include "map.h"
# include "CSemiDefHandler.h"
2007-07-02 14:23:42 +03:00
# include "CDefHandler.h"
2007-06-13 23:17:48 +03:00
# include "CCreatureHandler.h"
2007-06-06 19:12:12 +03:00
2007-06-17 19:59:14 +03:00
enum EDefType { TOWN_DEF , HERO_DEF , CREATURES_DEF , SEERHUT_DEF , RESOURCE_DEF , TERRAINOBJ_DEF , EVENTOBJ_DEF , SIGN_DEF , GARRISON_DEF , ARTIFACT_DEF , WITCHHUT_DEF , SCHOLAR_DEF , PLAYERONLY_DEF , SHRINE_DEF , SPELLSCROLL_DEF , PANDORA_DEF , GRAIL_DEF , CREGEN_DEF , CREGEN2_DEF , CREGEN3_DEF , BORDERGUARD_DEF } ;
2007-06-12 21:17:33 +03:00
2007-06-06 19:12:12 +03:00
class CAmbarCendamo
{
public :
/////////////////zmienne skladowe
Mapa map ;
std : : ifstream * is ; // stream used to read map file
int andame ; // length of map file
unsigned char * bufor ; // here we store map bytecode
2007-07-12 14:41:31 +03:00
std : : vector < CDefHandler * > defs ;
2007-06-06 19:12:12 +03:00
/////////////////funkcje skladowe
CAmbarCendamo ( const char * tie ) ; // c-tor; tie is the path of the map file
2007-07-09 08:57:30 +03:00
CAmbarCendamo ( unsigned char * map ) ; // c-tor; map is pointer to array containing map; it is not copied, so don't delete
2007-06-06 19:12:12 +03:00
~ CAmbarCendamo ( ) ; // d-tor
2007-06-13 23:17:48 +03:00
int readNormalNr ( int pos , int bytCon = 4 , bool cyclic = false ) ; //read number from bytCon bytes starting from pos position in buffer ; if cyclic is true, number is treated as it were signed number with bytCon bytes
2007-06-06 19:12:12 +03:00
void teceDef ( ) ; // create files with info about defs
void deh3m ( ) ; // decode file, results are stored in map
2007-07-13 18:10:27 +03:00
void processMap ( std : : vector < std : : string > & defsToUnpack ) ; //choose castles, creatures, resources, artifacts...
////
std : : vector < std : : string > resDefNames ;
////
2007-06-06 19:12:12 +03:00
void loadDefs ( ) ;
2007-06-12 21:17:33 +03:00
EDefType getDefType ( DefInfo & a ) ; //returns type of object in def
2007-06-13 23:17:48 +03:00
CCreatureSet readCreatureSet ( int pos , int number = 7 ) ; //reads creature set in most recently encountered format; reades number units (default is 7)
2007-06-06 19:12:12 +03:00
} ;
2007-06-26 15:38:58 +03:00
# endif //CAMBARCENDAMO_H