diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/base/base.cc | 94 | ||||
-rw-r--r-- | src/game/base/base.h | 20 |
2 files changed, 60 insertions, 54 deletions
diff --git a/src/game/base/base.cc b/src/game/base/base.cc index a5492ea..dfde132 100644 --- a/src/game/base/base.cc +++ b/src/game/base/base.cc @@ -26,16 +26,26 @@ namespace base { -/* -- engine game functions ---------------------------------------- */ +/* -- class Base static members ----------------------------------- */ + +// game variables +core::Cvar *Base::g_impulsespeed = 0; +core::Cvar *Base::g_impulseacceleration = 0; +core::Cvar *Base::g_strafespeed = 0; +core::Cvar *Base::g_jumppointrange = 0; +core::Cvar *Base::g_devel = 0; -/// list the ship model registry -void func_list_ship(std::string const &args) +core::Zone *Base::default_zone = 0; +ShipModel *Base::default_shipmodel = 0; + +// list the ship model registry +void Base::func_list_ship(std::string const &args) { ShipModel::list(); } -/// a player joins the game -void func_join(core::Player *player, std::string const &args) +// a player joins the game +void Base::func_join(core::Player *player, std::string const &args) { if (player->control()) return; @@ -59,8 +69,8 @@ void func_join(core::Player *player, std::string const &args) player->player_dirty = true; } -/// a player joins the spectators -void func_spectate(core::Player *player, std::string const &args) +// a player joins the spectators +void Base::func_spectate(core::Player *player, std::string const &args) { if (!player->control()) return; @@ -80,8 +90,8 @@ void func_spectate(core::Player *player, std::string const &args) player->set_view(0); } -/// a player buys a ship -void func_buy(core::Player *player, std::string const &args) +// a player buys a ship +void Base::func_buy(core::Player *player, std::string const &args) { std::string shipname; @@ -125,8 +135,8 @@ void func_buy(core::Player *player, std::string const &args) } } -/// a player sends standard hails -void func_hail(core::Player *player, std::string const &args) +// a player sends standard hails +void Base::func_hail(core::Player *player, std::string const &args) { std::string target; std::istringstream is(args); @@ -148,8 +158,8 @@ void func_hail(core::Player *player, std::string const &args) core::server()->send_sound(targetplayer, "com/hail"); } -/// a player actives the hyperspace jump drive on his ship -void func_jump(core::Player *player, std::string const &args) +// a player actives the hyperspace jump drive on his ship +void Base::func_jump(core::Player *player, std::string const &args) { if (!player->control()) return; @@ -159,8 +169,8 @@ void func_jump(core::Player *player, std::string const &args) ship->jump(args); } -/// a player actives the kinetic impulse drive on his ship -void func_impulse(core::Player *player, std::string const &args) +// a player actives the kinetic impulse drive on his ship +void Base::func_impulse(core::Player *player, std::string const &args) { if (!player->control()) return; @@ -170,8 +180,8 @@ void func_impulse(core::Player *player, std::string const &args) ship->impulse(); } -/// a player sends a docking request -void func_dock(core::Player *player,core::Entity *entity) +// a player sends a docking request +void Base::func_dock(core::Player *player,core::Entity *entity) { if (!player->control()) return; @@ -196,8 +206,8 @@ void func_dock(core::Player *player,core::Entity *entity) core::server()->send(player, "^BDocking at " + entity->name() + "^B..."); } -/// launch request -void func_launch(core::Player *player, std::string const &args) +// launch request +void Base::func_launch(core::Player *player, std::string const &args) { if (!player->control()) return; @@ -217,19 +227,6 @@ void func_launch(core::Player *player, std::string const &args) player->set_view(0); } -/* -- class Base static members ----------------------------------- */ - -// game variables -core::Cvar *Base::g_impulsespeed = 0; -core::Cvar *Base::g_impulseacceleration = 0; -core::Cvar *Base::g_strafespeed = 0; -core::Cvar *Base::g_jumppointrange = 0; -core::Cvar *Base::g_devel = 0; - -// game defaults -core::Zone *Base::default_zone = 0; -ShipModel *Base::default_shipmodel = 0; - /* -- class Base -------------------------------------------------- */ Base::Base() : core::Module("base", "Project::OSiRiON", true) @@ -256,34 +253,35 @@ void Base::init() return; } - // add engine game functions + // add engine functions core::Func *func = 0; + + func = core::Func::add("list_ship", Base::func_list_ship); + func->set_info("list ship statistics"); - func = core::Func::add("join", (core::GameFuncPtr) func_join); + func = core::Func::add("join", Base::func_join); func->set_info("join the game"); - func = core::Func::add("hail", (core::GameFuncPtr) func_hail); + + func = core::Func::add("hail", Base::func_hail); func->set_info("send a standard hail"); - func = core::Func::add("spectate", (core::GameFuncPtr) func_spectate); + + func = core::Func::add("spectate", Base::func_spectate); func->set_info("leave the game and spectate"); - func = core::Func::add("buy", (core::GameFuncPtr) func_buy); + func = core::Func::add("buy", Base::func_buy); func->set_info("buy a ship"); - func = core::Func::add("@dock", (core::TargetFuncPtr) func_dock); - func->set_info("dock with target object"); - - func = core::Func::add("launch", (core::GameFuncPtr) func_launch); - func->set_info("launch to space when docked"); - - func = core::Func::add("jump", (core::GameFuncPtr) func_jump); + func = core::Func::add("jump", Base::func_jump); func->set_info("[string] activate or deactivate hyperspace jump drive"); - func = core::Func::add("impulse", (core::GameFuncPtr) func_impulse); + func = core::Func::add("impulse", Base::func_impulse); func->set_info("activate are deactive kinetic impulse drive"); - // add engine core functions - func = core::Func::add("list_ship", (core::FuncPtr) func_list_ship); - func->set_info("list ship statistics"); + func = core::Func::add("launch", Base::func_launch); + func->set_info("launch to space when docked"); + + func = core::Func::add("@dock", Base::func_dock); + func->set_info("dock with target object"); // add engine variables g_impulsespeed = core::Cvar::get("g_impulsespeed", "15", core::Cvar::Game | core::Cvar::Archive); diff --git a/src/game/base/base.h b/src/game/base/base.h index fcf39d1..6979335 100644 --- a/src/game/base/base.h +++ b/src/game/base/base.h @@ -63,12 +63,6 @@ public: /// game variable: enable or disable development mode static core::Cvar *g_devel; - /// default zone - static core::Zone *default_zone; - - /// default ship model - static ShipModel *default_shipmodel; - protected: /// initialize the game void init(); @@ -86,6 +80,20 @@ private: bool load_ships(); + static core::Zone *default_zone; + static ShipModel *default_shipmodel; + + /* ---- engine functions ----------------------------------- */ + + static void func_list_ship(std::string const &args); + static void func_join(core::Player *player, std::string const &args); + static void func_spectate(core::Player *player, std::string const &args); + static void func_buy(core::Player *player, std::string const &args); + static void func_hail(core::Player *player, std::string const &args); + static void func_jump(core::Player *player, std::string const &args); + static void func_impulse(core::Player *player, std::string const &args); + static void func_dock(core::Player *player,core::Entity *entity); + static void func_launch(core::Player *player, std::string const &args); }; } |