Fixed warning + removed hardcoded constant

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5955 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-09-10 13:51:40 +00:00
parent 7f3f598193
commit 96d7bbf345
3 changed files with 10 additions and 11 deletions

View File

@ -220,9 +220,11 @@ Widget* AbstractTopLevelContainer::getLastWidget(ptr_vector<Widget>* within_vect
}
Widget* item = within_vector->get(i);
if (item->getIrrlichtElement() == NULL ||
item->getIrrlichtElement()->getTabOrder() == -1 ||
item->getIrrlichtElement()->getTabOrder() >= 1000 /* non-tabbing items are given such IDs */ ||
IGUIElement* elem = item->getIrrlichtElement();
if (elem == NULL ||
elem->getTabOrder() == -1 ||
!Widget::isFocusableId(elem->getTabOrder()) ||
!item->m_focusable)
{
continue;

View File

@ -188,14 +188,14 @@ bool Widget::deleteChild(const char* id)
namespace GUIEngine
{
// IDs must not start at 0, since it appears their GUI engine hardcodes some ID values
const unsigned int focusableIdsBase = 100;
const unsigned int unfocusableIdsBase = 1000;
const unsigned int FOCUSABLE_IDS_BASE = 100;
const unsigned int UNFOCUSABLE_IDS_BASE = 1000;
/** Used to assign irrLicht IDs to widgets dynamically */
static unsigned int id_counter = focusableIdsBase;
static unsigned int id_counter = FOCUSABLE_IDS_BASE;
/** for items that can't be reached with keyboard navigation but can be clicked */
static unsigned int id_counter_2 = unfocusableIdsBase;
static unsigned int id_counter_2 = UNFOCUSABLE_IDS_BASE;
}
int Widget::getNewID()
@ -212,7 +212,7 @@ bool Widget::isFocusableId(const int id)
{
if (id < 0) return false;
if ((unsigned int)id >= unfocusableIdsBase) return false;
if ((unsigned int)id >= UNFOCUSABLE_IDS_BASE) return false;
else return true;
}

View File

@ -270,6 +270,3 @@ void GrandPrixLose::setKarts(const std::vector<std::string> ident_arg)
// -------------------------------------------------------------------------------------