dfhack/library/shm/mod-maps.h

116 lines
3.7 KiB
C

2010-03-04 10:35:26 -07:00
/*
www.sourceforge.net/projects/dfhack
Copyright (c) 2009 Petr Mrázek (peterix)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#ifndef MOD_MAPS_H
#define MOD_MAPS_H
2010-05-25 22:48:23 -06:00
#include "dfhack/DFTypes.h"
2010-03-04 10:35:26 -07:00
namespace DFHack
{
2010-04-04 16:48:19 -06:00
namespace Server
2010-03-04 10:35:26 -07:00
{
2010-04-04 16:48:19 -06:00
namespace Maps
{
2010-05-25 22:48:23 -06:00
// increment on every change
#define MAPS_VERSION 4
2010-03-04 10:35:26 -07:00
typedef struct
{
uint32_t map_offset;// = d->offset_descriptor->getAddress ("map_data");
uint32_t x_count_offset;// = d->offset_descriptor->getAddress ("x_count");
uint32_t y_count_offset;// = d->offset_descriptor->getAddress ("y_count");
uint32_t z_count_offset;// = d->offset_descriptor->getAddress ("z_count");
2010-04-23 17:15:15 -06:00
/*
Block
*/
2010-03-04 10:35:26 -07:00
uint32_t tile_type_offset;// = d->offset_descriptor->getOffset ("type");
uint32_t designation_offset;// = d->offset_descriptor->getOffset ("designation");
uint32_t occupancy_offset;// = d->offset_descriptor->getOffset ("occupancy");
uint32_t biome_stuffs;// = d->offset_descriptor->getOffset ("biome_stuffs");
uint32_t veinvector;// = d->offset_descriptor->getOffset ("v_vein");
uint32_t temperature1_offset;
uint32_t temperature2_offset;
2010-04-23 17:15:15 -06:00
uint32_t global_feature_offset;
uint32_t local_feature_offset;
2010-03-04 10:35:26 -07:00
uint32_t vein_mineral_vptr;
uint32_t vein_ice_vptr;
2010-04-02 09:27:35 -06:00
uint32_t vein_spatter_vptr;
2010-03-04 10:35:26 -07:00
/*
GEOLOGY
2010-04-23 17:15:15 -06:00
*/
2010-03-04 10:35:26 -07:00
uint32_t region_x_offset;// = minfo->getAddress ("region_x");
uint32_t region_y_offset;// = minfo->getAddress ("region_y");
uint32_t region_z_offset;// = minfo->getAddress ("region_z");
2010-04-23 17:15:15 -06:00
uint32_t world_regions;// mem->getAddress ("ptr2_region_array");
2010-03-04 10:35:26 -07:00
uint32_t region_size;// = minfo->getHexValue ("region_size");
uint32_t region_geo_index_offset;// = minfo->getOffset ("region_geo_index_off");
2010-04-23 17:15:15 -06:00
uint32_t world_geoblocks_vector;// = minfo->getOffset ("geoblock_vector");
2010-03-04 10:35:26 -07:00
uint32_t world_size_x;// = minfo->getOffset ("world_size_x");
uint32_t world_size_y;// = minfo->getOffset ("world_size_y");
uint32_t geolayer_geoblock_offset;// = minfo->getOffset ("geolayer_geoblock_offset");
2010-04-23 17:15:15 -06:00
uint32_t type_inside_geolayer;// = mem->getOffset ("type_inside_geolayer");
2010-03-04 10:35:26 -07:00
} maps_offsets;
typedef struct
{
bool inited;
maps_offsets offsets;
} maps_modulestate;
typedef struct
{
2010-03-11 16:13:50 -07:00
shm_cmd cmd[SHM_MAX_CLIENTS]; // MANDATORY!
2010-03-04 10:35:26 -07:00
uint32_t x;
uint32_t y;
uint32_t z;
uint32_t x2;
uint32_t y2;
uint32_t z2;
uint32_t address;
uint32_t error;
} shm_maps_hdr;
enum MAPS_COMMAND
{
MAP_INIT = 0, // initialization
MAP_PROBE, // check if the map is still there
MAP_GET_SIZE, // get the map size in 16x16x1 blocks
MAP_READ_BLOCKTREE, // read the structure of pointers to blocks
MAP_READ_BLOCK_BY_COORDS, // read block by cords
2010-03-05 08:06:02 -07:00
MAP_READ_BLOCK_BY_ADDRESS, // read block by address
MAP_WRITE_BLOCK,
2010-03-04 10:35:26 -07:00
MAP_READ_BLOCKS_3D, // read blocks between two coords (volumetric)
MAP_READ_ALL_BLOCKS, // read the entire map
2010-03-05 08:06:02 -07:00
MAP_REVEAL, // reveal the whole map
2010-04-04 16:48:19 -06:00
NUM_MAPS_CMDS
2010-03-04 10:35:26 -07:00
};
2010-03-28 09:22:15 -06:00
DFPP_module Init(void);
2010-04-04 16:48:19 -06:00
}
2010-03-04 10:35:26 -07:00
}
}
2010-05-01 18:38:18 -06:00
#endif
2010-03-04 10:35:26 -07:00