From bebb67e03d378a084367cc05c3d9bbb76f1d8e73 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 16 Dec 2014 20:37:15 +0000 Subject: Project::OSiRiON can now be built with Clang, use -Wno-overloaded-virtual. --- src/client/hud.cc | 5 ---- src/client/hud.h | 1 - src/client/targets.cc | 1 - src/core/gameinterface.cc | 2 -- src/core/netserver.h | 1 - src/game/base/patrol.cc | 2 +- src/game/base/ship.h | 34 ++++++++++++++++++++++---- src/game/base/shipmodel.cc | 4 ++++ src/game/base/shipmodel.h | 16 +++++++++++-- src/model/asefile.cc | 2 +- src/model/mapfile.cc | 59 +++++++++++++++++++++++++++++++++++++++++----- src/render/dust.cc | 1 - 12 files changed, 102 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/client/hud.cc b/src/client/hud.cc index 4c98bd8..058b27a 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -48,8 +48,6 @@ HUD::HUD(ui::Widget *parent) : Widget(parent) void HUD::resize() { - //hud_toolbar->set_geometry(0.0f, 0.0f, width(), font()->height() *2 ); - const float padding = ui::root()->font_large()->height(); hud_center->set_size(ui::pointer_size, ui::pointer_size); @@ -131,9 +129,6 @@ void HUD::draw_offscreen_target(core::Entity *entity, bool is_active_target) bitmap_up *= bitmap_radius; bitmap_left *= bitmap_radius; - //math::Vector2f bitmap_location(bitmap_center[0] - bitmap_radius, bitmap_center[1] - bitmap_radius); - //math::Vector2f bitmap_size(2.0f * bitmap_radius, 2.0f * bitmap_radius); - math::Color bitmap_color; const float reputation = core::localplayer()->reputation(entity->faction()); diff --git a/src/client/hud.h b/src/client/hud.h index 07cd166..f241408 100644 --- a/src/client/hud.h +++ b/src/client/hud.h @@ -44,7 +44,6 @@ private: void draw_target(core::Entity *entity, bool is_active_target); ui::Bitmap *hud_center; - ui::Toolbar *hud_toolbar; ui::Widget *hud_playerstatus; ui::Widget *hud_enginestatus; diff --git a/src/client/targets.cc b/src/client/targets.cc index a35ebe7..b320b08 100644 --- a/src/client/targets.cc +++ b/src/client/targets.cc @@ -34,7 +34,6 @@ namespace client namespace targets { -const float TARGETBOXRADIUS = 0.025f; unsigned int current_target_id = 0; unsigned int current_hover = 0; diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc index a2d7fba..aa4ef4c 100644 --- a/src/core/gameinterface.cc +++ b/src/core/gameinterface.cc @@ -39,8 +39,6 @@ void func_list_players(std::string const &args) } } -const float MIN_DELTA = 10e-10; - Player GameInterface::game_localplayer(0); EntityControlable *localcontrol() diff --git a/src/core/netserver.h b/src/core/netserver.h index 95ada0d..a7e75bd 100644 --- a/src/core/netserver.h +++ b/src/core/netserver.h @@ -140,7 +140,6 @@ private: struct sockaddr_in netserver_addr; fd_set serverset; - int fdmax; char recbuf[FRAMESIZE]; diff --git a/src/game/base/patrol.cc b/src/game/base/patrol.cc index 797681d..78d2ebd 100644 --- a/src/game/base/patrol.cc +++ b/src/game/base/patrol.cc @@ -31,7 +31,7 @@ Patrol::Patrol() : core::Entity() patrol_profile = ProfilePatrol; - patrol_waypoint_current == patrol_waypoints.end(); + patrol_waypoint_current = patrol_waypoints.end(); patrol_launch_timeout = 0; } diff --git a/src/game/base/ship.h b/src/game/base/ship.h index d627295..4b4ae61 100644 --- a/src/game/base/ship.h +++ b/src/game/base/ship.h @@ -99,18 +99,30 @@ public: return ( (ship_autopilot_flags & flag) == flag); } - /// maximum amount of armor + /// maximal armor strength inline const float maxarmor() const { return ship_maxarmor; } - /// current amount of armor + /// current armor strength inline const float armor() const { return ship_armor; } + /// maximal armor strength + inline const float maxshield() const + { + return ship_maxshield; + } + + /// current armor strength + inline const float shield() const + { + return ship_shield; + } + virtual void print() const; /* -- mutators --------------------------------------------- */ @@ -160,19 +172,31 @@ public: ship_roll_force = roll; } - /// set maximal armor amount (100% health) + /// set maximal armor strength (100% health) inline void set_maxarmor(const float maxarmor) { ship_maxarmor = maxarmor; } - /// set current armor amount (current health) + /// set current armor strength (current health) inline void set_armor(const float armor) { ship_armor = armor; } - /// Initiate jump, departing from a jump point + /// set maximal shield strength + inline void set_maxshield(const float maxshield) + { + ship_maxshield = maxshield; + } + + /// set current shield strength + inline void set_shield(const float shield) + { + ship_shield = shield; + } + + /// initiate jump sequence, departing from a jump point void initiate_jump(JumpPoint *depart); /// reset physics state and ship controls diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc index 9489c91..f504107 100644 --- a/src/game/base/shipmodel.cc +++ b/src/game/base/shipmodel.cc @@ -116,6 +116,9 @@ bool ShipModel::init() } else if (inifile.got_key_float("armor", f)) { shipmodel->set_maxarmor(f); continue; + } else if (inifile.got_key_float("shield", f)) { + shipmodel->set_maxshield(f); + continue; } else if (inifile.got_key_float("radius", f)) { shipmodel->set_radius(f); continue; @@ -433,6 +436,7 @@ void ShipModel::apply(Ship *ship) const ship->set_roll_force(roll_force()); ship->set_jumpdrive(jumpdrive()); ship->set_maxarmor(maxarmor()); + ship->set_maxshield(maxshield()); } } diff --git a/src/game/base/shipmodel.h b/src/game/base/shipmodel.h index 64244fc..709a1d6 100644 --- a/src/game/base/shipmodel.h +++ b/src/game/base/shipmodel.h @@ -102,12 +102,18 @@ public: return shipmodel_maxcargo; } - /// maximum armor amount + /// maximal armor strength inline const float maxarmor() const { return shipmodel_maxarmor; } + /// maximal shield strength + inline const float maxshield() const + { + return shipmodel_maxshield; + } + /// ship radius inline const float radius() const { @@ -179,12 +185,18 @@ protected: // shipmodel_maxspeed = maxspeed; // } - /// set maximum armor amount + /// set maximal armor strength inline void set_maxarmor(const float maxarmor) { shipmodel_maxarmor = maxarmor; } + /// set maximal shield strength + inline void set_maxshield(const float maxshield) + { + shipmodel_maxshield = maxshield; + } + /// set size of the cargo hold inline void set_maxcargo(const float maxcargo) { diff --git a/src/model/asefile.cc b/src/model/asefile.cc index 90bd6f2..ce43cd0 100644 --- a/src/model/asefile.cc +++ b/src/model/asefile.cc @@ -83,7 +83,7 @@ bool ASEFile::read_header(std::istream &is) std::string word; line >> word; - if (!word.compare("*3DSMAX_ASCIIEXPORT") == 0) { + if (word.compare("*3DSMAX_ASCIIEXPORT") != 0) { return false; } diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 3a8aa40..9cdb23e 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -21,6 +21,52 @@ namespace model { +/** + * @brief a two-dimensional array class + * */ +template class Matrix { +public: + Matrix(size_t rows, size_t columns) + { + matrix_rows = rows; + matrix_columns = columns; + + matrix_values = new T *[matrix_rows]; + + for (size_t i = 0; i < matrix_rows; ++i) + { + matrix_values[i] = new T[columns]; + } + } + + ~Matrix() + { + for (size_t i = 0; i < matrix_rows; ++i) + { + delete[] matrix_values[i]; + } + + delete matrix_values; + } + + T * operator[](size_t row) + { + return matrix_values[row]; + } + + const T * operator[](size_t row) const + { + return matrix_values[row]; + } + + +private: + size_t matrix_rows; + size_t matrix_columns; + + T **matrix_values; +}; + // max geometry bounds const float MAX_BOUNDS = 16384; @@ -295,9 +341,10 @@ bool MapFile::read_patchdef() if ((columns < 2) || (rows < 2) || (columns >= 1024) || (rows >= 1024)) { return false; } - - math::Vector3f patchvertices[rows][columns]; - math::Vector2f patchtexcoords[rows][columns]; + + // clang doesn't like multidimensional arrays + Matrix patchvertices(rows, columns); + Matrix patchtexcoords(rows, columns); // read rows for (size_t r = 0; r < rows; r++) { @@ -417,9 +464,9 @@ bool MapFile::read_patchdef() size_t subdivide_u = 0; size_t subdivide_v = 0; - math::Vector3f mesh[subdivide_max + 1][subdivide_max +1]; - math::Vector3f meshnormals[subdivide_max + 1][subdivide_max +1]; - math::Vector2f meshtexcoords[subdivide_max + 1][subdivide_max +1]; + Matrix mesh(subdivide_max + 1, subdivide_max +1); + Matrix meshnormals(subdivide_max + 1, subdivide_max +1); + Matrix meshtexcoords(subdivide_max + 1, subdivide_max +1); for (size_t r = 0; r < rows-2; r +=2 ) { for (size_t c = 0; c < columns -2; c += 2) { diff --git a/src/render/dust.cc b/src/render/dust.cc index 7358496..1ca422c 100644 --- a/src/render/dust.cc +++ b/src/render/dust.cc @@ -20,7 +20,6 @@ core::Cvar *r_dustsize; const float LOWSPEEDLIMIT = 5.0f; const float TRAILLENGHT = 0.25f; -const float DUSTMAXALPHA = 0.8f; const float DUSTDISTANCE = 8.0f; float *dust = 0; -- cgit v1.2.3