1.1 --- a/extensions/updater/extension.cpp Thu Feb 26 12:47:56 2009 +1300
1.2 +++ b/extensions/updater/extension.cpp Sat Feb 28 23:14:16 2009 -0500
1.3 @@ -120,6 +120,7 @@
1.4 static void PumpUpdate(void *data)
1.5 {
1.6 String *str;
1.7 + bool new_files = false;
1.8 List<String *>::iterator iter;
1.9
1.10 char path[PLATFORM_MAX_PATH];
1.11 @@ -163,6 +164,7 @@
1.12 smutils->LogMessage(myself,
1.13 "Successfully updated gamedata file \"%s\"",
1.14 part->file);
1.15 + new_files = true;
1.16 }
1.17 skip_create:
1.18 temp = part->next;
1.19 @@ -186,6 +188,31 @@
1.20
1.21 smutils->LogError(myself, "--- END ERRORS FROM AUTOMATIC UPDATER ---");
1.22 }
1.23 +
1.24 + if (new_files)
1.25 + {
1.26 + const char *force_restart = smutils->GetCoreConfigValue("ForceRestartAfterUpdate");
1.27 + if (force_restart == NULL || strcasecmp(force_restart, "yes") != 0)
1.28 + {
1.29 + smutils->LogMessage(myself,
1.30 + "SourceMod has been updated, please reload it or restart your server.");
1.31 + }
1.32 + else
1.33 + {
1.34 + char buffer[255];
1.35 + smutils->Format(buffer,
1.36 + sizeof(buffer),
1.37 + "meta unload %d\n",
1.38 + smutils->GetPluginId());
1.39 + gamehelpers->ServerCommand(buffer);
1.40 + smutils->Format(buffer,
1.41 + sizeof(buffer),
1.42 + "changelevel \"%s\"\n",
1.43 + gamehelpers->GetCurrentMap());
1.44 + gamehelpers->ServerCommand(buffer);
1.45 + gamehelpers->ServerCommand("echo SourceMod has been restarted from an automatic update.\n");
1.46 + }
1.47 + }
1.48 }
1.49
1.50 void SmUpdater::RunThread(IThreadHandle *pHandle)