Freeciv-3.2
|
#include "fc_prehdrs.h"
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fciconv.h"
#include "fcintl.h"
#include "mem.h"
#include "rand.h"
#include "string_vector.h"
#include "bitvector.h"
Go to the source code of this file.
bool bv_are_equal | ( | const unsigned char * | vec1, |
const unsigned char * | vec2, | ||
size_t | size1, | ||
size_t | size2 | ||
) |
Compare elements of two bitvectors. Both vectors are expected to have same number of elements, i.e. , size1 must be equal to size2.
Definition at line 302 of file bitvector.c.
Referenced by dbv_are_equal().
bool bv_check_mask | ( | const unsigned char * | vec1, |
const unsigned char * | vec2, | ||
size_t | size1, | ||
size_t | size2 | ||
) |
Return whether two vectors: vec1 and vec2 have common bits. I.e. (vec1 & vec2) != 0.
Don't call this function directly, use BV_CHECK_MASK macro instead. Don't call this function with two different bitvectors.
Definition at line 280 of file bitvector.c.
Referenced by dbv_isset_any().
void bv_clr_all_from | ( | unsigned char * | vec_to, |
const unsigned char * | vec_from, | ||
size_t | size_to, | ||
size_t | size_from | ||
) |
Clear everything that is true in vec_from in vec_to. Stuff that already is false in vec_to aren't touched.
Both vectors are expected to have same number of elements, i.e. , size1 must be equal to size2.
Don't call this function directly, use BV_CLR_ALL_FROM macro instead.
Definition at line 351 of file bitvector.c.
Is content of static bitvector same as that of dynamic one. Comparison size is taken from the dynamic one.
Definition at line 205 of file bitvector.c.
Referenced by update_player_tile_knowledge().
void bv_set_all_from | ( | unsigned char * | vec_to, |
const unsigned char * | vec_from, | ||
size_t | size_to, | ||
size_t | size_from | ||
) |
Set everything that is true in vec_from in vec_to. Stuff that already is true in vec_to aren't touched. (Bitwise inclusive OR assignment)
Both vectors are expected to have same number of elements, i.e. , size1 must be equal to size2.
Don't call this function directly, use BV_SET_ALL_FROM macro instead.
Definition at line 329 of file bitvector.c.
Copy static bit vector content to dynamic bitvector. Static vector is assumed to be at least same size as the dynamic one.
Definition at line 244 of file bitvector.c.
Check if the two dynamic bitvectors are equal.
Definition at line 190 of file bitvector.c.
Returns the number of bits defined in a dynamic bitvector.
Definition at line 108 of file bitvector.c.
Referenced by sg_extras_get_dbv().
Clear the bit given by 'bit'.
Definition at line 167 of file bitvector.c.
Referenced by api_edit_tile_hide(), handle_tile_info(), map_clear_known(), and update_player_tile_knowledge().
Clear all bits.
Definition at line 179 of file bitvector.c.
Referenced by dbv_init(), dbv_resize(), make_rivers(), sg_load_map_known(), and sg_load_map_known().
Copy dynamic bit vector content from another.
Definition at line 222 of file bitvector.c.
Referenced by really_give_tile_info_from_player_to_player().
Debug a dynamic bitvector.
Definition at line 252 of file bitvector.c.
Destroy a dynamic bitvector.
Definition at line 95 of file bitvector.c.
Referenced by check_native_area(), is_city_channel_tile(), make_rivers(), player_destroy(), player_map_free(), player_tile_free(), and remove_city().
Initialize a dynamic bitvector of size 'bits'. 'bits' must be greater than 0 and lower than the maximal size given by MAX_DBV_LENGTH. The bitvector is set to all clear.
Definition at line 50 of file bitvector.c.
Referenced by check_native_area(), dbv_resize(), is_city_channel_tile(), make_rivers(), player_map_init(), player_tile_init(), and remove_city().
Check if the bit 'bit' is set.
Definition at line 120 of file bitvector.c.
Referenced by achievement_check(), check_native_area(), client_map_is_known_and_seen(), dbv_debug(), is_city_channel_tile(), make_rivers(), map_is_known(), objbind_get_value_from_object(), remove_city(), river_test_blocked(), sg_extras_get_dbv(), and tile_get_known().
Test if any bit is set.
Definition at line 132 of file bitvector.c.
Resize a dynamic bitvector. Create it if needed.
Definition at line 71 of file bitvector.c.
Referenced by client_player_maps_reset(), and dbv_copy().
Set the bit given by 'bit'.
Definition at line 144 of file bitvector.c.
Referenced by check_native_area(), handle_tile_info(), is_city_channel_tile(), make_river(), make_rivers(), map_set_known(), remove_city(), river_blockmark(), sg_bases_set_dbv(), sg_extras_set_dbv(), sg_extras_set_dbv(), sg_roads_set_dbv(), sg_special_set_dbv(), and update_player_tile_knowledge().
Set all bits.
Definition at line 156 of file bitvector.c.
Copy dynamic bit vector content to static bitvector. Static vector is assumed to be at least same size as the dynamic one.
Definition at line 235 of file bitvector.c.
Referenced by do_paradrop(), send_tile_info(), and sg_special_set_dbv().