2012-11-08 14:09:35 -05:00
|
|
|
|
2012-07-09 11:53:17 -04:00
|
|
|
#pragma once
|
2012-11-08 14:09:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef USE_SQUIRREL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-09 11:53:17 -04:00
|
|
|
#include <sqrat.h>
|
|
|
|
|
|
|
|
class cPlugin;
|
|
|
|
class cPlayer;
|
|
|
|
|
|
|
|
class cSquirrelCommandBinder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cSquirrelCommandBinder();
|
|
|
|
~cSquirrelCommandBinder();
|
|
|
|
|
|
|
|
bool HandleCommand( const std::string & a_Command, cPlayer* a_Player );
|
|
|
|
|
|
|
|
bool BindCommand( const std::string & a_Command, const std::string & a_Permission, cPlugin* a_Plugin, Sqrat::Function a_Callback);
|
|
|
|
|
|
|
|
void ClearBindings();
|
|
|
|
void RemoveBindingsForPlugin( cPlugin* a_Plugin );
|
|
|
|
private:
|
|
|
|
struct BoundFunction
|
|
|
|
{
|
|
|
|
Sqrat::Function Callback;
|
|
|
|
cPlugin *Plugin;
|
|
|
|
std::string Permission;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::map< std::string, BoundFunction > CommandMap;
|
|
|
|
CommandMap m_BoundCommands;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-08 14:09:35 -05:00
|
|
|
#endif // USE_SQUIRREL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|