Replaced hardcoded number (maximum number of players) with a clean constant
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3944 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f89cacbf5f
commit
11bb21770f
@ -31,7 +31,7 @@
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
Widget* g_focus_for_player[32]; // unused for player 0, player 0's focus is tracked by irrlicht
|
||||
Widget* g_focus_for_player[MAX_PLAYER_COUNT]; // unused for player 0, player 0's focus is tracked by irrlicht
|
||||
|
||||
IGUIEnvironment* g_env;
|
||||
Skin* g_skin = NULL;
|
||||
@ -155,7 +155,7 @@ void init(IrrlichtDevice* device_a, IVideoDriver* driver_a, AbstractStateManager
|
||||
g_driver = driver_a;
|
||||
g_state_manager = state_manager;
|
||||
|
||||
for (int n=0; n<32; n++)
|
||||
for (int n=0; n<MAX_PLAYER_COUNT; n++)
|
||||
{
|
||||
g_focus_for_player[n] = NULL;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ using namespace gui;
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
extern Widget* g_focus_for_player[32]; // unused for player 0, player 0's focus is tracked by irrlicht;
|
||||
extern Widget* g_focus_for_player[MAX_PLAYER_COUNT]; // unused for player 0, player 0's focus is tracked by irrlicht;
|
||||
|
||||
class Screen;
|
||||
class Widget;
|
||||
|
@ -79,7 +79,7 @@ Widget::Widget(bool reserve_id)
|
||||
m_show_bounding_box = false;
|
||||
m_parent = NULL;
|
||||
|
||||
for (int n=0; n<32; n++)
|
||||
for (int n=0; n<MAX_PLAYER_COUNT; n++)
|
||||
{
|
||||
m_player_focus[n] = false;
|
||||
GUIEngine::g_focus_for_player[n] = false;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <map>
|
||||
|
||||
#include "guiengine/skin.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
#include "utils/ptr_vector.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
@ -168,7 +169,7 @@ namespace GUIEngine
|
||||
/** Usually, only one widget at a time can be focused. There is however a special case where all
|
||||
players can move through the screen. This variable will then be used as a bitmask to contain
|
||||
which players beyong player 1 have this widget focused. */
|
||||
bool m_player_focus[32]; // FIXME : the 32 there is arbitrary, settle for a max number of players
|
||||
bool m_player_focus[MAX_PLAYER_COUNT];
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ RibbonGridWidget::RibbonGridWidget(const bool combo, const int max_rows)
|
||||
m_right_widget = NULL;
|
||||
m_type = WTYPE_RIBBON_GRID;
|
||||
|
||||
for (int n=0; n<32; n++)
|
||||
for (int n=0; n<MAX_PLAYER_COUNT; n++)
|
||||
{
|
||||
m_selected_item[n] = -1;
|
||||
}
|
||||
@ -458,7 +458,7 @@ void RibbonGridWidget::scroll(const int x_delta)
|
||||
// update selection markers in child ribbon
|
||||
if (m_combo)
|
||||
{
|
||||
for (int n=0; n<32; n++)
|
||||
for (int n=0; n<MAX_PLAYER_COUNT; n++)
|
||||
{
|
||||
RibbonWidget* ribbon = m_rows.get(0); // there is a single row when we can select items
|
||||
int id = m_selected_item[n] - m_scroll_offset;
|
||||
@ -474,7 +474,7 @@ void RibbonGridWidget::scroll(const int x_delta)
|
||||
used to ensure that all children ribbons always select the same column */
|
||||
void RibbonGridWidget::propagateSelection()
|
||||
{
|
||||
for (int p=0; p<32; p++)
|
||||
for (int p=0; p<MAX_PLAYER_COUNT; p++)
|
||||
{
|
||||
// find selection in current ribbon
|
||||
RibbonWidget* selected_ribbon = (RibbonWidget*)getSelectedRibbon(p);
|
||||
|
@ -132,7 +132,7 @@ namespace GUIEngine
|
||||
void scroll(const int x_delta);
|
||||
|
||||
/** Used for combo ribbons, to contain the ID of the currently selected item for each player */
|
||||
int m_selected_item[32]; // FIXME: 32 is arbitrary, settle for a max number of players
|
||||
int m_selected_item[MAX_PLAYER_COUNT];
|
||||
|
||||
/** Callbacks */
|
||||
void onRowChange(RibbonWidget* row, const int playerID);
|
||||
|
@ -29,7 +29,7 @@ using namespace GUIEngine;
|
||||
// -----------------------------------------------------------------------------
|
||||
RibbonWidget::RibbonWidget(const RibbonType type)
|
||||
{
|
||||
for (int n=0; n<32; n++)
|
||||
for (int n=0; n<MAX_PLAYER_COUNT; n++)
|
||||
{
|
||||
m_selection[n] = -1;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace GUIEngine
|
||||
friend class RibbonGridWidget;
|
||||
friend class EventHandler;
|
||||
|
||||
int m_selection[32]; // FIXME: 32 is a bit arbitrary, settle for a max number of players
|
||||
int m_selection[MAX_PLAYER_COUNT];
|
||||
|
||||
/** The type of this ribbon (toolbar, combo, tabs) */
|
||||
RibbonType m_ribbon_type;
|
||||
|
@ -407,7 +407,7 @@ class KartHoverListener : public RibbonGridHoverListener
|
||||
ModelViewWidget* w3 = g_player_karts[playerID].modelView;
|
||||
assert( w3 != NULL );
|
||||
|
||||
printf("%s\n", selectionID.c_str());
|
||||
//printf("%s\n", selectionID.c_str());
|
||||
const KartProperties* kart = kart_properties_manager->getKart(selectionID);
|
||||
if(kart == NULL) return;
|
||||
KartModel* kartModel = kart->getKartModel();
|
||||
|
@ -56,5 +56,8 @@
|
||||
#define NINETY_DEGREE_RAD (M_PI/2.0f)
|
||||
#define DEGREE_TO_RAD (M_PI/180.0f)
|
||||
#define RAD_TO_DEGREE (180.0f/M_PI)
|
||||
#endif
|
||||
|
||||
const int MAX_PLAYER_COUNT = 4;
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user