Feature #1365 » 0048-Rename-counter_behaviour-as-counter_behavior.patch
| client/packhand.c | ||
|---|---|---|
|   names_set(&curr->name, NULL, packet->name, packet->rule_name); | ||
|   curr->checkpoint = packet->checkpoint; | ||
|   curr->type = packet->behaviour; | ||
|   curr->type = packet->behavior; | ||
|   curr->target = packet->type; | ||
|   curr->def = packet->def; | ||
|   if (!counter_behaviour_is_valid(curr->type) | ||
|   if (!counter_behavior_is_valid(curr->type) | ||
|       || curr->target != CTGT_CITY) { | ||
|     return; | ||
|   } | ||
| common/counters.h | ||
|---|---|---|
|   struct name_translation name; | ||
|   struct strvec *helptext; | ||
|   bool ruledit_disabled; | ||
|   enum counter_behaviour type; | ||
|   enum counter_behavior type; | ||
|   enum counter_target target; | ||
|   int checkpoint; | ||
|   int def;    /* default value for each entity of given type | ||
|   int def;    /* Default value for each entity of given type | ||
|                * for this counter */ | ||
|   int index;  /* index in specific (city/player/world) array */ | ||
|   int index;  /* Index in specific (city/player/world) array */ | ||
| }; | ||
| void counters_init(void); | ||
| common/fc_types.h | ||
|---|---|---|
| /* Counters related types. See common/counters.h */ | ||
| /* Used in the network protocol. */ | ||
| #define SPECENUM_NAME counter_behaviour | ||
| #define SPECENUM_NAME counter_behavior | ||
| #define SPECENUM_VALUE1 CB_CITY_OWNED_TURNS | ||
| #define SPECENUM_VALUE1NAME "Owned" | ||
| #define SPECENUM_VALUE2 CB_CITY_CELEBRATION_TURNS | ||
| ... | ... | |
| #define SPECENUM_COUNT COUNTER_BEHAVIOUR_LAST | ||
| #define SPECENUM_COUNT COUNTER_BEHAVIOR_LAST | ||
| #include "specenum_gen.h" | ||
| /* Used in the network protocol. */ | ||
| common/networking/packets.def | ||
|---|---|---|
| type TRANSP_DEF_TYPE    = uint8(enum transp_def_type) | ||
| type AI_LEVEL           = uint8(enum ai_level) | ||
| type COUNTER_TARGET     = uint8(enum counter_target) | ||
| type COUNTER_BEHAVIOUR  = uint8(enum counter_behaviour) | ||
| type COUNTER_BEHAVIOR   = uint8(enum counter_behavior) | ||
| type CITY_WL_CB         = uint8(enum city_wl_cancel_behavior) | ||
| type CITY_ACQUIRE_TYPE  = uint8(enum city_acquire_type) | ||
| ... | ... | |
|   UINT32 def; | ||
|   UINT32 checkpoint; | ||
|   COUNTER_TARGET type; | ||
|   COUNTER_BEHAVIOUR behaviour; | ||
|   COUNTER_BEHAVIOR behavior; | ||
| end | ||
| PACKET_RULESET_MUSIC = 240; sc, lsend | ||
| server/ruleset/ruleload.c | ||
|---|---|---|
|                                                              "%s.type", | ||
|                                                               sec_name); | ||
|         enum counter_behaviour cb = counter_behaviour_by_name(counter_type, | ||
|         enum counter_behavior cb = counter_behavior_by_name(counter_type, | ||
|                                         fc_strcasecmp); | ||
|         if (!counter_behaviour_is_valid(cb)) { | ||
|         if (!counter_behavior_is_valid(cb)) { | ||
|           ruleset_error(NULL, LOG_ERROR, | ||
|                         "\"%s\" unknown counter type \"%s\".", | ||
|                         filename, counter_type); | ||
| ... | ... | |
|     sz_strlcpy(packet.name, untranslated_name(&pcount->name)); | ||
|     sz_strlcpy(packet.rule_name, rule_name_get(&pcount->name)); | ||
|     packet.checkpoint = pcount->checkpoint; | ||
|     packet.behaviour = pcount->type; | ||
|     packet.behavior = pcount->type; | ||
|     packet.type = pcount->target; | ||
|     packet.def = pcount->def; | ||
| tools/ruledit/tab_counters.cpp | ||
|---|---|---|
|   widgets_row(label, empty_widget, checkpoint); | ||
|   { | ||
|     enum counter_behaviour current; | ||
|     enum counter_behavior current; | ||
|     type = new QComboBox(this); | ||
|     label = new QLabel(QString::fromUtf8(R__("Behavior"))); | ||
|     label->setParent(this); | ||
|     for (current = counter_behaviour_begin(); current > counter_behaviour_end(); current = counter_behaviour_next(current)) { | ||
|     for (current = counter_behavior_begin(); current > counter_behavior_end(); | ||
|          current = counter_behavior_next(current)) { | ||
|       QVariant value(current); | ||
|       type->addItem(counter_behaviour_name(current), value); | ||
|       type->addItem(counter_behavior_name(current), value); | ||
|     }; | ||
|     connect(type, SIGNAL(activated(int)), this, SLOT(counter_behaviour_selected(int))); | ||
|     connect(type, SIGNAL(activated(int)), this, SLOT(counter_behavior_selected(int))); | ||
|     widgets_row(label, empty_widget, type); | ||
|   } | ||
| ... | ... | |
| } | ||
| /**********************************************************************//** | ||
|   Called when counter behaviour is set by user | ||
|   Called when counter behavior is set by user | ||
| **************************************************************************/ | ||
| void tab_counter::counter_behaviour_selected(int item) | ||
| void tab_counter::counter_behavior_selected(int item) | ||
| { | ||
|   QVariant item_data; | ||
| ... | ... | |
|     return; | ||
|   } | ||
|   item_data = type->currentData(); | ||
|   selected->type =  (enum counter_behaviour) item_data.toInt(); | ||
|   selected->type =  (enum counter_behavior) item_data.toInt(); | ||
|   update_counter_info(selected); | ||
|   refresh(); | ||
| ... | ... | |
|   // Try to reuse freed counter slot | ||
|   city_counters_iterate(pcount) { | ||
|     if (pcount->type == COUNTER_BEHAVIOUR_LAST | ||
|     if (pcount->type == COUNTER_BEHAVIOR_LAST | ||
|         || pcount->ruledit_disabled) { | ||
|       if (initialize_new_counter(pcount)) { | ||
|         update_counter_info(pcount); | ||
| tools/ruledit/tab_counters.h | ||
|---|---|---|
|     void same_name_toggle(bool checked); | ||
|     void edit_effects(); | ||
|     bool initialize_new_counter(struct counter *padv); | ||
|     void counter_behaviour_selected(int item); | ||
|     void counter_behavior_selected(int item); | ||
| }; | ||
| tools/ruleutil/rulesave.c | ||
|---|---|---|
|     save_default_int(sfile, pcounter->def, 0, path, "def"); | ||
|     save_default_int(sfile, pcounter->checkpoint, 0, path, "checkpoint"); | ||
|     secfile_insert_str(sfile, counter_behaviour_name(pcounter->type), "%s.type", path); | ||
|     secfile_insert_str(sfile, counter_behavior_name(pcounter->type), "%s.type", path); | ||
|     if (pcounter->helptext != nullptr | ||
|         && strvec_size(pcounter->helptext) > 0) { | ||