1 #ifndef __JSON_IO_H 2 #define __JSON_IO_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 #include "chat.h" 9 #include "counters.h" 10 #include "manufacture.h" 11 12 #define USE_JSON_DEBUG(message) {} 13 //#define USE_JSON_DEBUG(message) {printf("%s:%d %s\n", __FUNCTION__, __LINE__, message);} 14 15 /*! 16 * \name Functions to load and save the manufacture window recipes. 17 */ 18 /*! @{ */ 19 int json_open_recipes(const char *file_name); 20 int json_load_recipes(recipe_entry *recipes_store, size_t max_recipes); 21 int json_save_recipes(const char *file_name, recipe_entry *recipes_store, size_t num_recipes, int current_recipe); 22 /*! @} */ 23 24 25 /*! 26 * \name Functions to load and save the quickspells list. 27 */ 28 /*! @{ */ 29 int json_load_quickspells(const char *file_name, int *spell_ids, size_t max_num_spell_id); 30 int json_save_quickspells(const char *file_name, Uint16 *spell_ids, size_t num_spell_id); 31 /*! @} */ 32 33 34 /*! 35 * \name Functions to load and save the counters. 36 */ 37 /*! @{ */ 38 int json_load_counters(const char *file_name, const char **cat_str, int *entries, size_t num_categories, struct Counter **the_counters); 39 int json_save_counters(const char *file_name, const char **cat_str, const int *entries, size_t num_categories, const struct Counter **the_counters); 40 /*! @} */ 41 42 43 /*! 44 * \name Functions to load and save channel colours. 45 */ 46 /*! @{ */ 47 int json_load_channel_colours(const char *file_name, channelcolor *channel_colours, size_t max_channel_colours); 48 int json_save_channel_colours(const char *file_name, const channelcolor *channel_colours, size_t max_channel_colours); 49 /*! @} */ 50 51 /*! 52 * \name Functions for character options. 53 */ 54 /*! @{ */ 55 int json_character_options_set_file_name(const char *file_name); 56 int json_character_options_load_file(void); 57 int json_character_options_save_file(void); 58 int json_character_options_get_int(const char *var_name, int default_value); 59 void json_character_options_set_int(const char *var_name, int value); 60 float json_character_options_get_float(const char *var_name, float default_value); 61 void json_character_options_set_float(const char *var_name, float value); 62 int json_character_options_get_bool(const char *var_name, int default_value); 63 void json_character_options_set_bool(const char *var_name, int value); 64 int json_character_options_exists(const char *var_name); 65 void json_character_options_remove(const char *var_name); 66 /*! @} */ 67 68 /*! 69 * \name Functions for Client State 70 */ 71 /*! @{ */ 72 int json_load_cstate(const char *file_name); 73 int json_save_cstate(const char *file_name); 74 int json_cstate_get_int(const char *section_name, const char *var_name, int default_value); 75 void json_cstate_set_int(const char *section_name, const char *var_name, int value); 76 unsigned int json_cstate_get_unsigned_int(const char *section_name, const char *var_name, unsigned int default_value); 77 void json_cstate_set_unsigned_int(const char *section_name, const char *var_name, unsigned int value); 78 float json_cstate_get_float(const char *section_name, const char *var_name, float default_value); 79 void json_cstate_set_float(const char *section_name, const char *var_name, float value); 80 int json_cstate_get_bool(const char *section_name, const char *var_name, int default_value); 81 void json_cstate_set_bool(const char *section_name, const char *var_name, int value); 82 /*! @} */ 83 84 #ifdef __cplusplus 85 } // extern "C" 86 #endif 87 88 #endif 89