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/Makefile.am2
-rw-r--r--src/client/client.cc13
-rw-r--r--src/client/client.h1
-rw-r--r--src/client/gamewindow.cc105
-rw-r--r--src/client/gamewindow.h70
-rw-r--r--src/client/inventorywindow.cc25
-rw-r--r--src/client/mapwindow.cc4
-rw-r--r--src/client/reputationwindow.cc232
-rw-r--r--src/client/reputationwindow.h68
-rw-r--r--src/game/base/ship.cc6
10 files changed, 465 insertions, 61 deletions
diff --git a/src/client/Makefile.am b/src/client/Makefile.am
index cd87d63..fccf2d6 100644
--- a/src/client/Makefile.am
+++ b/src/client/Makefile.am
@@ -35,6 +35,7 @@ noinst_HEADERS = \
mapwidget.h \
mapwindow.h \
notifications.h \
+ reputationwindow.h \
savegamemenu.h \
soundext.h \
targeticonbutton.h \
@@ -70,6 +71,7 @@ libclient_la_SOURCES = \
mapwidget.cc \
mapwindow.cc \
notifications.cc \
+ reputationwindow.cc \
savegamemenu.cc \
soundext.cc \
targeticonbutton.cc \
diff --git a/src/client/client.cc b/src/client/client.cc
index 4d40e78..128ac7f 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -153,7 +153,10 @@ void Client::init(int count, char **arguments)
func->set_info("toggle chat bar");
func = core::Func::add("ui_inventory", func_ui_inventory);
- func->set_info("toggle inventory");
+ func->set_info("toggle inventory window");
+
+ func = core::Func::add("ui_reputation", func_ui_reputation);
+ func->set_info("toggle reputation window");
func = core::Func::add("ui_map", func_ui_map);
func->set_info("toggle map");
@@ -586,6 +589,14 @@ void Client::func_ui_inventory(std::string const &args)
}
}
+// used by keybinds to open the reputation view
+void Client::func_ui_reputation(std::string const &args)
+{
+ if (client()->connected() && client()->mainwindow()->gamewindow()->visible()) {
+ client()->mainwindow()->gamewindow()->toggle_reputation();
+ }
+}
+
// used by keybinds to open the map view
void Client::func_ui_map(std::string const &args)
{
diff --git a/src/client/client.h b/src/client/client.h
index 6430753..f4bfcf3 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -100,6 +100,7 @@ private:
static void func_ui_chat(std::string const &args);
static void func_ui_chatbar(std::string const &args);
static void func_ui_inventory(std::string const &args);
+ static void func_ui_reputation(std::string const &args);
static void func_ui_map(std::string const &args);
static void func_ui_menu(std::string const &args);
diff --git a/src/client/gamewindow.cc b/src/client/gamewindow.cc
index 2ad1db4..01e1e81 100644
--- a/src/client/gamewindow.cc
+++ b/src/client/gamewindow.cc
@@ -10,8 +10,20 @@
#include "core/info.h"
#include "core/application.h"
#include "ui/ui.h"
+
#include "client/targeticonbutton.h"
+
#include "client/gamewindow.h"
+#include "client/hud.h"
+
+#include "client/chat.h"
+#include "client/inventorywindow.h"
+#include "client/mapwindow.h"
+#include "client/reputationwindow.h"
+
+#include "client/buymenu.h"
+#include "client/entitymenu.h"
+#include "client/trademenu.h"
namespace client
{
@@ -36,6 +48,7 @@ GameWindow::GameWindow(ui::Widget *parent) : ui::Window(parent)
gamewindow_buymenu = new BuyMenu(this);
gamewindow_trademenu = new TradeMenu(this);
gamewindow_inventory = new InventoryWindow(this);
+ gamewindow_reputation = new ReputationWindow(this);
gamewindow_chat = new Chat(this);
// icon buttons
@@ -52,6 +65,7 @@ GameWindow::GameWindow(ui::Widget *parent) : ui::Window(parent)
gamewindow_chatbutton = new ui::IconButton(this, "bitmaps/icons/button_chat", "ui_chat");
gamewindow_mapbutton = new ui::IconButton(this, "bitmaps/icons/button_map", "ui_map");
gamewindow_inventorybutton = new ui::IconButton(this, "bitmaps/icons/button_ship", "ui_inventory");
+ gamewindow_reputationbutton = new ui::IconButton(this, "bitmaps/icons/button_reputation", "ui_reputation");
}
GameWindow::~GameWindow()
@@ -65,6 +79,7 @@ void GameWindow::clear()
gamewindow_chat->hide();
gamewindow_map->hide();
gamewindow_inventory->hide();
+ gamewindow_reputation->hide();
gamewindow_entitymenu->hide();
gamewindow_buymenu->hide();
gamewindow_trademenu->hide();
@@ -98,6 +113,10 @@ void GameWindow::toggle_map()
if (gamewindow_trademenu->visible()) {
gamewindow_trademenu->hide();
}
+
+ if (gamewindow_reputation->visible()) {
+ gamewindow_reputation->hide();
+ }
}
map()->toggle();
@@ -120,6 +139,11 @@ void GameWindow::toggle_inventory()
map()->hide();
}
+ if (gamewindow_reputation->visible()) {
+ gamewindow_reputation->hide();
+ }
+
+
if (gamewindow_entitymenu->visible()) {
gamewindow_entitymenu->hide();
}
@@ -130,15 +154,48 @@ void GameWindow::toggle_inventory()
if (gamewindow_trademenu->visible()) {
gamewindow_trademenu->hide();
- }
+ }
+
+ inventory()->show();
+
+ } else {
+ inventory()->hide();
}
+}
- inventory()->toggle();
+void GameWindow::toggle_reputation()
+{
-/* if (inventory()->visible() && chat()->visible() && chat()->small_view()) {
- chat()->raise();
+ if (!reputation()->visible()) {
+ if (chat()->visible() && !chat()->small_view()) {
+ chat()->hide();
+ }
+
+ if (map()->visible()) {
+ map()->hide();
+ }
+
+ if (gamewindow_inventory->visible()) {
+ gamewindow_inventory->hide();
+ }
+
+ if (gamewindow_entitymenu->visible()) {
+ gamewindow_entitymenu->hide();
+ }
+
+ if (gamewindow_buymenu->visible()) {
+ gamewindow_buymenu->hide();
+ }
+
+ if (gamewindow_trademenu->visible()) {
+ gamewindow_trademenu->hide();
+ }
+
+ reputation()->show();
+
+ } else {
+ reputation()->hide();
}
-*/
}
void GameWindow::toggle_chat()
@@ -155,6 +212,10 @@ void GameWindow::toggle_chat()
inventory()->hide();
}
+ if (gamewindow_reputation->visible()) {
+ gamewindow_reputation->hide();
+ }
+
if (gamewindow_entitymenu->visible()) {
gamewindow_entitymenu->hide();
}
@@ -210,6 +271,7 @@ void GameWindow::show_menu(const std::string & args)
gamewindow_chat->hide();
gamewindow_map->hide();
gamewindow_inventory->hide();
+ gamewindow_reputation->hide();
// requesting the info through game makes sure it is retreived from the server
gamewindow_buymenu->set_item( core::game()->request_info(id));
// show buy menu
@@ -232,6 +294,7 @@ void GameWindow::show_menu(const std::string & args)
gamewindow_chat->hide();
gamewindow_map->hide();
gamewindow_inventory->hide();
+ gamewindow_reputation->hide();
// show trade menu
gamewindow_trademenu->set_itemtype(core::InfoType::find(typestr));
gamewindow_trademenu->show();
@@ -253,6 +316,7 @@ void GameWindow::show_menu(const std::string & args)
gamewindow_chat->hide();
gamewindow_map->hide();
gamewindow_inventory->hide();
+ gamewindow_reputation->hide();
// show other menus
gamewindow_entitymenu->generate(core::localplayer()->view(), label.c_str());
gamewindow_entitymenu->show();
@@ -272,7 +336,7 @@ void GameWindow::resize()
// icons
const float icon_margin = 4.0f;
const float icon_size = 48.0f;
- const float icon_count = 10;
+ const float icon_count = 11;
const float l = (width() - ((icon_count + 1) * icon_margin) - (icon_count * icon_size)) * 0.5f;
gamewindow_menubutton->set_geometry(l, icon_margin, icon_size, icon_size);
@@ -287,6 +351,7 @@ void GameWindow::resize()
gamewindow_inventorybutton->set_geometry(l + 7.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
gamewindow_chatbutton->set_geometry(l + 8.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
gamewindow_mapbutton->set_geometry(l + 9.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
+ gamewindow_reputationbutton->set_geometry(l + 10.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size);
// reposition buy menu
gamewindow_buymenu->event_resize();
@@ -306,9 +371,13 @@ void GameWindow::resize()
gamewindow_map->set_size(width() - smallmargin * 2, height() - smallmargin * 4);
gamewindow_map->set_location(smallmargin, smallmargin * 2);
- // reposition inventory
+ // resize inventory window
gamewindow_inventory->set_size(width() - smallmargin * 2, height() - smallmargin * 4);
gamewindow_inventory->set_location(smallmargin, smallmargin * 2);
+
+ // resize reputation window
+ gamewindow_reputation->set_size(width() - smallmargin * 2, height() - smallmargin * 4);
+ gamewindow_reputation->set_location(smallmargin, smallmargin * 2);
}
void GameWindow::draw()
@@ -351,9 +420,18 @@ void GameWindow::draw()
gamewindow_chat->hide();
gamewindow_map->hide();
gamewindow_inventory->hide();
-
- } else if (!gamewindow_entitymenu->visible() && !gamewindow_buymenu->visible() && !gamewindow_trademenu->visible() &&
- !inventory()->visible() && !map()->visible() && (!chat()->visible() || chat()->small_view())) {
+ gamewindow_reputation->hide();
+
+ } else if (
+ !gamewindow_entitymenu->visible() &&
+ !gamewindow_buymenu->visible() &&
+ !gamewindow_trademenu->visible() &&
+ !inventory()->visible() &&
+ !reputation()->visible() &&
+ !map()->visible() &&
+ (!chat()->visible() || chat()->small_view())
+ )
+ {
// show the menu if there's no other window open
gamewindow_entitymenu->show();
@@ -386,7 +464,7 @@ void GameWindow::draw()
gamewindow_trademenu->hide();
}
- if (!map()->visible() && !chat()->visible() && !inventory()->visible()) {
+ if (!map()->visible() && !chat()->visible() && !inventory()->visible() && !reputation()->visible()) {
gamewindow_hud->set_focus();
}
@@ -425,6 +503,11 @@ bool GameWindow::on_keypress(const int key, const unsigned int modifier)
return true;
}
+ if (gamewindow_reputation->visible()) {
+ gamewindow_reputation->hide();
+ return true;
+ }
+
if (map()->visible()) {
map()->hide();
return true;
diff --git a/src/client/gamewindow.h b/src/client/gamewindow.h
index 158e6ea..6808eac 100644
--- a/src/client/gamewindow.h
+++ b/src/client/gamewindow.h
@@ -7,23 +7,24 @@
#ifndef __INCLUDED_CLIENT_GAMEWINDOW_H__
#define __INCLUDED_CLIENT_GAMEWINDOW_H__
+
#include "ui/window.h"
#include "ui/label.h"
#include "ui/iconbutton.h"
-#include "client/hud.h"
-
-#include "client/chat.h"
-#include "client/inventorywindow.h"
-#include "client/mapwindow.h"
-
-#include "client/buymenu.h"
-#include "client/entitymenu.h"
-#include "client/trademenu.h"
-
namespace client
{
+class HUD;
+class Chat;
+class MapWindow;
+class InventoryWindow;
+class ReputationWindow;
+
+class EntityMenu;
+class BuyMenu;
+class TradeMenu;
+
/**
* @brief the game user interface base widget
* The GameWindow is drawn if core::localcontrol() is set.
@@ -44,6 +45,9 @@ public:
/// toggle inventory window
void toggle_inventory();
+
+ /// toggle reputation window
+ void toggle_reputation();
/// togge chat window
void toggle_chat();
@@ -70,6 +74,10 @@ public:
return gamewindow_inventory;
}
+ inline ReputationWindow *reputation() {
+ return gamewindow_reputation;
+ }
+
inline EntityMenu *menu() {
return gamewindow_entitymenu;
}
@@ -82,30 +90,30 @@ protected:
virtual void resize();
private:
- HUD *gamewindow_hud;
- Chat *gamewindow_chat;
- MapWindow *gamewindow_map;
- InventoryWindow *gamewindow_inventory;
-
- EntityMenu *gamewindow_entitymenu;
- BuyMenu *gamewindow_buymenu;
- TradeMenu *gamewindow_trademenu;
-
- ui::IconButton *gamewindow_menubutton;
- ui::IconButton *gamewindow_freeflightbutton;
- ui::IconButton *gamewindow_gotobutton;
- ui::IconButton *gamewindow_dockbutton;
- ui::IconButton *gamewindow_launchbutton;
- ui::IconButton *gamewindow_formationbutton;
- ui::IconButton *gamewindow_homebutton;
- ui::IconButton *gamewindow_chatbutton;
- ui::IconButton *gamewindow_mapbutton;
- ui::IconButton *gamewindow_inventorybutton;
-
+ HUD *gamewindow_hud;
+ Chat *gamewindow_chat;
+ MapWindow *gamewindow_map;
+ InventoryWindow *gamewindow_inventory;
+ ReputationWindow *gamewindow_reputation;
+
+ EntityMenu *gamewindow_entitymenu;
+ BuyMenu *gamewindow_buymenu;
+ TradeMenu *gamewindow_trademenu;
+
+ ui::IconButton *gamewindow_menubutton;
+ ui::IconButton *gamewindow_freeflightbutton;
+ ui::IconButton *gamewindow_gotobutton;
+ ui::IconButton *gamewindow_dockbutton;
+ ui::IconButton *gamewindow_launchbutton;
+ ui::IconButton *gamewindow_formationbutton;
+ ui::IconButton *gamewindow_homebutton;
+ ui::IconButton *gamewindow_chatbutton;
+ ui::IconButton *gamewindow_mapbutton;
+ ui::IconButton *gamewindow_inventorybutton;
+ ui::IconButton *gamewindow_reputationbutton;
}; // class GameWindow
} // namepace client
-
#endif // __INCLUDED_CLIENT_GAMEWINDOW_H__
diff --git a/src/client/inventorywindow.cc b/src/client/inventorywindow.cc
index 0a60259..2d8ac91 100644
--- a/src/client/inventorywindow.cc
+++ b/src/client/inventorywindow.cc
@@ -92,6 +92,7 @@ void InventoryWindow::toggle()
else
show();
}
+
void InventoryWindow::update_inventory()
{
const float icon_size = 24.0f; // small icons
@@ -225,25 +226,23 @@ void InventoryWindow::resize()
inventorywindow_closebutton->set_size(inventorywindow_titlelabel->font()->height(), inventorywindow_titlelabel->font()->height());
inventorywindow_closebutton->set_location(inventorywindow_titlelabel->width() - inventorywindow_closebutton->width(), 0);
- // resize inventory listview
- inventorywindow_listview->set_size(ui::UI::elementsize.width(), height() -icon_size - padding * 8.0f);
- inventorywindow_listview->set_location(padding, padding * 6.0f);
-
+ // resize inventory text
inventorywindow_inventorytext->set_size(ui::UI::elementsize.width(), padding * 2.0f);
- inventorywindow_inventorytext->set_location(inventorywindow_listview->left(), padding * 3.0f);
+ inventorywindow_inventorytext->set_location(inventorywindow_titlelabel->left(), inventorywindow_titlelabel->bottom() + padding);
+ // resize inventory listview
+ inventorywindow_listview->set_location(inventorywindow_titlelabel->left(), inventorywindow_inventorytext->bottom() + padding);
+ inventorywindow_listview->set_size(ui::UI::elementsize.width(), height() - icon_size - padding * 3.0f - inventorywindow_inventorytext->bottom());
+
inventorywindow_shipbutton->set_size(icon_size, icon_size);
inventorywindow_shipbutton->set_location(inventorywindow_inventorytext->left(), height() - icon_size - padding);
inventorywindow_ejectbutton->set_size(icon_size, icon_size);
inventorywindow_ejectbutton->set_location(inventorywindow_inventorytext->right() - icon_size, height() - icon_size - padding);
-// inventorywindow_mountbutton->set_size(icon_size, icon_size);
-// inventorywindow_mountbutton->set_location(inventorywindow_ejectbutton->left() - icon_size - padding, height() - icon_size - padding);
-
// resize modelview
- inventorywindow_modelview->set_size( width() - inventorywindow_listview->right() - padding * 2.0f ,ui::UI::elementsize.width());
- inventorywindow_modelview->set_location(inventorywindow_listview->right() + padding, padding * 3.0f);
+ inventorywindow_modelview->set_size( width() - inventorywindow_inventorytext->right() - padding * 2.0f ,ui::UI::elementsize.width());
+ inventorywindow_modelview->set_location(inventorywindow_inventorytext->right() + padding, inventorywindow_inventorytext->top());
// modelview title label
inventorywindow_modelnamelabel->set_location(0, 0);
@@ -415,9 +414,9 @@ void InventoryWindow::set_info(const core::Info *info, const int amount)
inventorywindow_ejectslider->hide();
if (!info) {
- inventorywindow_modelview->clear();
- inventorywindow_modelnamelabel->set_text("");
- inventorywindow_modeltitlelabel->set_text("");
+ inventorywindow_modelview->clear();
+ inventorywindow_modelnamelabel->clear();
+ inventorywindow_modeltitlelabel->clear();
} else {
core::game()->request_info(info->id());
inventorywindow_modelview->set_modelname(info->modelname());
diff --git a/src/client/mapwindow.cc b/src/client/mapwindow.cc
index 925f938..f12364d 100644
--- a/src/client/mapwindow.cc
+++ b/src/client/mapwindow.cc
@@ -150,7 +150,7 @@ void MapWindow::resize()
mapwindow_closebutton->set_location(mapwindow_titlelabel->width() - mapwindow_closebutton->width(), 0);
// resize map label
- mapwindow_maplabel->set_size((width() - padding * 3.0f) * 0.5f, padding );
+ mapwindow_maplabel->set_size((width() - padding * 3.0f) * 0.5f, font()->height() );
mapwindow_maplabel->set_location(padding, mapwindow_titlelabel->bottom() + padding);
// resize zone map widget
@@ -172,7 +172,7 @@ void MapWindow::resize()
// resize target label
- mapwindow_targetlabel->set_size(width() - mapwindow_mapwidget->right() - padding * 2.0f, padding);
+ mapwindow_targetlabel->set_size(width() - mapwindow_mapwidget->right() - padding * 2.0f, font()->height());
mapwindow_targetlabel->set_location(mapwindow_maplabel->right() + padding, mapwindow_maplabel->top());
// resize target modelview
diff --git a/src/client/reputationwindow.cc b/src/client/reputationwindow.cc
new file mode 100644
index 0000000..6e5a535
--- /dev/null
+++ b/src/client/reputationwindow.cc
@@ -0,0 +1,232 @@
+/*
+ client/reputationwindow.cc
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+#include <iomanip>
+
+#include "ui/ui.h"
+#include "client/client.h"
+#include "client/reputationwindow.h"
+#include "core/reputation.h"
+
+namespace client {
+
+ReputationWindow::ReputationWindow(ui::Widget *parent) : ui::Window(parent)
+{
+ // window title
+ reputationwindow_titlelabel = new ui::Label(this);
+ reputationwindow_titlelabel->set_label("title");
+ reputationwindow_titlelabel->set_background(false);
+ reputationwindow_titlelabel->set_border(false);
+ reputationwindow_titlelabel->set_font(ui::root()->font_large());
+ reputationwindow_titlelabel->set_alignment(ui::AlignCenter);
+ reputationwindow_titlelabel->set_text("REPUTATION");
+
+ // close button
+ reputationwindow_closebutton = new ui::IconButton(reputationwindow_titlelabel, "bitmaps/icons/window_close");
+
+ // reputation listview
+ reputationwindow_listview = new ui::ListView(this);
+ reputationwindow_listview->set_label("listview");
+
+ // target label
+ reputationwindow_targetlabel = new ui::Label(this);
+ reputationwindow_targetlabel->set_label("info");
+ reputationwindow_targetlabel->set_background(false);
+ reputationwindow_targetlabel->set_border(false);
+ reputationwindow_targetlabel->set_alignment(ui::AlignCenter);
+
+ // player statistics / faction description
+ reputationwindow_scrollpane = new ui::ScrollPane(this, reputationwindow_infotext);
+ reputationwindow_scrollpane->set_background(false);
+ reputationwindow_scrollpane->set_border(false);
+ reputationwindow_scrollpane->set_alignment(ui::AlignTop);
+
+ hide();
+}
+
+ReputationWindow::~ReputationWindow()
+{
+
+}
+
+void ReputationWindow::show()
+{
+ if (hidden()) {
+ refresh();
+ }
+
+ ui::Window::show();
+}
+
+void ReputationWindow::refresh()
+{
+ reputationwindow_listview->clear();
+
+ for (core::Reputation::FactionReps::const_iterator it = core::localplayer()->reputation().factionreps().begin(); it != core::localplayer()->reputation().factionreps().end(); ++it) {
+ if ((*it)->faction()) {
+
+ std::ostringstream strdescription;
+ strdescription << (*it)->faction()->name() << '\n' << roundf((*it)->reputation());
+ ui::ListItem *listitem = new ui::ListItem(reputationwindow_listview, strdescription.str().c_str());
+ listitem->set_font(ui::root()->font_tiny());
+ listitem->set_height(listitem->font()->height() * 3.0f);
+ listitem->set_info((*it)->faction());
+
+ std::ostringstream strsortkey;
+ strsortkey << std::setfill('0') << std::setw(2) << (*it)->reputation() + 100;
+ listitem->set_sortkey(strsortkey.str().c_str());
+ }
+ }
+
+ reputationwindow_listview->sort();
+
+ set_info();
+}
+
+void ReputationWindow::set_info(const core::Info *info)
+{
+ reputationwindow_infotext.clear();
+ reputationwindow_targetlabel->clear();
+
+ if (!info) {
+ // player name
+ reputationwindow_targetlabel->set_text(core::localplayer()->name());
+
+ std::ostringstream strinfotext;
+
+ // player level
+ strinfotext.str("");
+ strinfotext.clear();
+ strinfotext << "^NLevel: ";
+ strinfotext << core::localplayer()->level();
+ reputationwindow_infotext.push_back(strinfotext.str());
+
+ // player credits
+ strinfotext.str("");
+ strinfotext.clear();
+ strinfotext << "^NCredits: ";
+ strinfotext << core::localplayer()->credits();
+ reputationwindow_infotext.push_back(strinfotext.str());
+
+ // ------------------
+ strinfotext.str("");
+ strinfotext.clear();
+ reputationwindow_infotext.push_back(strinfotext.str());
+
+ // player NPC kills
+ strinfotext.str("");
+ strinfotext.clear();
+ strinfotext << "^NNPC kills: ";
+ strinfotext << core::localplayer()->npckills();
+ reputationwindow_infotext.push_back(strinfotext.str());
+
+ // player PVP kills
+ strinfotext.str("");
+ strinfotext.clear();
+ strinfotext << "^NPVP kills: ";
+ strinfotext << core::localplayer()->pvpkills();
+ reputationwindow_infotext.push_back(strinfotext.str());
+
+ // player time wasted
+ strinfotext.str("");
+ strinfotext.clear();
+ strinfotext << "^NTime wasted: ";
+ long time_wasted = (core::localplayer()->time_wasted() + core::game()->timestamp() - core::localplayer()->time_joined()) / 1000;
+ const long time_wasted_seconds = time_wasted % 60;
+
+ time_wasted = (time_wasted - time_wasted_seconds) / 60;
+ const long time_wasted_minutes = time_wasted % 60;
+
+ time_wasted = (time_wasted - time_wasted_minutes) / 60;
+ const long time_wasted_hours = time_wasted % 24;
+
+ const long time_wasted_days = (time_wasted - time_wasted_hours) / 24;
+
+ if (time_wasted_days > 0) {
+ strinfotext << time_wasted_days << aux::plural("day", time_wasted_days) << " ";
+ }
+ strinfotext << std::setfill('0') << std::setw(2) << time_wasted_hours << ":" ;
+ strinfotext << std::setfill('0') << std::setw(2) << time_wasted_minutes << ":";
+ strinfotext << std::setfill('0') << std::setw(2) << time_wasted_seconds;
+ reputationwindow_infotext.push_back(strinfotext.str());
+
+ } else {
+ core::game()->request_info(info->id());
+
+ reputationwindow_targetlabel->set_text(info->name());
+
+ for (core::Info::Text::const_iterator it = info->text().begin(); it != info->text().end(); it++) {
+ reputationwindow_infotext.push_back((*it));
+ }
+ }
+}
+
+void ReputationWindow::resize()
+{
+ const float padding = ui::root()->font_large()->height();
+ //const float icon_size = 24.0f; // small icons
+
+ // resize label
+ reputationwindow_titlelabel->set_size(width() - padding * 2.0f, reputationwindow_titlelabel->font()->height());
+ reputationwindow_titlelabel->set_location(padding, padding);
+
+ // resize close button
+ reputationwindow_closebutton->set_size(reputationwindow_titlelabel->font()->height(), reputationwindow_titlelabel->font()->height());
+ reputationwindow_closebutton->set_location(reputationwindow_titlelabel->width() - reputationwindow_closebutton->width(), 0);
+
+ // resize reputation listview
+ reputationwindow_listview->set_size(ui::UI::elementsize.width(), height() - reputationwindow_titlelabel->bottom() - padding * 2.0f);
+ reputationwindow_listview->set_location(reputationwindow_titlelabel->left(), reputationwindow_titlelabel->bottom() + padding);
+
+ // resize reputation info label
+ reputationwindow_targetlabel->set_size(width() - reputationwindow_listview->right() - padding * 2.0f, reputationwindow_targetlabel->font()->height());
+ reputationwindow_targetlabel->set_location(reputationwindow_listview->right() + padding,reputationwindow_titlelabel->bottom() + padding);
+
+ // resize infotext scrollpane
+ reputationwindow_scrollpane->set_size(width() - reputationwindow_listview->right() - padding * 2.0f, height() - reputationwindow_targetlabel->bottom() - padding * 2.0f);
+ reputationwindow_scrollpane->set_location(reputationwindow_listview->right() + padding, reputationwindow_targetlabel->bottom() + padding);
+}
+
+bool ReputationWindow::on_emit(ui::Widget *sender, const Event event, void *data)
+{
+ if (event == ui::Widget::EventButtonClicked) {
+
+ if (sender == reputationwindow_closebutton) {
+ hide();
+ }
+ return true;
+
+
+ } else if (event == ui::Widget::EventListViewChanged) {
+
+ if (sender == reputationwindow_listview) {
+ set_info( reputationwindow_listview->selected() ? reputationwindow_listview->selected()->info() : 0);
+ }
+
+ return true;
+ }
+
+ return Window::on_emit(sender, event, data);
+}
+
+bool ReputationWindow::on_keypress(const int key, const unsigned int modifier)
+{
+ switch (key) {
+
+ case SDLK_ESCAPE:
+ this->hide();
+ return true;
+ break;
+
+ default:
+ break;
+ }
+
+ return Window::on_keypress(key, modifier);
+}
+
+
+} //namespace client
diff --git a/src/client/reputationwindow.h b/src/client/reputationwindow.h
new file mode 100644
index 0000000..d4af145
--- /dev/null
+++ b/src/client/reputationwindow.h
@@ -0,0 +1,68 @@
+/*
+ client/reputationwindow.h
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+#ifndef __INCLUDED_CLIENT_REPUTATIONWINDOW_H__
+#define __INCLUDED_CLIENT_REPUTATIONWINDOW_H__
+
+#include "ui/button.h"
+#include "ui/iconbutton.h"
+#include "ui/listview.h"
+#include "ui/scrollpane.h"
+#include "ui/slider.h"
+#include "ui/plaintext.h"
+#include "ui/window.h"
+
+namespace client {
+
+/**
+ * @brief an inventory window widget
+ */
+class ReputationWindow : public ui::Window
+{
+public:
+ ReputationWindow(ui::Widget *parent = 0);
+ ~ReputationWindow();
+
+ /**
+ * @brief show the window
+ * Showing the reputation window will refrish its content
+ * */
+ virtual void show();
+
+protected:
+ /**
+ * @brief resize event handler
+ * */
+ virtual void resize();
+
+ /**
+ * @brief emit event handler
+ * */
+ virtual bool on_emit(ui::Widget *sender, const Event event, void *data);
+
+ /**
+ * @brief keypress event handler
+ * */
+ virtual bool on_keypress(const int key, const unsigned int modifier);
+
+private:
+ void refresh();
+
+ void set_info(const core::Info *info = 0);
+
+ ui::Text reputationwindow_infotext;
+
+ ui::Label *reputationwindow_titlelabel;
+ ui::Label *reputationwindow_targetlabel;
+ ui::IconButton *reputationwindow_closebutton;
+ ui::ListView *reputationwindow_listview;
+ ui::ScrollPane *reputationwindow_scrollpane;
+
+}; // class ReputationWindow
+
+} // namespace client
+
+#endif // __INCLUDED_CLIENT_REPUTATIONWINDOW_H__
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 664b557..05edf9c 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -1230,7 +1230,7 @@ void Ship::frame_autopilot_goto(const unsigned long elapsed, core::Entity *targe
if (direction.x() < 0) {
// target is behind the ship
- target_direction = math::sgnf(direction.y());
+ target_direction = (direction.y() > 0 ? 1.0f : -1.0f);
target_pitch = 0.0f;
} else if (direction.x() + MIN_DELTA < 1.0f) {
@@ -1359,7 +1359,7 @@ void Ship::frame_autopilot_formation(const unsigned long elapsed, core::Entity *
if (reference.forward().x() < 0) {
// target is behind the ship
- target_direction = math::sgnf(reference.forward().y());
+ target_direction = (reference.forward().y() > 0 ? 1.0f : -1.0f);
target_pitch = 0.0f;
} else if (reference.forward().x() + MIN_DELTA < 1.0f) {
@@ -1375,7 +1375,7 @@ void Ship::frame_autopilot_formation(const unsigned long elapsed, core::Entity *
if (reference.up().z() < 0.0f) {
// upward-down
- target_roll = math::sgnf(reference.up().y());
+ target_roll = (reference.up().y() > 0 ? 1.0f : 0.0f);
} else if (reference.up().z() + MIN_DELTA < 1.0f) {
target_roll = reference.up().y();