Skip to content

Commit

Permalink
Fixed #8817 (Possibility to write in disabled Edit Field)
Browse files Browse the repository at this point in the history
Added missing Vehicle.getUpgradeOnSlot (serverside version is already available)
  • Loading branch information
jushar committed Apr 9, 2015
1 parent b869516 commit 9f56a0b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
18 changes: 12 additions & 6 deletions MTA10/gui/CGUITabList.cpp
Expand Up @@ -18,29 +18,35 @@ void CGUITabList::SelectNext ( CGUITabListItem* pBase )
bool bFound = false;
for ( CGUITabIterator iter = m_Items.begin (); iter != m_Items.end () ; ++ iter )
{
if ( (*iter) == pBase )
CGUITabListItem* pItem = *iter;

if ( pItem == pBase )
{
bFound = true;
}
else if ( bFound && (*iter)->ActivateOnTab () )
else if ( bFound && pItem->IsEnabled () )
{
// we found an element that wants to get selected
pItem->ActivateOnTab ();
return;
}
}

// Contine to search an element from the beginning
for ( CGUITabIterator iter = m_Items.begin (); iter != m_Items.end (); ++ iter )
{
if ( (*iter) == pBase )
CGUITabListItem* pItem = *iter;

if ( pItem == pBase )
{
// just where we started, so we don't have to do anything
return;
}
else if ( (*iter)->ActivateOnTab () )
else if ( pItem->IsEnabled () )
{
// finally found something different than the current element
return;
// finally found something different than the current element
pItem->ActivateOnTab ();
return;
}
}
}
5 changes: 3 additions & 2 deletions MTA10/gui/CGUITabListItem.h
Expand Up @@ -9,11 +9,12 @@
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/

#ifndef __CGUITABLISTITEM_H
#define __CGUITABLISTITEM_H

class CGUITabListItem
#include <gui/CGUI.h>

class CGUITabListItem : public CGUIElement
{
public:
virtual bool ActivateOnTab ( void ) = 0;
Expand Down
1 change: 1 addition & 0 deletions MTA10/mods/shared_logic/lua/CLuaMain.cpp
Expand Up @@ -308,6 +308,7 @@ void CLuaMain::AddVehicleClass ( lua_State* luaVM )
lua_classfunction ( luaVM, "getUpgrades", "getVehicleUpgrades" );
lua_classfunction ( luaVM, "getUpgradeSlotName", "getVehicleUpgradeSlotName" );
lua_classfunction ( luaVM, "getCompatibleUpgrades", "getVehicleCompatibleUpgrades" );
lua_classfunction ( luaVM, "getUpgradeOnSlot", "getVehicleUpgradeOnSlot" );

lua_classfunction ( luaVM, "setComponentVisible", "setVehicleComponentVisible" );
lua_classfunction ( luaVM, "setSirensOn", "setVehicleSirensOn" );
Expand Down

0 comments on commit 9f56a0b

Please sign in to comment.