2014-08-04 14:21:40 +04:00
|
|
|
// vim: set ts=4 sw=4 tw=99 noet:
|
|
|
|
//
|
|
|
|
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
|
|
// Copyright (C) The AMX Mod X Development Team.
|
|
|
|
//
|
|
|
|
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
|
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
|
|
// https://alliedmods.net/amxmodx-license
|
|
|
|
|
|
|
|
//
|
|
|
|
// Ham Sandwich Module
|
|
|
|
//
|
|
|
|
|
2018-09-28 17:51:54 +03:00
|
|
|
#include <amxxmodule.h>
|
2014-04-09 18:35:46 +04:00
|
|
|
#include "ham_const.h"
|
|
|
|
#include "hooklist.h"
|
|
|
|
#include "offsets.h"
|
|
|
|
|
2018-09-28 17:51:54 +03:00
|
|
|
IGameConfig *CommonConfig;
|
|
|
|
IGameConfigManager *ConfigManager;
|
2014-04-09 18:35:46 +04:00
|
|
|
|
2018-09-28 17:51:54 +03:00
|
|
|
int ReadConfig(void)
|
2014-04-09 18:35:46 +04:00
|
|
|
{
|
2018-09-28 17:51:54 +03:00
|
|
|
ConfigManager = MF_GetConfigManager();
|
2014-04-09 18:35:46 +04:00
|
|
|
|
2018-09-28 17:51:54 +03:00
|
|
|
char error[256] = "";
|
2014-04-09 18:35:46 +04:00
|
|
|
|
2018-09-28 17:51:54 +03:00
|
|
|
if (!ConfigManager->LoadGameConfigFile("common.games", &CommonConfig, error, sizeof error))
|
2014-04-09 18:35:46 +04:00
|
|
|
{
|
2018-09-28 17:51:54 +03:00
|
|
|
MF_Log("common.games gamedata could not be read: %s", error);
|
|
|
|
return -1;
|
2014-04-09 18:35:46 +04:00
|
|
|
}
|
|
|
|
|
2018-09-28 17:51:54 +03:00
|
|
|
TypeDescription value;
|
2014-04-09 18:35:46 +04:00
|
|
|
|
2018-09-28 17:51:54 +03:00
|
|
|
if (CommonConfig->GetOffset("pev", &value))
|
2014-04-09 18:35:46 +04:00
|
|
|
{
|
2018-09-28 17:51:54 +03:00
|
|
|
Offsets.SetPev(value.fieldOffset);
|
2014-04-09 18:35:46 +04:00
|
|
|
}
|
|
|
|
|
2018-09-28 17:51:54 +03:00
|
|
|
if (CommonConfig->GetOffset("base", &value))
|
2014-04-09 18:35:46 +04:00
|
|
|
{
|
2018-09-28 17:51:54 +03:00
|
|
|
Offsets.SetBase(value.fieldOffset);
|
2014-04-09 18:35:46 +04:00
|
|
|
}
|
|
|
|
|
2018-09-28 17:51:54 +03:00
|
|
|
for (auto index = 0; index < HAM_LAST_ENTRY_DONT_USE_ME_LOL; ++index)
|
2014-04-09 18:35:46 +04:00
|
|
|
{
|
2018-09-28 17:51:54 +03:00
|
|
|
if (CommonConfig->GetOffset(hooklist[index].name, &value))
|
2014-04-09 18:35:46 +04:00
|
|
|
{
|
2018-09-28 17:51:54 +03:00
|
|
|
hooklist[index].isset = 1;
|
|
|
|
hooklist[index].vtid = value.fieldOffset;
|
2014-04-09 18:35:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|