ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/include/deliantra/data/map.h
Revision: 1.3
Committed: Wed Oct 20 08:33:39 2010 UTC (16 years ago) by sf-pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.2: +1 -0 lines
Log Message:
2 glyphs / map space

File Contents

# User Rev Content
1 sf-pippijn 1.1 #pragma once
2    
3     #include "adt/map_vector.h"
4    
5     #include "counters.h"
6 sf-pippijn 1.2 #include "adt/types.h"
7 sf-pippijn 1.1
8     #include <iosfwd>
9     #include <vector>
10    
11     namespace data
12     {
13     struct map
14     {
15     struct cell
16     {
17     u32 player;
18     u16 face[3];
19     u16 darkness;
20     u08 stat_width;
21     u08 stat_hp;
22     u08 flags;
23    
24    
25     cell ()
26     : player (0)
27     {
28     ++cell_count;
29     clear_all ();
30     }
31    
32     ~cell ()
33     {
34     --cell_count;
35     }
36    
37     void clear ()
38     {
39     if (player)
40     face[2] = 0;
41     player = 0;
42     darkness = 0;
43     stat_width = 0;
44     stat_hp = 0;
45     flags = 0;
46     }
47    
48     void clear_all ()
49     {
50     clear ();
51     face[0] = face[1] = face[2] = 0;
52     }
53     };
54    
55     struct row
56     : map_vector<cell>
57     {
58     int c0, c1;
59     };
60    
61     map ()
62     : x (0)
63     , y (0)
64     , w (31)
65     , h (31)
66     {
67     }
68    
69     cell &operator () (int x, int y)
70     {
71     ensure (x, y);
72     return rows.at (y).at (x);
73     }
74    
75     void clear ();
76     void ensure (int x, int y);
77 sf-pippijn 1.3 void blank (int x0, int y0, int w, int h);
78 sf-pippijn 1.1
79     map_vector<row> rows;
80    
81     int x, y;
82     int w, h;
83     };
84     }