Pol  Revision:cb584c9
RawMap.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 #include <map>
5 #include <cstdio>
6 #include <iosfwd>
7 
8 #include "../pol/ustruct.h" // Needed because of USTRUCT_MAPINFO_BLOCK
9 
10 namespace Pol {
11 namespace Plib {
12  class RawMap
13  {
14  private:
15  bool is_init;
16 
17  std::vector<Pol::Core::USTRUCT_MAPINFO_BLOCK> m_mapinfo_vec;
18 
19  // Patch indices for map files (mapdifl[N].mul)
20  typedef std::map<unsigned int, unsigned int> MapBlockIndex;
21  MapBlockIndex mapdifl;
22 
23  unsigned short m_mapwidth;
24  unsigned short m_mapheight;
25 
26  public:
27  // Gets information about a single tile within a 8x8 cell
28  Pol::Core::USTRUCT_MAPINFO get_cell( unsigned int blockidx, unsigned int x_offset,
29  unsigned int y_offset );
30 
31  // Returns information about a given coordinate in the world
32  signed char rawinfo( unsigned short x, unsigned short y, Pol::Core::USTRUCT_MAPINFO* gi );
33 
34  // Inserts another block of 8x8 tiles
35  void add_block( const Pol::Core::USTRUCT_MAPINFO_BLOCK& block );
36 
37  // Sets map dimensions
38  void set_bounds( unsigned short width, unsigned short height );
39 
40  // Read map difference indices (mapdifl[N].mul)
41  // returns the number of patches
42  unsigned int load_map_difflist( FILE* mapdifl_file );
43 
44  // Read full map (old version with MUL)
45  // returns the number of blocks
46  unsigned int load_full_map( FILE* mapfile, FILE* mapdif_file );
47 
48  unsigned int load_full_map( int uo_mapid, std::istream& uopfile );
49 
50  RawMap();
51  ~RawMap();
52  };
53 
54  }
55 }
56 
std::vector< Pol::Core::USTRUCT_MAPINFO_BLOCK > m_mapinfo_vec
Definition: RawMap.h:17
Pol::Core::USTRUCT_MAPINFO get_cell(unsigned int blockidx, unsigned int x_offset, unsigned int y_offset)
Definition: RawMap.cpp:19
unsigned int load_full_map(FILE *mapfile, FILE *mapdif_file)
Definition: RawMap.cpp:67
std::map< unsigned int, unsigned int > MapBlockIndex
Definition: RawMap.h:20
unsigned short m_mapwidth
Definition: RawMap.h:23
FILE * mapdif_file
Definition: uofile00.cpp:30
unsigned int load_map_difflist(FILE *mapdifl_file)
Definition: RawMap.cpp:52
MapBlockIndex mapdifl
Definition: RawMap.h:21
unsigned short m_mapheight
Definition: RawMap.h:24
int uo_mapid
Definition: uofile00.cpp:85
signed char rawinfo(unsigned short x, unsigned short y, Pol::Core::USTRUCT_MAPINFO *gi)
Definition: RawMap.cpp:25
FILE * mapdifl_file
Definition: uofile00.cpp:29
void set_bounds(unsigned short width, unsigned short height)
Definition: RawMap.cpp:46
FILE * mapfile
Definition: uofile00.cpp:21
void add_block(const Pol::Core::USTRUCT_MAPINFO_BLOCK &block)
Definition: RawMap.cpp:41
Definition: berror.cpp:12