HoverRace
2.0
|
Defines the rules for a particular game session. More...
#include <Rulebook.h>
Classes | |
struct | metas_t |
Public Member Functions | |
Rulebook (Script::Core &scripting, const Util::OS::path_t &basePath) | |
Rulebook (const Rulebook &)=delete | |
~Rulebook () | |
void | AddRule (const std::string &name, const luabind::object &obj) |
luabind::object | CreateDefaultRules () const |
const Util::OS::path_t & | GetBasePath () const |
const std::string & | GetDescription () const |
int | GetMaxPlayers () const |
const metas_t & | GetMetas () const |
const std::string & | GetName () const |
const std::string & | GetTitle () const |
void | Load () const |
Ensure that the rulebook is fully-loaded. More... | |
bool | LoadMetadata () |
Load just enough of the rulebook to retrieve the metadata (title, etc.). More... | |
Rulebook & | operator= (const Rulebook &)=delete |
void | SetMetadata (const std::string &name, const std::string &title, const std::string &description, int maxPlayers) |
void | SetOnLoad (const luabind::object &fn) |
Protected Member Functions | |
void | OnLoad () const |
Private Attributes | |
Util::OS::path_t | basePath |
std::string | defaultName |
std::string | description |
std::shared_ptr< HoverScript::RulebookEnv > | env |
bool | loaded |
int | maxPlayers |
metas_t | metas |
std::string | name |
Script::RegistryRef | onLoad |
std::map< std::string, std::shared_ptr< Rule > > | rules |
Script::Core & | scripting |
std::string | title |
Friends | |
bool | operator< (const Rulebook &lhs, const Rulebook &rhs) |
bool | operator== (const Rulebook &lhs, const Rulebook &rhs) |
Defines the rules for a particular game session.
HoverRace::Client::Rulebook::Rulebook | ( | Script::Core & | scripting, |
const Util::OS::path_t & | basePath | ||
) |
|
delete |
|
inline |
void HoverRace::Client::Rulebook::AddRule | ( | const std::string & | name, |
const luabind::object & | obj | ||
) |
luabind::object HoverRace::Client::Rulebook::CreateDefaultRules | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void HoverRace::Client::Rulebook::Load | ( | ) | const |
Ensure that the rulebook is fully-loaded.
Initially, the rulebook is only partially loaded for speed. This function must be called before a game session starts.
bool HoverRace::Client::Rulebook::LoadMetadata | ( | ) |
Load just enough of the rulebook to retrieve the metadata (title, etc.).
In practice, this just runs the "bootstrap" script in the rulebook directory. If an error occurred while running the script, then this rulebook's metadata will be reset to their default values.
true
If the rulebook loaded successfully, false
otherwise.
|
protected |
|
inline |
void HoverRace::Client::Rulebook::SetOnLoad | ( | const luabind::object & | fn | ) |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |