Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

84 lines
1.6 KiB

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include <stdio.h>
#include <VGUI_Controls.h>
#include "filesystem.h"
#include "HelpText.h"
using namespace vgui;
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CHelpText::CHelpText(const char *mod)
{
char configName[200];
_snprintf(configName,200,"Admin\\HelpFile_%s.vdf",mod);
m_pHelpData = new KeyValues ("Help");
// always load the basic definiton
LoadHelpFile("Admin\\HelpFile.vdf");
// now load mod specific stuff
if( g_pFullFileSystem->FileExists(configName) )
{
LoadHelpFile(configName);
}
// and load an admin mod page if you can find it
if( g_pFullFileSystem->FileExists("Admin\\HelpFile_adminmod.vdf") )
{
LoadHelpFile("Admin\\HelpFile_adminmod.vdf");
}
}
//-----------------------------------------------------------------------------
// Purpose: Destructor
//-----------------------------------------------------------------------------
CHelpText::~CHelpText()
{
m_pHelpData->deleteThis();
}
void CHelpText::LoadHelpFile(const char *filename)
{
if (!m_pHelpData->LoadFromFile(g_pFullFileSystem, filename, true, "PLATFORM"))
{
// failed to load...
}
else
{
}
}
const char *CHelpText::GetHelp(const char *keyname)
{
KeyValues *help = m_pHelpData->FindKey(keyname, true);
if(help)
{
return help->GetString("text");
}
else
{
return NULL;
}
}