Permalink
Browse files

Merge branch 'Flakebi-master'

  • Loading branch information...
2 parents 025d7fa + 8228a5b commit ed978cc6e74106b00098a5857eac1daf9c25ab82 @hiker hiker committed Jun 12, 2014
@@ -109,7 +109,7 @@ inline int btGetVersion()
#ifdef __SPU__
#include <spu_printf.h>
#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
@@ -69,6 +69,7 @@ class AnimationBase
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
@@ -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"<?xml version=\"1.0\"?>\n";
players_file << L"<players version=\"1\" >\n";
- if(m_current_player && UserConfigParams::m_remember_user)
+ if(m_current_player)
{
players_file << L" <current player=\""
<< m_current_player->getName() << L"\"/>\n";
@@ -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);
@@ -101,6 +101,9 @@ class PlayerProfile : public NoCopy
/** 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 @@ class PlayerProfile : public NoCopy
/** 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
@@ -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."));
@@ -532,7 +532,7 @@ unsigned GPUTimer::elapsedTimeus()
FrameBuffer::FrameBuffer() {}
FrameBuffer::FrameBuffer(const std::vector<GLuint> &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<GLuint> &RTTs, size_t w, size_t h, bo
}
FrameBuffer::FrameBuffer(const std::vector<GLuint> &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<s32>& position,
glUseProgram(0);
glGetError();
-}
+}
@@ -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<irr::f32>& 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();
@@ -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;
@@ -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; n<childrenCount; n++)
@@ -173,8 +173,6 @@ namespace GUIEngine
/** Override method from base class Widget */
virtual void setDeactivated();
-
- bool isActivated() { return !m_deactivated; }
/** Display custom text in spinner */
void setCustomText(const core::stringw& text);
@@ -125,8 +125,8 @@ namespace Online
request->addParameter("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
@@ -73,8 +73,6 @@ void BaseUserScreen::init()
m_info_widget = getWidget<LabelWidget>("message");
assert(m_info_widget);
- getWidget<CheckBoxWidget>("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; n<PlayerManager::get()->getNumPlayers(); 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<TextBoxWidget >("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<CheckBoxWidget>("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<CheckBoxWidget>("remember-user")->getState();
+ getSelectedPlayer()->setRememberPassword(
+ getWidget<CheckBoxWidget>("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();
}

0 comments on commit ed978cc

Please sign in to comment.