View lcov test coverage results on http://www.gnu.org/software/liquidwar6/coverage/src/lib/map/index.html.
body: the body to initialize
w: the width
h: the height
d: the depth
noise_percent: the noise level to fill meta layers with
rules: the map rules
Sets up a default body structure.
Return value: none
body: the structure to clear
Clears a body structure.
Return value: none.
body: the structure to update
Updates (calculates) the checksum of a map body structure.
Return value: none.
body: the structure to update
rules: the game rules
This (fundamental) function ensures that all playable areas in a map are connected. If isolated zones are found out, then they are marked as walls and not used any more.
Return value: none.
level: the level to work on
body_x: the body (logical) x coord
body_y: the body (logical) y coord
texture_x: the texture x coord
texture_y: the texture y coord
Gets body (logical) coords from texture position.
Return value: 1 on success, 0 on failure (out of bounds)
level: the level to work on
texture_x: the texture x coord
texture_y: the texture y coord
z: the z position (depth related)
Tells wether a given map position is free or not, but using texture coords.
Return value: 1 if position is playable, 0 if not (wall)
color: the color to invert
Inverts a color couple, that is, replace fg by bg and vice-versa.
Return value: none.
color1: 1st color to compare
color2: 2nd color to compare
Compares two colors.
Return value: 1 if equal, 0 if not.
index: index of the color between 0 & 9
Transforms a team color index into its readable string form, which can be used in config files for instance.
Return value: a string, must *not* be freed.
key: key of the color, for instance "red"
The index of the color, between 0 & 9
Return value: an integer.
cursor_texture: the cursor texture to clear
Clears a cursor texture (set it all transparent).
Return value: none
cursor_texture: the cursor texture to clear
Sets a cursor texture to the builtin defauts, that is a circle that is black on the outside and gets white/transparent in the middle.
Return value: none
cursor_texture_layer: the cursor texture_layer to change
x: x coord
y: y coord
color: the color
Sets a pixel in the cursor texture_layer.
Return value: none
cursor_texture_layer: the cursor texture_layer to query
x: x coord
y: y coord
Gets a pixel in the cursor texture_layer.
Return value: the color
source: the map to copy
progress: to show advancement
Performs a deep copy of the map, all elements are newly allocated and source can safely be destroyed after it's been duplicated.
Return value: a newly allocated map, may be NULL.
exp: the player experience
Gets the highest color available for a given exp.
Return value: a color id
exp: the player experience
Gets the highest weapon available for a given exp.
Return value: a weapon id
Converts a map to something that is later readable by
lw6map_from_hexa
to reproduce the exact same map. Just a serializer.Return value: a newly allocated pointer, NULL if conversion failed.
hexa: an hexadecimal ASCII string, created by
lw6map_to_hexa
Constructs a map from an hexadecimal string generated by
lw6map_to_hexa
. Just an un-serializer.Return value: a new map, might be NULL if string isn't correct.
layer: the layer to init
w: width
h: height
Creates a default layer. This is mostly for testing purposes, the default layer is not empty, it contains a simplified map of the world.
Return value: none
layer: the layer to init
Clears a layer struct. This means freeing the pointer if it's non NULL and setting everything to 0.
Return value: none
Creates a new empty map. This object is perfectly unusable as is, since it has a 0x0 size, and many things set to "NULL". Still, it's used internally and is the canonical way to create the object, it ensures later calls that set up default parameters, for instance, will succeed.
Return value: a newly allocated pointer.
Creates a map, set to defaults. This is usefull mostly for testing. This builtin map has walls, paths, it's playable.
Return value: a newly allocated map.
w: the width of the map
h: the height of the map
d: the depth (number of layers) of the map
noise_percent: percentage of noise to use for metalayers
Creates a map, set to defaults. This is usefull mostly for testing. This one, unlike
lw6map_builtin_defaults
will let you give a width, height and a depth.Return value: a newly allocated map.
Frees a map and releases all its internal ressources.
Return value: none.
Reports how many bytes the map needs, in memory. Note that this is not contiguous memory, it involves a bunch of pointers, and possibly much more...
Returns a string describing the map. This is a very short description, use it for logs, and to debug stuff. By no means it's a complete exhaustive description. Still, the string returned should be unique.
Return value: a dynamically allocated string.
level_a: the first level to compare
level_b: the other level to compare
Compares two level structs, the idea is to compare the content, not only the pointers and level ids.
Return value: 1 if they're the same, 0 if not.
local_info: the structure to modify
music_dir: the new music_dir value
Sets the music_dir value, in a 'safe' manner, freeing any previous value and performing a string duplication.
Return value: 1 on success, 0 on failure.
local_info: the structure to clear
Clears the local_info structure, before destroying a level for instance.
Return value: none
meta_layer: the meta_layer structure
x: x coord
y: y coord
value: the value to set at this place
Simple setter for the meta_layer struct.
Return value: none
meta_layer: the meta_layer structure
x: x coord
y: y coord
Simple getter for the meta_layer struct.
Return value: the value at this place
meta_layer: the meta_layer to clear
Clears a meta_layer struct. This means freeing the pointer if it's non NULL and setting everything to 0.
Return value: none
meta_layer: the object to init
w: width
h: height
analog: wether to use analog mode (0-255) or boolean (0-1)
noise_percent: the quantity of noise to initialise the layer with
seed: a pseudo-random seed to feed the pseudo-random generator
Builds a custom metalyer, suitable for tests or demo, letting the choice of its size and the noise to fill it with. If noise is 100 then metalayer is "full". If noise is 0, then meta layer is empty.
Return value: 1 if OK, 0 on failure.
param: the param struct to modify
Sets a param structure to its default value, note that current structured must be zeroed or correctly initialized.
Return value: none
param: the param struct to modify
Resets a param structure to nothing. Note that current structured must be zeroed or correctly initialized. The idea is just to free member pointers before calling free.
Return value: none
dst: the destination param struct
src: the source param struct
Copies parameters. Both structures must be zeroed or correctly initialized.
Return value: none
param: the param struct to modify
key: the name of the parameter to modify
value: the value of the parameter to modify
Sets an entry in a param struct. All values must be submitted as strings, internally, the function will call atoi to convert to integers if needed, for instance. It will also dispatch automatically between rules, style and teams.
Return value: 1 if parameter successfully set, 0 on error.
param: the param struct to query
key: the name of the parameter to get
Gets an entry from a param struct. All values returned as strings, do not use this in performance bottlenecks, this is just to export values to scripts, for instance.
Return value: dynamically allocated string, NULL on error, might return a string containing 0 on bad keys.
param_a: one struct to compare
param_b: another struct to compare
Compares the contents of two param structs.
Return value: 1 if they contain the same thing, 0 if not
teams: data to initialize
Zeros the teams struct, this is not the same as setting to defaults.
Return value: none.
teams: data to initialize
Set the teams struct to its defaults.
Return value: none.
teams: data to initialize
Clears the teams struct, this is not the same as setting to defaults. This one supposes the struct has been properly initialized, at least zeroed before usage, it might contain pointers which should be freed.
Return value: none.
dst: destination
src: source
Copies the contents of the teams struct. It's a real duplicate, any string is reallocated.
Return value: none.
teams: the teams to modify
key: the key to modify
value: the value to affect to the key, as a string
Sets one single parameter in a teams structure. Value must always be passed as a string, will be converted to the right type automatically when storing it in the structure.
Return value: 1 if success, 0 if failed. Note that while 0 really means there's a problem, some affectations can fail and return 1, needs to be worked on.
teams: the teams to modify
key: the key to modify
Gets one single parameter in a teams structure. Value is converted as a string.
Return value: dynamically allocated string, NULL on error.
key: the key we want informations about.
Gets the default value for a given teams key.
Return value: dynamically allocated string, NULL on error.
teams_a: one struct to compare
teams_b: another struct to compare
Compares the contents of two teams structs.
Return value: 1 if they contain the same thing, 0 if not
mode: 0 for check only, 1 for full test
Runs the
map
module test suite.Return value: 1 if test is successfull, 0 on error.