Freeciv21
Develop your civilization from humble roots to a global empire
attribute.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3  __ __ part of Freeciv21. Freeciv21 is free software: you can
4 / \\..// \ redistribute it and/or modify it under the terms of the GNU
5  ( oo ) General Public License as published by the Free Software
6  \__/ Foundation, either version 3 of the License, or (at your
7  option) any later version. You should have received
8  a copy of the GNU General Public License along with Freeciv21. If not,
9  see https://www.gnu.org/licenses/.
10 **************************************************************************/
11 #pragma once
12 
13 #include <cstddef>
14 
15 /*
16  * If 4 byte wide signed int is used this gives 20 object types with
17  * 100 million keys each.
18  */
19 enum attr_object_type_start_keys { ATTR_CITY_START = 1 * 100 * 1000 * 1000 };
20 
21 enum attr_city {
24 };
25 
26 /*
27  * Generic methods.
28  */
29 void attribute_init();
30 void attribute_free();
31 void attribute_flush();
32 void attribute_restore();
33 void attribute_set(int key, int id, int x, int y, size_t data_length,
34  const void *const data);
35 size_t attribute_get(int key, int id, int x, int y, size_t max_data_length,
36  void *data);
37 
38 /*
39  * Special methods for cities.
40  */
41 void attr_city_set(enum attr_city what, int city_id, size_t data_length,
42  const void *const data);
43 size_t attr_city_get(enum attr_city what, int city_id,
44  size_t max_data_length, void *data);
void attribute_set(int key, int id, int x, int y, size_t data_length, const void *const data)
Low-level function to set an attribute.
Definition: attribute.cpp:332
attr_object_type_start_keys
Definition: attribute.h:19
@ ATTR_CITY_START
Definition: attribute.h:19
attr_city
Definition: attribute.h:21
@ ATTR_CITY_CMAFE_PARAMETER
Definition: attribute.h:23
@ ATTR_CITY_CMA_PARAMETER
Definition: attribute.h:22
void attribute_init()
Initializes the attribute module.
Definition: attribute.cpp:66
size_t attribute_get(int key, int id, int x, int y, size_t max_data_length, void *data)
Low-level function to get an attribute.
Definition: attribute.cpp:367
size_t attr_city_get(enum attr_city what, int city_id, size_t max_data_length, void *data)
Get city related attribute.
Definition: attribute.cpp:410
void attribute_restore()
Recreate the attribute set from the player's attribute_block.
Definition: attribute.cpp:305
void attribute_flush()
Send current state to the server.
Definition: attribute.cpp:284
void attribute_free()
Frees the attribute module.
Definition: attribute.cpp:71
void attr_city_set(enum attr_city what, int city_id, size_t data_length, const void *const data)
Set city related attribute.
Definition: attribute.cpp:401