This commit is contained in:
vlj 2014-08-14 02:09:15 +02:00
commit 5f78f2687f
7 changed files with 24 additions and 43 deletions

View File

@ -67,8 +67,7 @@ AnimationBase::AnimationBase(Ipo *ipo)
void AnimationBase::setInitialTransform(const Vec3 &xyz,
const Vec3 &hpr)
{
Ipo* curr;
for_in (curr, m_all_ipos)
for_var_in(Ipo*, curr, m_all_ipos)
{
curr->setInitialTransform(xyz, hpr);
}
@ -80,8 +79,7 @@ void AnimationBase::setInitialTransform(const Vec3 &xyz,
void AnimationBase::reset()
{
m_current_time = 0;
Ipo* curr;
for_in (curr, m_all_ipos)
for_var_in(Ipo*, curr, m_all_ipos)
{
curr->reset();
}
@ -103,8 +101,7 @@ void AnimationBase::update(float dt, Vec3 *xyz, Vec3 *hpr, Vec3 *scale)
assert(!isnan(m_current_time));
Ipo* curr;
for_in (curr, m_all_ipos)
for_var_in (Ipo*, curr, m_all_ipos)
{
curr->update(m_current_time, xyz, hpr, scale);
}

View File

@ -90,8 +90,7 @@ public:
{
float duration = -1;
const Ipo* currIpo;
for_in (currIpo, m_all_ipos)
for_var_in (const Ipo*, currIpo, m_all_ipos)
{
duration = std::max(duration, currIpo->getEndTime());
}

View File

@ -167,8 +167,7 @@ PlayerManager::PlayerManager()
PlayerManager::~PlayerManager()
{
// If the passwords should not be remembered, clear the saved session.
PlayerProfile *player;
for_in(player, m_all_players)
for_var_in(PlayerProfile*, player, m_all_players)
{
if(!player->rememberPassword())
player->clearSession();
@ -270,8 +269,7 @@ void PlayerManager::save()
}
// Save all non-guest players
PlayerProfile *player;
for_in(player, m_all_players)
for_var_in(PlayerProfile*, player, m_all_players)
{
if(!player->isGuestAccount())
player->save(players_file);
@ -321,7 +319,7 @@ void PlayerManager::enforceCurrentPlayer()
{
if (m_current_player) return;
PlayerProfile *player;
PlayerProfile* player;
for_in(player, m_all_players)
{
if (!player->isGuestAccount())
@ -408,8 +406,7 @@ void PlayerManager::createGuestPlayers(int n)
unsigned int PlayerManager::getNumNonGuestPlayers() const
{
unsigned int count=0;
const PlayerProfile *player;
for_in(player, m_all_players)
for_var_in(const PlayerProfile*, player, m_all_players)
{
if(!player->isGuestAccount()) count ++;
}
@ -422,8 +419,7 @@ unsigned int PlayerManager::getNumNonGuestPlayers() const
unsigned int PlayerManager::getUniqueId() const
{
unsigned int max_id=0;
const PlayerProfile *player;
for_in(player, m_all_players)
for_var_in(const PlayerProfile*, player, m_all_players)
{
if(player->getUniqueID()>max_id)
max_id = player->getUniqueID();
@ -439,8 +435,7 @@ unsigned int PlayerManager::getUniqueId() const
*/
const PlayerProfile *PlayerManager::getPlayerById(unsigned int id)
{
const PlayerProfile *player;
for_in(player, m_all_players)
for_var_in(const PlayerProfile*, player, m_all_players)
{
if(player->getUniqueID()==id)
return player;
@ -455,8 +450,7 @@ const PlayerProfile *PlayerManager::getPlayerById(unsigned int id)
*/
PlayerProfile *PlayerManager::getPlayer(const irr::core::stringw &name)
{
PlayerProfile *player;
for_in(player, m_all_players)
for_var_in(PlayerProfile*, player, m_all_players)
{
if(player->getName()==name)
return player;

View File

@ -828,8 +828,7 @@ namespace GUIEngine
{
// This code needs to go outside beginScene() / endScene() since
// the model view widget will do off-screen rendering there
GUIEngine::Widget* widget;
for_in (widget, GUIEngine::needsUpdate)
for_var_in(GUIEngine::Widget*, widget, GUIEngine::needsUpdate)
{
widget->update(dt);
}

View File

@ -534,8 +534,7 @@ irr::core::stringw DynamicRibbonWidget::getSelectionText(const int playerID)
// -----------------------------------------------------------------------------
RibbonWidget* DynamicRibbonWidget::getRowContaining(Widget* w)
{
RibbonWidget* row;
for_in (row, m_rows)
for_var_in (RibbonWidget*, row, m_rows)
{
if (row != NULL)
{
@ -548,8 +547,7 @@ RibbonWidget* DynamicRibbonWidget::getRowContaining(Widget* w)
// -----------------------------------------------------------------------------
RibbonWidget* DynamicRibbonWidget::getSelectedRibbon(const int playerID)
{
RibbonWidget* row;
for_in (row, m_rows)
for_var_in (RibbonWidget*, row, m_rows)
{
if (GUIEngine::isFocusedForPlayer(row, playerID))
{
@ -608,8 +606,7 @@ EventPropagation DynamicRibbonWidget::leftPressed(const int playerID)
updateLabel();
propagateSelection();
DynamicRibbonHoverListener* listener;
for_in( listener, m_hover_listeners )
for_var_in (DynamicRibbonHoverListener*, listener, m_hover_listeners)
{
listener->onSelectionChanged(this, w->getSelectionIDString(playerID),
w->getSelectionText(playerID), playerID);
@ -666,8 +663,7 @@ EventPropagation DynamicRibbonWidget::mouseHovered(Widget* child, const int play
if (getSelectedRibbon(playerID) != NULL)
{
DynamicRibbonHoverListener* listener;
for_in( listener, m_hover_listeners )
for_var_in (DynamicRibbonHoverListener*, listener, m_hover_listeners)
{
listener->onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID),
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
@ -682,15 +678,13 @@ EventPropagation DynamicRibbonWidget::focused(const int playerID)
Widget::focused(playerID);
updateLabel();
DynamicRibbonHoverListener* listener;
if (getSelectedRibbon(playerID)->getSelectionIDString(playerID) == "")
{
//fprintf(stderr, "[DynamicRibbonWidget] WARNING: Can't find selection for player %i, selecting first item\n", 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),
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
@ -719,15 +713,13 @@ void DynamicRibbonWidget::onRibbonWidgetFocus(RibbonWidget* emitter, const int p
updateLabel(emitter);
DynamicRibbonHoverListener* listener;
if (emitter->getSelectionIDString(playerID) == "")
{
//fprintf(stderr, "[DynamicRibbonWidget] WARNING: Can't find selection for player %i, selecting first item\n", 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),
emitter->getSelectionText(playerID), playerID);
@ -802,8 +794,7 @@ void DynamicRibbonWidget::propagateSelection()
}
// set same selection in all ribbons
RibbonWidget* ribbon;
for_in( ribbon, m_rows )
for_var_in (RibbonWidget*, ribbon, m_rows)
{
if (ribbon != selected_ribbon)
{

View File

@ -443,8 +443,7 @@ void RibbonWidget::removeChildNamed(const char* name)
// This method should only be called BEFORE a widget is added
assert(m_element == NULL);
Widget* child;
for_in (child, m_children)
for_var_in(Widget*, child, m_children)
{
if (child->m_properties[PROP_ID] == name)
{

View File

@ -303,6 +303,8 @@ public:
#define for_in( VAR, VECTOR ) for (unsigned int _foreach_i = 0; \
VAR = (_foreach_i < VECTOR.size() ? VECTOR.get(_foreach_i) : NULL),\
_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