#include <string.h>
#include "map.coding.h"
Include dependency graph for map.coding.c:
Go to the source code of this file.
Data Structures | |
struct | hex_struct |
Typedefs | |
typedef hex_struct | HS |
Functions | |
void | init_map_coding () |
int | Coding_GetIndex (char terrain, char elevation) |
char | Coding_GetElevation (int index) |
char | Coding_GetTerrain (int index) |
Variables | |
static int | first_free = 0 |
static unsigned char | data_to_id [LASTCHAR][ELEVATIONS] |
static HS | id_to_data [ENTRIES] |
typedef struct hex_struct HS |
char Coding_GetElevation | ( | int | index | ) |
Definition at line 56 of file map.coding.c.
References hex_struct::elev, and id_to_data.
00057 { 00058 return id_to_data[index].elev; 00059 }
int Coding_GetIndex | ( | char | terrain, | |
char | elevation | |||
) |
Definition at line 43 of file map.coding.c.
References data_to_id, hex_struct::elev, first_free, id_to_data, and hex_struct::terrain.
00044 { 00045 int i; 00046 00047 if((i = data_to_id[(short) terrain][(short) elevation])) 00048 return i - 1; 00049 id_to_data[first_free].terrain = terrain; 00050 id_to_data[first_free].elev = elevation; 00051 first_free++; 00052 data_to_id[(short) terrain][(short) elevation] = first_free; 00053 return first_free - 1; 00054 }
char Coding_GetTerrain | ( | int | index | ) |
Definition at line 61 of file map.coding.c.
References id_to_data, and hex_struct::terrain.
00062 { 00063 return id_to_data[index].terrain; 00064 }
void init_map_coding | ( | void | ) |
Definition at line 37 of file map.coding.c.
References data_to_id, and id_to_data.
00038 { 00039 bzero(id_to_data, sizeof(id_to_data)); 00040 bzero(data_to_id, sizeof(data_to_id)); 00041 }
unsigned char data_to_id[LASTCHAR][ELEVATIONS] [static] |
int first_free = 0 [static] |
HS id_to_data[ENTRIES] [static] |
Definition at line 35 of file map.coding.c.
Referenced by Coding_GetElevation(), Coding_GetIndex(), Coding_GetTerrain(), and init_map_coding().