map.h
author darkvater
Tue, 04 Jan 2005 00:07:58 +0000
changeset 880 f3d9b97fff06
parent 863 6a1444534f62
child 900 27eb21ced433
permissions -rw-r--r--
(svn r1365) -Fix: very, very nasty buffer overflow bug introduced with replace vehicles. You CANNOT access the i[255] of an array that only has 255 elements! I will kick the next person that does that so hard...goddammit (I only noticed it because it screwed up my console in the debug build and took me at least an hour to fix)
679
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     1
#ifndef MAP_H
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     2
#define MAP_H
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     3
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     4
#define TILE_X_BITS 8
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     5
#define TILE_Y_BITS 8
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
     6
817
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
     7
extern byte   _map_type_and_height[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
     8
extern byte   _map5[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
     9
extern byte   _map3_lo[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    10
extern byte   _map3_hi[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    11
extern byte   _map_owner[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    12
extern uint16 _map2[];
238bbdaa228b (svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents: 695
diff changeset
    13
extern byte   _map_extra_bits[];
679
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
    14
689
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    15
// binary logarithm of the map size, try to avoid using this one
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    16
static inline uint MapLogX(void)  { extern uint _map_log_x; return _map_log_x; }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    17
static inline uint MapLogY(void)  { extern uint _map_log_y; return _map_log_y; }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    18
/* The size of the map */
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    19
static inline uint MapSizeX(void) { return 1 << MapLogX(); }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    20
static inline uint MapSizeY(void) { return 1 << MapLogY(); }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    21
/* The maximum coordinates */
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    22
static inline uint MapMaxX(void) { return MapSizeX() - 1; }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    23
static inline uint MapMaxY(void) { return MapSizeY() - 1; }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    24
/* The number of tiles in the map */
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    25
static inline uint MapSize(void) { return MapSizeX() * MapSizeY(); }
5a4b1536db82 (svn r1130) Add helper functions to query map size
tron
parents: 679
diff changeset
    26
679
04ca2cd69420 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff changeset
    27
#endif