<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40087 >
Moved the existing ruleset_error() intercept into the con_handle_log() callback, so that server log messages can be sent to all connections. Currently, only LOG_FATAL and LOG_ERROR. Renamed E_MESSAGE_WALL to E_LOG_FATAL, as that was already used for the ruleset_error() and operator message popups. Renamed E_PLAYER_SETTINGS (unused) to E_LOG_ERROR, and these default to chat/output only. Used instead of E_LOG_FATAL for scripting. Changed the event sections to be properly translatable. Swapped the data fields for easier sorting (by event instead of strings). Likewise for the soundspec file. Used some existing sounds. Committed trunk revision 14390. Committed S2_2 revision 14391.
Index: server/console.c =================================================================== --- server/console.c (revision 14389) +++ server/console.c (working copy) @@ -25,9 +25,11 @@ #include "fciconv.h" #include "fcintl.h" +#include "game.h" #include "log.h" #include "support.h" +#include "plrhand.h" #include "srv_main.h" #include "console.h" @@ -47,6 +49,21 @@ ************************************************************************/ static void con_handle_log(int level, const char *message, bool file_too) { + if (LOG_ERROR == level) { + notify_conn(NULL, NULL, E_LOG_ERROR, message); + } else if (LOG_FATAL >= level) { + /* Make sure that message is not left to buffers when server dies */ + conn_list_iterate(game.est_connections, pconn) { + pconn->send_buffer->do_buffer_sends = 0; + pconn->compression.frozen_level = 0; + } conn_list_iterate_end; + + notify_conn(NULL, NULL, E_LOG_FATAL, message); + notify_conn(NULL, NULL, E_LOG_FATAL, + _("Please report this message at %s"), + BUG_URL); + } + /* Write debug/verbose message to console only when not written to file. */ if (!file_too || level <= LOG_NORMAL) { if (console_rfcstyle) { Index: server/scripting/api.pkg =================================================================== --- server/scripting/api.pkg (revision 14389) +++ server/scripting/api.pkg (working copy) @@ -419,7 +419,7 @@ E_BROADCAST_REPORT @ BROADCAST_REPORT, E_GAME_END @ GAME_END, E_GAME_START @ GAME_START, - E_MESSAGE_WALL @ MESSAGE_WALL, + E_LOG_ERROR @ E_LOG_ERROR, E_NATION_SELECTED @ NATION_SELECTED, E_DESTROYED @ DESTROYED, E_REPORT @ REPORT, Index: server/ruleset.c =================================================================== --- server/ruleset.c (revision 14389) +++ server/ruleset.c (working copy) @@ -140,19 +140,8 @@ va_start(args, format); - if (LOG_FATAL >= loglevel) { - /* Make sure that message is not left to buffers when server dies */ - conn_list_iterate(game.est_connections, pconn) { - pconn->send_buffer->do_buffer_sends = 0; - pconn->compression.frozen_level = 0; - } conn_list_iterate_end; + vreal_freelog(loglevel, format, args); - vreal_freelog(loglevel, format, args); - notify_conn(NULL, NULL, E_MESSAGE_WALL, _("Fatal ruleset error. Server dies!")); - } else { - vreal_freelog(loglevel, format, args); - } - va_end(args); if (LOG_FATAL >= loglevel) { Index: server/stdinhand.c =================================================================== --- server/stdinhand.c (revision 14389) +++ server/stdinhand.c (working copy) @@ -1636,8 +1636,8 @@ static bool wall(char *str, bool check) { if (!check) { - notify_conn(NULL, NULL, E_MESSAGE_WALL, - _("Server Operator: %s"), str); + notify_conn(NULL, NULL, E_LOG_FATAL, + _("Server Operator: %s"), str); } return TRUE; } Index: data/stdsounds.soundspec =================================================================== --- data/stdsounds.soundspec (revision 14389) +++ data/stdsounds.soundspec (working copy) @@ -194,54 +194,38 @@ ; 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) +; Alphabetical sorting is based on these tag names, +; as the message names and contents change. {was} ;e_ai_debug = "" +;e_anarchy = "" +;e_bad_command = "" ;e_broadcast_report = "" ;e_caravan_action = "" ;e_chat_error = "" ;e_chat_msg = "" +;e_city_aq_building = "" +;e_city_aqueduct = "" +;e_city_build = "" ;e_city_cantbuild = "" -;e_city_lost = "" -;e_city_love = "" +;e_city_cma_release = "" ;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_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_destroyed = "" +;e_diplomacy = "" ;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 = "" @@ -249,33 +233,48 @@ ;e_enemy_diplomat_poison = "" ;e_enemy_diplomat_sabotage = "" ;e_enemy_diplomat_theft = "" -;e_bad_command = "" +;e_first_contact = "" ;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_log_error = "stdsounds/LrgCan.ogg" ; [warzone] +e_log_fatal = "stdsounds/LrgExpl.ogg" ; [warzone] +;e_low_on_funds = "" ;e_message_wall = "" +;e_my_diplomat_bribe = "" +;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_nation_selected = "" -;e_destroyed = "" -;e_player_settings = "" +;e_new_government = "" +;e_next_year = "" +;e_nuke = "" +;e_pollution = "" ;e_report = "" +;e_revolt_done = "" +;e_revolt_start = "" ;e_setting = "" +;e_spaceship = "" ;e_tech_gain = "" +;e_tech_goal = "" ;e_tech_learned = "" -;e_tech_goal = "" ;e_treaty_alliance = "" ;e_treaty_broken = "" ;e_treaty_ceasefire = "" @@ -284,21 +283,22 @@ ;e_treaty_shared_vision = "" ;e_turn_bell = "" ;e_tutorial = "" -;e_unit_lost_att = "" -;e_unit_win_att = "" ;e_unit_became_vet = "" +;e_unit_built = "" ;e_unit_buy = "" -;e_unit_built = "" ;e_unit_lost = "" -;e_unit_win = "" +;e_unit_lost_att = "" ;e_unit_orders = "" +;e_unit_relocated = "" ;e_unit_upgraded = "" -;e_unit_relocated = "" +;e_unit_win = "" +;e_unit_win_att = "" +;e_uprising = "" ;e_wonder_build = "" ;e_wonder_obsolete = "" ;e_wonder_started = "" ;e_wonder_stopped = "" ;e_wonder_will_be_built = "" -;e_next_year = "" +;e_worklist = "" ;music_start = "" Index: common/events.c =================================================================== --- common/events.c (revision 14389) +++ common/events.c (working copy) @@ -26,123 +26,156 @@ #include "events.h" -#define GEN_EV(section, descr, event) { #event, NULL, section, descr, NULL, event } -#define GEN_EV_TERMINATOR { NULL, NULL, NULL, NULL, NULL, 0 } +enum event_section_n { + E_S_ADVANCE, + E_S_BUILD, + E_S_CITY, + E_S_D_ME, + E_S_D_THEM, + E_S_GLOBAL, + E_S_HUT, + E_S_NATION, + E_S_TREATY, + E_S_UNIT, + E_S_WONDER, + E_S_XYZZY +}; /* + * Information about all event sections, matching the enum above. + */ +static const char *event_sections[] = { + N_("Technology: %s"), + N_("Improvement: %s"), + N_("City: %s"), + N_("Diplomat Action: %s"), + N_("Enemy Diplomat: %s"), + N_("Global: %s"), + N_("Hut: %s"), + N_("Nation: %s"), + N_("Treaty: %s"), + N_("Unit: %s"), + N_("Wonder: %s"), + NULL +}; + +#define GEN_EV(event, section, descr) { #event, NULL, section, descr, NULL, event } +#define GEN_EV_TERMINATOR { NULL, NULL, E_S_XYZZY, NULL, NULL, 0 } + +/* * Holds information about all event types. The entries don't have * to be sorted. */ static struct { const char *enum_name; char *tag_name; - const char *section_orig; + enum event_section_n esn; char *descr_orig; char *full_descr; enum event_type event; } events[] = { - GEN_EV(N_("City"), N_("Building Unavailable Item"), E_CITY_CANTBUILD), - GEN_EV(N_("City"), N_("Captured/Destroyed"), E_CITY_LOST), - GEN_EV(N_("City"), N_("Celebrating"), E_CITY_LOVE), - GEN_EV(N_("City"), N_("Civil Disorder"), E_CITY_DISORDER), - GEN_EV(N_("City"), N_("Famine"), E_CITY_FAMINE), - GEN_EV(N_("City"), N_("Famine Feared"), E_CITY_FAMINE_FEARED), - GEN_EV(N_("City"), N_("Growth"), E_CITY_GROWTH), - GEN_EV(N_("City"), N_("May Soon Grow"), E_CITY_MAY_SOON_GROW), - GEN_EV(N_("City"), N_("Needs Aqueduct"), E_CITY_AQUEDUCT), - GEN_EV(N_("City"), N_("Needs Aqueduct Being Built"), E_CITY_AQ_BUILDING), - GEN_EV(N_("City"), N_("Normal"), E_CITY_NORMAL), - GEN_EV(N_("City"), N_("Nuked"), E_CITY_NUKED), - GEN_EV(N_("City"), N_("Released from citizen governor"), E_CITY_CMA_RELEASE), - GEN_EV(N_("City"), N_("Suggest Growth Throttling"), E_CITY_GRAN_THROTTLE), - GEN_EV(N_("City"), N_("Transfer"), E_CITY_TRANSFER), - GEN_EV(N_("City"), N_("Was Built"), E_CITY_BUILD), - GEN_EV(N_("City"), N_("Worklist Events"), E_WORKLIST), - GEN_EV(N_("City"), N_("Production changed"), E_CITY_PRODUCTION_CHANGED), - GEN_EV(N_("Civ"), N_("Barbarian Uprising"), E_UPRISING ), - GEN_EV(N_("Civ"), N_("Civil War"), E_CIVIL_WAR), - GEN_EV(N_("Civ"), N_("Collapse to Anarchy"), E_ANARCHY), - GEN_EV(N_("Civ"), N_("First Contact"), E_FIRST_CONTACT), - GEN_EV(N_("Civ"), N_("Learned New Government"), E_NEW_GOVERNMENT), - GEN_EV(N_("Civ"), N_("Low Funds"), E_LOW_ON_FUNDS), - GEN_EV(N_("Civ"), N_("Pollution"), E_POLLUTION), - GEN_EV(N_("Civ"), N_("Revolt Ended"), E_REVOLT_DONE), - GEN_EV(N_("Civ"), N_("Revolt Started"), E_REVOLT_START), - GEN_EV(N_("Civ"), N_("Spaceship Events"), E_SPACESHIP), - GEN_EV(N_("Diplomat Action"), N_("Bribe"), E_MY_DIPLOMAT_BRIBE), - GEN_EV(N_("Diplomat Action"), N_("Caused Incident"), E_DIPLOMATIC_INCIDENT), - GEN_EV(N_("Diplomat Action"), N_("Escape"), E_MY_DIPLOMAT_ESCAPE), - GEN_EV(N_("Diplomat Action"), N_("Embassy"), E_MY_DIPLOMAT_EMBASSY), - GEN_EV(N_("Diplomat Action"), N_("Failed"), E_MY_DIPLOMAT_FAILED), - GEN_EV(N_("Diplomat Action"), N_("Incite"), E_MY_DIPLOMAT_INCITE), - GEN_EV(N_("Diplomat Action"), N_("Poison"), E_MY_DIPLOMAT_POISON), - GEN_EV(N_("Diplomat Action"), N_("Sabotage"), E_MY_DIPLOMAT_SABOTAGE), - GEN_EV(N_("Diplomat Action"), N_("Theft"), E_MY_DIPLOMAT_THEFT), - GEN_EV(N_("Enemy Diplomat"), N_("Bribe"), E_ENEMY_DIPLOMAT_BRIBE), - GEN_EV(N_("Enemy Diplomat"), N_("Embassy"), E_ENEMY_DIPLOMAT_EMBASSY), - GEN_EV(N_("Enemy Diplomat"), N_("Failed"), E_ENEMY_DIPLOMAT_FAILED), - GEN_EV(N_("Enemy Diplomat"), N_("Incite"), E_ENEMY_DIPLOMAT_INCITE), - GEN_EV(N_("Enemy Diplomat"), N_("Poison"), E_ENEMY_DIPLOMAT_POISON), - GEN_EV(N_("Enemy Diplomat"), N_("Sabotage"), E_ENEMY_DIPLOMAT_SABOTAGE), - GEN_EV(N_("Enemy Diplomat"), N_("Theft"), E_ENEMY_DIPLOMAT_THEFT), - GEN_EV(NULL, N_("Caravan actions"), E_CARAVAN_ACTION), - GEN_EV(NULL, N_("Tutorial message"), E_TUTORIAL), - GEN_EV(NULL, N_("Broadcast Report"), E_BROADCAST_REPORT), - GEN_EV(NULL, N_("Game Ended"), E_GAME_END), - GEN_EV(NULL, N_("Game Started"), E_GAME_START), - GEN_EV(NULL, N_("Message from Server Operator"), E_MESSAGE_WALL), - GEN_EV(NULL, N_("Nation Selected"), E_NATION_SELECTED), - GEN_EV(NULL, N_("Player Destroyed"), E_DESTROYED), - GEN_EV(NULL, N_("Report"), E_REPORT), - GEN_EV(NULL, N_("Turn Bell"), E_TURN_BELL), - GEN_EV(NULL, N_("Year Advance"), E_NEXT_YEAR), - GEN_EV(N_("Global"), N_("Eco-Disaster"), E_GLOBAL_ECO), - GEN_EV(N_("Global"), N_("Nuke Detonated"), E_NUKE), - GEN_EV(N_("Hut"), N_("Barbarians in a Hut Roused"), E_HUT_BARB), - GEN_EV(N_("Hut"), N_("City Founded from Hut"), E_HUT_CITY), - GEN_EV(N_("Hut"), N_("Gold Found in Hut"), E_HUT_GOLD), - GEN_EV(N_("Hut"), N_("Killed by Barbarians in a Hut"), E_HUT_BARB_KILLED), - GEN_EV(N_("Hut"), N_("Mercenaries Found in Hut"), E_HUT_MERC), - GEN_EV(N_("Hut"), N_("Settler Found in Hut"), E_HUT_SETTLER), - GEN_EV(N_("Hut"), N_("Tech Found in Hut"), E_HUT_TECH), - GEN_EV(N_("Hut"), N_("Unit Spared by Barbarians"), E_HUT_BARB_CITY_NEAR), - GEN_EV(N_("Improvement"), N_("Bought"), E_IMP_BUY), - GEN_EV(N_("Improvement"), N_("Built"), E_IMP_BUILD), - GEN_EV(N_("Improvement"), N_("Forced to Sell"), E_IMP_AUCTIONED), - GEN_EV(N_("Improvement"), N_("New Improvement Selected"), E_IMP_AUTO), - GEN_EV(N_("Improvement"), N_("Sold"), E_IMP_SOLD), - GEN_EV(N_("Tech"), N_("Learned From Great Library"), E_TECH_GAIN), - GEN_EV(N_("Tech"), N_("Learned New Tech"), E_TECH_LEARNED), - GEN_EV(N_("Tech"), N_("Selected New Goal"), E_TECH_GOAL), - GEN_EV(N_("Treaty"), N_("Alliance"), E_TREATY_ALLIANCE), - GEN_EV(N_("Treaty"), N_("Broken"), E_TREATY_BROKEN), - GEN_EV(N_("Treaty"), N_("Cease-fire"), E_TREATY_CEASEFIRE), - GEN_EV(N_("Treaty"), N_("Peace"), E_TREATY_PEACE), - GEN_EV(N_("Treaty"), N_("Shared Vision"), E_TREATY_SHARED_VISION), - GEN_EV(N_("Unit"), N_("Attack Failed"), E_UNIT_LOST_ATT), - GEN_EV(N_("Unit"), N_("Attack Succeeded"), E_UNIT_WIN_ATT), - GEN_EV(N_("Unit"), N_("Bought"), E_UNIT_BUY), - GEN_EV(N_("Unit"), N_("Built"), E_UNIT_BUILT), - GEN_EV(N_("Unit"), N_("Defender Destroyed"), E_UNIT_LOST), - GEN_EV(N_("Unit"), N_("Defender Survived"), E_UNIT_WIN), - GEN_EV(N_("Unit"), N_("Promoted to Veteran"), E_UNIT_BECAME_VET), - GEN_EV(N_("Unit"), N_("Production Upgraded"), E_UNIT_UPGRADED), - GEN_EV(N_("Unit"), N_("Relocated"), E_UNIT_RELOCATED), - GEN_EV(N_("Unit"), N_("Orders / goto events"), E_UNIT_ORDERS), - GEN_EV(N_("Wonder"), N_("Finished"), E_WONDER_BUILD), - GEN_EV(N_("Wonder"), N_("Made Obsolete"), E_WONDER_OBSOLETE), - GEN_EV(N_("Wonder"), N_("Started"), E_WONDER_STARTED), - GEN_EV(N_("Wonder"), N_("Stopped"), E_WONDER_STOPPED), - GEN_EV(N_("Wonder"), N_("Will Finish Next Turn"), E_WONDER_WILL_BE_BUILT), - GEN_EV(NULL, N_("Diplomatic Message"), E_DIPLOMACY), - GEN_EV(N_("Treaty"), N_("Embassy"), E_TREATY_EMBASSY), - GEN_EV(NULL, N_("Error message from bad command"), E_BAD_COMMAND), - GEN_EV(NULL, N_("Server settings changed"), E_SETTING), - GEN_EV(NULL, N_("Chat messages"), E_CHAT_MSG), - GEN_EV(NULL, N_("Chat error messages"), E_CHAT_ERROR), - GEN_EV(NULL, N_("Connect/disconnect messages"), E_CONNECTION), - GEN_EV(NULL, N_("AI Debug messages"), E_AI_DEBUG), - GEN_EV(NULL, N_("Player settings"), E_PLAYER_SETTINGS), + GEN_EV(E_TECH_GAIN, E_S_ADVANCE, N_("Learned From Great Library")), + GEN_EV(E_TECH_LEARNED, E_S_ADVANCE, N_("Learned New Tech")), + GEN_EV(E_TECH_GOAL, E_S_ADVANCE, N_("Selected New Goal")), + GEN_EV(E_IMP_BUY, E_S_BUILD, N_("Bought")), + GEN_EV(E_IMP_BUILD, E_S_BUILD, N_("Built")), + GEN_EV(E_IMP_AUCTIONED, E_S_BUILD, N_("Forced to Sell")), + GEN_EV(E_IMP_AUTO, E_S_BUILD, N_("New Improvement Selected")), + GEN_EV(E_IMP_SOLD, E_S_BUILD, N_("Sold")), + GEN_EV(E_CITY_CANTBUILD, E_S_CITY, N_("Building Unavailable Item")), + GEN_EV(E_CITY_LOST, E_S_CITY, N_("Captured/Destroyed")), + GEN_EV(E_CITY_LOVE, E_S_CITY, N_("Celebrating")), + GEN_EV(E_CITY_DISORDER, E_S_CITY, N_("Civil Disorder")), + GEN_EV(E_CITY_FAMINE, E_S_CITY, N_("Famine")), + GEN_EV(E_CITY_FAMINE_FEARED, E_S_CITY, N_("Famine Feared")), + GEN_EV(E_CITY_GROWTH, E_S_CITY, N_("Growth")), + GEN_EV(E_CITY_MAY_SOON_GROW, E_S_CITY, N_("May Soon Grow")), + GEN_EV(E_CITY_AQUEDUCT, E_S_CITY, N_("Needs Aqueduct")), + GEN_EV(E_CITY_AQ_BUILDING, E_S_CITY, N_("Needs Aqueduct Being Built")), + GEN_EV(E_CITY_NORMAL, E_S_CITY, N_("Normal")), + GEN_EV(E_CITY_NUKED, E_S_CITY, N_("Nuked")), + GEN_EV(E_CITY_CMA_RELEASE, E_S_CITY, N_("Released from citizen governor")), + GEN_EV(E_CITY_GRAN_THROTTLE, E_S_CITY, N_("Suggest Growth Throttling")), + GEN_EV(E_CITY_TRANSFER, E_S_CITY, N_("Transfer")), + GEN_EV(E_CITY_BUILD, E_S_CITY, N_("Was Built")), + GEN_EV(E_WORKLIST, E_S_CITY, N_("Worklist Events")), + GEN_EV(E_CITY_PRODUCTION_CHANGED, E_S_CITY, N_("Production changed")), + GEN_EV(E_MY_DIPLOMAT_BRIBE, E_S_D_ME, N_("Bribe")), + GEN_EV(E_DIPLOMATIC_INCIDENT, E_S_D_ME, N_("Caused Incident")), + GEN_EV(E_MY_DIPLOMAT_ESCAPE, E_S_D_ME, N_("Escape")), + GEN_EV(E_MY_DIPLOMAT_EMBASSY, E_S_D_ME, N_("Embassy")), + GEN_EV(E_MY_DIPLOMAT_FAILED, E_S_D_ME, N_("Failed")), + GEN_EV(E_MY_DIPLOMAT_INCITE, E_S_D_ME, N_("Incite")), + GEN_EV(E_MY_DIPLOMAT_POISON, E_S_D_ME, N_("Poison")), + GEN_EV(E_MY_DIPLOMAT_SABOTAGE, E_S_D_ME, N_("Sabotage")), + GEN_EV(E_MY_DIPLOMAT_THEFT, E_S_D_ME, N_("Theft")), + GEN_EV(E_ENEMY_DIPLOMAT_BRIBE, E_S_D_THEM, N_("Bribe")), + GEN_EV(E_ENEMY_DIPLOMAT_EMBASSY, E_S_D_THEM, N_("Embassy")), + GEN_EV(E_ENEMY_DIPLOMAT_FAILED, E_S_D_THEM, N_("Failed")), + GEN_EV(E_ENEMY_DIPLOMAT_INCITE, E_S_D_THEM, N_("Incite")), + GEN_EV(E_ENEMY_DIPLOMAT_POISON, E_S_D_THEM, N_("Poison")), + GEN_EV(E_ENEMY_DIPLOMAT_SABOTAGE, E_S_D_THEM, N_("Sabotage")), + GEN_EV(E_ENEMY_DIPLOMAT_THEFT, E_S_D_THEM, N_("Theft")), + GEN_EV(E_GLOBAL_ECO, E_S_GLOBAL, N_("Eco-Disaster")), + GEN_EV(E_NUKE, E_S_GLOBAL, N_("Nuke Detonated")), + GEN_EV(E_HUT_BARB, E_S_HUT, N_("Barbarians in a Hut Roused")), + GEN_EV(E_HUT_CITY, E_S_HUT, N_("City Founded from Hut")), + GEN_EV(E_HUT_GOLD, E_S_HUT, N_("Gold Found in Hut")), + GEN_EV(E_HUT_BARB_KILLED, E_S_HUT, N_("Killed by Barbarians in a Hut")), + GEN_EV(E_HUT_MERC, E_S_HUT, N_("Mercenaries Found in Hut")), + GEN_EV(E_HUT_SETTLER, E_S_HUT, N_("Settler Found in Hut")), + GEN_EV(E_HUT_TECH, E_S_HUT, N_("Tech Found in Hut")), + GEN_EV(E_HUT_BARB_CITY_NEAR, E_S_HUT, N_("Unit Spared by Barbarians")), + GEN_EV(E_UPRISING, E_S_NATION, N_("Barbarian Uprising")), + GEN_EV(E_CIVIL_WAR, E_S_NATION, N_("Civil War")), + GEN_EV(E_ANARCHY, E_S_NATION, N_("Collapse to Anarchy")), + GEN_EV(E_FIRST_CONTACT, E_S_NATION, N_("First Contact")), + GEN_EV(E_NEW_GOVERNMENT, E_S_NATION, N_("Learned New Government")), + GEN_EV(E_LOW_ON_FUNDS, E_S_NATION, N_("Low Funds")), + GEN_EV(E_POLLUTION, E_S_NATION, N_("Pollution")), + GEN_EV(E_REVOLT_DONE, E_S_NATION, N_("Revolt Ended")), + GEN_EV(E_REVOLT_START, E_S_NATION, N_("Revolt Started")), + GEN_EV(E_SPACESHIP, E_S_NATION, N_("Spaceship Events")), + GEN_EV(E_TREATY_ALLIANCE, E_S_TREATY, N_("Alliance")), + GEN_EV(E_TREATY_BROKEN, E_S_TREATY, N_("Broken")), + GEN_EV(E_TREATY_CEASEFIRE, E_S_TREATY, N_("Cease-fire")), + GEN_EV(E_TREATY_EMBASSY, E_S_TREATY, N_("Embassy")), + GEN_EV(E_TREATY_PEACE, E_S_TREATY, N_("Peace")), + GEN_EV(E_TREATY_SHARED_VISION,E_S_TREATY, N_("Shared Vision")), + GEN_EV(E_UNIT_LOST_ATT, E_S_UNIT, N_("Attack Failed")), + GEN_EV(E_UNIT_WIN_ATT, E_S_UNIT, N_("Attack Succeeded")), + GEN_EV(E_UNIT_BUY, E_S_UNIT, N_("Bought")), + GEN_EV(E_UNIT_BUILT, E_S_UNIT, N_("Built")), + GEN_EV(E_UNIT_LOST, E_S_UNIT, N_("Defender Destroyed")), + GEN_EV(E_UNIT_WIN, E_S_UNIT, N_("Defender Survived")), + GEN_EV(E_UNIT_BECAME_VET, E_S_UNIT, N_("Promoted to Veteran")), + GEN_EV(E_UNIT_UPGRADED, E_S_UNIT, N_("Production Upgraded")), + GEN_EV(E_UNIT_RELOCATED, E_S_UNIT, N_("Relocated")), + GEN_EV(E_UNIT_ORDERS, E_S_UNIT, N_("Orders / goto events")), + GEN_EV(E_WONDER_BUILD, E_S_WONDER, N_("Finished")), + GEN_EV(E_WONDER_OBSOLETE, E_S_WONDER, N_("Made Obsolete")), + GEN_EV(E_WONDER_STARTED, E_S_WONDER, N_("Started")), + GEN_EV(E_WONDER_STOPPED, E_S_WONDER, N_("Stopped")), + GEN_EV(E_WONDER_WILL_BE_BUILT,E_S_WONDER, N_("Will Finish Next Turn")), + GEN_EV(E_AI_DEBUG, E_S_XYZZY, N_("AI Debug messages")), + GEN_EV(E_BROADCAST_REPORT, E_S_XYZZY, N_("Broadcast Report")), + GEN_EV(E_CARAVAN_ACTION, E_S_XYZZY, N_("Caravan actions")), + GEN_EV(E_CHAT_ERROR, E_S_XYZZY, N_("Chat error messages")), + GEN_EV(E_CHAT_MSG, E_S_XYZZY, N_("Chat messages")), + GEN_EV(E_CONNECTION, E_S_XYZZY, N_("Connect/disconnect messages")), + GEN_EV(E_DIPLOMACY, E_S_XYZZY, N_("Diplomatic Message")), + GEN_EV(E_BAD_COMMAND, E_S_XYZZY, N_("Error message from bad command")), + GEN_EV(E_GAME_END, E_S_XYZZY, N_("Game Ended")), + GEN_EV(E_GAME_START, E_S_XYZZY, N_("Game Started")), + GEN_EV(E_NATION_SELECTED, E_S_XYZZY, N_("Nation Selected")), + GEN_EV(E_DESTROYED, E_S_XYZZY, N_("Player Destroyed")), + GEN_EV(E_REPORT, E_S_XYZZY, N_("Report")), + GEN_EV(E_LOG_FATAL, E_S_XYZZY, N_("Server Aborting")), + GEN_EV(E_LOG_ERROR, E_S_XYZZY, N_("Server Problems")), + GEN_EV(E_SETTING, E_S_XYZZY, N_("Server settings changed")), + GEN_EV(E_TURN_BELL, E_S_XYZZY, N_("Turn Bell")), + GEN_EV(E_TUTORIAL, E_S_XYZZY, N_("Tutorial message")), + GEN_EV(E_NEXT_YEAR, E_S_XYZZY, N_("Year Advance")), GEN_EV_TERMINATOR }; @@ -255,17 +288,13 @@ for (i = 0; events[i].enum_name; i++) { 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"); + if (E_S_XYZZY > events[i].esn) { + const char *event_format = Q_(event_sections[events[i].esn]); + int l = 1 + strlen(event_format) + strlen(_(events[i].descr_orig)); - events[i].full_descr = fc_malloc(strlen(_(events[i].descr_orig)) - + strlen(_(events[i].section_orig)) - + strlen(event_format) + 1); - sprintf(events[i].full_descr, event_format, - _(events[i].section_orig), - _(events[i].descr_orig)); + events[i].full_descr = fc_malloc(l); + my_snprintf(events[i].full_descr, l, event_format, + _(events[i].descr_orig)); } else { /* No section part */ events[i].full_descr = _(events[i].descr_orig); @@ -297,7 +326,7 @@ int i; for (i = 0; events[i].enum_name; i++) { - if (events[i].section_orig) { + if (E_S_XYZZY > events[i].esn) { /* We have allocated memory for this event */ free(events[i].full_descr); events[i].full_descr = NULL; Index: common/events.h =================================================================== --- common/events.h (revision 14389) +++ common/events.h (working copy) @@ -115,15 +115,15 @@ E_WONDER_WILL_BE_BUILT, E_DIPLOMACY, E_TREATY_EMBASSY, - E_BAD_COMMAND, /* Illegal command sent from client. */ - E_SETTING, /* Messages for changed server settings */ - E_CHAT_MSG, /* Chatline messages */ - E_MESSAGE_WALL, - E_CHAT_ERROR, /* Chatline errors (bad syntax, etc.) */ - E_CONNECTION, /* Messages about acquired or lost connections */ - E_AI_DEBUG, /* AI debugging messages */ - E_PLAYER_SETTINGS, /* taxes etc */ - E_TECH_GOAL, /* Changed tech goal */ + E_BAD_COMMAND, /* Illegal command sent from client. */ + E_SETTING, /* Messages for changed server settings */ + E_CHAT_MSG, /* Chatline messages */ + E_LOG_FATAL, + E_CHAT_ERROR, /* Chatline errors (bad syntax, etc.) */ + E_CONNECTION, /* Messages about acquired or lost connections */ + E_AI_DEBUG, /* AI debugging messages */ + E_LOG_ERROR, /* Warning messages */ + E_TECH_GOAL, /* Changed tech goal */ /* * 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 @@ -132,8 +132,8 @@ E_LAST }; -extern enum event_type 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); Index: client/options.c =================================================================== --- client/options.c (revision 14389) +++ client/options.c (working copy) @@ -372,8 +372,12 @@ E_CITY_PRODUCTION_CHANGED, E_CITY_MAY_SOON_GROW, E_WORKLIST, E_AI_DEBUG }; - int out_only[] = {E_CHAT_MSG, E_CHAT_ERROR, E_SETTING, E_CONNECTION}; - int all[] = {E_MESSAGE_WALL, E_TUTORIAL}; + int out_only[] = { + E_CHAT_MSG, E_CHAT_ERROR, E_CONNECTION, E_LOG_ERROR, E_SETTING + }; + int all[] = { + E_LOG_FATAL, E_TUTORIAL + }; int i; for (i = 0; i < E_LAST; i++) {
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev