Commit 25514589 authored by hybrid's avatar hybrid

Renamed core::round to core::round_ just as for the other replacement...

Renamed core::round to core::round_ just as for the other replacement functions already available in standard headers. Fixed a signed/unsigned warning.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@900 dfc29bdd-3216-0410-991c-e03cc46cb475
parent a4c01959
......@@ -17,6 +17,11 @@
#define floorf(X) floor(X)
#define powf(X,Y) pow(X,Y)
#define fmodf(X,Y) fmod(X,Y)
#if defined(_IRR_SOLARIS_PLATFORM_)
#define roundf(X) (floor( X + 0.5f ))
#else
#define roundf(X) round(X)
#endif
#endif
namespace irr
......@@ -233,7 +238,7 @@ namespace core
inline f32 round ( f32 x )
inline f32 round_( f32 x )
{
return roundf(x);
}
......@@ -393,11 +398,11 @@ namespace core
);
#else
# warn IRRLICHT_FAST_MATH not supported.
return (s32) round(x);
return (s32) round_(x);
#endif
return t;
#else // no fast math
return (s32) round(x);
return (s32) round_(x);
#endif
}
......
......@@ -24,7 +24,7 @@ namespace gui
CGUIContextMenu::CGUIContextMenu(IGUIEnvironment* environment,
IGUIElement* parent, s32 id,
core::rect<s32> rectangle, bool getFocus, bool allowFocus)
: IGUIContextMenu(environment, parent, id, rectangle), HighLighted(-1),
: IGUIContextMenu(environment, parent, id, rectangle), HighLighted(-1),
ChangeTime(0), EventParent(0), AllowFocus(allowFocus)
{
#ifdef _DEBUG
......@@ -44,7 +44,7 @@ CGUIContextMenu::CGUIContextMenu(IGUIEnvironment* environment,
//! destructor
CGUIContextMenu::~CGUIContextMenu()
{
for (s32 i=0; i<(s32)Items.size(); ++i)
for (u32 i=0; i<Items.size(); ++i)
if (Items[i].SubMenu)
Items[i].SubMenu->drop();
}
......@@ -84,7 +84,7 @@ s32 CGUIContextMenu::addItem(const wchar_t* text, s32 id, bool enabled, bool has
//! Adds a sub menu from an element that already exists.
void CGUIContextMenu::setSubMenu(s32 index, CGUIContextMenu* menu)
{
if (index >= (s32)Items.size() || index < 0)
if ((u32)index >= Items.size())
return;
if (Items[index].SubMenu)
......@@ -117,7 +117,7 @@ void CGUIContextMenu::addSeparator()
//! Returns text of the menu item.
const wchar_t* CGUIContextMenu::getItemText(s32 idx)
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
return 0;
return Items[idx].Text.c_str();
......@@ -127,7 +127,7 @@ const wchar_t* CGUIContextMenu::getItemText(s32 idx)
//! Sets text of the menu item.
void CGUIContextMenu::setItemText(s32 idx, const wchar_t* text)
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
return;
Items[idx].Text = text;
......@@ -138,7 +138,7 @@ void CGUIContextMenu::setItemText(s32 idx, const wchar_t* text)
//! Returns if a menu item is enabled
bool CGUIContextMenu::isItemEnabled(s32 idx)
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
......@@ -151,7 +151,7 @@ bool CGUIContextMenu::isItemEnabled(s32 idx)
//! Returns if a menu item is checked
bool CGUIContextMenu::isItemChecked(s32 idx)
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
......@@ -165,7 +165,7 @@ bool CGUIContextMenu::isItemChecked(s32 idx)
//! Sets if the menu item should be enabled.
void CGUIContextMenu::setItemEnabled(s32 idx, bool enabled)
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
return;
Items[idx].Enabled = enabled;
......@@ -174,7 +174,7 @@ void CGUIContextMenu::setItemEnabled(s32 idx, bool enabled)
//! Sets if the menu item should be checked.
void CGUIContextMenu::setItemChecked(s32 idx, bool checked )
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
return;
Items[idx].Checked = checked;
......@@ -184,7 +184,7 @@ void CGUIContextMenu::setItemChecked(s32 idx, bool checked )
//! Removes a menu item
void CGUIContextMenu::removeItem(s32 idx)
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
return;
if (Items[idx].SubMenu)
......@@ -201,7 +201,7 @@ void CGUIContextMenu::removeItem(s32 idx)
//! Removes all menu items
void CGUIContextMenu::removeAllItems()
{
for (s32 i=0; i<(s32)Items.size(); ++i)
for (u32 i=0; i<Items.size(); ++i)
if (Items[i].SubMenu)
Items[i].SubMenu->drop();
......@@ -269,7 +269,7 @@ void CGUIContextMenu::setVisible(bool visible)
{
HighLighted = -1;
ChangeTime = os::Timer::getTime();
for (s32 j=0; j<(s32)Items.size(); ++j)
for (u32 j=0; j<Items.size(); ++j)
if (Items[j].SubMenu)
Items[j].SubMenu->setVisible(false);
......@@ -551,6 +551,7 @@ void CGUIContextMenu::recalculateSize()
// recalculate submenus
for (i=0; i<(s32)Items.size(); ++i)
{
if (Items[i].SubMenu)
{
// move submenu
......@@ -561,6 +562,7 @@ void CGUIContextMenu::recalculateSize()
core::rect<s32>(width-5, Items[i].PosY,
width+w-5, Items[i].PosY+h));
}
}
}
......@@ -574,7 +576,7 @@ s32 CGUIContextMenu::getSelectedItem()
//! \return Returns a pointer to the submenu of an item.
IGUIContextMenu* CGUIContextMenu::getSubMenu(s32 idx)
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
return 0;
return Items[idx].SubMenu;
......@@ -584,7 +586,7 @@ IGUIContextMenu* CGUIContextMenu::getSubMenu(s32 idx)
//! Returns command id of a menu item
s32 CGUIContextMenu::getItemCommandId(s32 idx)
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
return -1;
return Items[idx].CommandId;
......@@ -593,7 +595,7 @@ s32 CGUIContextMenu::getItemCommandId(s32 idx)
//! Sets the command id of a menu item
void CGUIContextMenu::setItemCommandId(s32 idx, s32 id)
{
if (idx < 0 || idx >= (s32)Items.size())
if ((u32)idx >= Items.size())
return;
Items[idx].CommandId = id;
......@@ -603,14 +605,14 @@ void CGUIContextMenu::setItemCommandId(s32 idx, s32 id)
void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0)
{
IGUIElement::serializeAttributes(out,options);
out->addPosition2d ("Position", Pos);
out->addPosition2d("Position", Pos);
if (Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU )
{
IGUIContextMenu* ptr = (IGUIContextMenu*)Parent;
s32 i=0;
// find the position of this item in its parent's list
for (; i<(s32)ptr->getItemCount() && ptr->getSubMenu(i) != this; ++i);
s32 i;
for (i=0; i<ptr->getItemCount() && ptr->getSubMenu(i) != this; ++i);
out->addInt("ParentItem", i);
}
......@@ -620,8 +622,7 @@ void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeRe
core::stringc tmp;
s32 i=0;
for (; i < (s32)Items.size(); ++i)
for (u32 i=0; i < Items.size(); ++i)
{
tmp = "IsSeparator"; tmp += i;
out->addBool(tmp.c_str(), Items[i].IsSeparator);
......@@ -655,8 +656,7 @@ void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeR
// read the item list
s32 count = in->getAttributeAsInt("ItemCount");
s32 i=0;
for (; i<(s32)count; ++i)
for (s32 i=0; i<count; ++i)
{
core::stringc tmp;
core::stringw txt;
......@@ -685,9 +685,7 @@ void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeR
}
}
recalculateSize();
}
// because sometimes the element has no parent at click time
......@@ -695,7 +693,7 @@ void CGUIContextMenu::setEventParent(IGUIElement *parent)
{
EventParent = parent;
for (u32 i=0; i<(s32)Items.size(); ++i)
for (u32 i=0; i<Items.size(); ++i)
if (Items[i].SubMenu)
{
Items[i].SubMenu->setEventParent(parent);
......@@ -704,7 +702,7 @@ void CGUIContextMenu::setEventParent(IGUIElement *parent)
bool CGUIContextMenu::hasOpenSubMenu()
{
for (s32 i=0; i<(s32)Items.size(); ++i)
for (u32 i=0; i<Items.size(); ++i)
if (Items[i].SubMenu)
if ( Items[i].SubMenu->isVisible() )
return true;
......@@ -713,7 +711,7 @@ bool CGUIContextMenu::hasOpenSubMenu()
void CGUIContextMenu::closeAllSubMenus()
{
for (s32 i=0; i<(s32)Items.size(); ++i)
for (u32 i=0; i<Items.size(); ++i)
if (Items[i].SubMenu)
Items[i].SubMenu->setVisible(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment