[springlobby] 03/06: Imported Upstream version 0.249+dfsg

Markus Koschany apo at moszumanska.debian.org
Mon Jul 11 19:18:27 UTC 2016


This is an automated email from the git hooks/post-receive script.

apo pushed a commit to branch master
in repository springlobby.

commit 04fec9819d7093b55679d7ca6bd356a2b278837a
Author: Markus Koschany <apo at debian.org>
Date:   Mon Jul 11 20:52:31 2016 +0200

    Imported Upstream version 0.249+dfsg
---
 ChangeLog                                       |   8 ++
 VERSION                                         |   2 +-
 springlobby_config.h                            |   2 +-
 src/gui/basedataviewctrl.h                      |   6 +-
 src/gui/basedataviewmodel.h                     |   4 +-
 src/gui/battlelist/battledataviewcttrl.cpp      |   4 +-
 src/gui/battlelist/battledataviewmodel.cpp      |   4 +-
 src/gui/battlelist/battlelistfilter.cpp         |   2 +-
 src/gui/battlelist/battlelisttab.cpp            |   2 +-
 src/gui/channel/channellistdataviewmodel.cpp    |   2 +-
 src/gui/channel/channellistview.cpp             |   4 +-
 src/gui/chatpanel.cpp                           |   6 +-
 src/gui/contentsearchresultdatamodel.cpp        |   2 +-
 src/gui/customdialogs.cpp                       |   1 +
 src/gui/dataviewctrlheadermenu.cpp              |   2 +-
 src/gui/downloaddataviewmodel.cpp               |   2 +-
 src/gui/hosting/battleroomdataviewctrl.cpp      |  10 +-
 src/gui/hosting/battleroomdataviewmodel.cpp     |  22 ++--
 src/gui/hosting/battleroomtab.cpp               |   4 +-
 src/gui/hosting/votepanel.cpp                   |   4 +-
 src/gui/iconscollection.cpp                     |   6 +-
 src/gui/mainwindow.cpp                          |   9 --
 src/gui/mainwindow.h                            |   1 -
 src/gui/mapgridctrl.cpp                         |   2 +-
 src/gui/nickdataviewctrl.cpp                    |  10 +-
 src/gui/nickdataviewmodel.cpp                   |   6 +-
 src/gui/notifications/toasterbox/ToasterBox.cpp |   2 +-
 src/gui/playback/playbackdatamodel.cpp          |   2 +-
 src/gui/playback/playbackdataview.cpp           |   2 +-
 src/gui/sltipwin.cpp                            |   4 +-
 src/gui/ui.cpp                                  |   4 +-
 src/gui/uiutils.cpp                             |   4 +-
 src/lsl/src/lsl/battle/tdfcontainer.cpp         | 111 ++++++++++++++++++-
 src/lsl/src/lsl/battle/tdfcontainer.h           | 119 --------------------
 src/lsl/src/lslunitsync/c_api.cpp               |   2 +-
 src/lsl/src/lslunitsync/unitsync.cpp            |   4 +
 src/lsl/src/lslutils/type_forwards.h            |   1 -
 src/replaylist.cpp                              | 139 ++++++++++--------------
 src/replaylist.h                                |   1 -
 src/servermanager.cpp                           |   8 +-
 src/springlobbyapp.cpp                          |   6 +-
 src/springlobbyapp.h                            |   1 -
 src/springsettings/settings.rc                  |   2 -
 src/tasserver.cpp                               |  10 +-
 src/tests/config.cpp                            |   6 +-
 src/tests/testingstuff/silent_logger.h          |   2 +-
 src/user.cpp                                    |   2 +-
 src/utils/globalevents.cpp                      |   1 -
 src/utils/globalevents.h                        |   1 -
 src/utils/slpaths.cpp                           |   3 +
 50 files changed, 260 insertions(+), 304 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d8d5b49..c64c1dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 ChangeLog of Springlobby
 
+## 0.249
+ - fix crash when parsing .sdfz (compressed spring demo file)
+ - fix crash with broken SpringData dirs
+
+## 0.248
+ - don't autodetect system installed spring to avoid crashes (see #707)
+ - always log to ~/.springlobby/springlobby.log
+
 ## 0.247
  - fix crash
  - fix rapid tags downloaded twice
diff --git a/VERSION b/VERSION
index b5c7415..96be840 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.247
+0.249
diff --git a/springlobby_config.h b/springlobby_config.h
index b3c893d..807fe9a 100644
--- a/springlobby_config.h
+++ b/springlobby_config.h
@@ -6,6 +6,6 @@
 #undef VERSION
 
 /* the git tag / commit we build from */
-#define VERSION "0.247"
+#define VERSION "0.249"
 
 #endif	/* SPRINGLOBBY_HEADERGUARD_CONFIG_H */
diff --git a/src/gui/basedataviewctrl.h b/src/gui/basedataviewctrl.h
index a8ec888..ed13140 100644
--- a/src/gui/basedataviewctrl.h
+++ b/src/gui/basedataviewctrl.h
@@ -136,7 +136,7 @@ inline DataType* BaseDataViewCtrl<DataType>::GetSelectedItem()
 
 	wxDataViewItem item = GetSelection();
 
