Show Cvars.h syntax highlighted
/**
**************************************************************************************
*Palisma - Secrets of the Illuminati is an open-source 2D RPG *
*Copyright (C) 2006, Tony Sparks *
* *
*This library is free software; you can redistribute it and/or *
*modify it under the terms of the GNU Lesser General Public *
*License as published by the Free Software Foundation; either *
*version 2.1 of the License, or (at your option) any later version. *
* *
*This library is distributed in the hope that it will be useful, *
*but WITHOUT ANY WARRANTY; without even the implied warranty of *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
*Lesser General Public License for more details. *
* *
*You should have received a copy of the GNU Lesser General Public *
*License along with this library; if not, write to the Free Software *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
**************************************************************************************
*/
#pragma once
#include <string>
#include <map>
#include "mmanager.h"
/**
* Console varible struct - holds
* scriptable variables
*/
struct cvar : public IMMObject {
float fvalue;
std::string svalue;
std::string name;
int flags;
AUTO_SIZE;
cvar():fvalue(0),flags(0) {};
virtual ~cvar(){};
};
/**
====================================
This class stores all console variables
====================================
*/
class Cvars : public IMMObject
{
public:
Cvars(void);
/** Initialize the cvar system */
void Init();
/** Get a cvar float value */
float GetFloatValue( const std::string &cvar_name );
std::string GetStringValue( const std::string &cvar_name );
/** Create a cvar */
bool RegisterCvar( const std::string &name, const std::string &sval, float val, int Flags );
void RemoveCvar( const std::string &cvar_name );
bool SetCvarValue( const std::string &name, float val );
bool SetCvarValue( const std::string &name, const std::string &value);
std::map< std::string, CMMPointer<cvar> >& GetCvars() { return cvarList; };
bool IsValid(const std::string &name);
AUTO_SIZE;
private:
std::map< std::string, CMMPointer<cvar> > cvarList;
public:
virtual ~Cvars(void);
};
/**
==========================================
Console variable flags
==========================================
*/
// Saveable cvar setting
#define CVAR_SAVE 1
// Do not allow changes
#define CVAR_PROTECT 2
// Server Access only
#define CVAR_SERVER 4
// Bindable
#define CVAR_BIND 8
See more files for this project here