Stop sharing requirement_unit_state_ereq().
[freeciv.git] / client / attribute.h
blob168b9da8f1051baaff06b135c0f2f48f1b2414b1
1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
13 #ifndef FC__ATTRIBUTE_H
14 #define FC__ATTRIBUTE_H
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 #include <stddef.h> /* size_t */
23 * If 4 byte wide signed int is used this gives 20 object types with
24 * 100 million keys each.
26 enum attr_object_type_start_keys {
27 ATTR_UNIT_START = 0 * 100 * 1000 * 1000,
28 ATTR_CITY_START = 1 * 100 * 1000 * 1000,
29 ATTR_PLAYER_START = 2 * 100 * 1000 * 1000,
30 ATTR_TILE_START = 3 * 100 * 1000 * 1000
33 enum attr_unit {
34 ATTR_UNIT_DUMMY = ATTR_UNIT_START
37 enum attr_city {
38 ATTR_CITY_CMA_PARAMETER = ATTR_CITY_START,
39 ATTR_CITY_CMAFE_PARAMETER
42 enum attr_player {
43 ATTR_PLAYER_DUMMY = ATTR_PLAYER_START
46 enum attr_tile {
47 ATTR_TILE_DUMMY = ATTR_TILE_START
51 * Generic methods.
53 void attribute_init(void);
54 void attribute_free(void);
55 void attribute_flush(void);
56 void attribute_restore(void);
57 void attribute_set(int key, int id, int x, int y, size_t data_length,
58 const void *const data);
59 size_t attribute_get(int key, int id, int x, int y, size_t max_data_length,
60 void *data);
63 * Special methods for units.
65 void attr_unit_set(enum attr_unit what, int unit_id, size_t data_length,
66 const void *const data);
67 size_t attr_unit_get(enum attr_unit what, int unit_id, size_t max_data_length,
68 void *data);
69 void attr_unit_set_int(enum attr_unit what, int unit_id, int data);
70 size_t attr_unit_get_int(enum attr_unit what, int unit_id, int *data);
74 * Special methods for cities.
76 void attr_city_set(enum attr_city what, int city_id, size_t data_length,
77 const void *const data);
78 size_t attr_city_get(enum attr_city what, int city_id, size_t max_data_length,
79 void *data);
80 void attr_city_set_int(enum attr_city what, int city_id, int data);
81 size_t attr_city_get_int(enum attr_city what, int city_id, int *data);
84 * Special methods for players.
86 void attr_player_set(enum attr_player what, int player_id, size_t data_length,
87 const void *const data);
88 size_t attr_player_get(enum attr_player what, int player_id,
89 size_t max_data_length, void *data);
92 * Special methods for tiles.
94 void attr_tile_set(enum attr_tile what, int x, int y, size_t data_length,
95 const void *const data);
96 size_t attr_tile_get(enum attr_tile what, int x, int y, size_t max_data_length,
97 void *data);
99 #ifdef __cplusplus
101 #endif /* __cplusplus */
103 #endif /* FC__ATTRIBUTE_H */