Ok then,
zombiereloaded.sp
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <hacks>
#undef REQUIRE_PLUGIN
#include <market>
#define VERSION "3.0-dev"
// Core includes.
#include "zr/zombiereloaded"
#include "zr/cvars"
#include "zr/config"
// .. more irrelevant includes (to this problem)
cvars.inc
Code:
/**
* List of cvars used by the plugin.
*/
enum CvarsList
{
Handle:CVAR_CONFIG_PATH_1,
Handle:CVAR_CONFIG_PATH_2,
Handle:CVAR_CONFIG_PATH_3,
Handle:CVAR_CONFIG_PATH_4,
Handle:CVAR_CONFIG_PATH_5,
Handle:CVAR_CONFIG_PATH_6,
// Many more handles, but again, irrelevant.
}
/**
* Array to store cvar data in.
*/
new g_hCvarsList[CvarsList];
config.inc
Code:
/**
* Load config file.
*
* @param file The cvar define of the path to the file.
* @return True if the file exists, false if not.
*/
bool:ConfigGetFilePath(CvarsList:cvar, String:path[])
{
// Get cvar's path.
decl String:filepath[PLATFORM_MAX_PATH];
GetConVarString(g_hCvarsList[cvar], filepath, sizeof(filepath));
// Build full path in return string.
BuildPath(Path_SM, path, PLATFORM_MAX_PATH, filepath);
return FileExists(path);
}
Grr, I think I know why the code I posted earlier was working.
In my enum I have all my entries with the "Handle" datatype, and I define the array as an int array (which is fine), but it seems that all this time the compiler has been reading the datatypes of the enum entry and so all my direct calls to it (eg GetConVarBool(g_hCvarsList[CVAR_BLAH])) returned no error because 'CVAR_BLAH' was defined as a handle.
But in this case, I'm using a variable to pass that enum entry onto a function, so the compiler doesn't know the datatype of whats being passed into the function until it happens. I'm lucky in this case that all of my entries are handles, so to fx this i can just define g_hCvarsList as a handle and the warning goes away.
Thanks for the help. Just going through all the code and thinking about everything helped me realize the problem. Hope what I said made sense so no one else has this problem!
Thanks again,
Greyscale
EDIT: Actually putting a Handle: tag on the array in the ConfigGetFilePath function got rid of the error too. I think it's a better solution.
__________________