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_tr