Freeciv-3.3: /fast/freeciv/nightly/main/client/attribute.h Source File

Freeciv-3.3

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 */
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
31};
32
33 enum attr_unit {
34 ATTR_UNIT_DUMMY = ATTR_UNIT_START
35};
36
37 enum attr_city {
38 ATTR_CITY_CMA_PARAMETER = ATTR_CITY_START,
39 ATTR_CITY_CMAFE_PARAMETER
40};
41
42 enum attr_player {
43 ATTR_PLAYER_DUMMY = ATTR_PLAYER_START
44};
45
46 enum attr_tile {
47 ATTR_TILE_DUMMY = ATTR_TILE_START
48};
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 */
attribute_set
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
attr_object_type_start_keys
Definition attribute.h:26
ATTR_CITY_START
@ ATTR_CITY_START
Definition attribute.h:28
ATTR_UNIT_START
@ ATTR_UNIT_START
Definition attribute.h:27
ATTR_TILE_START
@ ATTR_TILE_START
Definition attribute.h:30
ATTR_PLAYER_START
@ ATTR_PLAYER_START
Definition attribute.h:29
attr_city
attr_city
Definition attribute.h:37
ATTR_CITY_CMAFE_PARAMETER
@ ATTR_CITY_CMAFE_PARAMETER
Definition attribute.h:39
ATTR_CITY_CMA_PARAMETER
@ ATTR_CITY_CMA_PARAMETER
Definition attribute.h:38
attr_city_get_int
size_t attr_city_get_int(enum attr_city what, int city_id, int *data)
Definition attribute.c:509
attr_unit
attr_unit
Definition attribute.h:33
ATTR_UNIT_DUMMY
@ ATTR_UNIT_DUMMY
Definition attribute.h:34
attr_tile
attr_tile
Definition attribute.h:46
ATTR_TILE_DUMMY
@ ATTR_TILE_DUMMY
Definition attribute.h:47
attribute_init
void attribute_init(void)
Definition attribute.c:114
attribute_free
void attribute_free(void)
Definition attribute.c:123
attr_tile_get
size_t attr_tile_get(enum attr_tile what, int x, int y, size_t max_data_length, void *data)
Definition attribute.c:544
attr_player_set
void attr_player_set(enum attr_player what, int player_id, size_t data_length, const void *const data)
Definition attribute.c:517
attr_unit_get_int
size_t attr_unit_get_int(enum attr_unit what, int unit_id, int *data)
Definition attribute.c:475
attr_tile_set
void attr_tile_set(enum attr_tile what, int x, int y, size_t data_length, const void *const data)
Definition attribute.c:535
attribute_flush
void attribute_flush(void)
Definition attribute.c:327
attr_player
attr_player
Definition attribute.h:42
ATTR_PLAYER_DUMMY
@ ATTR_PLAYER_DUMMY
Definition attribute.h:43
attribute_get
size_t attribute_get(int key, int id, int x, int y, size_t max_data_length, void *data)
Definition attribute.c:416
attr_city_get
size_t attr_city_get(enum attr_city what, int city_id, size_t max_data_length, void *data)
Definition attribute.c:492
attribute_restore
void attribute_restore(void)
Definition attribute.c:355
attr_unit_set
void attr_unit_set(enum attr_unit what, int unit_id, size_t data_length, const void *const data)
Definition attribute.c:449
attr_unit_get
size_t attr_unit_get(enum attr_unit what, int unit_id, size_t max_data_length, void *data)
Definition attribute.c:458
attr_player_get
size_t attr_player_get(enum attr_player what, int player_id, size_t max_data_length, void *data)
Definition attribute.c:526
attr_unit_set_int
void attr_unit_set_int(enum attr_unit what, int unit_id, int data)
Definition attribute.c:467
attr_city_set_int
void attr_city_set_int(enum attr_city what, int city_id, int data)
Definition attribute.c:501
attr_city_set
void attr_city_set(enum attr_city what, int city_id, size_t data_length, const void *const data)
Definition attribute.c:483
incite_cost
char * incite_cost
Definition comments.c:74
y
struct sprite int int y
Definition sprite_g.h:31
x
struct sprite int x
Definition sprite_g.h:31