From 7bcbac3942f6eb97a9c394ade1363effc2d52828 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Thu, 21 Feb 2013 22:26:49 -0500 Subject: [PATCH] Improve that check a little bit --- qcsrc/common/notifications.qc | 2 ++ qcsrc/common/notifications.qh | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 99f1a5452..ae286771a 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -99,6 +99,8 @@ void Dump_Notifications(float fh, float alsoprint) // edit these to match whichever cvars are used for specific notification options NOTIF_WRITE("\n// HARD CODED notification variables:\n", ""); + NOTIF_WRITE("seta notification_version_mismatch_client_error 0 \"Cause a notif error on client if the version in notifications.cfg mismatches the code\"\n", ""); + NOTIF_WRITE("seta notification_version_mismatch_server_error 1 \"Cause a notif error on server if the version in notifications.cfg mismatches the code\"\n", ""); NOTIF_WRITE("seta notification_errors_are_fatal 1 \"If a notification fails upon initialization, cause a Host_Error to stop the program\"\n", ""); NOTIF_WRITE("seta notification_ctf_pickup_team_verbose 1 \"Show extra information if a team mate picks up a flag\"\n", ""); NOTIF_WRITE("seta notification_ctf_pickup_enemy_verbose 1 \"Show extra information if an enemy picks up a flag\"\n", ""); diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index b1e6a2adb..6ca29ae36 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -13,7 +13,7 @@ // This is used to check matches between the config file and the code, // and should be incremented any time you add a new/remove or edit an notification // or any time you change default values or add/edit/remove a special cvar. -#define NOTIF_VERSION 1 +#define NOTIF_VERSION 2 #define NO_MSG -12345 @@ -619,6 +619,8 @@ string arg_slot[NOTIF_MAX_ARGS]; #define NOTIF_ADD_AUTOCVAR(name,default) var float autocvar_notification_##name = default; NOTIF_ADD_AUTOCVAR(version, NOTIF_VERSION) +NOTIF_ADD_AUTOCVAR(version_mismatch_client_error, FALSE) +NOTIF_ADD_AUTOCVAR(version_mismatch_server_error, TRUE) NOTIF_ADD_AUTOCVAR(errors_are_fatal, TRUE) #ifdef SVQC @@ -893,8 +895,15 @@ void RegisterNotifications_First() notif_global_error = FALSE; if(autocvar_notification_version != NOTIF_VERSION) { - notif_global_error = TRUE; - print(sprintf("^1NOTIFICATION VERSION MISMATCH: ^7cvar = %d, code = %d.\n", autocvar_notification_version, NOTIF_VERSION)); + #ifdef CSQC + if(autocvar_notification_version_mismatch_client_error) + #else + if(autocvar_notification_version_mismatch_server_error) + #endif + notif_global_error = TRUE; + + print(sprintf("^1NOTIFICATION VERSION MISMATCH: ^7program = %s, config = %d, code = %d.\n", + "foobar", autocvar_notification_version, NOTIF_VERSION)); } } -- 2.39.2