|
35 | 35 | #include "steam/steam_gameserver.h" |
36 | 36 | #include <string> |
37 | 37 | #include <sstream> |
| 38 | +#include <fstream> |
38 | 39 | #include "iserver.h" |
39 | 40 |
|
40 | 41 | #include "tier0/memdbgon.h" |
@@ -377,7 +378,7 @@ bool MultiAddonManager::Load(PluginId id, ISmmAPI *ismm, char *error, size_t max |
377 | 378 |
|
378 | 379 | META_CONVAR_REGISTER(FCVAR_RELEASE); |
379 | 380 |
|
380 | | - g_pEngineServer->ServerCommand("exec multiaddonmanager/multiaddonmanager"); |
| 381 | + ParseCfg(); |
381 | 382 |
|
382 | 383 | Message("Plugin loaded successfully!\n"); |
383 | 384 |
|
@@ -447,6 +448,32 @@ void *MultiAddonManager::OnMetamodQuery(const char *iface, int *ret) |
447 | 448 | return static_cast<IMultiAddonManager*>(&g_MultiAddonManager); |
448 | 449 | } |
449 | 450 |
|
| 451 | +void MultiAddonManager::ParseCfg() |
| 452 | +{ |
| 453 | + char szPath[MAX_PATH]; |
| 454 | + V_snprintf(szPath, sizeof(szPath), "%s/csgo/cfg/multiaddonmanager/multiaddonmanager.cfg", Plat_GetGameDirectory()); |
| 455 | + std::ifstream cfgFile(szPath); |
| 456 | + |
| 457 | + if (!cfgFile.is_open()) |
| 458 | + { |
| 459 | + Message("Unable to open & execute custom cfg file \"multiaddonmanager/multiaddonmanager\"\n"); |
| 460 | + return; |
| 461 | + } |
| 462 | + |
| 463 | + Message("Executing custom cfg file \"multiaddonmanager/multiaddonmanager\"\n"); |
| 464 | + |
| 465 | + std::string strCommand; |
| 466 | + |
| 467 | + while (std::getline(cfgFile, strCommand)) |
| 468 | + { |
| 469 | + if (!strCommand.empty() && strCommand.back() == '\r') |
| 470 | + strCommand.pop_back(); |
| 471 | + |
| 472 | + if (!strCommand.empty()) |
| 473 | + g_pEngineServer->ServerCommand(strCommand.c_str()); |
| 474 | + } |
| 475 | +} |
| 476 | + |
450 | 477 | void MultiAddonManager::BuildAddonPath(const char *pszAddon, char *buf, size_t len, bool bLegacy = false) |
451 | 478 | { |
452 | 479 | // The workshop on a dedicated server is stored relative to the working directory for whatever reason |
|
0 commit comments