From 6867018d52db9e3a4bc13927d442f798e03480f9 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Sun, 27 Mar 2011 12:10:07 +0000 Subject: [PATCH] Enabled news (but not addons) in normal debug mode. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8086 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/addons/addon.cpp | 2 -- src/addons/addon.hpp | 3 --- src/addons/addons_manager.cpp | 3 --- src/addons/addons_manager.hpp | 3 +-- src/addons/network_http.cpp | 6 ++++-- src/addons/network_http.hpp | 4 +--- src/addons/zip.cpp | 3 +-- src/addons/zip.hpp | 3 +-- src/ide/vc9/supertuxkart.vcproj | 4 ++-- src/io/file_manager.cpp | 6 ------ src/io/file_manager.hpp | 4 ---- src/main.cpp | 19 ++++++------------- src/states_screens/main_menu_screen.cpp | 7 ++++--- src/states_screens/options_screen_ui.cpp | 21 +++++++++++++++------ 14 files changed, 35 insertions(+), 53 deletions(-) diff --git a/src/addons/addon.cpp b/src/addons/addon.cpp index 3285961d7..b93b03e8d 100644 --- a/src/addons/addon.cpp +++ b/src/addons/addon.cpp @@ -17,7 +17,6 @@ /** \page addons Addons */ -#ifdef ADDONS_MANAGER #include "addons/addon.hpp" @@ -87,5 +86,4 @@ void Addon::writeXML(std::ofstream *out_stream) << "\"/>\n"; } // writeXML -#endif diff --git a/src/addons/addon.hpp b/src/addons/addon.hpp index 550acdd0e..c4536af62 100644 --- a/src/addons/addon.hpp +++ b/src/addons/addon.hpp @@ -17,8 +17,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef ADDONS_MANAGER - #ifndef HEADER_ADDON_HPP #define HEADER_ADDON_HPP @@ -135,4 +133,3 @@ public: #endif -#endif diff --git a/src/addons/addons_manager.cpp b/src/addons/addons_manager.cpp index 013d9b961..c34fff53a 100644 --- a/src/addons/addons_manager.cpp +++ b/src/addons/addons_manager.cpp @@ -17,7 +17,6 @@ /** \page addons Addons */ -#ifdef ADDONS_MANAGER #include "addons/addons_manager.hpp" @@ -380,5 +379,3 @@ void AddonsManager::saveInstalled(const std::string &type) track_manager->loadTrackList(); } // saveInstalled - -#endif diff --git a/src/addons/addons_manager.hpp b/src/addons/addons_manager.hpp index 9ecf9332b..59306e58b 100644 --- a/src/addons/addons_manager.hpp +++ b/src/addons/addons_manager.hpp @@ -15,7 +15,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef ADDONS_MANAGER #ifndef HEADER_ADDONS_MANAGER_HPP #define HEADER_ADDONS_MANAGER_HPP @@ -90,4 +89,4 @@ public: extern AddonsManager *addons_manager; #endif -#endif + diff --git a/src/addons/network_http.cpp b/src/addons/network_http.cpp index 5c6705e98..89652e6c1 100644 --- a/src/addons/network_http.cpp +++ b/src/addons/network_http.cpp @@ -15,7 +15,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef ADDONS_MANAGER #include "addons/network_http.hpp" #include @@ -115,15 +114,19 @@ void *NetworkHttp::mainLoop(void *obj) me->checkRedirect(xml); me->updateNews(xml, xml_file); me->loadAddonsList(xml, xml_file); +#ifdef ADDONS_MANAGER addons_manager->initOnline(xml); if(UserConfigParams::m_verbosity>=3) printf("[addons] Addons manager list downloaded\n"); +#endif } else { +#ifdef ADDONS_MANAGER addons_manager->setErrorState(); if(UserConfigParams::m_verbosity>=3) printf("[addons] Can't download addons list.\n"); +#endif } pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); @@ -608,4 +611,3 @@ float NetworkHttp::getProgress() const return m_progress.get(); } // getProgress -#endif diff --git a/src/addons/network_http.hpp b/src/addons/network_http.hpp index 76349f62a..5702ce14a 100644 --- a/src/addons/network_http.hpp +++ b/src/addons/network_http.hpp @@ -15,8 +15,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef ADDONS_MANAGER - #ifndef HEADER_NETWORK_HTTP_HPP #define HEADER_NETWORK_HTTP_HPP @@ -148,4 +146,4 @@ public: extern NetworkHttp *network_http; #endif -#endif + diff --git a/src/addons/zip.cpp b/src/addons/zip.cpp index 16e01337c..63ed0b257 100644 --- a/src/addons/zip.cpp +++ b/src/addons/zip.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef ADDONS_MANAGER + #include "irrlicht.h" #include #include @@ -122,4 +122,3 @@ bool extract_zip(const std::string &from, const std::string &to) return !error; } // extract_zip -#endif diff --git a/src/addons/zip.hpp b/src/addons/zip.hpp index 22a6329b1..51a665c87 100644 --- a/src/addons/zip.hpp +++ b/src/addons/zip.hpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef ADDONS_MANAGER + #ifndef HEADER_ZIP_HPP #define HEADER_ZIP_HPP @@ -22,4 +22,3 @@ bool extract_zip(const std::string &from, const std::string &to); #endif -#endif diff --git a/src/ide/vc9/supertuxkart.vcproj b/src/ide/vc9/supertuxkart.vcproj index 162f21520..8dbec2137 100644 --- a/src/ide/vc9/supertuxkart.vcproj +++ b/src/ide/vc9/supertuxkart.vcproj @@ -43,7 +43,7 @@ Optimization="0" WholeProgramOptimization="false" AdditionalIncludeDirectories="../../../src;../../../src/bullet/src;../../../src/enet/include;../../../dependencies/include;../../../dependencies/include/irrlicht" - PreprocessorDefinitions="BT_NO_PROFILE;HAVE_OPENAL;HAVE_OGGVORBIS;_DEBUG;_CONSOLE;WIN32;NOMINMAX;VERSION=\"0.7alpha3\";_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;DEBUG;PACKAGE=\"supertuxkart\";HAVE_GETTEXT;ENABLE_NLS;HAVE_GLUT;_CRTDBG_MAP_ALLOC;ENABLE_BIDI" + PreprocessorDefinitions="BT_NO_PROFILE;HAVE_OPENAL;HAVE_OGGVORBIS;_DEBUG;_CONSOLE;WIN32;NOMINMAX;VERSION=\"0.7alpha3\";_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;DEBUG;PACKAGE=\"supertuxkart\";HAVE_GLUT;_CRTDBG_MAP_ALLOC;ENABLE_BIDI" GeneratePreprocessedFile="0" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -65,7 +65,7 @@ /> & result, //----------------------------------------------------------------------------- -#ifdef ADDONS_MANAGER void FileManager::checkAndCreateDirForAddons(std::string addons_name, std::string addons_type) { @@ -757,4 +752,3 @@ bool FileManager::removeDirectory(const std::string &name) const #endif } // remove directory -#endif diff --git a/src/io/file_manager.hpp b/src/io/file_manager.hpp index 181a46cd9..80c5011c2 100644 --- a/src/io/file_manager.hpp +++ b/src/io/file_manager.hpp @@ -69,9 +69,7 @@ private: io::path createAbsoluteFilename(const std::string &f); void checkAndCreateConfigDir(); bool isDirectory(const std::string &path) const; -#ifdef ADDONS_MANAGER void checkAndCreateAddonsDir(); -#endif public: FileManager(char *argv[]); ~FileManager(); @@ -82,14 +80,12 @@ public: std::string getConfigDir() const; bool checkAndCreateDirectoryP(const std::string &path); -#ifdef ADDONS_MANAGER const std::string &getAddonsDir() const; std::string getAddonsFile(const std::string &name); void checkAndCreateDirForAddons(std::string addons_name, std::string addons_type); bool removeFile(const std::string &name) const; bool removeDirectory(const std::string &name) const; -#endif std::string getDataDir () const; std::string getTranslationDir() const; std::string getGUIDir () const; diff --git a/src/main.cpp b/src/main.cpp index e33c28eae..4b0246f70 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,20 +40,23 @@ #include #include +#include "IEventReceiver.h" + #include "main_loop.hpp" +#include "addons/addons_manager.hpp" +#include "addons/network_http.hpp" #include "audio/music_manager.hpp" #include "audio/sfx_manager.hpp" #include "challenges/unlock_manager.hpp" -#include "tutorial/tutorial_manager.hpp" #include "config/stk_config.hpp" #include "config/user_config.hpp" #include "config/player.hpp" #include "graphics/irr_driver.hpp" #include "graphics/material_manager.hpp" #include "guiengine/engine.hpp" -#include "io/file_manager.hpp" #include "input/input_manager.hpp" #include "input/device_manager.hpp" +#include "io/file_manager.hpp" #include "items/attachment_manager.hpp" #include "items/item_manager.hpp" #include "items/projectile_manager.hpp" @@ -69,15 +72,9 @@ #include "states_screens/state_manager.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "tutorial/tutorial_manager.hpp" #include "utils/translation.hpp" -#include - -#ifdef ADDONS_MANAGER -#include "addons/network_http.hpp" -#include "addons/addons_manager.hpp" -#endif - // ============================================================================ // gamepad visualisation screen // ============================================================================ @@ -762,13 +759,11 @@ void initRest() GUIEngine::init(device, driver, StateManager::get()); -#ifdef ADDONS_MANAGER // This only initialises the non-network part of the addons manager. The // online section of the addons manager will be initialised from a // separate thread running in network http. addons_manager = new AddonsManager(); network_http = new NetworkHttp(); -#endif music_manager = new MusicManager(); sfx_manager = new SFXManager(); // The order here can be important, e.g. KartPropertiesManager needs @@ -820,9 +815,7 @@ void cleanTuxKart() //delete in reverse order of what they were created in. //see InitTuxkart() if(race_manager) delete race_manager; -#ifdef ADDONS_MANAGER if(network_http) delete network_http; -#endif if(network_manager) delete network_manager; if(grand_prix_manager) delete grand_prix_manager; if(highscore_manager) delete highscore_manager; diff --git a/src/states_screens/main_menu_screen.cpp b/src/states_screens/main_menu_screen.cpp index efcf3d51e..3c4d16359 100644 --- a/src/states_screens/main_menu_screen.cpp +++ b/src/states_screens/main_menu_screen.cpp @@ -21,6 +21,7 @@ #include #include "guiengine/scalable_font.hpp" +#include "guiengine/widgets/label_widget.hpp" #include "guiengine/widgets/list_widget.hpp" #include "guiengine/widgets/ribbon_widget.hpp" #include "input/device_manager.hpp" @@ -102,9 +103,9 @@ void MainMenuScreen::init() IconButtonWidget* w = this->getWidget("addons"); w->setDeactivated(); } +#endif LabelWidget* w = this->getWidget("info_addons"); w->setScrollSpeed(15); -#endif } @@ -121,6 +122,8 @@ void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver) addons_icon->setActivated(); } +#endif + LabelWidget* w = this->getWidget("info_addons"); w->update(delta); if(w->scrolledOff()) @@ -129,8 +132,6 @@ void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver) w->setText(news_text); } -#endif - IconButtonWidget* lang_combo = this->getWidget("lang_combo"); if (lang_combo != NULL) { diff --git a/src/states_screens/options_screen_ui.cpp b/src/states_screens/options_screen_ui.cpp index fd7b9450b..d2ee209a6 100644 --- a/src/states_screens/options_screen_ui.cpp +++ b/src/states_screens/options_screen_ui.cpp @@ -56,7 +56,7 @@ void OptionsScreenUI::loadedFromFile() { m_inited = false; - GUIEngine::SpinnerWidget* skinSelector = this->getWidget("skinchoice"); + GUIEngine::SpinnerWidget* skinSelector = getWidget("skinchoice"); assert( skinSelector != NULL ); skinSelector->m_properties[PROP_WARP_AROUND] = "true"; @@ -102,7 +102,7 @@ void OptionsScreenUI::loadedFromFile() void OptionsScreenUI::init() { Screen::init(); - RibbonWidget* ribbon = this->getWidget("options_choice"); + RibbonWidget* ribbon = getWidget("options_choice"); if (ribbon != NULL) ribbon->select( "tab_ui", PLAYER_ID_GAME_MASTER ); ribbon->getRibbonChildren()[0].setTooltip( _("Graphics") ); @@ -110,14 +110,17 @@ void OptionsScreenUI::init() ribbon->getRibbonChildren()[3].setTooltip( _("Players") ); ribbon->getRibbonChildren()[4].setTooltip( _("Controls") ); - GUIEngine::SpinnerWidget* skinSelector = this->getWidget("skinchoice"); + GUIEngine::SpinnerWidget* skinSelector = getWidget("skinchoice"); assert( skinSelector != NULL ); // ---- video modes - CheckBoxWidget* fps = this->getWidget("showfps"); + CheckBoxWidget* fps = getWidget("showfps"); assert( fps != NULL ); fps->setState( UserConfigParams::m_display_fps ); + CheckBoxWidget* news = getWidget("enable-internet"); + assert( news != NULL ); + news->setState( UserConfigParams::m_enable_internet ); // --- select the right skin in the spinner bool currSkinFound = false; @@ -161,7 +164,7 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con } else if (name == "skinchoice") { - GUIEngine::SpinnerWidget* skinSelector = this->getWidget("skinchoice"); + GUIEngine::SpinnerWidget* skinSelector = getWidget("skinchoice"); assert( skinSelector != NULL ); const core::stringw selectedSkin = skinSelector->getStringValue(); @@ -170,10 +173,16 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con } else if (name == "showfps") { - CheckBoxWidget* fps = this->getWidget("showfps"); + CheckBoxWidget* fps = getWidget("showfps"); assert( fps != NULL ); UserConfigParams::m_display_fps = fps->getState(); } + else if (name=="enable-internet") + { + CheckBoxWidget* news = getWidget("enable-internet"); + assert( news != NULL ); + UserConfigParams::m_enable_internet = news->getState(); + } } // eventCallback