Added support for arena-addons (as a separate tab).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9109 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
I18N="Section in the addons menu" text="Karts"/>
|
||||
<icon-button id="tab_track" width="128" height="128" icon="gui/mode_normal.png"
|
||||
I18N="Section in the addons menu" text="Tracks"/>
|
||||
<icon-button id="tab_arena" width="128" height="128" icon="gui/mode_normal.png"
|
||||
I18N="Section in the addons menu" text="Arenas"/>
|
||||
</tabs>
|
||||
<spacer height="5" width="10"/>
|
||||
|
||||
|
||||
@@ -48,6 +48,13 @@ Addon::Addon(const XMLNode &xml)
|
||||
m_icon_ready = false;
|
||||
m_type = xml.getName();
|
||||
|
||||
// FIXME: temporarily till the web page is updated.
|
||||
if(m_type=="track")
|
||||
{
|
||||
int is_arena=0;
|
||||
xml.get("arena", &is_arena );
|
||||
if(is_arena) m_type="arena";
|
||||
}
|
||||
xml.get("name", &m_name );
|
||||
m_id = StringUtils::toLowerCase(m_name);
|
||||
xml.get("id", &m_id );
|
||||
@@ -88,6 +95,9 @@ void Addon::copyInstallData(const Addon &addon)
|
||||
m_designer = addon.m_designer;
|
||||
m_status = addon.m_status;
|
||||
m_date = addon.m_date;
|
||||
// Support if the type of an addon changes, e.g. this ie necessary
|
||||
// when we introduce 'arena' as type (formerly arenas had type 'track').
|
||||
m_type = addon.m_type;
|
||||
} // copyInstallData
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -193,6 +193,8 @@ public:
|
||||
return "karts/";
|
||||
else if(m_type=="track")
|
||||
return "tracks/";
|
||||
else if(m_type=="arena") // arenas are installed as tracks
|
||||
return "tracks/";
|
||||
// It must be one of the two
|
||||
assert(false);
|
||||
return ""; // Ignore compiler warning
|
||||
|
||||
@@ -73,7 +73,8 @@ void AddonsManager::initOnline(const XMLNode *xml)
|
||||
const std::string &name = node->getName();
|
||||
// Ignore news/redirect, which is handled by network_http
|
||||
if(name=="include" || name=="message") continue;
|
||||
if(node->getName()=="track" || node->getName()=="kart")
|
||||
if(node->getName()=="track" || node->getName()=="kart" ||
|
||||
node->getName()=="arena" )
|
||||
{
|
||||
Addon addon(*node);
|
||||
int index = getAddonIndex(addon.getId());
|
||||
@@ -205,7 +206,7 @@ void AddonsManager::loadInstalledAddons()
|
||||
for(unsigned int i=0; i<xml->getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *node=xml->getNode(i);
|
||||
if(node->getName()=="kart" ||
|
||||
if(node->getName()=="kart" || node->getName()=="arena" ||
|
||||
node->getName()=="track" )
|
||||
{
|
||||
Addon addon(*node);
|
||||
@@ -334,7 +335,7 @@ void AddonsManager::saveInstalled(const std::string &type)
|
||||
xml_installed.close();
|
||||
if(type=="kart")
|
||||
kart_properties_manager->reLoadAllKarts();
|
||||
else if(type=="track")
|
||||
else if(type=="track" || type=="arena")
|
||||
track_manager->loadTrackList();
|
||||
} // saveInstalled
|
||||
|
||||
|
||||
@@ -238,6 +238,12 @@ void AddonsScreen::eventCallback(GUIEngine::Widget* widget,
|
||||
m_type = "kart";
|
||||
loadList();
|
||||
}
|
||||
else if (selection == "tab_arena")
|
||||
{
|
||||
m_type = "arena";
|
||||
loadList();
|
||||
}
|
||||
|
||||
}
|
||||
} // eventCallback
|
||||
|
||||
|
||||
Reference in New Issue
Block a user