<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39669 >

On 04/09/07, Marko Lindqvist  wrote:
>
>  - Trunk only: Function used in outputting soundspec entries added,
> but commented out

 This part taken out. Attached as separate patch in case it's needed
in the future.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/events.c freeciv/common/events.c
--- freeciv/common/events.c	2007-08-04 18:38:32.000000000 +0300
+++ freeciv/common/events.c	2007-09-07 19:12:07.000000000 +0300
@@ -153,7 +153,7 @@
  */
 static int event_to_index[E_LAST];
 
-int sorted_events[E_LAST];
+enum event_type sorted_events[E_LAST];
 
 
 /**************************************************************************
@@ -166,8 +166,10 @@
   if (events[event_to_index[event]].event == event) {
     return events[event_to_index[event]].full_descr;
   }
+
   freelog(LOG_ERROR, "unknown event %d", event);
-  return "UNKNOWN EVENT";
+  return "UNKNOWN EVENT"; /* FIXME: Should be marked for translation?
+                           * we get non-translated in log message. */
 }
 
 /**************************************************************************
@@ -176,8 +178,8 @@
 **************************************************************************/
 static int compar_event_message_texts(const void *i1, const void *i2)
 {
-  const int *j1 = i1;
-  const int *j2 = i2;
+  const enum event_type *j1 = i1;
+  const enum event_type *j2 = i2;
   
   return mystrcasecmp(get_event_message_text(*j1),
 		      get_event_message_text(*j2));
@@ -254,10 +256,14 @@
     int j;
 
     if (events[i].section_orig) {
+      /* TRANS: Most event descriptions come in two parts "Civ: Transfer"
+       *        This format is their glue. */
+      const char *event_format = Q_("?eventdescr:%s: %s");
+
       events[i].full_descr = fc_malloc(strlen(_(events[i].descr_orig))
                                        + strlen(_(events[i].section_orig))
-                                       + strlen(": ") + 1);
-      sprintf(events[i].full_descr, "%s: %s",
+                                       + strlen(event_format) + 1);
+      sprintf(events[i].full_descr, event_format,
               _(events[i].section_orig),
               _(events[i].descr_orig));
     } else {
diff -Nurd -X.diff_ignore freeciv/common/events.h freeciv/common/events.h
--- freeciv/common/events.h	2007-08-05 16:40:58.000000000 +0300
+++ freeciv/common/events.h	2007-09-07 19:07:00.000000000 +0300
@@ -17,7 +17,10 @@
 
 /* Add new event types to the end. Client saves message settings by
  * type number and installing new event type in between would cause
- * erronous loading of existing .civclientrc */
+ * erronous loading of existing .civclientrc
+ * When adding events to stable branch, there is risk that TRUNK
+ * already has allocated next slot for something else (and has
+ * new event in upper slot) */
 enum event_type {
   E_CITY_CANTBUILD,
   E_CITY_LOST,
@@ -124,13 +127,13 @@
   /* 
    * Note: If you add a new event, make sure you make a similar change
    * to the events array in common/events.c using GEN_EV and to
-   * data/stdsounds.spec.
+   * data/stdsounds.soundspec.
    */
   E_LAST
 };
 
-extern int sorted_events[];	        /* [E_LAST], sorted by the
-					   translated message text */
+extern enum event_type sorted_events[];	   /* [E_LAST], sorted by the
+					    * translated message text */
 
 const char *get_event_message_text(enum event_type event);
 const char *get_event_sound_tag(enum event_type event);
@@ -158,4 +161,3 @@
 }
 
 #endif /* FC__EVENTS_H */
-
diff -Nurd -X.diff_ignore freeciv/data/stdsounds.soundspec freeciv/data/stdsounds.soundspec
--- freeciv/data/stdsounds.soundspec	2007-08-04 18:37:57.000000000 +0300
+++ freeciv/data/stdsounds.soundspec	2007-09-07 19:07:00.000000000 +0300
@@ -191,73 +191,114 @@
 ;w_united_nations = ""
 ;w_womens_suffrage = ""
 
-;e_anarchy = ""
+
+; This list contains all events up to E_TECH_GOAL
+; (as numbered in common/events.h), in the sorted order.
+; Alphabetical sorting is based on event descriptions,
+; not to these tag names. These have been sorted using
+; Freeciv internal language (en_US)
+
+;e_ai_debug = ""
 ;e_broadcast_report = ""
-;e_cancel_pact = ""
-;e_city_aq_building = ""
-;e_city_aqueduct = ""
-;e_city_build = ""
+;e_caravan_action = ""
+;e_chat_error = ""
+;e_chat_msg = ""
 ;e_city_cantbuild = ""
-;e_city_cma_release = ""
+;e_city_lost = ""
+;e_city_love = ""
 ;e_city_disorder = ""
 ;e_city_famine = ""
 ;e_city_famine_feared = ""
-;e_city_gran_throttle = ""
 ;e_city_growth = ""
-;e_city_lost = ""
-;e_city_love = ""
 ;e_city_may_soon_grow = ""
+;e_city_aqueduct = ""
+;e_city_aq_building = ""
 ;e_city_normal = ""
 ;e_city_nuked = ""
-;e_city_wonder_will_be_built = ""
-;e_destroyed = ""
-;e_dipl_incident = ""
-;e_diplomated = ""
+;e_city_production_changed = ""
+;e_city_cma_release = ""
+;e_city_gran_throttle = ""
+;e_city_transfer = ""
+;e_city_build = ""
+;e_worklist = ""
+;e_uprising = ""
+;e_civil_war = ""
+;e_anarchy = ""
 ;e_first_contact = ""
+;e_new_government = ""
+;e_low_on_funds = ""
+;e_pollution = ""
+;e_revolt_done = ""
+;e_revolt_start = ""
+;e_spaceship = ""
+;e_connection = ""
+;e_my_diplomat_bribe = ""
+;e_diplomatic_incident = ""
+;e_my_diplomat_embassy = ""
+;e_my_diplomat_escape = ""
+;e_my_diplomat_failed = ""
+;e_my_diplomat_incite = ""
+;e_my_diplomat_poison = ""
+;e_my_diplomat_sabotage = ""
+;e_my_diplomat_theft = ""
+;e_diplomacy = ""
+;e_enemy_diplomat_bribe = ""
+;e_enemy_diplomat_embassy = ""
+;e_enemy_diplomat_failed = ""
+;e_enemy_diplomat_incite = ""
+;e_enemy_diplomat_poison = ""
+;e_enemy_diplomat_sabotage = ""
+;e_enemy_diplomat_theft = ""
+;e_bad_command = ""
 ;e_game_end = ""
 ;e_game_start = ""
 ;e_global_eco = ""
+;e_nuke = ""
 ;e_hut_barb = ""
-;e_hut_barb_city_near = ""
-;e_hut_barb_killed = ""
 ;e_hut_city = ""
 ;e_hut_gold = ""
+;e_hut_barb_killed = ""
 ;e_hut_merc = ""
 ;e_hut_settler = ""
 ;e_hut_tech = ""
+;e_hut_barb_city_near = ""
+;e_imp_buy = ""
+;e_imp_build = ""
 ;e_imp_auctioned = ""
 ;e_imp_auto = ""
-;e_imp_build = ""
-;e_imp_buy = ""
 e_imp_sold = "stdsounds/metbrk.ogg" ; [pox]
-;e_low_on_funds = ""
 ;e_message_wall = ""
-;e_my_diplomat = ""
 ;e_nation_selected = ""
-;e_new_government = ""
-;e_next_year = ""
-;e_nuke = ""
-;e_pollution = ""
+;e_destroyed = ""
+;e_player_settings = ""
 ;e_report = ""
-;e_revolt_done = ""
-;e_revolt_start = ""
-;e_spaceship = ""
+;e_setting = ""
 ;e_tech_gain = ""
 ;e_tech_learned = ""
+;e_tech_goal = ""
+;e_treaty_alliance = ""
+;e_treaty_broken = ""
+;e_treaty_ceasefire = ""
+;e_treaty_embassy = ""
+;e_treaty_peace = ""
+;e_treaty_shared_vision = ""
 ;e_turn_bell = ""
-;e_unit_build = ""
+;e_tutorial = ""
+;e_unit_lost_att = ""
+;e_unit_win_att = ""
+;e_unit_became_vet = ""
 ;e_unit_buy = ""
+;e_unit_built = ""
 ;e_unit_lost = ""
-;e_unit_lost_att = ""
-;e_unit_upgraded = ""
 ;e_unit_win = ""
-;e_unit_win_att = ""
-;e_uprising = ""
+;e_unit_orders = ""
+;e_unit_upgraded = ""
+;e_unit_relocated = ""
 ;e_wonder_build = ""
 ;e_wonder_obsolete = ""
 ;e_wonder_started = ""
 ;e_wonder_stopped = ""
-;e_worklist = ""
-;e_player_settings = ""
+;e_wonder_will_be_built = ""
+;e_next_year = ""
 
 ;music_start = ""
diff -Nurd -X.diff_ignore freeciv/server/scripting/api.pkg freeciv/server/scripting/api.pkg
--- freeciv/server/scripting/api.pkg	2007-08-13 20:51:02.000000000 +0300
+++ freeciv/server/scripting/api.pkg	2007-09-07 19:07:00.000000000 +0300
@@ -472,8 +472,8 @@
     E_CHAT_ERROR @ CHAT_ERROR,
     /* 
      * Note: If you add a new event, make sure you make a similar change
-     * to the events array in client/options.c using GEN_EV and to
-     * data/stdsounds.spec.
+     * to the events array in common/events.c using GEN_EV and to
+     * data/stdsounds.soundspec.
      */
     E_LAST @ LAST
   };
diff -Nurd -X.diff_ignore freeciv/common/events.c freeciv/common/events.c
--- freeciv/common/events.c	2007-09-07 19:13:17.000000000 +0300
+++ freeciv/common/events.c	2007-09-07 19:13:31.000000000 +0300
@@ -155,6 +155,20 @@
 
 enum event_type sorted_events[E_LAST];
 
+/**************************************************************************
+  This inserts empty soundspec entries to buffer.
+**************************************************************************/
+#if 0
+static void output_soundspec_events(char *buf, size_t bufsz)
+{
+  enum event_type et;
+
+  for (et = 0; et < E_LAST; et++) {
+    cat_snprintf(buf, bufsz, ";%s = \"\"\n",
+                 events[event_to_index[sorted_events[et]]].tag_name);
+  }
+}
+#endif
 
 /**************************************************************************
   Returns the translated description of the given event.
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to