Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/playerview.cc29
-rw-r--r--src/client/playerview.h1
-rw-r--r--src/game/base/game.cc63
-rwxr-xr-xsrc/ui/modelview.cc4
4 files changed, 92 insertions, 5 deletions
diff --git a/src/client/playerview.cc b/src/client/playerview.cc
index 5cbd408..90d33f7 100644
--- a/src/client/playerview.cc
+++ b/src/client/playerview.cc
@@ -46,7 +46,8 @@ PlayerView::PlayerView(ui::Widget *parent) : ui::Widget(parent)
view_launchbutton = new ui::IconButton(this, "bitmaps/icons/button_launch", "launch");
view_dockbutton = new TargetIconButton(this, "bitmaps/icons/button_dock", "dock", core::Entity::Dockable);
-
+
+ view_homebutton = new ui::IconButton(this, "bitmaps/icons/button_home", "view main");
view_chatbutton = new ui::IconButton(this, "bitmaps/icons/button_chat", "ui_chat");
view_mapbutton = new ui::IconButton(this, "bitmaps/icons/button_map", "ui_map");
view_inventorybutton = new ui::IconButton(this, "bitmaps/icons/button_inventory", "ui_inventory");
@@ -63,6 +64,7 @@ void PlayerView::clear()
view_chat->hide();
view_map->hide();
+ view_inventory->hide();
view_entitymenu->hide();
view_buymenu->hide();
view_trademenu->hide();
@@ -208,7 +210,10 @@ void PlayerView::show_menu(const std::string & args)
// hide other menus
view_entitymenu->hide();
view_trademenu->hide();
-
+ // hide other windows
+ view_chat->hide();
+ view_map->hide();
+ view_inventory->hide();
// requesting the info through game makes sure it is retreived from the server
view_buymenu->set_item( core::game()->request_info(id));
// show buy menu
@@ -227,6 +232,10 @@ void PlayerView::show_menu(const std::string & args)
// hide other menus
view_buymenu->hide();
view_entitymenu->hide();
+ // hide other windows
+ view_chat->hide();
+ view_map->hide();
+ view_inventory->hide();
// show trade menu
view_trademenu->set_itemtype(core::InfoType::find(typestr));
view_trademenu->show();
@@ -234,6 +243,7 @@ void PlayerView::show_menu(const std::string & args)
con_print << "usage: view trade [string] show the trade menu for this type of items" << std::endl;
}
+
} else if (label.compare("hide") == 0) {
// hide all menus
view_buymenu->hide();
@@ -243,6 +253,10 @@ void PlayerView::show_menu(const std::string & args)
// hide other menus
view_buymenu->hide();
view_trademenu->hide();
+ // hide other windows
+ view_chat->hide();
+ view_map->hide();
+ view_inventory->hide();
// show other menus
view_entitymenu->generate(core::localplayer()->view(), label.c_str());
view_entitymenu->show();
@@ -269,7 +283,7 @@ void PlayerView::resize()
// spacer
view_dockbutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
view_launchbutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
- // spacer
+ view_homebutton->set_geometry(l + 3.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
view_inventorybutton->set_geometry(l + 4.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
view_chatbutton->set_geometry(l + 5.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
view_mapbutton->set_geometry(l + 6.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
@@ -335,6 +349,11 @@ void PlayerView::draw()
map()->hide();
chat()->hide();
audio::play("ui/menu");
+
+ // hide other windows
+ view_chat->hide();
+ view_map->hide();
+ view_inventory->hide();
} else if (!view_entitymenu->visible() && !view_buymenu->visible() && !view_trademenu->visible() &&
!inventory()->visible() && !map()->visible() && (!chat()->visible() || chat()->small_view())) {
@@ -346,6 +365,8 @@ void PlayerView::draw()
view_notify->set_size(width() - smallmargin * 3.0f - ui::UI::elementsize.width() * 1.5f, height() - smallmargin * 4.0f);
view_notify->set_location(smallmargin * 2.0f + ui::UI::elementsize.width() * 1.5f, smallmargin * 2.0f);
+
+ view_homebutton->enable();
} else {
// entity without menus, plain view
@@ -354,6 +375,8 @@ void PlayerView::draw()
}
} else {
+ view_homebutton->disable();
+
view_notify->set_geometry(view_map->location(), view_map->size());
if (view_entitymenu->visible()) {
diff --git a/src/client/playerview.h b/src/client/playerview.h
index 5e82be5..e457ef1 100644
--- a/src/client/playerview.h
+++ b/src/client/playerview.h
@@ -87,6 +87,7 @@ private:
ui::IconButton *view_menubutton;
ui::IconButton *view_dockbutton;
ui::IconButton *view_launchbutton;
+ ui::IconButton *view_homebutton;
ui::IconButton *view_chatbutton;
ui::IconButton *view_mapbutton;
ui::IconButton *view_inventorybutton;
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 7cdc066..c6b45ad 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -201,7 +201,7 @@ void Game::func_give(core::Player *player, const std::string &args)
std::string labelstr;
if (!player->control()) {
- player->send("^WNeed a ship to swap!");
+ player->send("^WNeed a ship to swap with!");
}
if (!(is >> labelstr)) {
@@ -263,10 +263,69 @@ void Game::func_give(core::Player *player, const std::string &args)
}
player->set_dirty();
player->sound("game/buy");
+
+ } else if (str.compare("cargo") == 0) {
+ std::string labelstr;
+
+ if (!player->control()) {
+ player->send("^WNeed a ship to load cargo!");
+ }
+
+ if (!(is >> labelstr)) {
+ player->send("Usage: give cargo [string] [int]");
+ return;
+ }
+
+ Cargo *cargo = Cargo::find(labelstr);
+ if (!cargo) {
+ // enable rcon buffering
+ sys::ConsoleInterface::instance()->set_rcon(true);
+ Cargo::list();
+ // disable rcon buffering
+ sys::ConsoleInterface::instance()->set_rcon(false);
+
+ while (sys::ConsoleInterface::instance()->rconbuf().size()) {
+ player->send((*sys::ConsoleInterface::instance()->rconbuf().begin()));
+ sys::ConsoleInterface::instance()->rconbuf().pop_front();
+ }
+
+ player->send("Unkown cargo type '" + labelstr + "'");
+ return;
+ } else {
+ int amount = 0;
+ if (!(is >> amount)) {
+ amount = -1;
+ } else {
+ if (!amount)
+ return;
+ }
+
+ const int max = player->control()->inventory()->capacity_available() / cargo->volume();
+ if (amount < 0 ) {
+ amount = max;
+ }
+
+ if ((amount == 0) || (amount > max)) {
+ player->send("^WNot enough cargo space available!");
+ return;
+ }
+
+ core::Item *item = player->control()->inventory()->find(cargo);
+ if (!item) {
+ item = new core::Item(cargo);
+ player->control()->inventory()->add(item);
+ } else {
+ assert(player->control()->info() == cargo);
+ }
+ item->inc_amount(amount);
+ player->control()->inventory()->set_dirty();
+ player->sound("game/buy");
+ }
} else {
- player->send("Usage: give ship [string]");
+ player->send("Usage: give cargo [string] [int]");
player->send(" give credits [int]");
+ player->send(" give ship [string]");
return;
}
}
diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc
index a6a69ed..7eb1be6 100755
--- a/src/ui/modelview.cc
+++ b/src/ui/modelview.cc
@@ -49,6 +49,10 @@ void ModelView::set_modelname(const char *modelname)
modelview_modelname.clear();
set_background(false);
+
+ modelview_axis.clear();
+ modelview_axis.change_direction(180);
+ modelview_axis.change_pitch(-15);
}
void ModelView::set_color(const math::Color & color)