2007-11-25 19:42:40 +00:00
|
|
|
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
|
2007-07-26 20:07:45 +00:00
|
|
|
#include <stdio.h>
|
2007-12-15 10:24:49 +00:00
|
|
|
#include "e_datafile.h"
|
2007-05-22 15:03:32 +00:00
|
|
|
|
2007-09-23 22:54:31 +00:00
|
|
|
static DATAFILE *map = 0;
|
2007-05-22 15:03:32 +00:00
|
|
|
|
|
|
|
void *map_get_data(int index)
|
|
|
|
{
|
|
|
|
return datafile_get_data(map, index);
|
|
|
|
}
|
|
|
|
|
2008-01-13 11:15:32 +00:00
|
|
|
void *map_get_data_swapped(int index)
|
|
|
|
{
|
|
|
|
return datafile_get_data_swapped(map, index);
|
|
|
|
}
|
|
|
|
|
2007-08-25 08:48:24 +00:00
|
|
|
void map_unload_data(int index)
|
|
|
|
{
|
|
|
|
datafile_unload_data(map, index);
|
|
|
|
}
|
|
|
|
|
2007-05-22 15:03:32 +00:00
|
|
|
void *map_get_item(int index, int *type, int *id)
|
|
|
|
{
|
|
|
|
return datafile_get_item(map, index, type, id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void map_get_type(int type, int *start, int *num)
|
|
|
|
{
|
|
|
|
datafile_get_type(map, type, start, num);
|
|
|
|
}
|
|
|
|
|
|
|
|
void *map_find_item(int type, int id)
|
|
|
|
{
|
|
|
|
return datafile_find_item(map, type, id);
|
|
|
|
}
|
|
|
|
|
|
|
|
int map_num_items()
|
|
|
|
{
|
|
|
|
return datafile_num_items(map);
|
|
|
|
}
|
|
|
|
|
|
|
|
void map_unload()
|
|
|
|
{
|
|
|
|
datafile_unload(map);
|
|
|
|
map = 0x0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int map_is_loaded()
|
|
|
|
{
|
|
|
|
return map != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int map_load(const char *mapname)
|
|
|
|
{
|
2007-07-26 20:07:45 +00:00
|
|
|
char buf[512];
|
2007-07-30 19:46:31 +00:00
|
|
|
sprintf(buf, "data/maps/%s.map", mapname);
|
2007-07-26 20:07:45 +00:00
|
|
|
map = datafile_load(buf);
|
2007-05-22 15:03:32 +00:00
|
|
|
return map != 0;
|
|
|
|
}
|
2007-09-23 22:54:31 +00:00
|
|
|
|
|
|
|
void map_set(void *m)
|
|
|
|
{
|
|
|
|
if(map)
|
|
|
|
map_unload();
|
|
|
|
map = (DATAFILE*)m;
|
|
|
|
}
|