33#define log_attribute log_debug
52#define SPECHASH_TAG attribute
53#define SPECHASH_IKEY_TYPE struct attr_key *
54#define SPECHASH_IDATA_TYPE void *
55#define SPECHASH_IKEY_VAL attr_key_val
56#define SPECHASH_IKEY_COMP attr_key_comp
57#define SPECHASH_IKEY_COPY attr_key_dup
58#define SPECHASH_IKEY_FREE attr_key_destroy
59#define SPECHASH_IDATA_FREE free
61#define attribute_hash_values_iterate(hash, pvalue) \
62 TYPED_HASH_DATA_ITERATE(void *, hash, pvalue)
63#define attribute_hash_values_iterate_end HASH_DATA_ITERATE_END
64#define attribute_hash_iterate(hash, pkey, pvalue) \
65 TYPED_HASH_ITERATE(const struct attr_key *, void *, hash, pkey, pvalue)
66#define attribute_hash_iterate_end HASH_ITERATE_END
163 total_length = 4 + 1 + 4 + 4;
165 total_length +=
entries * (4 + 4 + 4 + 2 + 2);
209 "serialize_hash() total_length = %lu, actual = %lu",
210 (
long unsigned)total_length,
219 "serialized %lu entries in %lu bytes",
220 (
long unsigned)
entries, (
long unsigned) total_length);
243 log_verbose(
"attribute.c unserialize_hash() preamble, uint32 %lu != 0",
244 (
long unsigned) dummy);
249 log_verbose(
"attribute.c unserialize_hash() preamble, "
250 "uint8 %lu != 2 version", (
long unsigned) dummy);
256 log_verbose(
"attribute.c unserialize_hash() preamble, "
257 "uint32 %lu != %lu data_length",
258 (
long unsigned) dummy, (
long unsigned)
data_length);
263 "uint32 %lu entries, %lu data_length",
274 "uint32 value_length dio_input_too_short");
278 "uint32 %lu value_length", (
long unsigned)
value_length);
286 "uint32 key dio_input_too_short");
295 "memory dio_input_too_short");
316 "ignored %lu trailing octets",
370 "Your citizen governor settings may be broken."));
373 log_normal(
_(
"Old attributes detected and removed."));
385 const void *
const data)
389 log_attribute(
"attribute_set(key = %d, id = %d, x = %d, y = %d, "
390 "data_length = %lu, data = %p)",
key,
id,
x,
y,
424 log_attribute(
"attribute_get(key = %d, id = %d, x = %d, y = %d, "
425 "max_data_length = %lu, data = %p)", key,
id,
x,
y,
450 const void *
const data)
484 const void *
const data)
518 const void *
const data)
536 const void *
const data)
struct @126::my_agent entries[MAX_AGENTS]
void attribute_set(int key, int id, int x, int y, size_t data_length, const void *const data)
static struct attribute_hash * attribute_hash
size_t attr_city_get_int(enum attr_city what, int city_id, int *data)
static void attr_key_destroy(struct attr_key *pkey)
void attribute_init(void)
void attribute_free(void)
size_t attr_tile_get(enum attr_tile what, int x, int y, size_t max_data_length, void *data)
void attr_player_set(enum attr_player what, int player_id, size_t data_length, const void *const data)
size_t attr_unit_get_int(enum attr_unit what, int unit_id, int *data)
void attr_tile_set(enum attr_tile what, int x, int y, size_t data_length, const void *const data)
static enum attribute_serial unserialize_hash(struct attribute_hash *hash, const void *data, size_t data_length)
void attribute_flush(void)
#define attribute_hash_iterate_end
size_t attribute_get(int key, int id, int x, int y, size_t max_data_length, void *data)
size_t attr_city_get(enum attr_city what, int city_id, size_t max_data_length, void *data)
static struct attr_key * attr_key_dup(const struct attr_key *pkey)
#define attribute_hash_values_iterate_end
static genhash_val_t attr_key_val(const struct attr_key *pkey)
void attribute_restore(void)
void attr_unit_set(enum attr_unit what, int unit_id, size_t data_length, const void *const data)
size_t attr_unit_get(enum attr_unit what, int unit_id, size_t max_data_length, void *data)
size_t attr_player_get(enum attr_player what, int player_id, size_t max_data_length, void *data)
static enum attribute_serial serialize_hash(const struct attribute_hash *hash, void **pdata, int *pdata_length)
#define attribute_hash_iterate(hash, pkey, pvalue)
void attr_unit_set_int(enum attr_unit what, int unit_id, int data)
static bool attr_key_comp(const struct attr_key *pkey1, const struct attr_key *pkey2)
void attr_city_set_int(enum attr_city what, int city_id, int data)
void attr_city_set(enum attr_city what, int city_id, size_t data_length, const void *const data)
#define attribute_hash_values_iterate(hash, pvalue)
bool client_is_observer(void)
int dio_put_uint8_raw(struct raw_data_out *dout, int value)
int dio_put_uint32_raw(struct raw_data_out *dout, int value)
void dio_output_init(struct raw_data_out *dout, void *destination, size_t dest_size)
size_t dio_input_remaining(struct data_in *din)
bool dio_get_uint32_raw(struct data_in *din, int *dest)
bool dio_get_sint16_raw(struct data_in *din, int *dest)
bool dio_get_memory_raw(struct data_in *din, void *dest, size_t dest_size)
int dio_put_memory_raw(struct raw_data_out *dout, const void *value, size_t size)
bool dio_get_uint8_raw(struct data_in *din, int *dest)
size_t dio_output_used(struct raw_data_out *dout)
void dio_input_init(struct data_in *din, const void *src, size_t src_size)
int dio_put_sint16_raw(struct raw_data_out *dout, int value)
unsigned int genhash_val_t
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_normal(message,...)
#define log_error(message,...)
void send_attribute_block(const struct player *pplayer, struct connection *pconn)
#define ADD_TO_POINTER(p, n)
struct attribute_block_s attribute_block