-	if (item.IsOk() == false) {
+	if (!item.IsOk()) {
 		return nullptr;
 	} else {
 		DataType* dataItem = static_cast<DataType*>(item.GetID());
@@ -288,9 +288,9 @@ inline void BaseDataViewCtrl<DataType>::OnHideColumn(wxCommandEvent& event)
 		return;
 	}
 
-	if (column->IsHidden() == true) {
+	if (column->IsHidden()) {
 		wxASSERT(false);
-		wxLogWarning(_T("BaseDataViewCtrl<DataType>::OnHideColumn() : column->IsHidden() == true"));
+		wxLogWarning(_T("BaseDataViewCtrl<DataType>::OnHideColumn() : column->IsHidden()"));
 		return;
 	}
 
diff --git a/src/gui/basedataviewmodel.h b/src/gui/basedataviewmodel.h
index c1c6eb0..2d46804 100644
--- a/src/gui/basedataviewmodel.h
+++ b/src/gui/basedataviewmodel.h
@@ -93,7 +93,7 @@ template <class DataType>
 unsigned int BaseDataViewModel<DataType>::GetChildren(const wxDataViewItem& item,
 						      wxDataViewItemArray& children) const
 {
-	if (item.IsOk() == true) { //Return items only for root!
+	if (item.IsOk()) { //Return items only for root!
 		return 0;
 	} else {
 
@@ -182,7 +182,7 @@ inline void BaseDataViewModel<DataType>::Clear()
 template <class DataType>
 inline bool BaseDataViewModel<DataType>::UpdateItem(const DataType& item)
 {
-	if (ContainsItem(item) == true) {
+	if (ContainsItem(item)) {
 		//FIXME: Maybe update item in m_ModelData. At this moment it stores pointer and does not need to be updated
 		ItemChanged(wxDataViewItem(const_cast<DataType*>(&item)));
 		return true;
diff --git a/src/gui/battlelist/battledataviewcttrl.cpp b/src/gui/battlelist/battledataviewcttrl.cpp
index dfa44a1..bea5f18 100644
--- a/src/gui/battlelist/battledataviewcttrl.cpp
+++ b/src/gui/battlelist/battledataviewcttrl.cpp
@@ -121,8 +121,8 @@ void BattleDataViewCtrl::OnContextMenu(wxDataViewEvent& /*event*/)
 		return;
 	}
 
-	const bool mod_missing = battle->GameExists(false) == false;
-	const bool map_missing = battle->MapExists(false) == false;
+	const bool mod_missing = !battle->GameExists(false);
+	const bool map_missing = !battle->MapExists(false);
 	const bool engine_missing = SlPaths::GetCompatibleVersion(battle->GetEngineVersion()).empty();
 
 	m_popup = new wxMenu(wxEmptyString);
diff --git a/src/gui/battlelist/battledataviewmodel.cpp b/src/gui/battlelist/battledataviewmodel.cpp
index ac05504..31c083d 100644
--- a/src/gui/battlelist/battledataviewmodel.cpp
+++ b/src/gui/battlelist/battledataviewmodel.cpp
@@ -29,7 +29,7 @@ void BattleDataViewModel::GetValue(wxVariant& variant,
 	IconsCollection* iconsCollection = IconsCollection::Instance();
 
 	/* In case if wxGTK will try to render invalid item */
-	if (battle == nullptr || ContainsItem(*battle) == false) {
+	if (battle == nullptr || !ContainsItem(*battle)) {
 
 		switch (col) {
 			case STATUS:
@@ -234,7 +234,7 @@ bool BattleDataViewModel::GetAttr(const wxDataViewItem& item,
 
 	wxASSERT(battle != nullptr);
 
-	if (battle == nullptr || ContainsItem(*battle) == false) {
+	if (battle == nullptr || !ContainsItem(*battle)) {
 		return false;
 	}
 
diff --git a/src/gui/battlelist/battlelistfilter.cpp b/src/gui/battlelist/battlelistfilter.cpp
index 05a7180..fd5cb11 100644
--- a/src/gui/battlelist/battlelistfilter.cpp
+++ b/src/gui/battlelist/battlelistfilter.cpp
@@ -576,7 +576,7 @@ bool BattleListFilter::FilterBattle(IBattle& battle)
 		if (m_filter_status_open->GetValue())
 			bResult |= (!battle.IsPassworded() && !battle.IsLocked() && !battle.GetInGame() && !battle.IsFull());
 
-		if (bResult == false)
+		if (!bResult)
 			return false;
 	}
 
diff --git a/src/gui/battlelist/battlelisttab.cpp b/src/gui/battlelist/battlelisttab.cpp
index 9619a4f..835315b 100644
--- a/src/gui/battlelist/battlelisttab.cpp
+++ b/src/gui/battlelist/battlelisttab.cpp
@@ -446,7 +446,7 @@ void BattleListTab::OnSelect(wxDataViewEvent& /*event*/)
  */
 void BattleListTab::OnUnitsyncReloaded(wxCommandEvent& /*data*/)
 {
-	ASSERT_LOGIC(wxThread::IsMain(), "wxThread::IsMain() == false");
+	ASSERT_LOGIC(wxThread::IsMain(), "wxThread::IsMain()");
 
 	if (!serverSelector().IsServerAvailible())
 		return;
diff --git a/src/gui/channel/channellistdataviewmodel.cpp b/src/gui/channel/channellistdataviewmodel.cpp
index fb4b0b7..3da921a 100644
--- a/src/gui/channel/channellistdataviewmodel.cpp
+++ b/src/gui/channel/channellistdataviewmodel.cpp
@@ -19,7 +19,7 @@ void ChannelListDataViewModel::GetValue(wxVariant& variant,
 	wxASSERT(channelInfo != nullptr);
 
 	/* In case if wxGTK will try to render invalid item */
-	if (channelInfo == nullptr || ContainsItem(*channelInfo) == false) {
+	if (channelInfo == nullptr || !ContainsItem(*channelInfo)) {
 		variant = wxVariant(wxEmptyString);
 		return;
 	}
diff --git a/src/gui/channel/channellistview.cpp b/src/gui/channel/channellistview.cpp
index fd50011..b5b8476 100644
--- a/src/gui/channel/channellistview.cpp
+++ b/src/gui/channel/channellistview.cpp
@@ -61,11 +61,11 @@ void ChannelListView::FilterChannel(const wxString& partial)
 
 	for (auto const item : m_realChannelCollection) {
 		if ((partial.IsEmpty()) || (item.second->name.Contains(partial))) {
-			if (ContainsItem(*item.second) == false) {
+			if (!ContainsItem(*item.second)) {
 				AddItem(*item.second);
 			}
 		} else {
-			if (ContainsItem(*item.second) == true) {
+			if (ContainsItem(*item.second)) {
 				RemoveItem(*item.second);
 			}
 		}
diff --git a/src/gui/chatpanel.cpp b/src/gui/chatpanel.cpp
index 93d294b..8fc2d10 100644
--- a/src/gui/chatpanel.cpp
+++ b/src/gui/chatpanel.cpp
@@ -599,7 +599,7 @@ bool ChatPanel::ContainsWordToHighlight(const wxString& message) const
  */
 void ChatPanel::CheckForPromotion(const wxString& /*who*/, const wxString& action)
 {
-	if (m_reactOnPromoteEvents == false) { //If this feature disabled in options do nothing
+	if (!m_reactOnPromoteEvents) { //If this feature disabled in options do nothing
 		return;
 	}
 
@@ -610,9 +610,7 @@ void ChatPanel::CheckForPromotion(const wxString& /*who*/, const wxString& actio
 	//Detect event and notify user
 	//TODO: Rework for using array of regexps, not shit crap
 	if (action.Contains(promoteMessageTemplate) || action.Contains(promoteMessageTemplate2)) {
-		wxCommandEvent promoteEvent = wxCommandEvent(GlobalEventManager::GamePromotedEvent);
-		promoteEvent.SetString(action); //Send action string with that should be shown
-		GlobalEventManager::Instance()->Send(promoteEvent);
+		UiEvents::GetNotificationEventSender().SendEvent(UiEvents::NotficationData(UiEvents::GamePromoted, action));
 	}
 }
 
diff --git a/src/gui/contentsearchresultdatamodel.cpp b/src/gui/contentsearchresultdatamodel.cpp
index c9db352..c8baa76 100644
--- a/src/gui/contentsearchresultdatamodel.cpp
+++ b/src/gui/contentsearchresultdatamodel.cpp
@@ -20,7 +20,7 @@ void ContentSearchResultDataModel::GetValue(wxVariant& variant,
 	wxASSERT(searchResult != nullptr);
 
 	/* In case if wxGTK will try to render invalid item */
-	if (searchResult == nullptr || ContainsItem(*searchResult) == false) {
+	if (searchResult == nullptr || !ContainsItem(*searchResult)) {
 		variant = wxVariant(wxEmptyString);
 		return;
 	}
diff --git a/src/gui/customdialogs.cpp b/src/gui/customdialogs.cpp
index 7a2c098..c586f35 100644
--- a/src/gui/customdialogs.cpp
+++ b/src/gui/customdialogs.cpp
@@ -80,6 +80,7 @@ CustomMessageBox::CustomMessageBox(wxIcon* icon, wxWindow* parent, const wxStrin
 			bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX);
 			break;
 	}
+	wxLogMessage(message);
 
 	wxStaticBitmap* info_icon = new wxStaticBitmap(this, wxID_ANY, bitmap);
 	m_icon_text->Add(info_icon, 0, wxCENTER);
diff --git a/src/gui/dataviewctrlheadermenu.cpp b/src/gui/dataviewctrlheadermenu.cpp
index 65bea6e..36273d3 100644
--- a/src/gui/dataviewctrlheadermenu.cpp
+++ b/src/gui/dataviewctrlheadermenu.cpp
@@ -62,7 +62,7 @@ int DataViewCtrlHeaderMenu::CountVisibleColumns()
 
 	for (int i = 0; i < totalColumnsCount; ++i) {
 		wxDataViewColumn* column = parentDataView->GetColumn(i);
-		if (column->IsHidden() == false) {
+		if (!column->IsHidden()) {
 			totalVisibleColumnsCount++;
 		}
 	}
diff --git a/src/gui/downloaddataviewmodel.cpp b/src/gui/downloaddataviewmodel.cpp
index fcf5ab2..8ac9e23 100644
--- a/src/gui/downloaddataviewmodel.cpp
+++ b/src/gui/downloaddataviewmodel.cpp
@@ -21,7 +21,7 @@ void DownloadDataViewModel::GetValue(wxVariant& variant,
 	wxASSERT(downloadInfo != nullptr);
 
 	/* In case if wxGTK will try to render invalid item */
-	if (downloadInfo == nullptr || ContainsItem(*downloadInfo) == false) {
+	if (downloadInfo == nullptr || !ContainsItem(*downloadInfo)) {
 		variant = wxVariant(wxEmptyString);
 		return;
 	}
diff --git a/src/gui/hosting/battleroomdataviewctrl.cpp b/src/gui/hosting/battleroomdataviewctrl.cpp
index b9f7081..38a7519 100644
--- a/src/gui/hosting/battleroomdataviewctrl.cpp
+++ b/src/gui/hosting/battleroomdataviewctrl.cpp
@@ -51,11 +51,11 @@ BattleroomDataViewCtrl::BattleroomDataViewCtrl(const wxString& dataViewName, wxW
 	AppendTextColumn(_("Resource Bonus"), BONUS, wxDATAVIEW_CELL_INERT, DEFAULT_SIZE, wxALIGN_NOT, wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
 
 	//Hide "ingame" column if not needed
-	if (showInGame == false) {
+	if (!showInGame) {
 		GetColumn(INGAME)->SetHidden(true);
 	}
 	//ReadOnly means quick info about battle
-	if (readOnly == false) {
+	if (!readOnly) {
 		CreateContextMenu();
 	}
 
@@ -87,7 +87,7 @@ void BattleroomDataViewCtrl::SetBattle(IBattle* battle)
 void BattleroomDataViewCtrl::AddUser(User& user)
 {
 	//TODO: implement
-	if (ContainsItem(user) == true) {
+	if (ContainsItem(user)) {
 		return;
 	}
 	AddItem(user);
@@ -96,7 +96,7 @@ void BattleroomDataViewCtrl::AddUser(User& user)
 void BattleroomDataViewCtrl::RemoveUser(User& user)
 {
 	//TODO: implement
-	if (ContainsItem(user) == false) {
+	if (!ContainsItem(user)) {
 		return;
 	}
 	RemoveItem(user);
@@ -295,7 +295,7 @@ void BattleroomDataViewCtrl::OnColourSelect(wxCommandEvent& /*event*/)
 	wxColour CurrentColour = lslTowxColour(user->BattleStatus().colour);
 	CurrentColour = GetColourFromUser(this, CurrentColour);
 
-	if (CurrentColour.IsOk() == false) {
+	if (!CurrentColour.IsOk()) {
 		return;
 	}
 
diff --git a/src/gui/hosting/battleroomdataviewmodel.cpp b/src/gui/hosting/battleroomdataviewmodel.cpp
index 7c452b0..79fe89a 100644
--- a/src/gui/hosting/battleroomdataviewmodel.cpp
+++ b/src/gui/hosting/battleroomdataviewmodel.cpp
@@ -30,7 +30,7 @@ void BattleroomDataViewModel::GetValue(wxVariant& variant,
 	wxASSERT(user != nullptr);
 
 	/* In case if wxGTK will try to render invalid item */
-	if (user == nullptr || ContainsItem(*user) == false) {
+	if (user == nullptr || !ContainsItem(*user)) {
 		switch (col) {
 			case STATUS:
 			case INGAME:
@@ -112,7 +112,7 @@ void BattleroomDataViewModel::GetValue(wxVariant& variant,
 				wxString ownerName = wxString(user->BattleStatus().owner);
 				wxString playerName = wxString(user->GetNick());
 
-				if (user->BattleStatus().aiversion.empty() == false) {
+				if (!user->BattleStatus().aiversion.empty()) {
 					botName += _T(" ") + user->BattleStatus().aiversion;
 				}
 				variant = wxString::Format(_T("%s - %s (%s)"), playerName, botName, ownerName);
@@ -252,9 +252,9 @@ int BattleroomDataViewModel::Compare(const wxDataViewItem& itemA,
 		} break;
 
 		case FACTION:
-			if (userA->BattleStatus().spectator && (userB->BattleStatus().spectator == false)) {
+			if (userA->BattleStatus().spectator && (!userB->BattleStatus().spectator)) {
 				return 1;
-			} else if (userB->BattleStatus().spectator && (userA->BattleStatus().spectator == false)) {
+			} else if (userB->BattleStatus().spectator && (!userA->BattleStatus().spectator)) {
 				return -1;
 			} else if (userA->BattleStatus().spectator && userB->BattleStatus().spectator) {
 				return 0;
@@ -316,9 +316,9 @@ int BattleroomDataViewModel::Compare(const wxDataViewItem& itemA,
 			break;
 
 		case TEAM:
-			if (userA->BattleStatus().spectator && (userB->BattleStatus().spectator == false)) {
+			if (userA->BattleStatus().spectator && (!userB->BattleStatus().spectator)) {
 				return 1;
-			} else if (userB->BattleStatus().spectator && (userA->BattleStatus().spectator == false)) {
+			} else if (userB->BattleStatus().spectator && (!userA->BattleStatus().spectator)) {
 				return -1;
 			} else if (userA->BattleStatus().spectator && userB->BattleStatus().spectator) {
 				return 0;
@@ -328,9 +328,9 @@ int BattleroomDataViewModel::Compare(const wxDataViewItem& itemA,
 			break;
 
 		case ALLY:
-			if (userA->BattleStatus().spectator && (userB->BattleStatus().spectator == false)) {
+			if (userA->BattleStatus().spectator && (!userB->BattleStatus().spectator)) {
 				return 1;
-			} else if (userB->BattleStatus().spectator && (userA->BattleStatus().spectator == false)) {
+			} else if (userB->BattleStatus().spectator && (!userA->BattleStatus().spectator)) {
 				return -1;
 			} else if (userA->BattleStatus().spectator && userB->BattleStatus().spectator) {
 				return 0;
@@ -340,9 +340,9 @@ int BattleroomDataViewModel::Compare(const wxDataViewItem& itemA,
 			break;
 
 		case BONUS:
-			if (userA->BattleStatus().spectator && (userB->BattleStatus().spectator == false)) {
+			if (userA->BattleStatus().spectator && (!userB->BattleStatus().spectator)) {
 				return 1;
-			} else if (userB->BattleStatus().spectator && (userA->BattleStatus().spectator == false)) {
+			} else if (userB->BattleStatus().spectator && (!userA->BattleStatus().spectator)) {
 				return -1;
 			} else if (userA->BattleStatus().spectator && userB->BattleStatus().spectator) {
 				return 0;
@@ -371,7 +371,7 @@ bool BattleroomDataViewModel::GetAttr(const wxDataViewItem& item,
 
 	wxASSERT(user != nullptr);
 
-	if (user == nullptr || ContainsItem(*user) == false) {
+	if (user == nullptr || !ContainsItem(*user)) {
 		return false;
 	}
 
diff --git a/src/gui/hosting/battleroomtab.cpp b/src/gui/hosting/battleroomtab.cpp
index 53e3482..8d34aaf 100644
--- a/src/gui/hosting/battleroomtab.cpp
+++ b/src/gui/hosting/battleroomtab.cpp
@@ -533,7 +533,7 @@ void BattleRoomTab::UpdateUser(User& user, bool userJustAdded)
 	}
 
 	//Do not update user that was just added (he already updated)
-	if (userJustAdded == false) {
+	if (!userJustAdded) {
 		m_players->UpdateUser(user);
 	}
 
@@ -919,7 +919,7 @@ void BattleRoomTab::OnUserJoined(User& user)
 		return;
 	}
 
-	if (user.BattleStatus().IsBot() == false) {
+	if (!user.BattleStatus().IsBot()) {
 		m_chat->Joined(user);
 	}
 
diff --git a/src/gui/hosting/votepanel.cpp b/src/gui/hosting/votepanel.cpp
index eab6e97..8ba2f0a 100644
--- a/src/gui/hosting/votepanel.cpp
+++ b/src/gui/hosting/votepanel.cpp
@@ -88,7 +88,7 @@ void VotePanel::OnChatAction(const wxString& /*actionAuthor*/, const wxString& a
 	}
 
 	//Do not show this panel if player in spectator mode
-	if (player->GetBattleStatus().spectator == true) {
+	if (player->GetBattleStatus().spectator) {
 		return;
 	}
 
@@ -145,7 +145,7 @@ void VotePanel::showButtons(bool showState)
 	noButton->Show(showState);
 	dontCareButton->Show(showState);
 
-	if (showState == true) {
+	if (showState) {
 		enableButtons();
 	}
 
diff --git a/src/gui/iconscollection.cpp b/src/gui/iconscollection.cpp
index 4790fa0..274ba01 100644
--- a/src/gui/iconscollection.cpp
+++ b/src/gui/iconscollection.cpp
@@ -178,7 +178,7 @@ wxBitmap& IconsCollection::GetFlagBmp(const wxString& country)
 
 wxBitmap& IconsCollection::GetRankBmp(unsigned int rank, bool showLowest)
 {
-	if ((showLowest == false) && (rank == UserStatus::RANK_1)) {
+	if ((!showLowest) && (rank == UserStatus::RANK_1)) {
 		return BMP_RANK_NONE;
 	}
 
@@ -232,7 +232,7 @@ wxBitmap& IconsCollection::GetFractionBmp(const std::string& gameName, size_t fr
 {
 
 	if (gameName.empty() || !LSL::usync().GameExists(gameName)) {
-		wxLogWarning("SideIcon %d for game %s not found!", fractionId, gameName.c_str());
+		wxLogWarning("SideIcon %zu for game %s not found!", fractionId, gameName.c_str());
 		// game doesn't exist, dl needed?!
 		return BMP_EMPTY;
 	}
@@ -276,7 +276,7 @@ wxBitmap& IconsCollection::GetFractionBmp(const std::string& gameName, size_t fr
 wxBitmap IconsCollection::CreateBitmap(const char* const* data)
 {
 	wxImage img = wxImage(data);
-	if (img.HasAlpha() == false) {
+	if (!img.HasAlpha()) {
 		img.InitAlpha();
 	}
 	return wxBitmap(img);
diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
index 2c04327..c1ce04d 100644
--- a/src/gui/mainwindow.cpp
+++ b/src/gui/mainwindow.cpp
@@ -243,7 +243,6 @@ MainWindow::MainWindow()
 	Logger::ShowDebugWindow(true);
 	//	Logger::ShowDebugWindow(cfg().ReadBool(_T("/debug")));
 
-	GlobalEventManager::Instance()->Subscribe(this, GlobalEventManager::GamePromotedEvent, wxObjectEventFunction(&MainWindow::OnGamePromoted));
 	GlobalEventManager::Instance()->Subscribe(this, GlobalEventManager::OnUnitsyncReloaded, wxObjectEventFunction(&MainWindow::OnUnitSyncReloaded));
 }
 
@@ -746,11 +745,3 @@ void MainWindow::OnMenuDownload(wxCommandEvent& /*event*/)
 	} while (pos != wxNOT_FOUND);
 }
 
-void MainWindow::OnGamePromoted(wxCommandEvent& promoteEvent)
-{
-	//Promote user without checking his status
-	//TODO: Maybe need to separate users by status to groups which one should be notified
-	//and which one should not be.
-	wxString msg = promoteEvent.GetString();
-	UiEvents::GetNotificationEventSender().SendEvent(UiEvents::NotficationData(UiEvents::GamePromoted, msg));
-}
diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h
index 456e867..e5a9d39 100644
--- a/src/gui/mainwindow.h
+++ b/src/gui/mainwindow.h
@@ -113,7 +113,6 @@ public:
 	void SavePerspectives(const wxString& perspective_name = wxEmptyString);
 
 private:
-	void OnGamePromoted(wxCommandEvent&);
 	void OnUnitSyncReloaded(wxCommandEvent& /*unused*/);
 
 private:
diff --git a/src/gui/mapgridctrl.cpp b/src/gui/mapgridctrl.cpp
index eb6dfb1..66e28d2 100644
--- a/src/gui/mapgridctrl.cpp
+++ b/src/gui/mapgridctrl.cpp
@@ -262,7 +262,7 @@ void MapGridCtrl::AddMap(const wxString& mapname)
 
 	if (!LSL::usync().MapExists(STD_STRING(mapname))) {
 		//FIXME: offer download button on image instead?
-		wxLogError(_("Map %s doesn't exist!"), mapname.wc_str());
+		wxLogWarning(_("Map %s doesn't exist!"), mapname.wc_str());
 		return;
 	}
 
diff --git a/src/gui/nickdataviewctrl.cpp b/src/gui/nickdataviewctrl.cpp
index 4f9f839..53858ce 100644
--- a/src/gui/nickdataviewctrl.cpp
+++ b/src/gui/nickdataviewctrl.cpp
@@ -34,7 +34,7 @@ NickDataViewCtrl::NickDataViewCtrl(const wxString& dataViewName, wxWindow* paren
 	AppendBitmapColumn(_("r"), RANK, wxDATAVIEW_CELL_INERT, wxDVC_DEFAULT_MINWIDTH, wxALIGN_CENTER, wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
 	AppendTextColumn(_("Nickname"), NICKNAME, wxDATAVIEW_CELL_INERT, wxDVC_DEFAULT_WIDTH + 10 /*add 10 px to let some nicks to fit better*/, wxALIGN_NOT, wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
 
-	if (show_header == false) {
+	if (!show_header) {
 		//TODO: implement "no header" style somehow
 	}
 
@@ -67,7 +67,7 @@ void NickDataViewCtrl::SetUsersFilterString(const wxString& fs)
 
 void NickDataViewCtrl::AddUser(const User& user)
 {
-	if (AddRealUser(user) == false) {
+	if (!AddRealUser(user)) {
 		//User already added to widget
 		return;
 	}
@@ -77,7 +77,7 @@ void NickDataViewCtrl::AddUser(const User& user)
 
 void NickDataViewCtrl::RemoveUser(const User& user)
 {
-	if (RemoveRealUser(user) == false) {
+	if (!RemoveRealUser(user)) {
 		return;
 	}
 
@@ -124,12 +124,12 @@ void NickDataViewCtrl::DoUsersFilter()
 	for (auto const item : m_real_users_list) {
 		if (checkFilteringConditions(item.second)) {
 			//User passed filter. Add him/her to the list.
-			if (ContainsItem(*item.second) == false) {
+			if (!ContainsItem(*item.second)) {
 				AddItem(*item.second);
 			}
 		} else {
 			//Remove user from the list.
-			if (ContainsItem(*item.second) == true) {
+			if (ContainsItem(*item.second)) {
 				RemoveItem(*item.second);
 			}
 		}
diff --git a/src/gui/nickdataviewmodel.cpp b/src/gui/nickdataviewmodel.cpp
index 16d9715..efb91fb 100644
--- a/src/gui/nickdataviewmodel.cpp
+++ b/src/gui/nickdataviewmodel.cpp
@@ -28,7 +28,7 @@ void NickDataViewModel::GetValue(wxVariant& variant, const wxDataViewItem& item,
 	wxASSERT(user != nullptr);
 
 	/* In case if wxGTK will try to render invalid item */
-	if (user == nullptr || ContainsItem(*user) == false) {
+	if (user == nullptr || !ContainsItem(*user)) {
 		switch (col) {
 			case STATUS:
 			case COUNTRY:
@@ -75,7 +75,7 @@ void NickDataViewModel::GetValue(wxVariant& variant, const wxDataViewItem& item,
 				wxString ownerName = wxString(user->BattleStatus().owner);
 				wxString playerName = wxString(user->GetNick());
 
-				if (user->BattleStatus().aiversion.empty() == false) {
+				if (!user->BattleStatus().aiversion.empty()) {
 					botName += _T(" ") + user->BattleStatus().aiversion;
 				}
 				variant = wxString::Format(_T("%s - %s (%s)"), playerName, botName,
@@ -175,7 +175,7 @@ bool NickDataViewModel::GetAttr(const wxDataViewItem& item, unsigned int,
 
 	wxASSERT(user != nullptr);
 
-	if (user == nullptr || ContainsItem(*user) == false) {
+	if (user == nullptr || !ContainsItem(*user)) {
 		return false;
 	}
 
diff --git a/src/gui/notifications/toasterbox/ToasterBox.cpp b/src/gui/notifications/toasterbox/ToasterBox.cpp
index 627b377..f52ff6a 100644
--- a/src/gui/notifications/toasterbox/ToasterBox.cpp
+++ b/src/gui/notifications/toasterbox/ToasterBox.cpp
@@ -116,7 +116,7 @@ void ToasterBox::Play()
 	tb->SetPopupBackgroundColor(colBg.Red(), colBg.Green(), colBg.Blue());
 	if (m_bitmap.IsOk()) {
 		tb->SetPopupBitmap(m_bitmap);
-	} else if (bitmapFile.IsEmpty() == false) {
+	} else if (!bitmapFile.IsEmpty()) {
 		tb->SetPopupBitmap(bitmapFile);
 	} else {
 		//No image for ToasterBox???
diff --git a/src/gui/playback/playbackdatamodel.cpp b/src/gui/playback/playbackdatamodel.cpp
index 77d0f54..f48bcbb 100644
--- a/src/gui/playback/playbackdatamodel.cpp
+++ b/src/gui/playback/playbackdatamodel.cpp
@@ -29,7 +29,7 @@ void PlaybackDataModel::GetValue(wxVariant& variant, const wxDataViewItem& item,
 	}
 
 	/* In case if wxGTK will try to render invalid item */
-	if (storedGame == nullptr || ContainsItem(*storedGame) == false) {
+	if (storedGame == nullptr || !ContainsItem(*storedGame)) {
 		switch (col) {
 			case DATE:
 				variant = wxVariant(wxDataViewIconText(wxEmptyString));
diff --git a/src/gui/playback/playbackdataview.cpp b/src/gui/playback/playbackdataview.cpp
index d08b395..8656ecc 100644
--- a/src/gui/playback/playbackdataview.cpp
+++ b/src/gui/playback/playbackdataview.cpp
@@ -106,7 +106,7 @@ void PlaybackDataView::DeletePlayback()
 
 	try {
 		const int m_sel_replay_id = storedGame->id;
-		if (replaylist().DeletePlayback(m_sel_replay_id) == false) {
+		if (!replaylist().DeletePlayback(m_sel_replay_id)) {
 			wxString fn = wxString(storedGame->Filename);
 			customMessageBoxModal(SL_MAIN_ICON, _("Could not delete Replay: ") + fn, _("Error"));
 		} else {
diff --git a/src/gui/sltipwin.cpp b/src/gui/sltipwin.cpp
index 9261fa5..131644c 100644
--- a/src/gui/sltipwin.cpp
+++ b/src/gui/sltipwin.cpp
@@ -20,7 +20,7 @@ SLTipWindow::SLTipWindow(wxWindow* parent, const wxString& text)
 
 SLTipWindow::~SLTipWindow()
 {
-	if (isHookInstalled == true) {
+	if (isHookInstalled) {
 		wxEvtHandler::RemoveFilter(this);
 		isHookInstalled = false;
 	}
@@ -30,7 +30,7 @@ SLTipWindow::~SLTipWindow()
 int SLTipWindow::FilterEvent(wxEvent& hookedEvent)
 {
 	//Only mouse events are in interest
-	if (isMouseEvent(hookedEvent) == true) {
+	if (isMouseEvent(hookedEvent)) {
 		//Remove hook before proceed, prevents deadlock
 		wxEvtHandler::RemoveFilter(this);
 		isHookInstalled = false;
diff --git a/src/gui/ui.cpp b/src/gui/ui.cpp
index de2383e..f85d150 100644
--- a/src/gui/ui.cpp
+++ b/src/gui/ui.cpp
@@ -861,7 +861,9 @@ void Ui::CheckForUpdates(bool show)
 		wxLogError("Unknown exception");
 	}
 #else
-	customMessageBoxModal(SL_MAIN_ICON, _("Your SpringLobby version is not up to date.\n\n") + msg, _("Not up to Date"));
+	const wxString motivation = _("Please update to the latest version before reporting bugs.");
+	const wxString doublenl = _T("\n\n");
+	customMessageBoxModal(SL_MAIN_ICON, _("Your SpringLobby version is not up to date.") + doublenl + msg + doublenl + motivation, _("Not up to Date"));
 #endif
 }
 
diff --git a/src/gui/uiutils.cpp b/src/gui/uiutils.cpp
index 6e2aa50..d43b263 100644
--- a/src/gui/uiutils.cpp
+++ b/src/gui/uiutils.cpp
@@ -164,7 +164,7 @@ wxImage charArr2wxImage(const unsigned char* arg, int size)
 {
 	wxMemoryInputStream istream(arg, size);
 	wxImage img = wxImage(istream, wxBITMAP_TYPE_PNG);
-	if (img.HasAlpha() == false) {
+	if (!img.HasAlpha()) {
 		img.InitAlpha();
 	}
 	return img;
@@ -457,7 +457,7 @@ wxBitmap getColourIcon(const wxColour& colour)
 	g = colour.Green() + 80;
 	b = colour.Blue() + 80;
 	img.Replace(2, 2, 2, r > 255 ? 255 : r, g > 255 ? 255 : g, b > 255 ? 255 : b);
-	if (img.HasAlpha() == false) {
+	if (!img.HasAlpha()) {
 		img.InitAlpha();
 	}
 	/*r = colour.Red()-60; g = colour.Green()-60; b = colour.Blue()-60;
diff --git a/src/lsl/src/lsl/battle/tdfcontainer.cpp b/src/lsl/src/lsl/battle/tdfcontainer.cpp
index ada4f62..6bf1dee 100644
--- a/src/lsl/src/lsl/battle/tdfcontainer.cpp
+++ b/src/lsl/src/lsl/battle/tdfcontainer.cpp
@@ -22,6 +22,110 @@ namespace LSL
 namespace TDF
 {
 
+inline bool IsWhitespace(char c)
+{
+	return (c == ' ') || (c == 10) || (c == 13) || (c == '\t');
+}
+
+/** \brief Tokenizer used in TDF parsing
+ * \todo clean up
+ **/
+class Tokenizer
+{
+
+	/// simple reference counted pointer to stream.
+	struct IncludeCacheEntry {
+		std::string name; ///< used for error reporting
+		int line;
+		int column;
+		std::istream* stream;
+		//bool must_delete;
+		int* refcount;
+
+		IncludeCacheEntry(std::istream* stream_, bool must_delete_ = false)
+		    : line(1)
+		    , column(1)
+		    , stream(stream_)
+		    , refcount(NULL)
+		{
+			if (must_delete_) {
+				refcount = new int;
+				(*refcount) = 1;
+			}
+		}
+		IncludeCacheEntry(const IncludeCacheEntry& other)
+		    : line(other.line)
+		    , column(other.column)
+		    , stream(other.stream)
+		    , refcount(other.refcount)
+		{
+			stream = other.stream;
+			refcount = other.refcount;
+			if (refcount)
+				(*refcount) += 1;
+		}
+		~IncludeCacheEntry()
+		{
+			if (refcount) {
+				(*refcount)--;
+				if ((*refcount) <= 0) {
+					delete stream;
+					delete refcount;
+				}
+			}
+		}
+	};
+	std::vector<IncludeCacheEntry> include_stack;
+	void UnwindStack();
+
+	std::deque<Token> token_buffer;
+	//size_t max_buffer_size;
+	size_t buffer_pos;
+
+	bool skip_eol;
+	char GetNextChar();
+	char PeekNextChar();
+
+	void ReadToken(Token& token);
+	void SkipSpaces();
+
+	int errors;
+
+public:
+	Tokenizer()
+	    : buffer_pos(0)
+	    , skip_eol(false)
+	    , errors(0)
+	{
+	}
+
+	void EnterStream(std::istream& stream_, const std::string& name = "");
+
+	Token GetToken(int i = 0);
+	void Step(int i = 1);
+	inline Token TakeToken()
+	{
+		Token result = GetToken();
+		Step();
+		return result;
+	}
+
+	bool Good();
+
+	void ReportError(const Token& t, const std::string& err);
+
+	int NumErrors() const
+	{
+		return errors;
+	}
+};
+
+inline Tokenizer& operator>>(Tokenizer& tokenizer, Token& token)
+{
+	token = tokenizer.TakeToken();
+	return tokenizer;
+}
+
 namespace BA = boost::algorithm;
 
 TDFWriter::TDFWriter(std::stringstream& s)
@@ -91,9 +195,6 @@ void Tokenizer::ReportError(const Token& t, const std::string& err)
 	errors++;
 }
 
-//#define ReportError(a) {std::cerr<<"error "<<(a);}
-//#define ReportError(a) {slLogMessage(\1;}
-
 void Tokenizer::EnterStream(std::istream& stream_, const std::string& name)
 {
 	skip_eol = false;
@@ -148,7 +249,7 @@ char Tokenizer::GetNextChar()
 bool Tokenizer::Good()
 {
 	UnwindStack();
-	return !include_stack.empty();
+	return (errors == 0) && !include_stack.empty();
 }
 
 void Tokenizer::ReadToken(Token& token)
@@ -207,6 +308,7 @@ start:
 				}
 			}
 			ReportError(token, "Quotes not closed before end of file");
+			return;
 		}
 		case '{':
 			token.type = Token::type_enter_section;
@@ -753,5 +855,6 @@ PDataList ParseTDF(std::istream& s, int* error_count)
 	}
 	return result;
 }
+
 }
 } // namespace LSL { namespace TDF {
diff --git a/src/lsl/src/lsl/battle/tdfcontainer.h b/src/lsl/src/lsl/battle/tdfcontainer.h
index 5db155e..5d5d2f8 100644
--- a/src/lsl/src/lsl/battle/tdfcontainer.h
+++ b/src/lsl/src/lsl/battle/tdfcontainer.h
@@ -167,26 +167,6 @@ public:
 	virtual void Load(Tokenizer& f);
 };
 
-inline bool IsLetter(char c)
-{
-	return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_');
-}
-inline bool IsNum(char c)
-{
-	return c >= '0' && c <= '9';
-}
-inline bool IsNumDot(char c)
-{
-	return (c >= '0' && c <= '9') || c == '.';
-}
-inline bool IsAlphaNum(char c)
-{
-	return IsLetter(c) || IsNum(c);
-}
-inline bool IsWhitespace(char c)
-{
-	return (c == ' ') || (c == 10) || (c == 13) || (c == '\t');
-}
 struct Token {
 	enum TokenType {
 		type_none,
@@ -213,105 +193,6 @@ struct Token {
 	}
 };
 
-/** \brief Tokenizer used in TDF parsing
- * \todo clean up, move to CPP file
- **/
-class Tokenizer
-{
-
-	/// simple reference counted pointer to stream.
-	struct IncludeCacheEntry {
-		std::string name; ///< used for error reporting
-		int line;
-		int column;
-		std::istream* stream;
-		//bool must_delete;
-		int* refcount;
-
-		IncludeCacheEntry(std::istream* stream_, bool must_delete_ = false)
-		    : line(1)
-		    , column(1)
-		    , stream(stream_)
-		    , refcount(NULL)
-		{
-			if (must_delete_) {
-				refcount = new int;
-				(*refcount) = 1;
-			}
-		}
-		IncludeCacheEntry(const IncludeCacheEntry& other)
-		    : line(other.line)
-		    , column(other.column)
-		    , stream(other.stream)
-		    , refcount(other.refcount)
-		{
-			stream = other.stream;
-			refcount = other.refcount;
-			if (refcount)
-				(*refcount) += 1;
-		}
-		~IncludeCacheEntry()
-		{
-			if (refcount) {
-				(*refcount)--;
-				if ((*refcount) <= 0) {
-					delete stream;
-					delete refcount;
-				}
-			}
-		}
-	};
-	std::vector<IncludeCacheEntry> include_stack;
-	void UnwindStack();
-
-	std::deque<Token> token_buffer;
-	//size_t max_buffer_size;
-	size_t buffer_pos;
-
-	bool skip_eol;
-	char GetNextChar();
-	char PeekNextChar();
-
-	void ReadToken(Token& token);
-	void SkipSpaces();
-
-	int errors;
-
-public:
-	Tokenizer()
-	    : buffer_pos(0)
-	    , skip_eol(false)
-	    , errors(0)
-	{
-	}
-
-	void EnterStream(std::istream& stream_, const std::string& name = "");
-
-	Token GetToken(int i = 0);
-	void Step(int i = 1);
-	inline Token TakeToken()
-	{
-		Token result = GetToken();
-		Step();
-		return result;
-	}
-
-	bool Good();
-
-	void ReportError(const Token& t, const std::string& err);
-
-	int NumErrors() const
-	{
-		return errors;
-	}
-};
-
-inline Tokenizer& operator>>(Tokenizer& tokenizer, Token& token)
-{
-	token = tokenizer.TakeToken();
-	return tokenizer;
-}
-
 PDataList ParseTDF(std::istream& s, int* error_count = NULL);
 }
 } // namespace LSL { namespace TDF {
diff --git a/src/lsl/src/lslunitsync/c_api.cpp b/src/lsl/src/lslunitsync/c_api.cpp
index 3c5efe4..3f0c804 100644
--- a/src/lsl/src/lslunitsync/c_api.cpp
+++ b/src/lsl/src/lslunitsync/c_api.cpp
@@ -55,7 +55,7 @@ public:
 		clock_gettime(CLOCK_REALTIME, &stop);
 		const int diff = diff_ms(stop, start);
 		if (diff > 10) {
-			printf("Slow Unitsync call (%s():%d) took: %dms\n", func.c_str(), line, diff);
+			LslWarning("Slow Unitsync call (%s():%d) took: %dms", func.c_str(), line, diff);
 		}
 	}
 
diff --git a/src/lsl/src/lslunitsync/unitsync.cpp b/src/lsl/src/lslunitsync/unitsync.cpp
index 9c1d4ba..b94b95c 100644
--- a/src/lsl/src/lslunitsync/unitsync.cpp
+++ b/src/lsl/src/lslunitsync/unitsync.cpp
@@ -704,6 +704,10 @@ void Unitsync::GetSpringDataPaths()
 {
 	m_datapaths.clear();
 	const int dirs = susynclib().GetSpringDataDirCount();
+	if (dirs < 0) {
+		LslWarning("Couldn't get GetSpringDataDirCount(): %d", dirs);
+		return;
+	}
 	m_datapaths.resize(dirs + 1);
 	for (int i = 1; i <= dirs; i++) {
 		const std::string datadir = susynclib().GetSpringDataDirByIndex(i-1);
diff --git a/src/lsl/src/lslutils/type_forwards.h b/src/lsl/src/lslutils/type_forwards.h
index 9c90716..afa62ae 100644
--- a/src/lsl/src/lslutils/type_forwards.h
+++ b/src/lsl/src/lslutils/type_forwards.h
@@ -35,7 +35,6 @@ class RefcountedPointer;
 
 namespace TDF
 {
-class Tokenizer;
 class Node;
 typedef RefcountedPointer<Node, true> PNode;
 class DataList;
diff --git a/src/replaylist.cpp b/src/replaylist.cpp
index 1f98d83..a741f1d 100644
--- a/src/replaylist.cpp
+++ b/src/replaylist.cpp
@@ -6,6 +6,7 @@
 #include <wx/log.h>
 #include <wx/datetime.h>
 #include <wx/wfstream.h>
+#include <wx/filename.h>
 #include <zlib.h>
 
 #include "replaylist.h"
@@ -17,29 +18,38 @@ class PlayBackDataReader
 {
 private:
 	wxInputStream* inputStream;
-	unsigned char* dataSource;
-	size_t dataSourceSize;
-	size_t dataSourcePosition;
+	gzFile gzInputStream;
+	std::string m_name;
 
 public:
 	PlayBackDataReader()
+		: inputStream(nullptr)
+		, gzInputStream(nullptr)
 	{
-		inputStream = nullptr;
-		dataSource = nullptr;
-		dataSourceSize = 0;
-		dataSourcePosition = 0;
 	}
-	explicit PlayBackDataReader(wxInputStream* inputStream)
-	    : PlayBackDataReader()
+
+	~PlayBackDataReader()
 	{
-		this->inputStream = inputStream;
+		gzclose(gzInputStream);
+		gzInputStream = nullptr;
+
+		delete inputStream;
+		inputStream = nullptr;
 	}
 
-	explicit PlayBackDataReader(unsigned char* p, size_t size)
-	    : PlayBackDataReader()
+	explicit PlayBackDataReader(const std::string& name)
+		: PlayBackDataReader()
 	{
-		this->dataSource = p;
-		this->dataSourceSize = size;
+		m_name = name;
+		if (name.substr(name.length() - 5) == ".sdfz") {
+			gzInputStream = gzopen(name.c_str(), "rb");
+			if (gzInputStream == nullptr) {
+				wxLogWarning("Couldn't open %s",name.c_str());
+				return;
+			}
+		} else {
+			inputStream = new wxFileInputStream(name);
+		}
 	}
 
 	int Seek(size_t pos)
@@ -47,32 +57,30 @@ public:
 		if (inputStream != nullptr) {
 			return inputStream->SeekI(pos);
 		} else {
-			if (pos >= dataSourceSize) {
-				return -1;
-			}
-
-			dataSourcePosition = pos;
-			return pos;
+			return gzseek(gzInputStream, pos, SEEK_SET);
 		}
 	}
 
-	void Read(void* target, size_t size)
+	size_t Read(void* target, size_t size)
 	{
+		wxASSERT(size > 0);
 		if (inputStream != nullptr) {
 			inputStream->Read(target, size);
-			return;
+			return inputStream->LastRead();
 		} else {
-			memcpy(target, &dataSource[dataSourcePosition], size);
+			const int res = gzread(gzInputStream, target, size);
+			if (res <= 0) {
+				wxLogWarning("Couldn't read from %s", m_name.c_str());
+			}
+			return res;
 		}
 	}
 
-	size_t GetLength()
-	{
-		if (inputStream != nullptr) {
-			return inputStream->GetLength();
-		}
+	const std::string& GetName() const { return m_name; }
 
-		return dataSourceSize;
+	bool IsOk() const
+	{
+		return gzInputStream != nullptr || inputStream != nullptr;
 	}
 };
 
@@ -112,19 +120,13 @@ bool ReplayList::GetReplayInfos(const std::string& ReplayPath, StoredGame& ret)
 	ret.battle.SetPlayBackFilePath(ReplayPath);
 	ret.SpringVersion = LSL::Util::BeforeLast(LSL::Util::AfterLast(FileName, "_"), ".");
 	ret.MapName = LSL::Util::BeforeLast(FileName, "_");
+	ret.size = wxFileName::GetSize(ReplayPath).GetLo(); //FIXME: use longlong
 
 	if (!wxFileExists(TowxString(ReplayPath))) {
 		wxLogWarning(wxString::Format(_T("File %s does not exist!"), ReplayPath.c_str()));
 		MarkBroken(ret);
 		return false;
 	}
-	wxFileInputStream inputFileStream(ReplayPath);
-
-	if (!inputFileStream) {
-		wxLogWarning(wxString::Format(_T("Could not open file %s for reading!"), ReplayPath.c_str()));
-		MarkBroken(ret);
-		return false;
-	}
 
 	//try to get date from filename
 	wxDateTime rdate;
@@ -137,32 +139,28 @@ bool ReplayList::GetReplayInfos(const std::string& ReplayPath, StoredGame& ret)
 	ret.date = rdate.GetTicks(); // now it is sorted properly
 	ret.date_string = STD_STRING(rdate.FormatISODate() + _T(" ") + rdate.FormatISOTime());
 
-	if (inputFileStream.GetLength() == 0) {
+	if (ret.size <= 0) {
 		MarkBroken(ret);
 		return false;
 	}
 
-	std::unique_ptr<unsigned char[]> ptr;
-	std::unique_ptr<PlayBackDataReader> replay;
-
-	if (ReplayPath.substr(ReplayPath.length() - 5) == ".sdfz") {
-		const size_t CHUNK_SIZE = 20480;
-		unsigned char* buf = new unsigned char[CHUNK_SIZE];
-		ptr.reset(buf);
+	PlayBackDataReader* replay = new PlayBackDataReader(ReplayPath);
 
-		size_t dataSourceSize = getUnzippedData(buf, CHUNK_SIZE, inputFileStream);
-
-		replay.reset(new PlayBackDataReader(buf, dataSourceSize));
-	} else {
-		replay.reset(new PlayBackDataReader(&inputFileStream));
+	if (!replay->IsOk()) {
+		wxLogWarning(wxString::Format(_T("Could not open file %s for reading!"), ReplayPath.c_str()));
+		MarkBroken(ret);
+		delete replay;
+		return false;
 	}
 
+
 	const int replay_version = replayVersion(*replay);
 	ret.battle.SetScript(GetScriptFromReplay(*replay, replay_version));
 
 	if (ret.battle.GetScript().empty()) {
 		wxLogWarning(wxString::Format(_T("File %s have incompatible version!"), ReplayPath.c_str()));
 		MarkBroken(ret);
+		delete replay;
 		return false;
 	}
 
@@ -173,40 +171,10 @@ bool ReplayList::GetReplayInfos(const std::string& ReplayPath, StoredGame& ret)
 	ret.battle.SetEngineName("spring");
 	ret.battle.SetEngineVersion(ret.SpringVersion);
 	ret.battle.SetPlayBackFilePath(ReplayPath);
-
+	delete replay;
 	return true;
 }
 
-size_t ReplayList::getUnzippedData(unsigned char* ptr, size_t bufSize, wxInputStream& inputStream) const
-{
-	wxASSERT(ptr != nullptr);
-	wxASSERT(bufSize > 0);
-
-	z_stream strm;
-	memset(&strm, 0, sizeof(strm));
-
-	std::unique_ptr<unsigned char[]> inBuff(new unsigned char[bufSize]);
-
-	strm.zalloc = Z_NULL;
-	strm.zfree = Z_NULL;
-	strm.opaque = Z_NULL;
-	strm.next_in = inBuff.get();
-
-	inflateInit2(&strm, 15 | 32);
-
-	inputStream.Read(inBuff.get(), bufSize);
-	strm.avail_in = inputStream.LastRead();
-	strm.avail_out = bufSize;
-	strm.next_out = ptr;
-
-	inflate(&strm, Z_NO_FLUSH);
-	size_t readBytes = bufSize - strm.avail_out;
-
-	inflateEnd(&strm);
-
-	return readBytes;
-}
-
 std::string ReplayList::GetScriptFromReplay(PlayBackDataReader& replay, const int version) const
 {
 	std::string script;
@@ -217,13 +185,19 @@ std::string ReplayList::GetScriptFromReplay(PlayBackDataReader& replay, const in
 	replay.Read(&headerSize, 4);
 	const int seek = 64 + (version < 5 ? 0 : 240);
 	if (replay.Seek(seek) == wxInvalidOffset) {
+		wxLogWarning("Couldn't seek to scriptsize from demo: %s", replay.GetName().c_str());
 		return script;
 	}
 	wxFileOffset scriptSize = 0;
 	replay.Read(&scriptSize, 4);
-	scriptSize = LSL::Util::Clamp(wxFileOffset(scriptSize), wxFileOffset(0), (wxFileOffset)replay.GetLength());
-	if (replay.Seek(headerSize) == wxInvalidOffset)
+	if (scriptSize <= 0) {
+		wxLogWarning("Demo contains empty script: %s (%d)", replay.GetName().c_str(), (int)scriptSize);
 		return script;
+	}
+	if (replay.Seek(headerSize) == wxInvalidOffset) {
+		wxLogWarning("Couldn't seek to script from demo: %s (%d)", replay.GetName().c_str());
+		return script;
+	}
 	script.resize(scriptSize, 0);
 	replay.Read(&script[0], scriptSize);
 	return script;
@@ -238,5 +212,4 @@ void ReplayList::GetHeaderInfo(PlayBackDataReader& replay, StoredGame& rep, cons
 	int gametime = 0;
 	replay.Read(&gametime, 4);
 	rep.duration = gametime;
-	rep.size = replay.GetLength();
 }
diff --git a/src/replaylist.h b/src/replaylist.h
index 3f89c5c..439379b 100644
--- a/src/replaylist.h
+++ b/src/replaylist.h
@@ -47,7 +47,6 @@ private:
 	std::string GetScriptFromReplay(PlayBackDataReader& replay, const int version) const;
 	//! saves relevant infos from header into replay struct
 	void GetHeaderInfo(PlayBackDataReader& replay, StoredGame& rep, const int version) const;
-	size_t getUnzippedData(unsigned char* ptr, size_t bufSize, wxInputStream& inputStream) const;
 };
 
 IPlaybackList& replaylist();
diff --git a/src/servermanager.cpp b/src/servermanager.cpp
index 710551b..e4ad5f9 100644
--- a/src/servermanager.cpp
+++ b/src/servermanager.cpp
@@ -42,7 +42,7 @@ void ServerManager::Release()
 //Try to connect to server
 void ServerManager::ConnectToServer()
 {
-	if (serverSelector().GetServer().IsConnected() == true) {
+	if (serverSelector().GetServer().IsConnected()) {
 		//TODO: Maybe call ReconnectToServer() before return?
 		return;
 	}
@@ -70,7 +70,7 @@ void ServerManager::ReconnectToServer()
 	const std::string pass = STD_STRING(sett().GetServerAccountPass(servname));
 
 	//TODO: Need to be reworked
-	if (sett().GetServerAccountSavePass(servname) == false) {
+	if (!sett().GetServerAccountSavePass(servname)) {
 		ui().ShowConnectWindow();
 		return;
 	}
@@ -91,7 +91,7 @@ void ServerManager::DisconnectFromServer()
 void ServerManager::RegisterNewUser(const std::string& servername, const std::string& username, const std::string& password)
 {
 	//TODO: No ui calls here!
-	if (sett().ServerExists(servername) == false) {
+	if (!sett().ServerExists(servername)) {
 		ui().OnRegistrationDenied(_T("Server does not exist in settings"));
 		return;
 	}
@@ -122,7 +122,7 @@ void ServerManager::DoConnectToServer(const std::string& servername, const std::
 	IServer* server = &serverSelector().GetServer();
 
 	//Disconnect from server if not done before
-	if (server->IsConnected() == true) {
+	if (server->IsConnected()) {
 		server->Disconnect();
 	}
 
diff --git a/src/springlobbyapp.cpp b/src/springlobbyapp.cpp
index 6cea2cf..d34038f 100644
--- a/src/springlobbyapp.cpp
+++ b/src/springlobbyapp.cpp
@@ -74,7 +74,7 @@ END_EVENT_TABLE()
 SpringLobbyApp::SpringLobbyApp()
     : quit_called(false)
     , m_translationhelper(NULL)
-    , m_log_verbosity(3)
+    , m_log_verbosity(4)
     , m_log_console(true)
     , m_log_window_show(false)
     , m_crash_handle_disable(false)
@@ -112,6 +112,8 @@ bool SpringLobbyApp::OnInit()
 	wxHandleFatalExceptions(!m_crash_handle_disable);
 #endif
 
+	const wxString m_log_file_path = SlPaths::GetLobbyWriteDir() + "springlobby.log";
+
 	//initialize all loggers, we'll use the returned pointer to set correct parent window later
 	wxLogWindow* loggerwin = Logger::InitializeLoggingTargets(0, m_log_console, m_log_file_path, m_log_window_show, m_log_verbosity);
 
@@ -221,7 +223,6 @@ void SpringLobbyApp::OnInitCmdLine(wxCmdLineParser& parser)
 	    {
 	     {wxCMD_LINE_SWITCH, "h", "help", wxTRANSLATE("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP},
 	     {wxCMD_LINE_SWITCH, "nc", "no-crash-handler", wxTRANSLATE("don't use the crash handler (useful for debugging)"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL},
-	     {wxCMD_LINE_OPTION, "fl", "file-logging", wxTRANSLATE("dumps application log to a file ( enter path )"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_NEEDS_SEPARATOR},
 	     {wxCMD_LINE_SWITCH, "cl", "console-logging", wxTRANSLATE("shows application log to the console(if available)"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL},
 	     {wxCMD_LINE_SWITCH, "gl", "gui-logging", wxTRANSLATE("enables application log window"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL},
 	     {wxCMD_LINE_OPTION, "f", "config-file", wxTRANSLATE("override default choice for config-file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_NEEDS_SEPARATOR},
@@ -242,7 +243,6 @@ bool SpringLobbyApp::OnCmdLineParsed(wxCmdLineParser& parser)
 	if (!parser.Parse(true)) {
 		m_log_console = parser.Found(_T("console-logging"));
 		m_log_window_show = parser.Found(_T("gui-logging"));
-		parser.Found(_T("file-logging"), &m_log_file_path);
 		m_crash_handle_disable = parser.Found(_T("no-crash-handler"));
 		parser.Found(_T("log-verbosity"), &m_log_verbosity);
 
diff --git a/src/springlobbyapp.h b/src/springlobbyapp.h
index 555d009..b7ebe9d 100644
--- a/src/springlobbyapp.h
+++ b/src/springlobbyapp.h
@@ -35,7 +35,6 @@ private:
 
 	long m_log_verbosity;
 	bool m_log_console;
-	wxString m_log_file_path;
 	bool m_log_window_show;
 	bool m_crash_handle_disable;
 	wxString m_appname;
diff --git a/src/springsettings/settings.rc b/src/springsettings/settings.rc
deleted file mode 100644
index 8805dea..0000000
--- a/src/springsettings/settings.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-springsettings ICON "images/springsettings.ico"
-#include <wx/msw/wx.rc>
diff --git a/src/tasserver.cpp b/src/tasserver.cpp
index f53dc04..050cc7e 100644
--- a/src/tasserver.cpp
+++ b/src/tasserver.cpp
@@ -300,7 +300,7 @@ void TASServer::Disconnect()
 		return;
 	}
 
-	if (IsConnected() == true) {
+	if (IsConnected()) {
 		SendCmd("EXIT " + STD_STRING(cfg().ReadString(_T("/Server/ExitMessage")))); // EXIT command for new protocol compatibility
 		m_sock->Disconnect();
 	}
@@ -461,10 +461,10 @@ void TASServer::Notify()
 		// Is it time for a nat traversal PING?
 		m_last_udp_ping = 0;
 		// Nat travelsal "ping"
-		if (m_battle_id != -1) {
+		if (BattleExists(m_battle_id)) {
 			IBattle* battle = GetCurrentBattle();
-			if ((battle) &&
-			    (battle->GetNatType() == NAT_Hole_punching || (battle->GetNatType() == NAT_Fixed_source_ports)) && !battle->GetInGame()) {
+			if ((battle != nullptr &&
+				battle->GetNatType() == NAT_Hole_punching || (battle->GetNatType() == NAT_Fixed_source_ports)) && !battle->GetInGame()) {
 				UdpPingTheServer(GetUserName());
 				if (battle->IsFounderMe()) {
 					UdpPingAllClients();
@@ -477,7 +477,7 @@ void TASServer::Notify()
 
 void TASServer::ExecuteCommand(const std::string& in)
 {
-	wxLogMessage(_T("%s"), TowxString(in).c_str());
+	wxLogDebug(_T("%s"), TowxString(in).c_str());
 	wxString cmd;
 	wxString params = TowxString(in);
 	long replyid = 0;
diff --git a/src/tests/config.cpp b/src/tests/config.cpp
index 58ebc67..05ca06e 100644
--- a/src/tests/config.cpp
+++ b/src/tests/config.cpp
@@ -54,8 +54,8 @@ BOOST_AUTO_TEST_CASE(slconfig)
 	BOOST_CHECK(cfg().ReadDouble(_T("/test/double")) == -321.123);
 	BOOST_CHECK(cfg().Read(_T("/test/double")) == _T("-321.123"));
 
-	BOOST_CHECK(cfg().ReadBool(_T("/test/bool")) == true);
-	BOOST_CHECK(cfg().ReadBool(_T("/test/notbool")) == false);
+	BOOST_CHECK(cfg().ReadBool(_T("/test/bool")));
+	BOOST_CHECK(!cfg().ReadBool(_T("/test/notbool")));
 	BOOST_CHECK(cfg().Read(_T("/test/bool")) == _T("1"));
 
 	BOOST_CHECK(cfg().ReadString(_T("/test/string")) == _T("hello world!"));
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(slconfig)
 	BOOST_CHECK(cfg().ReadDouble(_T("/test/double")) == 10.3);
 
 	BOOST_CHECK(cfg().Write(_T("/test/bool"), false));
-	BOOST_CHECK(cfg().ReadBool(_T("/test/bool")) == false);
+	BOOST_CHECK(!cfg().ReadBool(_T("/test/bool")));
 
 	BOOST_CHECK(cfg().Write(_T("/test/string"), (const wxString&)_T("test2")));
 	BOOST_CHECK(cfg().Read(_T("/test/string")) == _T("test2"));
diff --git a/src/tests/testingstuff/silent_logger.h b/src/tests/testingstuff/silent_logger.h
index 0979e7c..3827cc4 100644
--- a/src/tests/testingstuff/silent_logger.h
+++ b/src/tests/testingstuff/silent_logger.h
@@ -16,7 +16,7 @@ public:
 
 	void DoLogRecord(wxLogLevel loglevel, const wxString& msg, const wxLogRecordInfo& info) override
 	{
-		if (totalSilence == false) {
+		if (!totalSilence) {
 			const std::string msg_str = msg.ToStdString();
 			const std::string std_msg = wxString::Format(_T("%s %s:%d %s\n"), LogLevelToString(loglevel).c_str(), info.filename, info.line, msg_str.c_str()).ToStdString();
 			std::cout << std_msg;
diff --git a/src/user.cpp b/src/user.cpp
index b01c18b..3a9e70f 100644
--- a/src/user.cpp
+++ b/src/user.cpp
@@ -265,7 +265,7 @@ LSL::lslColor User::GetColor() const
 
 bool User::IsHuman() const
 {
-	return (BattleStatus().IsBot() == false);
+	return (!BattleStatus().IsBot());
 }
 
 bool User::IsBot() const
diff --git a/src/utils/globalevents.cpp b/src/utils/globalevents.cpp
index 6c6cf46..aa8b6c7 100644
--- a/src/utils/globalevents.cpp
+++ b/src/utils/globalevents.cpp
@@ -24,7 +24,6 @@ const wxEventType GlobalEventManager::OnLogin = wxNewEventType();
 const wxEventType GlobalEventManager::BattleSyncReload = wxNewEventType();
 const wxEventType GlobalEventManager::BattleStartedEvent = wxNewEventType();
 const wxEventType GlobalEventManager::OnUpdateFinished = wxNewEventType();
-const wxEventType GlobalEventManager::GamePromotedEvent = wxNewEventType();
 const wxEventType GlobalEventManager::ApplicationSettingsChangedEvent =
     wxNewEventType();
 
diff --git a/src/utils/globalevents.h b/src/utils/globalevents.h
index 87906e4..e7b4d56 100644
--- a/src/utils/globalevents.h
+++ b/src/utils/globalevents.h
@@ -49,7 +49,6 @@ public:
 
 	static const wxEventType BattleSyncReload;
 	static const wxEventType BattleStartedEvent;
-	static const wxEventType GamePromotedEvent;
 	static const wxEventType ApplicationSettingsChangedEvent;
 
 private:
diff --git a/src/utils/slpaths.cpp b/src/utils/slpaths.cpp
index 3269e80..a437782 100644
--- a/src/utils/slpaths.cpp
+++ b/src/utils/slpaths.cpp
@@ -165,10 +165,13 @@ void SlPaths::RefreshSpringVersionList(bool autosearch, const LSL::SpringBundle*
 			usync_paths.push_back(bundle);
 		}
 		if (!SlPaths::IsPortableMode()) {
+/*
+//FIXME: reenable when #707 is fixed / spring 102.0 is "established"
 			LSL::SpringBundle systembundle;
 			if (LSL::SpringBundle::LocateSystemInstalledSpring(systembundle)) {
 				usync_paths.push_back(systembundle);
 			}
+*/
 
 			std::vector<std::string> paths;
 			PossibleEnginePaths(paths);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/springlobby.git



More information about the Pkg-games-commits mailing list