![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <QHash>#include "dataio.h"#include "fcintl.h"#include "genhash.h"#include "log.h"#include "packets.h"#include "client_main.h"#include "attribute.h"
Include dependency graph for attribute.cpp:Go to the source code of this file.
Classes | |
| class | attr_key |
Macros | |
| #define | log_attribute log_debug |
Typedefs | |
| typedef QHash< attr_key, void * > | attributeHash |
Enumerations | |
| enum | attribute_serial { A_SERIAL_FAIL , A_SERIAL_OK , A_SERIAL_OLD } |
Functions | |
| bool | operator== (const attr_key &pkey1, const attr_key &pkey2) |
| uint | qHash (const attr_key &pkey, uint seed) |
| void | attribute_init () |
| Initializes the attribute module. More... | |
| void | attribute_free () |
| Frees the attribute module. More... | |
| static enum attribute_serial | serialize_hash (attributeHash *hash, QByteArray &data) |
| Serialize an attribute hash for network/storage. More... | |
| static enum attribute_serial | unserialize_hash (attributeHash *hash, const QByteArray &data) |
| This data was serialized (above), sent as an opaque data packet to the server, stored in a savegame, retrieved from the savegame, sent as an opaque data packet back to the client, and now is ready to be restored. More... | |
| void | attribute_flush () |
| Send current state to the server. More... | |
| void | attribute_restore () |
| Recreate the attribute set from the player's attribute_block. More... | |
| 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. More... | |
| 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. More... | |
| void | attr_city_set (enum attr_city what, int city_id, size_t data_length, const void *const data) |
| Set city related attribute. More... | |
| size_t | attr_city_get (enum attr_city what, int city_id, size_t max_data_length, void *data) |
| Get city related attribute. More... | |
| #define log_attribute log_debug |
Definition at line 29 of file attribute.cpp.
| typedef QHash<attr_key, void *> attributeHash |
Definition at line 60 of file attribute.cpp.
| enum attribute_serial |
| Enumerator | |
|---|---|
| A_SERIAL_FAIL | |
| A_SERIAL_OK | |
| A_SERIAL_OLD | |
Definition at line 31 of file attribute.cpp.
| size_t attr_city_get | ( | enum attr_city | what, |
| int | city_id, | ||
| size_t | max_data_length, | ||
| void * | data | ||
| ) |
Get city related attribute.
Definition at line 410 of file attribute.cpp.
Referenced by cma_yoloswag::get_parameter().
| void attr_city_set | ( | enum attr_city | what, |
| int | city_id, | ||
| size_t | data_length, | ||
| const void *const | data | ||
| ) |
Set city related attribute.
Definition at line 401 of file attribute.cpp.
Referenced by cma_yoloswag::release_city(), governor::run(), and cma_yoloswag::set_parameter().
| void attribute_flush | ( | ) |
Send current state to the server.
Note that the current implementation will send all attributes to the server.
Definition at line 284 of file attribute.cpp.
Referenced by attribute_set(), client_exit(), disconnect_from_server(), and send_turn_done().
| void attribute_free | ( | ) |
Frees the attribute module.
Definition at line 71 of file attribute.cpp.
Referenced by client_game_free(), and client_game_reset().
| 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.
If data hasn't enough space to hold the attribute data isn't set to the attribute. Returns the actual size of the attribute. Can be zero if the attribute is unset. To get the size of an attribute use size = attribute_get(key, id, x, y, 0, nullptr)
Definition at line 367 of file attribute.cpp.
Referenced by attr_city_get().
| void attribute_init | ( | ) |
Initializes the attribute module.
Definition at line 66 of file attribute.cpp.
Referenced by client_game_init(), and client_game_reset().
| void attribute_restore | ( | ) |
Recreate the attribute set from the player's attribute_block.
Shouldn't be used by normal code.
Definition at line 305 of file attribute.cpp.
Referenced by handle_player_attribute_chunk().
| 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.
If data_length is zero the attribute is removed.
Definition at line 332 of file attribute.cpp.
Referenced by attr_city_set().
Definition at line 49 of file attribute.cpp.
|
inline |
Definition at line 55 of file attribute.cpp.
|
static |
Serialize an attribute hash for network/storage.
Definition at line 71 of file attribute.cpp.
Referenced by attribute_flush().
|
static |
This data was serialized (above), sent as an opaque data packet to the server, stored in a savegame, retrieved from the savegame, sent as an opaque data packet back to the client, and now is ready to be restored.
Check everything!
Definition at line 71 of file attribute.cpp.
Referenced by attribute_restore().