Freeciv-3.2
Loading...
Searching...
No Matches
attribute.h
Go to the documentation of this file.
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.
7
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
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20#include <stddef.h> /* size_t */
21
22/*
23 * If 4 byte wide signed int is used this gives 20 object types with
24 * 100 million keys each.
25 */
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
31};
32
36
41
45
49
50/*
51 * Generic methods.
52 */
53void attribute_init(void);
54void attribute_free(void);
55void attribute_flush(void);
56void attribute_restore(void);
57void attribute_set(int key, int id, int x, int y, size_t data_length,
58 const void *const data);
59size_t attribute_get(int key, int id, int x, int y, size_t max_data_length,
60 void *data);
61
62/*
63 * Special methods for units.
64 */
65void attr_unit_set(enum attr_unit what, int unit_id, size_t data_length,
66 const void *const data);
67size_t attr_unit_get(enum attr_unit what, int unit_id, size_t max_data_length,
68 void *data);
69void attr_unit_set_int(enum attr_unit what, int unit_id, int data);
70size_t attr_unit_get_int(enum attr_unit what, int unit_id, int *data);
71
72
73/*
74 * Special methods for cities.
75 */
76void attr_city_set(enum attr_city what, int city_id, size_t data_length,
77 const void *const data);
78size_t attr_city_get(enum attr_city what, int city_id, size_t max_data_length,
79 void *data);
80void attr_city_set_int(enum attr_city what, int city_id, int data);
81size_t attr_city_get_int(enum attr_city what, int city_id, int *data);
82
83/*
84 * Special methods for players.
85 */
86void attr_player_set(enum attr_player what, int player_id, size_t data_length,
87 const void *const data);
88size_t attr_player_get(enum attr_player what, int player_id,
89 size_t max_data_length, void *data);
90
91/*
92 * Special methods for tiles.
93 */
94void attr_tile_set(enum attr_tile what, int x, int y, size_t data_length,
95 const void *const data);
96size_t attr_tile_get(enum attr_tile what, int x, int y, size_t max_data_length,
97 void *data);
98
99#ifdef __cplusplus
100}
101#endif /* __cplusplus */
102
103#endif /* FC__ATTRIBUTE_H */
void attribute_set(int key, int id, int x, int y, size_t data_length, const void *const data)
Definition attribute.c:384
attr_object_type_start_keys
Definition attribute.h:26
@ ATTR_CITY_START
Definition attribute.h:28
@ ATTR_UNIT_START
Definition attribute.h:27
@ ATTR_TILE_START
Definition attribute.h:30
@ ATTR_PLAYER_START
Definition attribute.h:29
attr_city
Definition attribute.h:37
@ ATTR_CITY_CMAFE_PARAMETER
Definition attribute.h:39
@ ATTR_CITY_CMA_PARAMETER
Definition attribute.h:38
size_t attr_city_get_int(enum attr_city what, int city_id, int *data)
Definition attribute.c:509
attr_unit
Definition attribute.h:33
@ ATTR_UNIT_DUMMY
Definition attribute.h:34
attr_tile
Definition attribute.h:46
@ ATTR_TILE_DUMMY
Definition attribute.h:47
void attribute_init(void)
Definition attribute.c:114
void attribute_free(void)
Definition attribute.c:123
size_t attr_tile_get(enum attr_tile what, int x, int y, size_t max_data_length, void *data)
Definition attribute.c:544
void attr_player_set(enum attr_player what, int player_id, size_t data_length, const void *const data)
Definition attribute.c:517
size_t attr_unit_get_int(enum attr_unit what, int unit_id, int *data)
Definition attribute.c:475
void attr_tile_set(enum attr_tile what, int x, int y, size_t data_length, const void *const data)
Definition attribute.c:535
void attribute_flush(void)
Definition attribute.c:327
attr_player
Definition attribute.h:42
@ ATTR_PLAYER_DUMMY
Definition attribute.h:43
size_t attribute_get(int key, int id, int x, int y, size_t max_data_length, void *data)
Definition attribute.c:416
size_t attr_city_get(enum attr_city what, int city_id, size_t max_data_length, void *data)
Definition attribute.c:492
void attribute_restore(void)
Definition attribute.c:355
void attr_unit_set(enum attr_unit what, int unit_id, size_t data_length, const void *const data)
Definition attribute.c:449
size_t attr_unit_get(enum attr_unit what, int unit_id, size_t max_data_length, void *data)
Definition attribute.c:458
size_t attr_player_get(enum attr_player what, int player_id, size_t max_data_length, void *data)
Definition attribute.c:526
void attr_unit_set_int(enum attr_unit what, int unit_id, int data)
Definition attribute.c:467
void attr_city_set_int(enum attr_city what, int city_id, int data)
Definition attribute.c:501
void attr_city_set(enum attr_city what, int city_id, size_t data_length, const void *const data)
Definition attribute.c:483
char * incite_cost
Definition comments.c:75
struct sprite int int y
Definition sprite_g.h:31
struct sprite int x
Definition sprite_g.h:31