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)
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
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
34 ATTR_UNIT_DUMMY
= ATTR_UNIT_START
38 ATTR_CITY_CMA_PARAMETER
= ATTR_CITY_START
,
39 ATTR_CITY_CMAFE_PARAMETER
43 ATTR_PLAYER_DUMMY
= ATTR_PLAYER_START
47 ATTR_TILE_DUMMY
= ATTR_TILE_START
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
,
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
,
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
,
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
,
101 #endif /* __cplusplus */
103 #endif /* FC__ATTRIBUTE_H */