diff --git a/lib/bullet/src/LinearMath/btScalar.h b/lib/bullet/src/LinearMath/btScalar.h index 7d54bf5ad..f601e3a90 100644 --- a/lib/bullet/src/LinearMath/btScalar.h +++ b/lib/bullet/src/LinearMath/btScalar.h @@ -109,7 +109,7 @@ inline int btGetVersion() #ifdef __SPU__ #include #define printf spu_printf - #define btAssert(x) {if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}} + #define btAssert(x) {if(!(x)){printf("Assert " __FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}} #else #define btAssert assert #endif diff --git a/src/animations/animation_base.hpp b/src/animations/animation_base.hpp index 2bc335bc3..1fc6ef090 100644 --- a/src/animations/animation_base.hpp +++ b/src/animations/animation_base.hpp @@ -69,6 +69,7 @@ protected: public: AnimationBase(const XMLNode &node); AnimationBase(Ipo *ipo); + virtual ~AnimationBase() {} virtual void update(float dt, Vec3 *xyz=NULL, Vec3 *hpr=NULL, Vec3 *scale=NULL); /** This needs to be implemented by the inheriting classes. It is called diff --git a/src/config/player_manager.cpp b/src/config/player_manager.cpp index 0455fab3c..af4e0bc63 100644 --- a/src/config/player_manager.cpp +++ b/src/config/player_manager.cpp @@ -166,15 +166,12 @@ PlayerManager::PlayerManager() */ PlayerManager::~PlayerManager() { - // If the passwords should not be remembered, clear all saved sessions. - if(!UserConfigParams::m_remember_user) + // If the passwords should not be remembered, clear the saved session. + PlayerProfile *player; + for_in(player, m_all_players) { - PlayerProfile *player; - for_in(player, m_all_players) - { + if(!player->rememberPassword()) player->clearSession(); - } - } save(); @@ -266,7 +263,7 @@ void PlayerManager::save() players_file << L"\n"; players_file << L"\n"; - if(m_current_player && UserConfigParams::m_remember_user) + if(m_current_player) { players_file << L" getName() << L"\"/>\n"; diff --git a/src/config/player_profile.cpp b/src/config/player_profile.cpp index fe7d47077..c5fdcabe5 100644 --- a/src/config/player_profile.cpp +++ b/src/config/player_profile.cpp @@ -47,6 +47,7 @@ PlayerProfile::PlayerProfile(const core::stringw& name, bool is_guest) m_saved_user_id = 0; m_last_online_name = ""; m_last_was_online = false; + m_remember_password = false; initRemainingData(); } // PlayerProfile @@ -72,20 +73,22 @@ PlayerProfile::PlayerProfile(const XMLNode* node) m_saved_user_id = 0; m_last_online_name = ""; m_last_was_online = false; + m_remember_password = false; m_story_mode_status = NULL; m_achievements_status = NULL; m_icon_filename = ""; - node->get("name", &m_local_name ); - node->get("guest", &m_is_guest_account); - node->get("use-frequency", &m_use_frequency ); - node->get("unique-id", &m_unique_id ); - node->get("saved-session", &m_saved_session ); - node->get("saved-user", &m_saved_user_id ); - node->get("saved-token", &m_saved_token ); - node->get("last-online-name", &m_last_online_name); - node->get("last-was-online", &m_last_was_online ); - node->get("icon-filename", &m_icon_filename ); + node->get("name", &m_local_name ); + node->get("guest", &m_is_guest_account ); + node->get("use-frequency", &m_use_frequency ); + node->get("unique-id", &m_unique_id ); + node->get("saved-session", &m_saved_session ); + node->get("saved-user", &m_saved_user_id ); + node->get("saved-token", &m_saved_token ); + node->get("last-online-name", &m_last_online_name ); + node->get("last-was-online", &m_last_was_online ); + node->get("remember-password", &m_remember_password); + node->get("icon-filename", &m_icon_filename ); #ifdef DEBUG m_magic_number = 0xABCD1234; @@ -203,7 +206,8 @@ void PlayerProfile::save(UTFWriter &out) out << L" saved-user=\"" << m_saved_user_id << L"\" saved-token=\"" << m_saved_token << L"\"\n"; out << L" last-online-name=\"" << m_last_online_name - << L"\" last-was-online=\"" << m_last_was_online<< L"\">\n"; + << L"\" last-was-online=\"" << m_last_was_online << L"\"\n"; + out << L" remember-password=\"" << m_remember_password << L"\">\n"; { if(m_story_mode_status) m_story_mode_status->save(out); diff --git a/src/config/player_profile.hpp b/src/config/player_profile.hpp index cb68dd81a..a294d0a70 100644 --- a/src/config/player_profile.hpp +++ b/src/config/player_profile.hpp @@ -101,6 +101,9 @@ private: /** True if the last time this player was used as online. */ bool m_last_was_online; + /** True if the login data are saved. */ + bool m_remember_password; + /** The complete challenge state. */ StoryModeStatus *m_story_mode_status; @@ -271,6 +274,13 @@ public: /** Sets if this player was logged in last time it was used. */ void setWasOnlineLastTime(bool b) { m_last_was_online = b; } // ------------------------------------------------------------------------ + /** Returns if the last time this player was used it was used online or + * offline. */ + bool rememberPassword() const { return m_remember_password; } + // ------------------------------------------------------------------------ + /** Sets if this player was logged in last time it was used. */ + void setRememberPassword(bool b) { m_remember_password = b; } + // ------------------------------------------------------------------------ }; // class PlayerProfile #endif diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index bf91d0ddc..bf65f4633 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -682,10 +682,6 @@ namespace UserConfigParams // ---- User managerment - PARAM_PREFIX BoolUserConfigParam m_remember_user - PARAM_DEFAULT( BoolUserConfigParam(true, "remember_me", - "Automatically remember login data")); - PARAM_PREFIX BoolUserConfigParam m_always_show_login_screen PARAM_DEFAULT( BoolUserConfigParam(false, "always_show_login_screen", "Always show the login screen even if last player's session was saved.")); diff --git a/src/graphics/glwrap.cpp b/src/graphics/glwrap.cpp index 45c51a279..516be8203 100644 --- a/src/graphics/glwrap.cpp +++ b/src/graphics/glwrap.cpp @@ -532,7 +532,7 @@ unsigned GPUTimer::elapsedTimeus() FrameBuffer::FrameBuffer() {} FrameBuffer::FrameBuffer(const std::vector &RTTs, size_t w, size_t h, bool layered) : - DepthTexture(0), RenderTargets(RTTs), width(w), height(h) + RenderTargets(RTTs), DepthTexture(0), width(w), height(h) { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); @@ -551,7 +551,7 @@ FrameBuffer::FrameBuffer(const std::vector &RTTs, size_t w, size_t h, bo } FrameBuffer::FrameBuffer(const std::vector &RTTs, GLuint DS, size_t w, size_t h, bool layered) : - DepthTexture(DS), RenderTargets(RTTs), width(w), height(h) + RenderTargets(RTTs), DepthTexture(DS), width(w), height(h) { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); @@ -904,4 +904,4 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect& position, glUseProgram(0); glGetError(); -} \ No newline at end of file +} diff --git a/src/graphics/stkbillboard.cpp b/src/graphics/stkbillboard.cpp index 4ce29f479..710dec32d 100644 --- a/src/graphics/stkbillboard.cpp +++ b/src/graphics/stkbillboard.cpp @@ -22,7 +22,7 @@ static void createbillboardvao() STKBillboard::STKBillboard(irr::scene::ISceneNode* parent, irr::scene::ISceneManager* mgr, irr::s32 id, const irr::core::vector3df& position, const irr::core::dimension2d& size, irr::video::SColor colorTop, irr::video::SColor colorBottom) : - CBillboardSceneNode(parent, mgr, id, position, size, colorTop, colorBottom), IBillboardSceneNode(parent, mgr, id, position) + IBillboardSceneNode(parent, mgr, id, position), CBillboardSceneNode(parent, mgr, id, position, size, colorTop, colorBottom) { if (!billboardvao) createbillboardvao(); diff --git a/src/guiengine/event_handler.cpp b/src/guiengine/event_handler.cpp index cfcc0332c..0e6e3465f 100644 --- a/src/guiengine/event_handler.cpp +++ b/src/guiengine/event_handler.cpp @@ -631,7 +631,7 @@ void EventHandler::sendEventToUser(GUIEngine::Widget* widget, std::string& name, EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int playerID) { - if (w->m_deactivated) return EVENT_BLOCK; + if (!w->isActivated()) return EVENT_BLOCK; Widget* parent = w->m_event_handler; @@ -658,7 +658,7 @@ EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int parent = parent->m_event_handler; } - if (parent->m_deactivated) return EVENT_BLOCK; + if (!parent->isActivated()) return EVENT_BLOCK; /* notify the found event event handler, and also notify the main callback if the parent event handler says so */ @@ -699,7 +699,7 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event) { Widget* w = GUIEngine::getWidget(id); if (w == NULL) break; - if (w->m_deactivated) + if (!w->isActivated()) { GUIEngine::getCurrentScreen()->onDisabledItemClicked(w->m_properties[PROP_ID].c_str()); return EVENT_BLOCK; diff --git a/src/guiengine/widget.cpp b/src/guiengine/widget.cpp index 446d4b565..4d8fe4e98 100644 --- a/src/guiengine/widget.cpp +++ b/src/guiengine/widget.cpp @@ -339,7 +339,6 @@ void Widget::setVisible(bool visible) m_element->setVisible(visible); } m_is_visible = visible; - m_deactivated = !visible; const int childrenCount = m_children.size(); for (int n=0; naddParameter("username",username); request->addParameter("password",password); request->addParameter("save-session", - UserConfigParams::m_remember_user ? "true" - : "false"); + rememberPassword() ? "true" + : "false"); request->queue(); m_online_state = OS_SIGNING_IN; return request; @@ -187,9 +187,9 @@ namespace Online m_profile = new OnlineProfile(userid, username, true); assert(token_fetched && username_fetched && userid_fetched); m_online_state = OS_SIGNED_IN; - if(UserConfigParams::m_remember_user) + if(rememberPassword()) { - saveSession(getOnlineId(), getToken() ); + saveSession(getOnlineId(), getToken()); } ProfileManager::get()->addPersistent(m_profile); std::string achieved_string(""); @@ -238,8 +238,8 @@ namespace Online { m_player = player; m_player->setUserDetails(this, - UserConfigParams::m_remember_user ? "client-quit" - :"disconnect"); + m_player->rememberPassword() ? "client-quit" + : "disconnect"); setAbortable(false); } // SignOutRequest }; // SignOutRequest @@ -282,7 +282,7 @@ namespace Online m_profile = NULL; m_online_state = OS_SIGNED_OUT; // Discard token if session should not be saved. - if(!UserConfigParams::m_remember_user) + if(!rememberPassword()) clearSession(); } // signOut diff --git a/src/states_screens/user_screen.cpp b/src/states_screens/user_screen.cpp index 88193f09f..266d73db6 100644 --- a/src/states_screens/user_screen.cpp +++ b/src/states_screens/user_screen.cpp @@ -73,8 +73,6 @@ void BaseUserScreen::init() m_info_widget = getWidget("message"); assert(m_info_widget); - getWidget("remember-user") - ->setState(UserConfigParams::m_remember_user); m_sign_out_name = ""; m_sign_in_name = ""; @@ -87,7 +85,7 @@ void BaseUserScreen::init() Screen::init(); m_players->clearItems(); - std::string current_player_index=""; + int current_player_index = -1; for (unsigned int n=0; ngetNumPlayers(); n++) { @@ -96,38 +94,20 @@ void BaseUserScreen::init() std::string s = StringUtils::toString(n); m_players->addItem(player->getName(), s, player->getIconFilename(), 0, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE); - if(player==PlayerManager::getCurrentPlayer()) - current_player_index = s; + if(player == PlayerManager::getCurrentPlayer()) + current_player_index = n; } m_players->updateItemDisplay(); // Select the current player. That can only be done after // updateItemDisplay is called. - if(current_player_index.size()>0) - { - m_players->setSelection(current_player_index, PLAYER_ID_GAME_MASTER, - /*focus*/ true); - PlayerProfile *player = PlayerManager::getCurrentPlayer(); - const stringw &online_name = player->getLastOnlineName(); - m_username_tb->setText(online_name); - // Select 'online - m_online_cb->setState(player->wasOnlineLastTime() || - player->isLoggedIn() ); - makeEntryFieldsVisible(); - // We have to deactivate after make visible (since make visible - // automatically activates widgets). - if(online_name.size()>0) - m_username_tb->setDeactivated(); - else - m_username_tb->setActivated(); - } - else // no current player found - { - // The first player is the most frequently used, so select it - if (PlayerManager::get()->getNumPlayers() > 0) - selectUser(0); - } + if(current_player_index != -1) + selectUser(current_player_index); + // no current player found + // The first player is the most frequently used, so select it + else if (PlayerManager::get()->getNumPlayers() > 0) + selectUser(0); } // init @@ -157,9 +137,8 @@ void BaseUserScreen::selectUser(int index) PlayerProfile *profile = PlayerManager::get()->getPlayer(index); assert(profile); - getWidget("username")->setText(profile - ->getLastOnlineName()); - m_players->setSelection(StringUtils::toString(index), 0, /*focusIt*/true); + m_players->setSelection(StringUtils::toString(index), PLAYER_ID_GAME_MASTER, + /*focusIt*/ true); // Last game was not online, so make the offline settings the default // (i.e. unckeck online checkbox, and make entry fields invisible). @@ -175,6 +154,8 @@ void BaseUserScreen::selectUser(int index) m_online_cb->setState(true); makeEntryFieldsVisible(); m_username_tb->setText(profile->getLastOnlineName()); + getWidget("remember-user")->setState( + profile->rememberPassword()); if(profile->getLastOnlineName().size()>0) m_username_tb->setDeactivated(); else @@ -246,21 +227,24 @@ void BaseUserScreen::eventCallback(Widget* widget, } else if (name == "remember-user") { - UserConfigParams::m_remember_user = - getWidget("remember-user")->getState(); + getSelectedPlayer()->setRememberPassword( + getWidget("remember-user")->getState()); } else if (name == "online") { // If online access is not allowed, do not accept an online account // but advice the user where to enable this option. - if (m_online_cb->getState() && UserConfigParams::m_internet_status == - Online::RequestManager::IPERM_NOT_ALLOWED) + if (m_online_cb->getState()) { - m_info_widget->setText( - _("Internet access is disabled, please enable it in the options"), - true); - sfx_manager->quickSound( "anvil" ); - m_online_cb->setState(false); + if (UserConfigParams::m_internet_status == + Online::RequestManager::IPERM_NOT_ALLOWED) + { + m_info_widget->setText( + _("Internet access is disabled, please enable it in the options"), + true); + sfx_manager->quickSound( "anvil" ); + m_online_cb->setState(false); + } } makeEntryFieldsVisible(); }