Pol  Revision:cb584c9
polfile2.cpp
Go to the documentation of this file.
1 
7 // TODO: consider joining this file with landtile.cpp, tiles.cpp and clidata.h and renaming it all
8 // to something consistent.
9 // TODO: encapsulate the tile[] vector here
10 
11 #include <string>
12 
13 #include "../clib/rawtypes.h"
14 #include "../plib/mapcell.h"
15 #include "../plib/systemstate.h"
16 #include "tiles.h"
17 
18 namespace Pol
19 {
20 namespace Core
21 {
22 unsigned char tilelayer( unsigned short tilenum )
23 {
24  if ( tilenum <= Plib::systemstate.config.max_tile_id )
25  {
26  return Plib::systemstate.tile[tilenum].layer;
27  }
28  else
29  {
30  return 0;
31  }
32 }
33 
34 char tileheight( unsigned short tilenum )
35 {
36  if ( tilenum <= Plib::systemstate.config.max_tile_id )
37  {
38  char height = Plib::systemstate.tile[tilenum].height;
39  if ( Plib::systemstate.tile[tilenum].flags & Plib::FLAG::GRADUAL )
40  height /= 2;
41  return height;
42  }
43  else
44  {
45  return 0;
46  }
47 }
48 
49 u32 tile_flags( unsigned short tilenum )
50 {
51  if ( tilenum <= Plib::systemstate.config.max_tile_id )
52  {
53  return Plib::systemstate.tile[tilenum].flags;
54  }
55  else
56  {
57  return 0;
58  }
59 }
60 
61 u32 tile_uoflags( unsigned short tilenum )
62 {
63  if ( tilenum <= Plib::systemstate.config.max_tile_id )
64  {
65  return Plib::systemstate.tile[tilenum].uoflags;
66  }
67  else
68  {
69  return 0;
70  }
71 }
72 
73 std::string tile_desc( unsigned short tilenum )
74 {
75  if ( tilenum <= Plib::systemstate.config.max_tile_id )
76  {
77  return Plib::systemstate.tile[tilenum].desc;
78  }
79  else // a multi, probably
80  {
81  return "multi";
82  }
83 }
84 
85 unsigned short tileweight( unsigned short tilenum )
86 {
87  if ( tilenum <= Plib::systemstate.config.max_tile_id )
88  {
89  return Plib::systemstate.tile[tilenum].weight;
90  }
91  else
92  {
93  return 0;
94  }
95 }
96 }
97 }
unsigned int uoflags
Definition: tiles.h:23
unsigned int tile_flags(unsigned short tilenum)
Definition: polfile2.cpp:49
SystemState systemstate
Definition: systemstate.cpp:12
unsigned int tile_uoflags(unsigned short tilenum)
Definition: polfile2.cpp:61
unsigned char tilelayer(unsigned short tilenum)
Definition: polfile2.cpp:22
std::string tile_desc(unsigned short tilenum)
Definition: polfile2.cpp:73
std::string desc
Definition: tiles.h:22
unsigned int u32
Definition: rawtypes.h:27
unsigned int flags
Definition: tiles.h:24
char tileheight(unsigned short tilenum)
Definition: polfile2.cpp:34
unsigned short tileweight(unsigned short tilenum)
Definition: polfile2.cpp:85
Definition: berror.cpp:12