Merge branch 'master' of https://github.com/supertuxkart/stk-code
This commit is contained in:
commit
5f78f2687f
@ -67,8 +67,7 @@ AnimationBase::AnimationBase(Ipo *ipo)
|
|||||||
void AnimationBase::setInitialTransform(const Vec3 &xyz,
|
void AnimationBase::setInitialTransform(const Vec3 &xyz,
|
||||||
const Vec3 &hpr)
|
const Vec3 &hpr)
|
||||||
{
|
{
|
||||||
Ipo* curr;
|
for_var_in(Ipo*, curr, m_all_ipos)
|
||||||
for_in (curr, m_all_ipos)
|
|
||||||
{
|
{
|
||||||
curr->setInitialTransform(xyz, hpr);
|
curr->setInitialTransform(xyz, hpr);
|
||||||
}
|
}
|
||||||
@ -80,8 +79,7 @@ void AnimationBase::setInitialTransform(const Vec3 &xyz,
|
|||||||
void AnimationBase::reset()
|
void AnimationBase::reset()
|
||||||
{
|
{
|
||||||
m_current_time = 0;
|
m_current_time = 0;
|
||||||
Ipo* curr;
|
for_var_in(Ipo*, curr, m_all_ipos)
|
||||||
for_in (curr, m_all_ipos)
|
|
||||||
{
|
{
|
||||||
curr->reset();
|
curr->reset();
|
||||||
}
|
}
|
||||||
@ -103,8 +101,7 @@ void AnimationBase::update(float dt, Vec3 *xyz, Vec3 *hpr, Vec3 *scale)
|
|||||||
|
|
||||||
assert(!isnan(m_current_time));
|
assert(!isnan(m_current_time));
|
||||||
|
|
||||||
Ipo* curr;
|
for_var_in (Ipo*, curr, m_all_ipos)
|
||||||
for_in (curr, m_all_ipos)
|
|
||||||
{
|
{
|
||||||
curr->update(m_current_time, xyz, hpr, scale);
|
curr->update(m_current_time, xyz, hpr, scale);
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,7 @@ public:
|
|||||||
{
|
{
|
||||||
float duration = -1;
|
float duration = -1;
|
||||||
|
|
||||||
const Ipo* currIpo;
|
for_var_in (const Ipo*, currIpo, m_all_ipos)
|
||||||
for_in (currIpo, m_all_ipos)
|
|
||||||
{
|
{
|
||||||
duration = std::max(duration, currIpo->getEndTime());
|
duration = std::max(duration, currIpo->getEndTime());
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,7 @@ PlayerManager::PlayerManager()
|
|||||||
PlayerManager::~PlayerManager()
|
PlayerManager::~PlayerManager()
|
||||||
{
|
{
|
||||||
// If the passwords should not be remembered, clear the saved session.
|
// If the passwords should not be remembered, clear the saved session.
|
||||||
PlayerProfile *player;
|
for_var_in(PlayerProfile*, player, m_all_players)
|
||||||
for_in(player, m_all_players)
|
|
||||||
{
|
{
|
||||||
if(!player->rememberPassword())
|
if(!player->rememberPassword())
|
||||||
player->clearSession();
|
player->clearSession();
|
||||||
@ -270,8 +269,7 @@ void PlayerManager::save()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save all non-guest players
|
// Save all non-guest players
|
||||||
PlayerProfile *player;
|
for_var_in(PlayerProfile*, player, m_all_players)
|
||||||
for_in(player, m_all_players)
|
|
||||||
{
|
{
|
||||||
if(!player->isGuestAccount())
|
if(!player->isGuestAccount())
|
||||||
player->save(players_file);
|
player->save(players_file);
|
||||||
@ -321,7 +319,7 @@ void PlayerManager::enforceCurrentPlayer()
|
|||||||
{
|
{
|
||||||
if (m_current_player) return;
|
if (m_current_player) return;
|
||||||
|
|
||||||
PlayerProfile *player;
|
PlayerProfile* player;
|
||||||
for_in(player, m_all_players)
|
for_in(player, m_all_players)
|
||||||
{
|
{
|
||||||
if (!player->isGuestAccount())
|
if (!player->isGuestAccount())
|
||||||
@ -408,8 +406,7 @@ void PlayerManager::createGuestPlayers(int n)
|
|||||||
unsigned int PlayerManager::getNumNonGuestPlayers() const
|
unsigned int PlayerManager::getNumNonGuestPlayers() const
|
||||||
{
|
{
|
||||||
unsigned int count=0;
|
unsigned int count=0;
|
||||||
const PlayerProfile *player;
|
for_var_in(const PlayerProfile*, player, m_all_players)
|
||||||
for_in(player, m_all_players)
|
|
||||||
{
|
{
|
||||||
if(!player->isGuestAccount()) count ++;
|
if(!player->isGuestAccount()) count ++;
|
||||||
}
|
}
|
||||||
@ -422,8 +419,7 @@ unsigned int PlayerManager::getNumNonGuestPlayers() const
|
|||||||
unsigned int PlayerManager::getUniqueId() const
|
unsigned int PlayerManager::getUniqueId() const
|
||||||
{
|
{
|
||||||
unsigned int max_id=0;
|
unsigned int max_id=0;
|
||||||
const PlayerProfile *player;
|
for_var_in(const PlayerProfile*, player, m_all_players)
|
||||||
for_in(player, m_all_players)
|
|
||||||
{
|
{
|
||||||
if(player->getUniqueID()>max_id)
|
if(player->getUniqueID()>max_id)
|
||||||
max_id = player->getUniqueID();
|
max_id = player->getUniqueID();
|
||||||
@ -439,8 +435,7 @@ unsigned int PlayerManager::getUniqueId() const
|
|||||||
*/
|
*/
|
||||||
const PlayerProfile *PlayerManager::getPlayerById(unsigned int id)
|
const PlayerProfile *PlayerManager::getPlayerById(unsigned int id)
|
||||||
{
|
{
|
||||||
const PlayerProfile *player;
|
for_var_in(const PlayerProfile*, player, m_all_players)
|
||||||
for_in(player, m_all_players)
|
|
||||||
{
|
{
|
||||||
if(player->getUniqueID()==id)
|
if(player->getUniqueID()==id)
|
||||||
return player;
|
return player;
|
||||||
@ -455,8 +450,7 @@ const PlayerProfile *PlayerManager::getPlayerById(unsigned int id)
|
|||||||
*/
|
*/
|
||||||
PlayerProfile *PlayerManager::getPlayer(const irr::core::stringw &name)
|
PlayerProfile *PlayerManager::getPlayer(const irr::core::stringw &name)
|
||||||
{
|
{
|
||||||
PlayerProfile *player;
|
for_var_in(PlayerProfile*, player, m_all_players)
|
||||||
for_in(player, m_all_players)
|
|
||||||
{
|
{
|
||||||
if(player->getName()==name)
|
if(player->getName()==name)
|
||||||
return player;
|
return player;
|
||||||
|
@ -828,8 +828,7 @@ namespace GUIEngine
|
|||||||
{
|
{
|
||||||
// This code needs to go outside beginScene() / endScene() since
|
// This code needs to go outside beginScene() / endScene() since
|
||||||
// the model view widget will do off-screen rendering there
|
// the model view widget will do off-screen rendering there
|
||||||
GUIEngine::Widget* widget;
|
for_var_in(GUIEngine::Widget*, widget, GUIEngine::needsUpdate)
|
||||||
for_in (widget, GUIEngine::needsUpdate)
|
|
||||||
{
|
{
|
||||||
widget->update(dt);
|
widget->update(dt);
|
||||||
}
|
}
|
||||||
|
@ -534,8 +534,7 @@ irr::core::stringw DynamicRibbonWidget::getSelectionText(const int playerID)
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
RibbonWidget* DynamicRibbonWidget::getRowContaining(Widget* w)
|
RibbonWidget* DynamicRibbonWidget::getRowContaining(Widget* w)
|
||||||
{
|
{
|
||||||
RibbonWidget* row;
|
for_var_in (RibbonWidget*, row, m_rows)
|
||||||
for_in (row, m_rows)
|
|
||||||
{
|
{
|
||||||
if (row != NULL)
|
if (row != NULL)
|
||||||
{
|
{
|
||||||
@ -548,8 +547,7 @@ RibbonWidget* DynamicRibbonWidget::getRowContaining(Widget* w)
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
RibbonWidget* DynamicRibbonWidget::getSelectedRibbon(const int playerID)
|
RibbonWidget* DynamicRibbonWidget::getSelectedRibbon(const int playerID)
|
||||||
{
|
{
|
||||||
RibbonWidget* row;
|
for_var_in (RibbonWidget*, row, m_rows)
|
||||||
for_in (row, m_rows)
|
|
||||||
{
|
{
|
||||||
if (GUIEngine::isFocusedForPlayer(row, playerID))
|
if (GUIEngine::isFocusedForPlayer(row, playerID))
|
||||||
{
|
{
|
||||||
@ -608,8 +606,7 @@ EventPropagation DynamicRibbonWidget::leftPressed(const int playerID)
|
|||||||
updateLabel();
|
updateLabel();
|
||||||
propagateSelection();
|
propagateSelection();
|
||||||
|
|
||||||
DynamicRibbonHoverListener* listener;
|
for_var_in (DynamicRibbonHoverListener*, listener, m_hover_listeners)
|
||||||
for_in( listener, m_hover_listeners )
|
|
||||||
{
|
{
|
||||||
listener->onSelectionChanged(this, w->getSelectionIDString(playerID),
|
listener->onSelectionChanged(this, w->getSelectionIDString(playerID),
|
||||||
w->getSelectionText(playerID), playerID);
|
w->getSelectionText(playerID), playerID);
|
||||||
@ -666,8 +663,7 @@ EventPropagation DynamicRibbonWidget::mouseHovered(Widget* child, const int play
|
|||||||
|
|
||||||
if (getSelectedRibbon(playerID) != NULL)
|
if (getSelectedRibbon(playerID) != NULL)
|
||||||
{
|
{
|
||||||
DynamicRibbonHoverListener* listener;
|
for_var_in (DynamicRibbonHoverListener*, listener, m_hover_listeners)
|
||||||
for_in( listener, m_hover_listeners )
|
|
||||||
{
|
{
|
||||||
listener->onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID),
|
listener->onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID),
|
||||||
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
|
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
|
||||||
@ -682,15 +678,13 @@ EventPropagation DynamicRibbonWidget::focused(const int playerID)
|
|||||||
Widget::focused(playerID);
|
Widget::focused(playerID);
|
||||||
updateLabel();
|
updateLabel();
|
||||||
|
|
||||||
DynamicRibbonHoverListener* listener;
|
|
||||||
|
|
||||||
if (getSelectedRibbon(playerID)->getSelectionIDString(playerID) == "")
|
if (getSelectedRibbon(playerID)->getSelectionIDString(playerID) == "")
|
||||||
{
|
{
|
||||||
//fprintf(stderr, "[DynamicRibbonWidget] WARNING: Can't find selection for player %i, selecting first item\n", playerID);
|
//fprintf(stderr, "[DynamicRibbonWidget] WARNING: Can't find selection for player %i, selecting first item\n", playerID);
|
||||||
getSelectedRibbon(playerID)->setSelection(0, playerID);
|
getSelectedRibbon(playerID)->setSelection(0, playerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
for_in( listener, m_hover_listeners )
|
for_var_in (DynamicRibbonHoverListener*, listener, m_hover_listeners)
|
||||||
{
|
{
|
||||||
listener->onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID),
|
listener->onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID),
|
||||||
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
|
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
|
||||||
@ -719,15 +713,13 @@ void DynamicRibbonWidget::onRibbonWidgetFocus(RibbonWidget* emitter, const int p
|
|||||||
|
|
||||||
updateLabel(emitter);
|
updateLabel(emitter);
|
||||||
|
|
||||||
DynamicRibbonHoverListener* listener;
|
|
||||||
|
|
||||||
if (emitter->getSelectionIDString(playerID) == "")
|
if (emitter->getSelectionIDString(playerID) == "")
|
||||||
{
|
{
|
||||||
//fprintf(stderr, "[DynamicRibbonWidget] WARNING: Can't find selection for player %i, selecting first item\n", playerID);
|
//fprintf(stderr, "[DynamicRibbonWidget] WARNING: Can't find selection for player %i, selecting first item\n", playerID);
|
||||||
emitter->setSelection(0, playerID);
|
emitter->setSelection(0, playerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
for_in( listener, m_hover_listeners )
|
for_var_in(DynamicRibbonHoverListener*, listener, m_hover_listeners)
|
||||||
{
|
{
|
||||||
listener->onSelectionChanged(this, emitter->getSelectionIDString(playerID),
|
listener->onSelectionChanged(this, emitter->getSelectionIDString(playerID),
|
||||||
emitter->getSelectionText(playerID), playerID);
|
emitter->getSelectionText(playerID), playerID);
|
||||||
@ -802,8 +794,7 @@ void DynamicRibbonWidget::propagateSelection()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set same selection in all ribbons
|
// set same selection in all ribbons
|
||||||
RibbonWidget* ribbon;
|
for_var_in (RibbonWidget*, ribbon, m_rows)
|
||||||
for_in( ribbon, m_rows )
|
|
||||||
{
|
{
|
||||||
if (ribbon != selected_ribbon)
|
if (ribbon != selected_ribbon)
|
||||||
{
|
{
|
||||||
|
@ -443,8 +443,7 @@ void RibbonWidget::removeChildNamed(const char* name)
|
|||||||
// This method should only be called BEFORE a widget is added
|
// This method should only be called BEFORE a widget is added
|
||||||
assert(m_element == NULL);
|
assert(m_element == NULL);
|
||||||
|
|
||||||
Widget* child;
|
for_var_in(Widget*, child, m_children)
|
||||||
for_in (child, m_children)
|
|
||||||
{
|
{
|
||||||
if (child->m_properties[PROP_ID] == name)
|
if (child->m_properties[PROP_ID] == name)
|
||||||
{
|
{
|
||||||
|
@ -303,6 +303,8 @@ public:
|
|||||||
#define for_in( VAR, VECTOR ) for (unsigned int _foreach_i = 0; \
|
#define for_in( VAR, VECTOR ) for (unsigned int _foreach_i = 0; \
|
||||||
VAR = (_foreach_i < VECTOR.size() ? VECTOR.get(_foreach_i) : NULL),\
|
VAR = (_foreach_i < VECTOR.size() ? VECTOR.get(_foreach_i) : NULL),\
|
||||||
_foreach_i < VECTOR.size(); _foreach_i++)
|
_foreach_i < VECTOR.size(); _foreach_i++)
|
||||||
|
#define for_var_in( TYPE, VAR, VECTOR ) TYPE VAR; for (unsigned int _foreach_i = 0; \
|
||||||
|
VAR = (_foreach_i < VECTOR.size() ? VECTOR.get(_foreach_i) : NULL), \
|
||||||
|
_foreach_i < VECTOR.size(); _foreach_i++)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user