Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base/cargo.cc')
-rw-r--r--src/game/base/cargo.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/game/base/cargo.cc b/src/game/base/cargo.cc
index c7f2492..41cce1b 100644
--- a/src/game/base/cargo.cc
+++ b/src/game/base/cargo.cc
@@ -7,24 +7,30 @@
#include <assert.h>
#include <cmath>
+#include "sys/sys.h"
+#include "filesystem/inifile.h"
+#include "auxiliary/functions.h"
+#include "core/func.h"
#include "base/game.h"
#include "base/cargo.h"
#include "base/cargopod.h"
-#include "filesystem/inifile.h"
-#include "auxiliary/functions.h"
-#include "sys/sys.h"
namespace game
{
core::InfoType *Cargo::cargo_infotype = 0;
+void func_list_cargo(const std::string &args)
+{
+ Cargo::list();
+}
+
// loads cargo types from ini file
bool Cargo::init()
{
- // initialize commodities InfoType
- Cargo::cargo_infotype = new core::InfoType("cargo");
+ // initialize cargo InfoType
+ cargo_infotype = new core::InfoType("cargo");
filesystem::IniFile cargoini;
cargoini.open("ini/cargo");
@@ -47,8 +53,7 @@ bool Cargo::init()
if (cargoini.section().compare("cargo") == 0) {
if (cargoini.got_key_label("label", str)) {
- cargo->set_label(std::string(str));
- count++;
+ cargo->set_label(str);
continue;
} else if (cargoini.got_key_string("name", str)) {
@@ -80,6 +85,7 @@ bool Cargo::init()
if (cargoini.got_section("cargo")) {
cargo = new Cargo();
+ count++;
} else if (cargoini.got_section()) {
cargoini.unknown_section();
@@ -91,6 +97,10 @@ bool Cargo::init()
con_debug << " " << cargoini.name() << " " << count << " cargo types" << std::endl;
cargoini.close();
+
+ core::Func *func = core::Func::add("list_cargo", func_list_cargo);
+ func->set_info("list available cargo types");
+
return true;
}