- Update more headers
authorunc0rr
Thu, 05 Oct 2006 17:02:09 +0000
changeset 184 f97a7a3dc8f6
parent 183 57c2ef19f719
child 185 3b777d7008d9
- Update more headers - set svn:eol-style to native
CMakeLists.txt
QTfrontend/CMakeLists.txt
QTfrontend/SquareLabel.cpp
QTfrontend/SquareLabel.h
QTfrontend/binds.h
QTfrontend/frameTeam.cpp
QTfrontend/frameTeam.h
QTfrontend/game.cpp
QTfrontend/game.h
QTfrontend/gamecfgwidget.cpp
QTfrontend/gamecfgwidget.h
QTfrontend/gameuiconfig.cpp
QTfrontend/gameuiconfig.h
QTfrontend/hedgehogerWidget.cpp
QTfrontend/hedgehogerWidget.h
QTfrontend/hwconsts.h
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/hwmap.cpp
QTfrontend/hwmap.h
QTfrontend/main.cpp
QTfrontend/mapContainer.cpp
QTfrontend/mapContainer.h
QTfrontend/netclient.cpp
QTfrontend/netclient.h
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/predefteams.h
QTfrontend/sdlkeys.h
QTfrontend/tcpBase.cpp
QTfrontend/tcpBase.h
QTfrontend/team.cpp
QTfrontend/team.h
QTfrontend/teamselect.cpp
QTfrontend/teamselect.h
QTfrontend/teamselhelper.cpp
QTfrontend/teamselhelper.h
QTfrontend/ui_hwform.cpp
QTfrontend/ui_hwform.h
QTfrontend/vertScrollArea.cpp
QTfrontend/vertScrollArea.h
hedgewars/CMakeLists.txt
hedgewars/checksdl.dpr
hedgewars/tunsetborder.inc
hedgewars/uLandGraphics.pas
hedgewars/uLandObjects.pas
hedgewars/uLandTemplates.pas
hedgewars/uLocale.pas
share/CMakeLists.txt
share/hedgewars/CMakeLists.txt
share/hedgewars/Data/CMakeLists.txt
share/hedgewars/Data/Graphics/AmmoMenu/CMakeLists.txt
share/hedgewars/Data/Graphics/CMakeLists.txt
share/hedgewars/Data/Locale/CMakeLists.txt
share/hedgewars/Data/Locale/en.txt
share/hedgewars/Data/Locale/ru.txt
share/hedgewars/Data/Sounds/CMakeLists.txt
share/hedgewars/Data/Themes/CMakeLists.txt
share/hedgewars/Data/Themes/avematan/CMakeLists.txt
share/hedgewars/Data/Themes/avematan/theme.cfg
share/hedgewars/Data/Themes/bubbles/CMakeLists.txt
share/hedgewars/Data/Themes/bubbles/theme.cfg
share/hedgewars/Data/Themes/ethereal/theme.cfg
share/hedgewars/Data/Themes/norsk/theme.cfg
share/hedgewars/Data/Themes/steel/CMakeLists.txt
share/hedgewars/Data/Themes/steel/theme.cfg
share/hedgewars/Data/Themes/themes.cfg
share/hedgewars/Data/Themes/tibet/CMakeLists.txt
share/hedgewars/Data/Themes/tibet/theme.cfg
share/hedgewars/Data/Themes/wood/CMakeLists.txt
share/hedgewars/Data/Themes/wood/theme.cfg
share/hedgewars/Data/Themes/xtheme/CMakeLists.txt
share/hedgewars/Data/Themes/xtheme/theme.cfg
--- a/CMakeLists.txt	Thu Oct 05 16:33:18 2006 +0000
+++ b/CMakeLists.txt	Thu Oct 05 17:02:09 2006 +0000
@@ -1,36 +1,36 @@
-project(hedgewars)
-
-cmake_minimum_required(VERSION 2.4.0)
-
-set(SHAREPATH share/hedgewars/)
-
-add_subdirectory(QTfrontend)
-add_subdirectory(hedgewars)
-add_subdirectory(share)
-
-if(WIN32 AND NOT UNIX)
-	add_subdirectory(bin)
-endif(WIN32 AND NOT UNIX)
-
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hedgewars, a turn-based strategy")
-set(CPACK_PACKAGE_VENDOR "Hedgewars")
-set(CPACK_PACKAGE_VERSION_MAJOR "0")
-set(CPACK_PACKAGE_VERSION_MINOR "2")
-set(CPACK_PACKAGE_VERSION_PATCH "0")
-set(CPACK_PACKAGE_FILE_NAME "hedgewars-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
-set(CPACK_PACKAGE_EXECUTABLES "hedgewars" "hwengine")
-#set(CPACK_RESOURCE_FILE_LICENSE "COPYING.txt")
-
-if(WIN32 AND NOT UNIX)
-	set(CPACK_NSIS_DISPLAY_NAME "Hedgewars, a cross-platform, open-source turn-based Worms-like strategy")
-	set(CPACK_NSIS_HELP_LINK "http://www.hedgewars.org/")
-	set(CPACK_NSIS_URL_INFO_ABOUT "http://www.hedgewars.org/")
-	set(CPACK_NSIS_CONTACT "unC0Rr@gmail.com")
-	set(CPACK_NSIS_MODIFY_PATH ON)
-	set(CPACK_PACKAGE_EXECUTABLES "hedgewars" "hedgewars") 
-else(WIN32 AND NOT UNIX)
-	set(CPACK_STRIP_FILES "bin/hedgewars;bin/hwengine")
-endif(WIN32 AND NOT UNIX)
-
-include(CPack)
-
+project(hedgewars)
+
+cmake_minimum_required(VERSION 2.4.0)
+
+set(SHAREPATH share/hedgewars/)
+
+add_subdirectory(QTfrontend)
+add_subdirectory(hedgewars)
+add_subdirectory(share)
+
+if(WIN32 AND NOT UNIX)
+	add_subdirectory(bin)
+endif(WIN32 AND NOT UNIX)
+
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hedgewars, a turn-based strategy")
+set(CPACK_PACKAGE_VENDOR "Hedgewars")
+set(CPACK_PACKAGE_VERSION_MAJOR "0")
+set(CPACK_PACKAGE_VERSION_MINOR "2")
+set(CPACK_PACKAGE_VERSION_PATCH "0")
+set(CPACK_PACKAGE_FILE_NAME "hedgewars-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+set(CPACK_PACKAGE_EXECUTABLES "hedgewars" "hwengine")
+#set(CPACK_RESOURCE_FILE_LICENSE "COPYING.txt")
+
+if(WIN32 AND NOT UNIX)
+	set(CPACK_NSIS_DISPLAY_NAME "Hedgewars, a cross-platform, open-source turn-based Worms-like strategy")
+	set(CPACK_NSIS_HELP_LINK "http://www.hedgewars.org/")
+	set(CPACK_NSIS_URL_INFO_ABOUT "http://www.hedgewars.org/")
+	set(CPACK_NSIS_CONTACT "unC0Rr@gmail.com")
+	set(CPACK_NSIS_MODIFY_PATH ON)
+	set(CPACK_PACKAGE_EXECUTABLES "hedgewars" "hedgewars") 
+else(WIN32 AND NOT UNIX)
+	set(CPACK_STRIP_FILES "bin/hedgewars;bin/hwengine")
+endif(WIN32 AND NOT UNIX)
+
+include(CPack)
+
--- a/QTfrontend/CMakeLists.txt	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/CMakeLists.txt	Thu Oct 05 17:02:09 2006 +0000
@@ -1,91 +1,91 @@
-find_package(Qt4 REQUIRED)
-
-include_directories(${QT_INCLUDES} .)
-
-if(WIN32 AND NOT UNIX)
-	set(HEDGEWARS_BINDIR ".")
-else(WIN32 AND NOT UNIX)
-	set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX})
-endif(WIN32 AND NOT UNIX)
-
-configure_file(${hedgewars_SOURCE_DIR}/QTfrontend/main.cpp.in 
-	${hedgewars_SOURCE_DIR}/QTfrontend/main.cpp)
-
-set(hwfr_src 
-	game.cpp
-	main.cpp
-	hwform.cpp 
-	team.cpp
-	netclient.cpp
-	teamselect.cpp
-	teamselhelper.cpp
-	frameTeam.cpp
-	vertScrollArea.cpp
-	gameuiconfig.cpp
-	ui_hwform.cpp
-	gamecfgwidget.cpp
-	pages.cpp
-	SquareLabel.cpp
-	hedgehogerWidget.cpp
-	hwmap.cpp
-	mapContainer.cpp
-	tcpBase.cpp)
-
-if (WIN32)
-	set(hwfr_src ${hwfr_src} res/hedgewars.rc)
-endif (WIN32)
-
-set(hwfr_moc_hdrs
-	game.h
-	hwform.h
-	binds.h
-	netclient.h
-	teamselect.h
-	teamselhelper.h
-	frameTeam.h
-	vertScrollArea.h
-	gameuiconfig.h
-	ui_hwform.h
-	gamecfgwidget.h
-	predefteams.h
-	pages.h
-	SquareLabel.h
-	hedgehogerWidget.h
-	hwmap.h
-	mapContainer.h
-	tcpBase.h)
-
-
-set(hwfr_rez
-	hedgewars.qrc)
-
-qt4_add_resources(hwfr_rez_src
-	${hwfr_rez})
-
-qt4_wrap_cpp(hwfr_moc_srcs
-	${hwfr_moc_hdrs})
-
-add_executable(hedgewars WIN32
-	${hwfr_src}
-	${hwfr_moc_srcs}
-	${hwfr_rez_src})
-
-target_link_libraries(hedgewars 
-	${QT_QTCORE_LIBRARY}
-	${QT_QTGUI_LIBRARY}
-	${QT_QTNETWORK_LIBRARY}
-	${QT_QTMAIN_LIBRARY})
-
-install(PROGRAMS "hedgewars${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
-
-
-if(WIN32 AND NOT UNIX)
-	string(REPLACE "\\" "/" QT_BIN_DIR $ENV{QTDIR}/bin)
-
-	install(FILES
-		"${QT_BIN_DIR}/QtNetwork4.dll"
-		"${QT_BIN_DIR}/QtGui4.dll"
-		"${QT_BIN_DIR}/QtCore4.dll"
-		"${QT_BIN_DIR}/mingwm10.dll"
-		DESTINATION bin)
-endif(WIN32 AND NOT UNIX)
+find_package(Qt4 REQUIRED)
+
+include_directories(${QT_INCLUDES} .)
+
+if(WIN32 AND NOT UNIX)
+	set(HEDGEWARS_BINDIR ".")
+else(WIN32 AND NOT UNIX)
+	set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX})
+endif(WIN32 AND NOT UNIX)
+
+configure_file(${hedgewars_SOURCE_DIR}/QTfrontend/main.cpp.in 
+	${hedgewars_SOURCE_DIR}/QTfrontend/main.cpp)
+
+set(hwfr_src 
+	game.cpp
+	main.cpp
+	hwform.cpp 
+	team.cpp
+	netclient.cpp
+	teamselect.cpp
+	teamselhelper.cpp
+	frameTeam.cpp
+	vertScrollArea.cpp
+	gameuiconfig.cpp
+	ui_hwform.cpp
+	gamecfgwidget.cpp
+	pages.cpp
+	SquareLabel.cpp
+	hedgehogerWidget.cpp
+	hwmap.cpp
+	mapContainer.cpp
+	tcpBase.cpp)
+
+if (WIN32)
+	set(hwfr_src ${hwfr_src} res/hedgewars.rc)
+endif (WIN32)
+
+set(hwfr_moc_hdrs
+	game.h
+	hwform.h
+	binds.h
+	netclient.h
+	teamselect.h
+	teamselhelper.h
+	frameTeam.h
+	vertScrollArea.h
+	gameuiconfig.h
+	ui_hwform.h
+	gamecfgwidget.h
+	predefteams.h
+	pages.h
+	SquareLabel.h
+	hedgehogerWidget.h
+	hwmap.h
+	mapContainer.h
+	tcpBase.h)
+
+
+set(hwfr_rez
+	hedgewars.qrc)
+
+qt4_add_resources(hwfr_rez_src
+	${hwfr_rez})
+
+qt4_wrap_cpp(hwfr_moc_srcs
+	${hwfr_moc_hdrs})
+
+add_executable(hedgewars WIN32
+	${hwfr_src}
+	${hwfr_moc_srcs}
+	${hwfr_rez_src})
+
+target_link_libraries(hedgewars 
+	${QT_QTCORE_LIBRARY}
+	${QT_QTGUI_LIBRARY}
+	${QT_QTNETWORK_LIBRARY}
+	${QT_QTMAIN_LIBRARY})
+
+install(PROGRAMS "hedgewars${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
+
+
+if(WIN32 AND NOT UNIX)
+	string(REPLACE "\\" "/" QT_BIN_DIR $ENV{QTDIR}/bin)
+
+	install(FILES
+		"${QT_BIN_DIR}/QtNetwork4.dll"
+		"${QT_BIN_DIR}/QtGui4.dll"
+		"${QT_BIN_DIR}/QtCore4.dll"
+		"${QT_BIN_DIR}/mingwm10.dll"
+		DESTINATION bin)
+endif(WIN32 AND NOT UNIX)
--- a/QTfrontend/SquareLabel.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/SquareLabel.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,41 +1,41 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QPaintEvent>
-#include <QPainter>
-#include "SquareLabel.h"
-
-SquareLabel::SquareLabel(QWidget * parent) :
-  QLabel(parent)
-{
-
-}
-
-void SquareLabel::paintEvent(QPaintEvent * event)
-{
-	QPainter painter(this);
-	int pixsize;
-	if (width() > height()) {
-		pixsize = height();
-		painter.translate((width() - pixsize) / 2, 0);
-	} else {
-		pixsize = width();
-		painter.translate(0, (height() - pixsize) / 2);
-	}
-	painter.drawPixmap(0, 0, pixsize, pixsize, pixmap()->scaled(pixsize, pixsize, Qt::KeepAspectRatio));
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QPaintEvent>
+#include <QPainter>
+#include "SquareLabel.h"
+
+SquareLabel::SquareLabel(QWidget * parent) :
+  QLabel(parent)
+{
+
+}
+
+void SquareLabel::paintEvent(QPaintEvent * event)
+{
+	QPainter painter(this);
+	int pixsize;
+	if (width() > height()) {
+		pixsize = height();
+		painter.translate((width() - pixsize) / 2, 0);
+	} else {
+		pixsize = width();
+		painter.translate(0, (height() - pixsize) / 2);
+	}
+	painter.drawPixmap(0, 0, pixsize, pixsize, pixmap()->scaled(pixsize, pixsize, Qt::KeepAspectRatio));
+}
--- a/QTfrontend/SquareLabel.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/SquareLabel.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,35 +1,35 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef _SQUARELABEL_H
-#define _SQUARELABEL_H
-
-#include <QLabel>
-
-class SquareLabel : public QLabel
-{
-	Q_OBJECT
-
-public:
-	SquareLabel(QWidget * parent = 0);
-
-protected:
-	virtual void paintEvent(QPaintEvent * event);
-};
-
-#endif // _SQUARELABEL_H
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef _SQUARELABEL_H
+#define _SQUARELABEL_H
+
+#include <QLabel>
+
+class SquareLabel : public QLabel
+{
+	Q_OBJECT
+
+public:
+	SquareLabel(QWidget * parent = 0);
+
+protected:
+	virtual void paintEvent(QPaintEvent * event);
+};
+
+#endif // _SQUARELABEL_H
--- a/QTfrontend/binds.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/binds.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,68 +1,68 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef BINDS_H
-#define BINDS_H
-
-#include <QString>
-#include <QtGlobal>
-
-#define BINDS_NUMBER 29
-
-struct BindAction
-{
-	QString action;
-	QString strbind;
-	const char * name;
-	bool chwidget;
-};
-
-const BindAction cbinds[BINDS_NUMBER] =
-{
-	{"+up",	"up",	QT_TRANSLATE_NOOP("binds", "up"),	false},
-	{"+left",	"left",	QT_TRANSLATE_NOOP("binds", "left"),	false},
-	{"+right",	"right",	QT_TRANSLATE_NOOP("binds", "right"),	false},
-	{"+down",	"down",	QT_TRANSLATE_NOOP("binds", "down"),	false},
-	{"ljump",	"return",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
-	{"hjump",	"backspace",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
-	{"+attack",	"space",	QT_TRANSLATE_NOOP("binds", "attack"),	false},
-	{"put",	"mousel",	QT_TRANSLATE_NOOP("binds", "put"),	false},
-	{"switch",	"tab",	QT_TRANSLATE_NOOP("binds", "switch"),	false},
-	{"findhh",	"h",	QT_TRANSLATE_NOOP("binds", "find hedgehog"),	true},
-	{"ammomenu",	"mouser",	QT_TRANSLATE_NOOP("binds", "ammo menu"),	false},
-	{"slot 1",	"f1",	QT_TRANSLATE_NOOP("binds", "slot 1"),	false},
-	{"slot 2",	"f2",	QT_TRANSLATE_NOOP("binds", "slot 2"),	false},
-	{"slot 3",	"f3",	QT_TRANSLATE_NOOP("binds", "slot 3"),	false},
-	{"slot 4",	"f4",	QT_TRANSLATE_NOOP("binds", "slot 4"),	false},
-	{"slot 5",	"f5",	QT_TRANSLATE_NOOP("binds", "slot 5"),	false},
-	{"slot 6",	"f6",	QT_TRANSLATE_NOOP("binds", "slot 6"),	false},
-	{"slot 7",	"f7",	QT_TRANSLATE_NOOP("binds", "slot 7"),	false},
-	{"slot 8",	"f8",	QT_TRANSLATE_NOOP("binds", "slot 8"),	true},
-	{"timer 1",	"1",	QT_TRANSLATE_NOOP("binds", "timer 1 sec"),	false},
-	{"timer 2",	"2",	QT_TRANSLATE_NOOP("binds", "timer 2 sec"),	false},
-	{"timer 3",	"3",	QT_TRANSLATE_NOOP("binds", "timer 3 sec"),	false},
-	{"timer 4",	"4",	QT_TRANSLATE_NOOP("binds", "timer 4 sec"),	false},
-	{"timer 5",	"5",	QT_TRANSLATE_NOOP("binds", "timer 5 sec"),	true},
-	{"+voldown",	"9",	QT_TRANSLATE_NOOP("binds", "volume down"),	false},
-	{"+volup",	"0",	QT_TRANSLATE_NOOP("binds", "volume up"),	false},
-	{"fullscr",	"f",	QT_TRANSLATE_NOOP("binds", "change mode"),	false},
-	{"capture",	"c",	QT_TRANSLATE_NOOP("binds", "capture"),	false},
-	{"quit",	"escape",	QT_TRANSLATE_NOOP("binds", "quit"),	true}
-};
-
-#endif // BINDS_H
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef BINDS_H
+#define BINDS_H
+
+#include <QString>
+#include <QtGlobal>
+
+#define BINDS_NUMBER 29
+
+struct BindAction
+{
+	QString action;
+	QString strbind;
+	const char * name;
+	bool chwidget;
+};
+
+const BindAction cbinds[BINDS_NUMBER] =
+{
+	{"+up",	"up",	QT_TRANSLATE_NOOP("binds", "up"),	false},
+	{"+left",	"left",	QT_TRANSLATE_NOOP("binds", "left"),	false},
+	{"+right",	"right",	QT_TRANSLATE_NOOP("binds", "right"),	false},
+	{"+down",	"down",	QT_TRANSLATE_NOOP("binds", "down"),	false},
+	{"ljump",	"return",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
+	{"hjump",	"backspace",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
+	{"+attack",	"space",	QT_TRANSLATE_NOOP("binds", "attack"),	false},
+	{"put",	"mousel",	QT_TRANSLATE_NOOP("binds", "put"),	false},
+	{"switch",	"tab",	QT_TRANSLATE_NOOP("binds", "switch"),	false},
+	{"findhh",	"h",	QT_TRANSLATE_NOOP("binds", "find hedgehog"),	true},
+	{"ammomenu",	"mouser",	QT_TRANSLATE_NOOP("binds", "ammo menu"),	false},
+	{"slot 1",	"f1",	QT_TRANSLATE_NOOP("binds", "slot 1"),	false},
+	{"slot 2",	"f2",	QT_TRANSLATE_NOOP("binds", "slot 2"),	false},
+	{"slot 3",	"f3",	QT_TRANSLATE_NOOP("binds", "slot 3"),	false},
+	{"slot 4",	"f4",	QT_TRANSLATE_NOOP("binds", "slot 4"),	false},
+	{"slot 5",	"f5",	QT_TRANSLATE_NOOP("binds", "slot 5"),	false},
+	{"slot 6",	"f6",	QT_TRANSLATE_NOOP("binds", "slot 6"),	false},
+	{"slot 7",	"f7",	QT_TRANSLATE_NOOP("binds", "slot 7"),	false},
+	{"slot 8",	"f8",	QT_TRANSLATE_NOOP("binds", "slot 8"),	true},
+	{"timer 1",	"1",	QT_TRANSLATE_NOOP("binds", "timer 1 sec"),	false},
+	{"timer 2",	"2",	QT_TRANSLATE_NOOP("binds", "timer 2 sec"),	false},
+	{"timer 3",	"3",	QT_TRANSLATE_NOOP("binds", "timer 3 sec"),	false},
+	{"timer 4",	"4",	QT_TRANSLATE_NOOP("binds", "timer 4 sec"),	false},
+	{"timer 5",	"5",	QT_TRANSLATE_NOOP("binds", "timer 5 sec"),	true},
+	{"+voldown",	"9",	QT_TRANSLATE_NOOP("binds", "volume down"),	false},
+	{"+volup",	"0",	QT_TRANSLATE_NOOP("binds", "volume up"),	false},
+	{"fullscr",	"f",	QT_TRANSLATE_NOOP("binds", "change mode"),	false},
+	{"capture",	"c",	QT_TRANSLATE_NOOP("binds", "capture"),	false},
+	{"quit",	"escape",	QT_TRANSLATE_NOOP("binds", "quit"),	true}
+};
+
+#endif // BINDS_H
--- a/QTfrontend/frameTeam.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/frameTeam.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,61 +1,61 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "frameTeam.h"
-#include "teamselhelper.h"
-
-#include <QResizeEvent>
-#include <QCoreApplication>
-
-using namespace std;
-
-FrameTeams::FrameTeams(QWidget* parent) :
-  QWidget(parent), maxHedgehogsPerGame(18), overallHedgehogs(0), mainLayout(this)
-{
-  mainLayout.setSpacing(1);
-}
-
-void FrameTeams::addTeam(HWTeam team, bool willPlay)
-{
-  TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team, willPlay, this);
-//  int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
-  teamToWidget.insert(make_pair(team, pTeamShowWidget));
-  mainLayout.addWidget(pTeamShowWidget);
-  QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
-  QCoreApplication::postEvent(parentWidget(), pevent);
-}
-
-void FrameTeams::removeTeam(HWTeam team)
-{
-  tmapTeamToWidget::iterator it=teamToWidget.find(team);
-  mainLayout.removeWidget(it->second);
-  delete it->second;
-  teamToWidget.erase(team);
-}
-
-QWidget* FrameTeams::getTeamWidget(HWTeam team)
-{
-  tmapTeamToWidget::iterator it=teamToWidget.find(team);
-  QWidget* ret = it!=teamToWidget.end() ? it->second : 0;
-  return ret;
-}
-
-bool FrameTeams::isFullTeams() const
-{
-  return overallHedgehogs==maxHedgehogsPerGame;
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "frameTeam.h"
+#include "teamselhelper.h"
+
+#include <QResizeEvent>
+#include <QCoreApplication>
+
+using namespace std;
+
+FrameTeams::FrameTeams(QWidget* parent) :
+  QWidget(parent), maxHedgehogsPerGame(18), overallHedgehogs(0), mainLayout(this)
+{
+  mainLayout.setSpacing(1);
+}
+
+void FrameTeams::addTeam(HWTeam team, bool willPlay)
+{
+  TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team, willPlay, this);
+//  int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
+  teamToWidget.insert(make_pair(team, pTeamShowWidget));
+  mainLayout.addWidget(pTeamShowWidget);
+  QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
+  QCoreApplication::postEvent(parentWidget(), pevent);
+}
+
+void FrameTeams::removeTeam(HWTeam team)
+{
+  tmapTeamToWidget::iterator it=teamToWidget.find(team);
+  mainLayout.removeWidget(it->second);
+  delete it->second;
+  teamToWidget.erase(team);
+}
+
+QWidget* FrameTeams::getTeamWidget(HWTeam team)
+{
+  tmapTeamToWidget::iterator it=teamToWidget.find(team);
+  QWidget* ret = it!=teamToWidget.end() ? it->second : 0;
+  return ret;
+}
+
+bool FrameTeams::isFullTeams() const
+{
+  return overallHedgehogs==maxHedgehogsPerGame;
+}
--- a/QTfrontend/frameTeam.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/frameTeam.h	Thu Oct 05 17:02:09 2006 +0000
@@ -2,33 +2,18 @@
  * Hedgewars, a worms-like game
  * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
  *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
  *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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
  */
 
 #ifndef _FRAME_TEAM_INCLUDED
--- a/QTfrontend/game.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/game.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,281 +1,281 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QMessageBox>
-#include <QProcess>
-#include <QTimer>
-#include <QString>
-#include <QByteArray>
-#include <QFile>
-#include <QTextStream>
-#include <QUuid>
-
-#include "game.h"
-#include "hwconsts.h"
-#include "gameuiconfig.h"
-#include "gamecfgwidget.h"
-
-HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg) :
-  TCPBase(true)
-{
-	this->config = config;
-	this->gamecfg = gamecfg;
-	TeamCount = 0;
-	seed = "";
-}
-
-void HWGame::onClientDisconnect()
-{
-	SaveDemo(cfgdir->absolutePath() + "/Demos/LastRound.hwd_1");
-}
-
-void HWGame::SendTeamConfig(int index)
-{
-	LocalCFG(teams[index]);
-}
-
-void HWGame::SendConfig()
-{
-	SendIPC(QString("eseed %1").arg(seed).toAscii());
-	SendIPC(QString("etheme %1").arg(config->GetRandomTheme()).toAscii());
-	SendIPC("TL");
-	SendIPC(QString("e$gmflags %1").arg(gamecfg->getGameFlags()).toAscii());
-
-	for (int i = 0; i < TeamCount; i++)
-	{
-		SendIPC("eaddteam");
-		LocalCFG(teams[i]);
-		SendIPC(QString("ecolor %1").arg(65535 << i * 8).toAscii());
-		for (int t = 0; t < hdNum[teams[i]]; t++)
-			SendIPC(QString("eadd hh%1 0").arg(t).toAscii());
-	}
-}
-
-void HWGame::SendQuickConfig()
-{
-	SendIPC(QString("eseed %1").arg(seed).toAscii());
-	SendIPC(QString("etheme %1").arg(config->GetRandomTheme()).toAscii());
-	SendIPC("TL");
-	SendIPC(QString("e$gmflags %1").arg(gamecfg->getGameFlags()).toAscii());
-	SendIPC("eaddteam");
-	LocalCFG(0);
-	SendIPC("ecolor 65535");
-	SendIPC("eadd hh0 0");
-	SendIPC("eadd hh1 0");
-	SendIPC("eadd hh2 0");
-	SendIPC("eadd hh3 0");
-	SendIPC("eaddteam");
-	LocalCFG(2);
-	SendIPC("ecolor 16776960");
-	SendIPC("eadd hh0 1");
-	SendIPC("eadd hh1 1");
-	SendIPC("eadd hh2 1");
-	SendIPC("eadd hh3 1");
-}
-
-void HWGame::ParseMessage(const QByteArray & msg)
-{
-	switch(msg.data()[1]) {
-		case '?': {
-			if (gameType == gtNet)
-				emit SendNet(QByteArray("\x01""?"));
-			else
-				SendIPC("!");
-			break;
-		}
-		case 'C': {
-			switch (gameType) {
-				case gtLocal: {
-				 	SendConfig();
-					break;
-				}
-				case gtQLocal: {
-				 	SendQuickConfig();
-					break;
-				}
-				case gtDemo: break;
-				case gtNet: {
-					SendIPC("TN");
-					emit SendNet(QByteArray("\x01""C"));
-					break;
-				}
-			}
-			break;
-		}
-		case 'E': {
-			QMessageBox::critical(0,
-					"Hedgewars: error message",
-					QString().append(msg.mid(2)).left(msg.size() - 6),
-					QMessageBox::Ok,
-					QMessageBox::NoButton,
-					QMessageBox::NoButton);
-			return;
-		}
-		case '+': {
-			if (gameType == gtNet)
-			{
-				emit SendNet(msg);
-			}
-			break;
-		}
-		default: {
-			if (gameType == gtNet)
-			{
-				emit SendNet(msg);
-			}
-			demo->append(msg);
-		}
-	}
-}
-
-void HWGame::FromNet(const QByteArray & msg)
-{
-	RawSendIPC(msg);
-}
-
-void HWGame::onClientRead()
-{
-	quint8 msglen;
-	quint32 bufsize;
-	while (((bufsize = readbuffer.size()) > 0) &&
-			((msglen = readbuffer.data()[0]) < bufsize))
-	{
-		QByteArray msg = readbuffer.left(msglen + 1);
-		readbuffer.remove(0, msglen + 1);
-		ParseMessage(msg);
-	}
-}
-
-QStringList HWGame::setArguments()
-{
-	QStringList arguments;
-	arguments << resolutions[0][config->vid_Resolution()];
-	arguments << resolutions[1][config->vid_Resolution()];
-	arguments << "16";
-	arguments << "46631";
-	arguments << (config->vid_Fullscreen() ? "1" : "0");
-	arguments << (config->isSoundEnabled() ? "1" : "0");
-	arguments << tr("en.txt");
-	arguments << "128";
-	return arguments;
-}
-
-void HWGame::AddTeam(const QString & teamname, unsigned char numHedgedogs)
-{
-	if (TeamCount == 5) return;
-	teams[TeamCount] = teamname;
-	TeamCount++;
-	hdNum[teamname]=numHedgedogs;
-}
-
-void HWGame::SaveDemo(const QString & filename)
-{
-	demo->replace(QByteArray("\x02TL"), QByteArray("\x02TD"));
-	demo->replace(QByteArray("\x02TN"), QByteArray("\x02TD"));
-
-	QFile demofile(filename);
-	if (!demofile.open(QIODevice::WriteOnly))
-	{
-		QMessageBox::critical(0,
-				tr("Error"),
-				tr("Cannot save demo to file %1").arg(filename),
-				tr("Quit"));
-		return ;
-	}
-	QDataStream stream(&demofile);
-	stream.writeRawData(demo->constData(), demo->size());
-	demofile.close();
-	delete demo;
-}
-
-void HWGame::PlayDemo(const QString & demofilename)
-{
-	gameType = gtDemo;
-	QFile demofile(demofilename);
-	if (!demofile.open(QIODevice::ReadOnly))
-	{
-		QMessageBox::critical(0,
-				tr("Error"),
-				tr("Cannot open demofile %1").arg(demofilename),
-				tr("Quit"));
-		return ;
-	}
-
-	// read demo
-	QDataStream stream(&demofile);
-	char buf[512];
-	int readbytes;
-	do
-	{
-		readbytes = stream.readRawData((char *)&buf, 512);
-		toSendBuf.append(QByteArray((char *)&buf, readbytes));
-		//SendIPC(QByteArray((char *)&buf, readbytes));
-
-	} while (readbytes > 0);
-	demofile.close();
-
-	// run engine
-	demo = new QByteArray;
-	Start();
-}
-
-void HWGame::StartNet()
-{
-	gameType = gtNet;
-	demo = new QByteArray;
-	Start();
-}
-
-void HWGame::StartLocal()
-{
-	gameType = gtLocal;
-	if (TeamCount < 2) return;
-	seed = gamecfg->getCurrentSeed();//QUuid::createUuid().toString();
-	demo = new QByteArray;
-	Start();
-}
-
-void HWGame::StartQuick()
-{
-	gameType = gtQLocal;
-	seed = gamecfg->getCurrentSeed();//QUuid::createUuid().toString();
-	demo = new QByteArray;
-	Start();
-}
-
-
-void HWGame::LocalCFG(const QString & teamname)
-{
-	HWTeam team(teamname);
-	if (!team.LoadFromFile()) {
-		QMessageBox::critical(0,
-				"Error",
-				QString("Cannot load team config ""%1""").arg(teamname),
-				QMessageBox::Ok,
-				QMessageBox::NoButton,
-				QMessageBox::NoButton);
-		return;
-	}
-	RawSendIPC(team.IPCTeamInfo());
-}
-
-void HWGame::LocalCFG(quint8 num)
-{
-	HWTeam team(num);
-	RawSendIPC(team.IPCTeamInfo());
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QMessageBox>
+#include <QProcess>
+#include <QTimer>
+#include <QString>
+#include <QByteArray>
+#include <QFile>
+#include <QTextStream>
+#include <QUuid>
+
+#include "game.h"
+#include "hwconsts.h"
+#include "gameuiconfig.h"
+#include "gamecfgwidget.h"
+
+HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg) :
+  TCPBase(true)
+{
+	this->config = config;
+	this->gamecfg = gamecfg;
+	TeamCount = 0;
+	seed = "";
+}
+
+void HWGame::onClientDisconnect()
+{
+	SaveDemo(cfgdir->absolutePath() + "/Demos/LastRound.hwd_1");
+}
+
+void HWGame::SendTeamConfig(int index)
+{
+	LocalCFG(teams[index]);
+}
+
+void HWGame::SendConfig()
+{
+	SendIPC(QString("eseed %1").arg(seed).toAscii());
+	SendIPC(QString("etheme %1").arg(config->GetRandomTheme()).toAscii());
+	SendIPC("TL");
+	SendIPC(QString("e$gmflags %1").arg(gamecfg->getGameFlags()).toAscii());
+
+	for (int i = 0; i < TeamCount; i++)
+	{
+		SendIPC("eaddteam");
+		LocalCFG(teams[i]);
+		SendIPC(QString("ecolor %1").arg(65535 << i * 8).toAscii());
+		for (int t = 0; t < hdNum[teams[i]]; t++)
+			SendIPC(QString("eadd hh%1 0").arg(t).toAscii());
+	}
+}
+
+void HWGame::SendQuickConfig()
+{
+	SendIPC(QString("eseed %1").arg(seed).toAscii());
+	SendIPC(QString("etheme %1").arg(config->GetRandomTheme()).toAscii());
+	SendIPC("TL");
+	SendIPC(QString("e$gmflags %1").arg(gamecfg->getGameFlags()).toAscii());
+	SendIPC("eaddteam");
+	LocalCFG(0);
+	SendIPC("ecolor 65535");
+	SendIPC("eadd hh0 0");
+	SendIPC("eadd hh1 0");
+	SendIPC("eadd hh2 0");
+	SendIPC("eadd hh3 0");
+	SendIPC("eaddteam");
+	LocalCFG(2);
+	SendIPC("ecolor 16776960");
+	SendIPC("eadd hh0 1");
+	SendIPC("eadd hh1 1");
+	SendIPC("eadd hh2 1");
+	SendIPC("eadd hh3 1");
+}
+
+void HWGame::ParseMessage(const QByteArray & msg)
+{
+	switch(msg.data()[1]) {
+		case '?': {
+			if (gameType == gtNet)
+				emit SendNet(QByteArray("\x01""?"));
+			else
+				SendIPC("!");
+			break;
+		}
+		case 'C': {
+			switch (gameType) {
+				case gtLocal: {
+				 	SendConfig();
+					break;
+				}
+				case gtQLocal: {
+				 	SendQuickConfig();
+					break;
+				}
+				case gtDemo: break;
+				case gtNet: {
+					SendIPC("TN");
+					emit SendNet(QByteArray("\x01""C"));
+					break;
+				}
+			}
+			break;
+		}
+		case 'E': {
+			QMessageBox::critical(0,
+					"Hedgewars: error message",
+					QString().append(msg.mid(2)).left(msg.size() - 6),
+					QMessageBox::Ok,
+					QMessageBox::NoButton,
+					QMessageBox::NoButton);
+			return;
+		}
+		case '+': {
+			if (gameType == gtNet)
+			{
+				emit SendNet(msg);
+			}
+			break;
+		}
+		default: {
+			if (gameType == gtNet)
+			{
+				emit SendNet(msg);
+			}
+			demo->append(msg);
+		}
+	}
+}
+
+void HWGame::FromNet(const QByteArray & msg)
+{
+	RawSendIPC(msg);
+}
+
+void HWGame::onClientRead()
+{
+	quint8 msglen;
+	quint32 bufsize;
+	while (((bufsize = readbuffer.size()) > 0) &&
+			((msglen = readbuffer.data()[0]) < bufsize))
+	{
+		QByteArray msg = readbuffer.left(msglen + 1);
+		readbuffer.remove(0, msglen + 1);
+		ParseMessage(msg);
+	}
+}
+
+QStringList HWGame::setArguments()
+{
+	QStringList arguments;
+	arguments << resolutions[0][config->vid_Resolution()];
+	arguments << resolutions[1][config->vid_Resolution()];
+	arguments << "16";
+	arguments << "46631";
+	arguments << (config->vid_Fullscreen() ? "1" : "0");
+	arguments << (config->isSoundEnabled() ? "1" : "0");
+	arguments << tr("en.txt");
+	arguments << "128";
+	return arguments;
+}
+
+void HWGame::AddTeam(const QString & teamname, unsigned char numHedgedogs)
+{
+	if (TeamCount == 5) return;
+	teams[TeamCount] = teamname;
+	TeamCount++;
+	hdNum[teamname]=numHedgedogs;
+}
+
+void HWGame::SaveDemo(const QString & filename)
+{
+	demo->replace(QByteArray("\x02TL"), QByteArray("\x02TD"));
+	demo->replace(QByteArray("\x02TN"), QByteArray("\x02TD"));
+
+	QFile demofile(filename);
+	if (!demofile.open(QIODevice::WriteOnly))
+	{
+		QMessageBox::critical(0,
+				tr("Error"),
+				tr("Cannot save demo to file %1").arg(filename),
+				tr("Quit"));
+		return ;
+	}
+	QDataStream stream(&demofile);
+	stream.writeRawData(demo->constData(), demo->size());
+	demofile.close();
+	delete demo;
+}
+
+void HWGame::PlayDemo(const QString & demofilename)
+{
+	gameType = gtDemo;
+	QFile demofile(demofilename);
+	if (!demofile.open(QIODevice::ReadOnly))
+	{
+		QMessageBox::critical(0,
+				tr("Error"),
+				tr("Cannot open demofile %1").arg(demofilename),
+				tr("Quit"));
+		return ;
+	}
+
+	// read demo
+	QDataStream stream(&demofile);
+	char buf[512];
+	int readbytes;
+	do
+	{
+		readbytes = stream.readRawData((char *)&buf, 512);
+		toSendBuf.append(QByteArray((char *)&buf, readbytes));
+		//SendIPC(QByteArray((char *)&buf, readbytes));
+
+	} while (readbytes > 0);
+	demofile.close();
+
+	// run engine
+	demo = new QByteArray;
+	Start();
+}
+
+void HWGame::StartNet()
+{
+	gameType = gtNet;
+	demo = new QByteArray;
+	Start();
+}
+
+void HWGame::StartLocal()
+{
+	gameType = gtLocal;
+	if (TeamCount < 2) return;
+	seed = gamecfg->getCurrentSeed();//QUuid::createUuid().toString();
+	demo = new QByteArray;
+	Start();
+}
+
+void HWGame::StartQuick()
+{
+	gameType = gtQLocal;
+	seed = gamecfg->getCurrentSeed();//QUuid::createUuid().toString();
+	demo = new QByteArray;
+	Start();
+}
+
+
+void HWGame::LocalCFG(const QString & teamname)
+{
+	HWTeam team(teamname);
+	if (!team.LoadFromFile()) {
+		QMessageBox::critical(0,
+				"Error",
+				QString("Cannot load team config ""%1""").arg(teamname),
+				QMessageBox::Ok,
+				QMessageBox::NoButton,
+				QMessageBox::NoButton);
+		return;
+	}
+	RawSendIPC(team.IPCTeamInfo());
+}
+
+void HWGame::LocalCFG(quint8 num)
+{
+	HWTeam team(num);
+	RawSendIPC(team.IPCTeamInfo());
+}
--- a/QTfrontend/game.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/game.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,81 +1,81 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef GAME_H
-#define GAME_H
-
-#include <QObject>
-#include <QByteArray>
-#include <QString>
-#include "team.h"
-
-#include <map>
-
-#include "tcpBase.h"
-
-class GameUIConfig;
-class GameCFGWidget;
-
-class HWGame : public TCPBase
-{
-	Q_OBJECT
-public:
-	HWGame(GameUIConfig * config, GameCFGWidget * gamecfg);
-	void AddTeam(const QString & team, unsigned char numHedgedogs);
-	void PlayDemo(const QString & demofilename);
-	void StartLocal();
-	void StartQuick();
-	void StartNet();
-
- protected:
-	virtual QStringList setArguments();
-	virtual void onClientRead();
-	virtual void onClientDisconnect();
-
-signals:
-	void SendNet(const QByteArray & msg);
-
-public slots:
-	void FromNet(const QByteArray & msg);
-	void LocalCFG(const QString & teamname);
-	void LocalCFG(quint8 num);
-
-private:
-    enum GameType {
-        gtLocal  = 1,
-        gtQLocal = 2,
-        gtDemo   = 3,
-        gtNet    = 4
-    };
-	char msgbuf[MAXMSGCHARS];
-	QString teams[5];
-	std::map<QString, unsigned char> hdNum;
-	QString seed;
-	int TeamCount;
-	GameUIConfig * config;
-	GameCFGWidget * gamecfg;
-	GameType gameType;
-
-	void SendConfig();
-	void SendQuickConfig();
-	void SendTeamConfig(int index);
-	void ParseMessage(const QByteArray & msg);
-	void SaveDemo(const QString & filename);
-};
-
-#endif
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef GAME_H
+#define GAME_H
+
+#include <QObject>
+#include <QByteArray>
+#include <QString>
+#include "team.h"
+
+#include <map>
+
+#include "tcpBase.h"
+
+class GameUIConfig;
+class GameCFGWidget;
+
+class HWGame : public TCPBase
+{
+	Q_OBJECT
+public:
+	HWGame(GameUIConfig * config, GameCFGWidget * gamecfg);
+	void AddTeam(const QString & team, unsigned char numHedgedogs);
+	void PlayDemo(const QString & demofilename);
+	void StartLocal();
+	void StartQuick();
+	void StartNet();
+
+ protected:
+	virtual QStringList setArguments();
+	virtual void onClientRead();
+	virtual void onClientDisconnect();
+
+signals:
+	void SendNet(const QByteArray & msg);
+
+public slots:
+	void FromNet(const QByteArray & msg);
+	void LocalCFG(const QString & teamname);
+	void LocalCFG(quint8 num);
+
+private:
+    enum GameType {
+        gtLocal  = 1,
+        gtQLocal = 2,
+        gtDemo   = 3,
+        gtNet    = 4
+    };
+	char msgbuf[MAXMSGCHARS];
+	QString teams[5];
+	std::map<QString, unsigned char> hdNum;
+	QString seed;
+	int TeamCount;
+	GameUIConfig * config;
+	GameCFGWidget * gamecfg;
+	GameType gameType;
+
+	void SendConfig();
+	void SendQuickConfig();
+	void SendTeamConfig(int index);
+	void ParseMessage(const QByteArray & msg);
+	void SaveDemo(const QString & filename);
+};
+
+#endif
--- a/QTfrontend/gamecfgwidget.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/gamecfgwidget.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,43 +1,43 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QResizeEvent>
-#include "gamecfgwidget.h"
-
-GameCFGWidget::GameCFGWidget(QWidget* parent) : 
-  QWidget(parent), mainLayout(this)
-{
-	CB_mode_Forts = new QCheckBox(this);
-	CB_mode_Forts->setText(QCheckBox::tr("Forts mode"));
-	mainLayout.addWidget(CB_mode_Forts);
-	pMapContainer=new HWMapContainer(this);
-	mainLayout.addWidget(pMapContainer, 80);
-}
-
-quint32 GameCFGWidget::getGameFlags()
-{
-	quint32 result = 0;
-	if (CB_mode_Forts->isChecked())
-		result |= 1;
-	return result;
-}
-
-QString GameCFGWidget::getCurrentSeed() const
-{
-  return pMapContainer->getCurrentSeed();
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QResizeEvent>
+#include "gamecfgwidget.h"
+
+GameCFGWidget::GameCFGWidget(QWidget* parent) : 
+  QWidget(parent), mainLayout(this)
+{
+	CB_mode_Forts = new QCheckBox(this);
+	CB_mode_Forts->setText(QCheckBox::tr("Forts mode"));
+	mainLayout.addWidget(CB_mode_Forts);
+	pMapContainer=new HWMapContainer(this);
+	mainLayout.addWidget(pMapContainer, 80);
+}
+
+quint32 GameCFGWidget::getGameFlags()
+{
+	quint32 result = 0;
+	if (CB_mode_Forts->isChecked())
+		result |= 1;
+	return result;
+}
+
+QString GameCFGWidget::getCurrentSeed() const
+{
+  return pMapContainer->getCurrentSeed();
+}
--- a/QTfrontend/gamecfgwidget.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/gamecfgwidget.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,45 +1,45 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef GAMECONFIGWIDGET_H
-#define GAMECONFIGWIDGET_H
-
-#include <QWidget>
-#include <QCheckBox>
-#include <QVBoxLayout>
-
-#include "mapContainer.h"
-
-class GameCFGWidget : public QWidget
-{
-	Q_OBJECT
-
-public:
-	GameCFGWidget(QWidget* parent=0);
-	quint32 getGameFlags();
-	QString getCurrentSeed() const;
-
-private slots:
-
-private:
-	QCheckBox * CB_mode_Forts;
-	QVBoxLayout mainLayout;
-	HWMapContainer* pMapContainer;
-};
-
-#endif // GAMECONFIGWIDGET_H
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef GAMECONFIGWIDGET_H
+#define GAMECONFIGWIDGET_H
+
+#include <QWidget>
+#include <QCheckBox>
+#include <QVBoxLayout>
+
+#include "mapContainer.h"
+
+class GameCFGWidget : public QWidget
+{
+	Q_OBJECT
+
+public:
+	GameCFGWidget(QWidget* parent=0);
+	quint32 getGameFlags();
+	QString getCurrentSeed() const;
+
+private slots:
+
+private:
+	QCheckBox * CB_mode_Forts;
+	QVBoxLayout mainLayout;
+	HWMapContainer* pMapContainer;
+};
+
+#endif // GAMECONFIGWIDGET_H
--- a/QTfrontend/gameuiconfig.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/gameuiconfig.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,131 +1,131 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QMessageBox>
-#include <QTextStream>
-#include "gameuiconfig.h"
-#include "hwform.h"
-#include "pages.h"
-#include "hwconsts.h"
-
-GameUIConfig::GameUIConfig(HWForm * FormWidgets)
-	: QObject()
-{
-	Form = FormWidgets;
-
-	QFile settings(cfgdir->absolutePath() + "/options");
-	if (settings.open(QIODevice::ReadOnly))
-	{
-		QTextStream stream(&settings);
-		stream.setCodec("UTF-8");
-		QString str;
-
-		while (!stream.atEnd())
-		{
-			str = stream.readLine();
-			if (str.startsWith(";")) continue;
-			if (str.startsWith("resolution "))
-			{
-				Form->ui.pageOptions->CBResolution->setCurrentIndex(str.mid(11).toLong());
-			} else
-			if (str.startsWith("fullscreen "))
-			{
-				Form->ui.pageOptions->CBFullscreen->setChecked(str.mid(11).toLong());
-			} else
-			if (str.startsWith("sound "))
-			{
-				Form->ui.pageOptions->CBEnableSound->setChecked(str.mid(6).toLong());
-			} else
-			if (str.startsWith("nick "))
-			{
-				Form->ui.pageNet->editNetNick->setText(str.mid(5));
-			} else
-			if (str.startsWith("ip "))
-			{
-				Form->ui.pageNet->editIP->setText(str.mid(3));
-			}
-		}
-		settings.close();
-	}
-
-	QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg");
-	if (themesfile.open(QIODevice::ReadOnly)) {
-		QTextStream stream(&themesfile);
-		QString str;
-		while (!stream.atEnd())
-		{
-			Themes << stream.readLine();
-		}
-		themesfile.close();
-	} else {
-		QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK");
-	}
-}
-
-QStringList GameUIConfig::GetTeamsList()
-{
-	QStringList teamslist = cfgdir->entryList(QStringList("*.cfg"));
-	QStringList cleanedList;
-	for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
-	  QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1");
-	  cleanedList.push_back(tmpTeamStr);
-	}
-	return cleanedList;
-}
-
-void GameUIConfig::SaveOptions()
-{
-	QFile settings(cfgdir->absolutePath() + "/options");
-	if (!settings.open(QIODevice::WriteOnly))
-	{
-		QMessageBox::critical(0,
-				tr("Error"),
-				tr("Cannot save options to file %1").arg(settings.fileName()),
-				tr("Quit"));
-		return ;
-	}
-	QTextStream stream(&settings);
-	stream.setCodec("UTF-8");
-	stream << "; Generated by Hedgewars, do not modify" << endl;
-	stream << "resolution " << Form->ui.pageOptions->CBResolution->currentIndex() << endl;
-	stream << "fullscreen " << Form->ui.pageOptions->CBFullscreen->isChecked() << endl;
-	stream << "sound " << Form->ui.pageOptions->CBEnableSound->isChecked() << endl;
-	stream << "nick " << Form->ui.pageNet->editNetNick->text() << endl;
-	stream << "ip " << Form->ui.pageNet->editIP->text() << endl;
-	settings.close();
-}
-
-int GameUIConfig::vid_Resolution()
-{
-	return Form->ui.pageOptions->CBResolution->currentIndex();
-}
-
-bool GameUIConfig::vid_Fullscreen()
-{
-	return Form->ui.pageOptions->CBFullscreen->isChecked();
-}
-
-bool GameUIConfig::isSoundEnabled()
-{
-	return Form->ui.pageOptions->CBEnableSound->isChecked();
-}
-
-QString GameUIConfig::GetRandomTheme()
-{
-	return (Themes.size() > 0) ? Themes[rand() % Themes.size()] : QString("steel");
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QMessageBox>
+#include <QTextStream>
+#include "gameuiconfig.h"
+#include "hwform.h"
+#include "pages.h"
+#include "hwconsts.h"
+
+GameUIConfig::GameUIConfig(HWForm * FormWidgets)
+	: QObject()
+{
+	Form = FormWidgets;
+
+	QFile settings(cfgdir->absolutePath() + "/options");
+	if (settings.open(QIODevice::ReadOnly))
+	{
+		QTextStream stream(&settings);
+		stream.setCodec("UTF-8");
+		QString str;
+
+		while (!stream.atEnd())
+		{
+			str = stream.readLine();
+			if (str.startsWith(";")) continue;
+			if (str.startsWith("resolution "))
+			{
+				Form->ui.pageOptions->CBResolution->setCurrentIndex(str.mid(11).toLong());
+			} else
+			if (str.startsWith("fullscreen "))
+			{
+				Form->ui.pageOptions->CBFullscreen->setChecked(str.mid(11).toLong());
+			} else
+			if (str.startsWith("sound "))
+			{
+				Form->ui.pageOptions->CBEnableSound->setChecked(str.mid(6).toLong());
+			} else
+			if (str.startsWith("nick "))
+			{
+				Form->ui.pageNet->editNetNick->setText(str.mid(5));
+			} else
+			if (str.startsWith("ip "))
+			{
+				Form->ui.pageNet->editIP->setText(str.mid(3));
+			}
+		}
+		settings.close();
+	}
+
+	QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg");
+	if (themesfile.open(QIODevice::ReadOnly)) {
+		QTextStream stream(&themesfile);
+		QString str;
+		while (!stream.atEnd())
+		{
+			Themes << stream.readLine();
+		}
+		themesfile.close();
+	} else {
+		QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK");
+	}
+}
+
+QStringList GameUIConfig::GetTeamsList()
+{
+	QStringList teamslist = cfgdir->entryList(QStringList("*.cfg"));
+	QStringList cleanedList;
+	for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
+	  QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1");
+	  cleanedList.push_back(tmpTeamStr);
+	}
+	return cleanedList;
+}
+
+void GameUIConfig::SaveOptions()
+{
+	QFile settings(cfgdir->absolutePath() + "/options");
+	if (!settings.open(QIODevice::WriteOnly))
+	{
+		QMessageBox::critical(0,
+				tr("Error"),
+				tr("Cannot save options to file %1").arg(settings.fileName()),
+				tr("Quit"));
+		return ;
+	}
+	QTextStream stream(&settings);
+	stream.setCodec("UTF-8");
+	stream << "; Generated by Hedgewars, do not modify" << endl;
+	stream << "resolution " << Form->ui.pageOptions->CBResolution->currentIndex() << endl;
+	stream << "fullscreen " << Form->ui.pageOptions->CBFullscreen->isChecked() << endl;
+	stream << "sound " << Form->ui.pageOptions->CBEnableSound->isChecked() << endl;
+	stream << "nick " << Form->ui.pageNet->editNetNick->text() << endl;
+	stream << "ip " << Form->ui.pageNet->editIP->text() << endl;
+	settings.close();
+}
+
+int GameUIConfig::vid_Resolution()
+{
+	return Form->ui.pageOptions->CBResolution->currentIndex();
+}
+
+bool GameUIConfig::vid_Fullscreen()
+{
+	return Form->ui.pageOptions->CBFullscreen->isChecked();
+}
+
+bool GameUIConfig::isSoundEnabled()
+{
+	return Form->ui.pageOptions->CBEnableSound->isChecked();
+}
+
+QString GameUIConfig::GetRandomTheme()
+{
+	return (Themes.size() > 0) ? Themes[rand() % Themes.size()] : QString("steel");
+}
--- a/QTfrontend/gameuiconfig.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/gameuiconfig.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,50 +1,50 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef GAMECONFIG_H
-#define GAMECONFIG_H
-
-#include <QObject>
-#include <QDir>
-#include <QStringList>
-
-class HWForm;
-
-class GameUIConfig : public QObject
-{
-	Q_OBJECT
-
-public:
-	GameUIConfig(HWForm * FormWidgets);
-	QStringList GetTeamsList();
-	int vid_Resolution();
-	bool vid_Fullscreen();
-	bool isSoundEnabled();
-	QString GetRandomTheme();
-
-private slots:
-
-public slots:
-	void SaveOptions();
-
-private:
-	HWForm * Form;
-	QStringList Themes;
-};
-
-#endif
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef GAMECONFIG_H
+#define GAMECONFIG_H
+
+#include <QObject>
+#include <QDir>
+#include <QStringList>
+
+class HWForm;
+
+class GameUIConfig : public QObject
+{
+	Q_OBJECT
+
+public:
+	GameUIConfig(HWForm * FormWidgets);
+	QStringList GetTeamsList();
+	int vid_Resolution();
+	bool vid_Fullscreen();
+	bool isSoundEnabled();
+	QString GetRandomTheme();
+
+private slots:
+
+public slots:
+	void SaveOptions();
+
+private:
+	HWForm * Form;
+	QStringList Themes;
+};
+
+#endif
--- a/QTfrontend/hedgehogerWidget.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/hedgehogerWidget.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,79 +1,79 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "hedgehogerWidget.h"
-
-#include <QMouseEvent>
-#include <QPainter>
-
-#include "frameTeam.h"
-
-CHedgehogerWidget::CHedgehogerWidget(QWidget * parent) :
-  QWidget(parent)
-{
-  if(parent) {
-    pOurFrameTeams=dynamic_cast<FrameTeams*>(parent->parentWidget());
-  }
-  if(pOurFrameTeams->overallHedgehogs+4>pOurFrameTeams->maxHedgehogsPerGame) {
-    numHedgehogs=pOurFrameTeams->maxHedgehogsPerGame-pOurFrameTeams->overallHedgehogs;
-  } else numHedgehogs=4;
-  pOurFrameTeams->overallHedgehogs+=numHedgehogs;
-}
-
-CHedgehogerWidget::~CHedgehogerWidget()
-{
-  pOurFrameTeams->overallHedgehogs-=numHedgehogs;
-}
-
-void CHedgehogerWidget::mousePressEvent ( QMouseEvent * event )
-{
-  if(event->button()==Qt::LeftButton) {
-    event->accept();
-    if(numHedgehogs < 8 && pOurFrameTeams->overallHedgehogs<18) {
-      numHedgehogs++;
-      pOurFrameTeams->overallHedgehogs++;
-    }
-  } else if (event->button()==Qt::RightButton) {
-    event->accept();
-    if(numHedgehogs > 3) {
-      numHedgehogs--;
-      pOurFrameTeams->overallHedgehogs--;
-    }
-  } else {
-    event->ignore();
-    return;
-  }
-  repaint();
-}
-
-void CHedgehogerWidget::paintEvent(QPaintEvent* event)
-{
-  QImage image(":/res/hh25x25.png");
-
-  QPainter painter(this);
-
-  for(int i=0; i<numHedgehogs; i++) {
-    QRect target(11 * i, i % 2, 25, 25);
-    painter.drawImage(target, image);
-  }
-}
-
-unsigned char CHedgehogerWidget::getHedgehogsNum()
-{
-  return numHedgehogs;
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "hedgehogerWidget.h"
+
+#include <QMouseEvent>
+#include <QPainter>
+
+#include "frameTeam.h"
+
+CHedgehogerWidget::CHedgehogerWidget(QWidget * parent) :
+  QWidget(parent)
+{
+  if(parent) {
+    pOurFrameTeams=dynamic_cast<FrameTeams*>(parent->parentWidget());
+  }
+  if(pOurFrameTeams->overallHedgehogs+4>pOurFrameTeams->maxHedgehogsPerGame) {
+    numHedgehogs=pOurFrameTeams->maxHedgehogsPerGame-pOurFrameTeams->overallHedgehogs;
+  } else numHedgehogs=4;
+  pOurFrameTeams->overallHedgehogs+=numHedgehogs;
+}
+
+CHedgehogerWidget::~CHedgehogerWidget()
+{
+  pOurFrameTeams->overallHedgehogs-=numHedgehogs;
+}
+
+void CHedgehogerWidget::mousePressEvent ( QMouseEvent * event )
+{
+  if(event->button()==Qt::LeftButton) {
+    event->accept();
+    if(numHedgehogs < 8 && pOurFrameTeams->overallHedgehogs<18) {
+      numHedgehogs++;
+      pOurFrameTeams->overallHedgehogs++;
+    }
+  } else if (event->button()==Qt::RightButton) {
+    event->accept();
+    if(numHedgehogs > 3) {
+      numHedgehogs--;
+      pOurFrameTeams->overallHedgehogs--;
+    }
+  } else {
+    event->ignore();
+    return;
+  }
+  repaint();
+}
+
+void CHedgehogerWidget::paintEvent(QPaintEvent* event)
+{
+  QImage image(":/res/hh25x25.png");
+
+  QPainter painter(this);
+
+  for(int i=0; i<numHedgehogs; i++) {
+    QRect target(11 * i, i % 2, 25, 25);
+    painter.drawImage(target, image);
+  }
+}
+
+unsigned char CHedgehogerWidget::getHedgehogsNum()
+{
+  return numHedgehogs;
+}
--- a/QTfrontend/hedgehogerWidget.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/hedgehogerWidget.h	Thu Oct 05 17:02:09 2006 +0000
@@ -2,33 +2,18 @@
  * Hedgewars, a worms-like game
  * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
  *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
  *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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
  */
 
 #ifndef _HEDGEHOGER_WIDGET
--- a/QTfrontend/hwconsts.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/hwconsts.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,29 +1,29 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QDir>
-
-const char resolutions[2][4][5] =
-{
-	{"640", "800", "1024", "1280"},
-	{"480", "600",  "768", "1024"}
-};
-
-extern QDir * cfgdir;
-extern QDir * datadir;
-extern QDir * bindir;
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QDir>
+
+const char resolutions[2][4][5] =
+{
+	{"640", "800", "1024", "1280"},
+	{"480", "600",  "768", "1024"}
+};
+
+extern QDir * cfgdir;
+extern QDir * datadir;
+extern QDir * bindir;
--- a/QTfrontend/hwform.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/hwform.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,251 +1,251 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QtGui>
-#include <QStringList>
-#include <QProcess>
-#include <QDir>
-#include <QPixmap>
-#include <QRegExp>
-#include <QIcon>
-#include <QFile>
-#include <QTextStream>
-
-#include "hwform.h"
-#include "game.h"
-#include "team.h"
-#include "netclient.h"
-#include "teamselect.h"
-#include "gameuiconfig.h"
-#include "pages.h"
-#include "hwconsts.h"
-
-HWForm::HWForm(QWidget *parent)
-	: QMainWindow(parent)
-{
-	ui.setupUi(this);
-
-	config = new GameUIConfig(this);
-
-	QStringList teamslist = config->GetTeamsList();
-
-	if(teamslist.empty()) {
-		HWTeam defaultTeam("DefaultTeam");
-		defaultTeam.SaveToFile();
-		teamslist.push_back("DefaultTeam");
-	}
-
-	for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it )
-	{
-	  ui.pageMultiplayer->teamsSelect->addTeam(*it);
-	  ui.pageOptions->CBTeamName->addItem(*it);
-	}
-
-	connect(ui.pageMain->BtnSinglePlayer,	SIGNAL(clicked()),	this, SLOT(GoToSinglePlayer()));
-	connect(ui.pageMain->BtnSetup,	SIGNAL(clicked()),	this, SLOT(GoToSetup()));
-	connect(ui.pageMain->BtnMultiplayer,	SIGNAL(clicked()),	this, SLOT(GoToMultiplayer()));
-	connect(ui.pageMain->BtnDemos,	SIGNAL(clicked()),	this, SLOT(GoToDemos()));
-	connect(ui.pageMain->BtnNet,	SIGNAL(clicked()),	this, SLOT(GoToNet()));
-	connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(close()));
-
-	connect(ui.pageLocalGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
-	connect(ui.pageLocalGame->BtnSimpleGame,	SIGNAL(clicked()),	this, SLOT(SimpleGame()));
-
-	connect(ui.pageEditTeam->BtnTeamSave,	SIGNAL(clicked()),	this, SLOT(TeamSave()));
-	connect(ui.pageEditTeam->BtnTeamDiscard,	SIGNAL(clicked()),	this, SLOT(TeamDiscard()));
-
-	connect(ui.pageMultiplayer->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
-	connect(ui.pageMultiplayer->BtnStartMPGame,	SIGNAL(clicked()),	this, SLOT(StartMPGame()));
-
-	connect(ui.pagePlayDemo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
-	connect(ui.pagePlayDemo->BtnPlayDemo,	SIGNAL(clicked()),	this, SLOT(PlayDemo()));
-
-	connect(ui.pageOptions->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
-	connect(ui.pageOptions->BtnNewTeam,	SIGNAL(clicked()),	this, SLOT(NewTeam()));
-	connect(ui.pageOptions->BtnEditTeam,	SIGNAL(clicked()),	this, SLOT(EditTeam()));
-	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	config, SLOT(SaveOptions()));
-
-	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
-	connect(ui.pageNet->BtnNetConnect,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
-
-	connect(ui.pageNetGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToNetChat()));
-	connect(ui.pageNetGame->BtnAddTeam,	SIGNAL(clicked()),	this, SLOT(NetAddTeam()));
-	connect(ui.pageNetGame->BtnGo,	SIGNAL(clicked()),	this, SLOT(NetStartGame()));
-
-	connect(ui.pageNetChat->BtnDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect()));
-	connect(ui.pageNetChat->BtnJoin,	SIGNAL(clicked()),	this, SLOT(NetJoin()));
-	connect(ui.pageNetChat->BtnCreate,	SIGNAL(clicked()),	this, SLOT(NetCreate()));
-
-	ui.Pages->setCurrentIndex(ID_PAGE_MAIN);
-}
-
-void HWForm::GoToMain()
-{
-	ui.Pages->setCurrentIndex(ID_PAGE_MAIN);
-}
-
-void HWForm::GoToSinglePlayer()
-{
-	ui.Pages->setCurrentIndex(ID_PAGE_SINGLEPLAYER);
-}
-
-void HWForm::GoToSetup()
-{
-	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
-}
-
-void HWForm::GoToMultiplayer()
-{
-	ui.pageMultiplayer->teamsSelect->resetPlayingTeams(config->GetTeamsList());
-	ui.Pages->setCurrentIndex(ID_PAGE_MULTIPLAYER);
-}
-
-void HWForm::GoToDemos()
-{
-	QDir tmpdir;
-	tmpdir.cd(cfgdir->absolutePath());
-	tmpdir.cd("Demos");
-	tmpdir.setFilter(QDir::Files);
-	ui.pagePlayDemo->DemosList->clear();
-	ui.pagePlayDemo->DemosList->addItems(tmpdir.entryList(QStringList("*.hwd_1")).replaceInStrings(QRegExp("^(.*).hwd_1"), "\\1"));
-	ui.Pages->setCurrentIndex(ID_PAGE_DEMOS);
-}
-
-void HWForm::GoToNet()
-{
-	ui.Pages->setCurrentIndex(ID_PAGE_NET);
-}
-
-void HWForm::GoToNetChat()
-{
-	ui.Pages->setCurrentIndex(ID_PAGE_NETCHAT);
-}
-
-void HWForm::NewTeam()
-{
-	tmpTeam = new HWTeam("unnamed");
-	tmpTeam->SetToPage(this);
-	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
-}
-
-void HWForm::EditTeam()
-{
-	tmpTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
-	tmpTeam->LoadFromFile();
-	tmpTeam->SetToPage(this);
-	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
-}
-
-void HWForm::TeamSave()
-{
-	tmpTeam->GetFromPage(this);
-	tmpTeam->SaveToFile();
-	delete tmpTeam;
-	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
-}
-
-void HWForm::TeamDiscard()
-{
-	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
-}
-
-void HWForm::SimpleGame()
-{
-	game = new HWGame(config, ui.pageLocalGame->gameCFG);
-	game->StartQuick();
-}
-
-void HWForm::PlayDemo()
-{
-	QListWidgetItem * curritem = ui.pagePlayDemo->DemosList->currentItem();
-	if (!curritem)
-	{
-		QMessageBox::critical(this,
-				tr("Error"),
-				tr("Please, select demo from the list above"),
-				tr("OK"));
-		return ;
-	}
-	game = new HWGame(config, 0);
-	game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_1");
-}
-
-void HWForm::NetConnect()
-{
-	hwnet = new HWNet(config);
-	connect(hwnet, SIGNAL(Connected()), this, SLOT(GoToNetChat()));
-	connect(hwnet, SIGNAL(AddGame(const QString &)), this, SLOT(AddGame(const QString &)));
-	connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
-	connect(hwnet, SIGNAL(ChangeInTeams(const QStringList &)), this, SLOT(ChangeInNetTeams(const QStringList &)));
-	hwnet->Connect(ui.pageNet->editIP->text(), 6667, ui.pageNet->editNetNick->text());
-	config->SaveOptions();
-}
-
-void HWForm::NetDisconnect()
-{
-	hwnet->Disconnect();
-	GoToNet();
-}
-
-void HWForm::AddGame(const QString & chan)
-{
-	ui.pageNetChat->ChannelsList->addItem(chan);
-}
-
-void HWForm::NetGameEnter()
-{
-	ui.Pages->setCurrentIndex(ID_PAGE_NETCFG);
-}
-
-void HWForm::NetJoin()
-{
-	hwnet->JoinGame("#hw");
-}
-
-void HWForm::NetCreate()
-{
-	hwnet->JoinGame("#hw");
-}
-
-void HWForm::NetAddTeam()
-{
-	HWTeam team("DefaultTeam");
-	team.LoadFromFile();
-	hwnet->AddTeam(team);
-}
-
-void HWForm::NetStartGame()
-{
-	hwnet->StartGame();
-}
-
-void HWForm::ChangeInNetTeams(const QStringList & teams)
-{
-	ui.pageNetGame->listNetTeams->clear();
-	ui.pageNetGame->listNetTeams->addItems(teams);
-}
-
-void HWForm::StartMPGame()
-{
-	game = new HWGame(config, ui.pageMultiplayer->gameCFG);
-	list<HWTeam> teamslist=ui.pageMultiplayer->teamsSelect->getPlayingTeams();
-	for (list<HWTeam>::const_iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
-	  game->AddTeam(it->TeamName, ui.pageMultiplayer->teamsSelect->numHedgedogs(it->TeamName));
-	}
-	game->StartLocal();
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QtGui>
+#include <QStringList>
+#include <QProcess>
+#include <QDir>
+#include <QPixmap>
+#include <QRegExp>
+#include <QIcon>
+#include <QFile>
+#include <QTextStream>
+
+#include "hwform.h"
+#include "game.h"
+#include "team.h"
+#include "netclient.h"
+#include "teamselect.h"
+#include "gameuiconfig.h"
+#include "pages.h"
+#include "hwconsts.h"
+
+HWForm::HWForm(QWidget *parent)
+	: QMainWindow(parent)
+{
+	ui.setupUi(this);
+
+	config = new GameUIConfig(this);
+
+	QStringList teamslist = config->GetTeamsList();
+
+	if(teamslist.empty()) {
+		HWTeam defaultTeam("DefaultTeam");
+		defaultTeam.SaveToFile();
+		teamslist.push_back("DefaultTeam");
+	}
+
+	for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it )
+	{
+	  ui.pageMultiplayer->teamsSelect->addTeam(*it);
+	  ui.pageOptions->CBTeamName->addItem(*it);
+	}
+
+	connect(ui.pageMain->BtnSinglePlayer,	SIGNAL(clicked()),	this, SLOT(GoToSinglePlayer()));
+	connect(ui.pageMain->BtnSetup,	SIGNAL(clicked()),	this, SLOT(GoToSetup()));
+	connect(ui.pageMain->BtnMultiplayer,	SIGNAL(clicked()),	this, SLOT(GoToMultiplayer()));
+	connect(ui.pageMain->BtnDemos,	SIGNAL(clicked()),	this, SLOT(GoToDemos()));
+	connect(ui.pageMain->BtnNet,	SIGNAL(clicked()),	this, SLOT(GoToNet()));
+	connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(close()));
+
+	connect(ui.pageLocalGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
+	connect(ui.pageLocalGame->BtnSimpleGame,	SIGNAL(clicked()),	this, SLOT(SimpleGame()));
+
+	connect(ui.pageEditTeam->BtnTeamSave,	SIGNAL(clicked()),	this, SLOT(TeamSave()));
+	connect(ui.pageEditTeam->BtnTeamDiscard,	SIGNAL(clicked()),	this, SLOT(TeamDiscard()));
+
+	connect(ui.pageMultiplayer->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
+	connect(ui.pageMultiplayer->BtnStartMPGame,	SIGNAL(clicked()),	this, SLOT(StartMPGame()));
+
+	connect(ui.pagePlayDemo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
+	connect(ui.pagePlayDemo->BtnPlayDemo,	SIGNAL(clicked()),	this, SLOT(PlayDemo()));
+
+	connect(ui.pageOptions->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
+	connect(ui.pageOptions->BtnNewTeam,	SIGNAL(clicked()),	this, SLOT(NewTeam()));
+	connect(ui.pageOptions->BtnEditTeam,	SIGNAL(clicked()),	this, SLOT(EditTeam()));
+	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	config, SLOT(SaveOptions()));
+
+	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
+	connect(ui.pageNet->BtnNetConnect,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
+
+	connect(ui.pageNetGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToNetChat()));
+	connect(ui.pageNetGame->BtnAddTeam,	SIGNAL(clicked()),	this, SLOT(NetAddTeam()));
+	connect(ui.pageNetGame->BtnGo,	SIGNAL(clicked()),	this, SLOT(NetStartGame()));
+
+	connect(ui.pageNetChat->BtnDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect()));
+	connect(ui.pageNetChat->BtnJoin,	SIGNAL(clicked()),	this, SLOT(NetJoin()));
+	connect(ui.pageNetChat->BtnCreate,	SIGNAL(clicked()),	this, SLOT(NetCreate()));
+
+	ui.Pages->setCurrentIndex(ID_PAGE_MAIN);
+}
+
+void HWForm::GoToMain()
+{
+	ui.Pages->setCurrentIndex(ID_PAGE_MAIN);
+}
+
+void HWForm::GoToSinglePlayer()
+{
+	ui.Pages->setCurrentIndex(ID_PAGE_SINGLEPLAYER);
+}
+
+void HWForm::GoToSetup()
+{
+	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
+}
+
+void HWForm::GoToMultiplayer()
+{
+	ui.pageMultiplayer->teamsSelect->resetPlayingTeams(config->GetTeamsList());
+	ui.Pages->setCurrentIndex(ID_PAGE_MULTIPLAYER);
+}
+
+void HWForm::GoToDemos()
+{
+	QDir tmpdir;
+	tmpdir.cd(cfgdir->absolutePath());
+	tmpdir.cd("Demos");
+	tmpdir.setFilter(QDir::Files);
+	ui.pagePlayDemo->DemosList->clear();
+	ui.pagePlayDemo->DemosList->addItems(tmpdir.entryList(QStringList("*.hwd_1")).replaceInStrings(QRegExp("^(.*).hwd_1"), "\\1"));
+	ui.Pages->setCurrentIndex(ID_PAGE_DEMOS);
+}
+
+void HWForm::GoToNet()
+{
+	ui.Pages->setCurrentIndex(ID_PAGE_NET);
+}
+
+void HWForm::GoToNetChat()
+{
+	ui.Pages->setCurrentIndex(ID_PAGE_NETCHAT);
+}
+
+void HWForm::NewTeam()
+{
+	tmpTeam = new HWTeam("unnamed");
+	tmpTeam->SetToPage(this);
+	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
+}
+
+void HWForm::EditTeam()
+{
+	tmpTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
+	tmpTeam->LoadFromFile();
+	tmpTeam->SetToPage(this);
+	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
+}
+
+void HWForm::TeamSave()
+{
+	tmpTeam->GetFromPage(this);
+	tmpTeam->SaveToFile();
+	delete tmpTeam;
+	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
+}
+
+void HWForm::TeamDiscard()
+{
+	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
+}
+
+void HWForm::SimpleGame()
+{
+	game = new HWGame(config, ui.pageLocalGame->gameCFG);
+	game->StartQuick();
+}
+
+void HWForm::PlayDemo()
+{
+	QListWidgetItem * curritem = ui.pagePlayDemo->DemosList->currentItem();
+	if (!curritem)
+	{
+		QMessageBox::critical(this,
+				tr("Error"),
+				tr("Please, select demo from the list above"),
+				tr("OK"));
+		return ;
+	}
+	game = new HWGame(config, 0);
+	game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_1");
+}
+
+void HWForm::NetConnect()
+{
+	hwnet = new HWNet(config);
+	connect(hwnet, SIGNAL(Connected()), this, SLOT(GoToNetChat()));
+	connect(hwnet, SIGNAL(AddGame(const QString &)), this, SLOT(AddGame(const QString &)));
+	connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
+	connect(hwnet, SIGNAL(ChangeInTeams(const QStringList &)), this, SLOT(ChangeInNetTeams(const QStringList &)));
+	hwnet->Connect(ui.pageNet->editIP->text(), 6667, ui.pageNet->editNetNick->text());
+	config->SaveOptions();
+}
+
+void HWForm::NetDisconnect()
+{
+	hwnet->Disconnect();
+	GoToNet();
+}
+
+void HWForm::AddGame(const QString & chan)
+{
+	ui.pageNetChat->ChannelsList->addItem(chan);
+}
+
+void HWForm::NetGameEnter()
+{
+	ui.Pages->setCurrentIndex(ID_PAGE_NETCFG);
+}
+
+void HWForm::NetJoin()
+{
+	hwnet->JoinGame("#hw");
+}
+
+void HWForm::NetCreate()
+{
+	hwnet->JoinGame("#hw");
+}
+
+void HWForm::NetAddTeam()
+{
+	HWTeam team("DefaultTeam");
+	team.LoadFromFile();
+	hwnet->AddTeam(team);
+}
+
+void HWForm::NetStartGame()
+{
+	hwnet->StartGame();
+}
+
+void HWForm::ChangeInNetTeams(const QStringList & teams)
+{
+	ui.pageNetGame->listNetTeams->clear();
+	ui.pageNetGame->listNetTeams->addItems(teams);
+}
+
+void HWForm::StartMPGame()
+{
+	game = new HWGame(config, ui.pageMultiplayer->gameCFG);
+	list<HWTeam> teamslist=ui.pageMultiplayer->teamsSelect->getPlayingTeams();
+	for (list<HWTeam>::const_iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
+	  game->AddTeam(it->TeamName, ui.pageMultiplayer->teamsSelect->numHedgedogs(it->TeamName));
+	}
+	game->StartLocal();
+}
--- a/QTfrontend/hwform.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/hwform.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,83 +1,83 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef HWFORM_H
-#define HWFORM_H
-
-#include <QLabel>
-#include <QLineEdit>
-#include <QDir>
-
-#include "ui_hwform.h"
-
-class HWGame;
-class HWTeam;
-class HWNet;
-class GameUIConfig;
-
-class HWForm : public QMainWindow
-{
-	Q_OBJECT
-
-public:
-	HWForm(QWidget *parent = 0);
-	Ui_HWForm ui;
-
-private slots:
-	void GoToMain();
-	void GoToSinglePlayer();
-	void GoToSetup();
-	void GoToMultiplayer();
-	void GoToDemos();
-	void GoToNet();
-	void GoToNetChat();
-	void NewTeam();
-	void EditTeam();
-	void TeamSave();
-	void TeamDiscard();
-	void SimpleGame();
-	void PlayDemo();
-	void NetConnect();
-	void NetDisconnect();
-	void NetJoin();
-	void NetCreate();
-	void AddGame(const QString & chan);
-	void NetAddTeam();
-	void NetGameEnter();
-	void NetStartGame();
-	void ChangeInNetTeams(const QStringList & teams);
-	void StartMPGame();
-
-private:
-	HWGame * game;
-	HWTeam * tmpTeam;
-	HWNet * hwnet;
-	GameUIConfig * config;
-};
-
-#define ID_PAGE_SINGLEPLAYER 0
-#define ID_PAGE_SETUP_TEAM 1
-#define ID_PAGE_SETUP 2
-#define ID_PAGE_MULTIPLAYER 3
-#define ID_PAGE_DEMOS 4
-#define ID_PAGE_NET 5
-#define ID_PAGE_NETCHAT 6
-#define ID_PAGE_NETCFG 7
-#define ID_PAGE_MAIN 8
-
-#endif
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef HWFORM_H
+#define HWFORM_H
+
+#include <QLabel>
+#include <QLineEdit>
+#include <QDir>
+
+#include "ui_hwform.h"
+
+class HWGame;
+class HWTeam;
+class HWNet;
+class GameUIConfig;
+
+class HWForm : public QMainWindow
+{
+	Q_OBJECT
+
+public:
+	HWForm(QWidget *parent = 0);
+	Ui_HWForm ui;
+
+private slots:
+	void GoToMain();
+	void GoToSinglePlayer();
+	void GoToSetup();
+	void GoToMultiplayer();
+	void GoToDemos();
+	void GoToNet();
+	void GoToNetChat();
+	void NewTeam();
+	void EditTeam();
+	void TeamSave();
+	void TeamDiscard();
+	void SimpleGame();
+	void PlayDemo();
+	void NetConnect();
+	void NetDisconnect();
+	void NetJoin();
+	void NetCreate();
+	void AddGame(const QString & chan);
+	void NetAddTeam();
+	void NetGameEnter();
+	void NetStartGame();
+	void ChangeInNetTeams(const QStringList & teams);
+	void StartMPGame();
+
+private:
+	HWGame * game;
+	HWTeam * tmpTeam;
+	HWNet * hwnet;
+	GameUIConfig * config;
+};
+
+#define ID_PAGE_SINGLEPLAYER 0
+#define ID_PAGE_SETUP_TEAM 1
+#define ID_PAGE_SETUP 2
+#define ID_PAGE_MULTIPLAYER 3
+#define ID_PAGE_DEMOS 4
+#define ID_PAGE_NET 5
+#define ID_PAGE_NETCHAT 6
+#define ID_PAGE_NETCFG 7
+#define ID_PAGE_MAIN 8
+
+#endif
--- a/QTfrontend/hwmap.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/hwmap.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -2,34 +2,18 @@
  * Hedgewars, a worms-like game
  * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
  *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
  *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+ * 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 */
 
 #include "hwmap.h"
 
--- a/QTfrontend/hwmap.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/hwmap.h	Thu Oct 05 17:02:09 2006 +0000
@@ -2,33 +2,18 @@
  * Hedgewars, a worms-like game
  * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
  *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
  *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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
  */
 
 #ifndef _HWMAP_INCLUDED
--- a/QTfrontend/main.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/main.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,80 +1,80 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QApplication>
-#include <QTranslator>
-#include <QLocale>
-#include <QMessageBox>
-#include <QFileInfo>
-#include <QDateTime>
-#include "hwform.h"
-#include "hwconsts.h"
-
-QDir * bindir;
-QDir * cfgdir;
-QDir * datadir;
-
-bool checkForDir(const QString & dir)
-{
-	QDir tmpdir;
-	if (!tmpdir.exists(dir))
-		if (!tmpdir.mkdir(dir))
-		{
-			QMessageBox::critical(0,
-					QObject::tr("Error"),
-					QObject::tr("Cannot create directory %1").arg(dir),
-					QObject::tr("OK"));
-			return false;
-		}
-	return true;
-}
-
-int main(int argc, char *argv[])
-{
-	QApplication app(argc, argv);
-
-	QDateTime now = QDateTime::currentDateTime();
-	QDateTime zero;
-	srand(now.secsTo(zero));
-
-	Q_INIT_RESOURCE(hedgewars);
-
-	QTranslator Translator;
-	Translator.load(":/translations/hedgewars_" + QLocale::system().name());
-	app.installTranslator(&Translator);
-
-	QDir mydir(".");
-	mydir.cd("bin");
-
-	bindir = new QDir(mydir);
-	cfgdir = new QDir();
-
-	cfgdir->setPath(cfgdir->homePath());
-	if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
-	{
-		checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos");
-	}
-	cfgdir->cd(".hedgewars");
-
-	datadir = new QDir(mydir);
-	datadir->cd("../share/hedgewars/Data");
-
-	HWForm *Form = new HWForm();
-	Form->show();
-	return app.exec();
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QApplication>
+#include <QTranslator>
+#include <QLocale>
+#include <QMessageBox>
+#include <QFileInfo>
+#include <QDateTime>
+#include "hwform.h"
+#include "hwconsts.h"
+
+QDir * bindir;
+QDir * cfgdir;
+QDir * datadir;
+
+bool checkForDir(const QString & dir)
+{
+	QDir tmpdir;
+	if (!tmpdir.exists(dir))
+		if (!tmpdir.mkdir(dir))
+		{
+			QMessageBox::critical(0,
+					QObject::tr("Error"),
+					QObject::tr("Cannot create directory %1").arg(dir),
+					QObject::tr("OK"));
+			return false;
+		}
+	return true;
+}
+
+int main(int argc, char *argv[])
+{
+	QApplication app(argc, argv);
+
+	QDateTime now = QDateTime::currentDateTime();
+	QDateTime zero;
+	srand(now.secsTo(zero));
+
+	Q_INIT_RESOURCE(hedgewars);
+
+	QTranslator Translator;
+	Translator.load(":/translations/hedgewars_" + QLocale::system().name());
+	app.installTranslator(&Translator);
+
+	QDir mydir(".");
+	mydir.cd("bin");
+
+	bindir = new QDir(mydir);
+	cfgdir = new QDir();
+
+	cfgdir->setPath(cfgdir->homePath());
+	if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
+	{
+		checkForDir(cfgdir->absolutePath() + "/.hedgewars/Demos");
+	}
+	cfgdir->cd(".hedgewars");
+
+	datadir = new QDir(mydir);
+	datadir->cd("../share/hedgewars/Data");
+
+	HWForm *Form = new HWForm();
+	Form->show();
+	return app.exec();
+}
--- a/QTfrontend/mapContainer.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/mapContainer.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,78 +1,78 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "mapContainer.h"
-
-#include <QPushButton>
-#include <QBuffer>
-#include <QUuid>
-#include <QBitmap>
-#include <QPainter>
-#include <QLinearGradient>
-#include <QColor>
-
-HWMapContainer::HWMapContainer(QWidget * parent) :
-  QWidget(parent), mainLayout(this)
-{
-  imageButt=new QPushButton(this);
-  imageButt->setMaximumSize(256, 128);
-  imageButt->setFlat(true);
-  imageButt->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-  mainLayout.addWidget(imageButt);
-  connect(imageButt, SIGNAL(clicked()), this, SLOT(changeImage()));
-  changeImage();
-}
-
-void HWMapContainer::setImage(const QImage newImage)
-{
-  QPixmap px(256, 128);
-  QPixmap pxres(256, 128);
-  QPainter p(&pxres);
-
-  px.fill(Qt::yellow);
-  QBitmap bm = QBitmap::fromImage(newImage);
-  px.setMask(bm);
-
-  QLinearGradient linearGrad(QPoint(128, 0), QPoint(128, 128));
-  linearGrad.setColorAt(0, QColor(0, 0, 192));
-  linearGrad.setColorAt(1, QColor(0, 0, 64));
-  p.fillRect(QRect(0, 0, 256, 128), linearGrad);
-  p.drawPixmap(QPoint(0, 0), px);
-
-
-  imageButt->setIcon(pxres);
-  imageButt->setIconSize(QSize(256, 128));
-}
-
-void HWMapContainer::changeImage()
-{
-  pMap=new HWMap();
-  connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
-  m_seed = QUuid::createUuid().toString();
-  pMap->getImage(m_seed.toStdString());
-}
-
-QString HWMapContainer::getCurrentSeed() const
-{
-  return m_seed;
-}
-
-void HWMapContainer::resizeEvent ( QResizeEvent * event )
-{
-  //imageButt->setIconSize(imageButt->size());
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "mapContainer.h"
+
+#include <QPushButton>
+#include <QBuffer>
+#include <QUuid>
+#include <QBitmap>
+#include <QPainter>
+#include <QLinearGradient>
+#include <QColor>
+
+HWMapContainer::HWMapContainer(QWidget * parent) :
+  QWidget(parent), mainLayout(this)
+{
+  imageButt=new QPushButton(this);
+  imageButt->setMaximumSize(256, 128);
+  imageButt->setFlat(true);
+  imageButt->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+  mainLayout.addWidget(imageButt);
+  connect(imageButt, SIGNAL(clicked()), this, SLOT(changeImage()));
+  changeImage();
+}
+
+void HWMapContainer::setImage(const QImage newImage)
+{
+  QPixmap px(256, 128);
+  QPixmap pxres(256, 128);
+  QPainter p(&pxres);
+
+  px.fill(Qt::yellow);
+  QBitmap bm = QBitmap::fromImage(newImage);
+  px.setMask(bm);
+
+  QLinearGradient linearGrad(QPoint(128, 0), QPoint(128, 128));
+  linearGrad.setColorAt(0, QColor(0, 0, 192));
+  linearGrad.setColorAt(1, QColor(0, 0, 64));
+  p.fillRect(QRect(0, 0, 256, 128), linearGrad);
+  p.drawPixmap(QPoint(0, 0), px);
+
+
+  imageButt->setIcon(pxres);
+  imageButt->setIconSize(QSize(256, 128));
+}
+
+void HWMapContainer::changeImage()
+{
+  pMap=new HWMap();
+  connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
+  m_seed = QUuid::createUuid().toString();
+  pMap->getImage(m_seed.toStdString());
+}
+
+QString HWMapContainer::getCurrentSeed() const
+{
+  return m_seed;
+}
+
+void HWMapContainer::resizeEvent ( QResizeEvent * event )
+{
+  //imageButt->setIconSize(imageButt->size());
+}
--- a/QTfrontend/mapContainer.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/mapContainer.h	Thu Oct 05 17:02:09 2006 +0000
@@ -2,33 +2,18 @@
  * Hedgewars, a worms-like game
  * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
  *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
  *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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
  */
 
 #ifndef _HWMAP_CONTAINER_INCLUDED
--- a/QTfrontend/netclient.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/netclient.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,497 +1,497 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QMessageBox>
-#include <QUuid>
-#include "netclient.h"
-#include "game.h"
-#include "gameuiconfig.h"
-
-HWNet::HWNet(GameUIConfig * config)
-	: QObject()
-{
-	this->config = config;
-	state = nsDisconnected;
-	IRCmsg_cmd_text = new QRegExp("^[A-Z]+ :.+$");
-	IRCmsg_number_param = new QRegExp("^:\\S+ [0-9]{3} .+$");
-	IRCmsg_who_cmd_target = new QRegExp("^:\\S+ [A-Z]+ \\S+$"); // last \\S should mean 'the 1st char is not ":"'
-	IRCmsg_who_cmd_text = new QRegExp("^:\\S+ [A-Z]+ :.+$");
-	IRCmsg_who_cmd_target_text = new QRegExp("^:\\S+ [A-Z]+ \\S+ :.+$");
-	isOp = false;
-	teamsCount = 0;
-
-	connect(&NetSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
-	connect(&NetSocket, SIGNAL(connected()), this, SLOT(OnConnect()));
-	connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect()));
-	connect(&NetSocket, SIGNAL(error(QAbstractSocket::SocketError)), this,
-			SLOT(displayError(QAbstractSocket::SocketError)));
-}
-
-void HWNet::ClientRead()
-{
-	while (NetSocket.canReadLine())
-	{
-		ParseLine(NetSocket.readLine().trimmed());
-	}
-}
-
-void HWNet::displayError(QAbstractSocket::SocketError socketError)
-{
-	switch (socketError)
-	{
-		case QAbstractSocket::RemoteHostClosedError:
-			break;
-		case QAbstractSocket::HostNotFoundError:
-			QMessageBox::information(0, tr("Error"),
-					tr("The host was not found. Please check the host name and port settings."));
-			break;
-		case QAbstractSocket::ConnectionRefusedError:
-			QMessageBox::information(0, tr("Error"),
-					tr("Connection refused"));
-			break;
-		default:
-			QMessageBox::information(0, tr("Error"),
-					NetSocket.errorString());
-    }
-}
-
-void HWNet::Connect(const QString & hostName, quint16 port, const QString & nick)
-{
-	state = nsConnecting;
-	NetSocket.connectToHost(hostName, port);
-	mynick = nick;
-	opnick = "";
-	opCount = 0;
-}
-
-
-void HWNet::OnConnect()
-{
-	state = nsConnected;
-	RawSendNet(QString("USER hwgame 1 2 Hedgewars game"));
-	RawSendNet(QString("NICK %1").arg(mynick));
-}
-
-void HWNet::OnDisconnect()
-{
-	state = nsDisconnected;
-}
-
-void HWNet::Perform()
-{
-
-}
-
-void HWNet::JoinGame(const QString & game)
-{
-	state = nsJoining;
-	RawSendNet(QString("JOIN %1").arg(game));
-}
-
-void HWNet::Disconnect()
-{
-	switch (state)
-	{
-		case nsDisconnected:
-		{
-			break;
-		}
-		case nsConnecting:
-		case nsQuitting:
-		{
-			NetSocket.disconnect();
-			break;
-		}
-		default:
-		{
-			state = nsQuitting;
-			RawSendNet(QString("QUIT :oops"));
-		}
-	}
-}
-
-void HWNet::RawSendNet(const QString & str)
-{
-	RawSendNet(str.toUtf8());
-}
-
-void HWNet::RawSendNet(const QByteArray & buf)
-{
-	if (buf.size() > 510) return;
-	NetSocket.write(buf);
-	NetSocket.write("\x0d\x0a", 2);
-}
-
-void HWNet::SendNet(const QByteArray & buf)
-{
-	if ((state == nsGaming) || (state == nsStarting))
-	{
-		QString msg = QString(buf.toBase64());
-		if ((msg == "AUM=") && (mynick == opnick))
-		{
-			ConfigAsked();
-		} else
-		if (msg == "AT8=")
-		{
-			// its ping ("?")
-		} else
-		{
-			if (state == nsGaming)
-			{
-				NetBuffer += buf;
-			} else
-			{
-				RawSendNet(QString("PRIVMSG %1 :"MAGIC_CHAR MAGIC_CHAR"%2").arg(channel, msg));
-			}
-		}
-	}
-}
-
-void HWNet::FlushNetBuf()
-{
-	if (NetBuffer.size() > 0)
-	{
-		RawSendNet(QString("PRIVMSG %1 :"MAGIC_CHAR MAGIC_CHAR"%2").arg(channel, QString(NetBuffer.toBase64())));
-		NetBuffer.clear();
-	}
-}
-
-void HWNet::ParseLine(const QByteArray & line)
-{
-	QString msg = QString::fromUtf8 (line.data(), line.size());
-	//QMessageBox::information(0, "", msg);
-	if (IRCmsg_cmd_text->exactMatch(msg))
-	{
-		msgcmd_textHandler(msg);
-	} else
-	if (IRCmsg_number_param->exactMatch(msg))
-	{
-		msgnumber_paramHandler(msg);
-	} else
-	if (IRCmsg_who_cmd_text->exactMatch(msg))
-	{
-		msgwho_cmd_textHandler(msg);
-	} else
-	if (IRCmsg_who_cmd_target->exactMatch(msg))
-	{
-		msgwho_cmd_targetHandler(msg);
-	} else
-	if (IRCmsg_who_cmd_target_text->exactMatch(msg))
-	{
-		msgwho_cmd_target_textHandler(msg);
-	}
-}
-
-void HWNet::msgcmd_textHandler(const QString & msg)
-{
-	QStringList list = msg.split(" :");
-	if (list[0] == "PING")
-	{
-		RawSendNet(QString("PONG %1").arg(list[1]));
-	}
-}
-
-void HWNet::msgnumber_paramHandler(const QString & msg)
-{
-	int pos = msg.indexOf(" :");
-	QString text = msg.mid(pos + 2);
-	QStringList list = msg.mid(0, pos).split(" ");
-	bool ok;
-	quint16 number = list[1].toInt(&ok);
-	if (!ok)
-		return ;
-	switch (number)
-	{
-		case 001 :
-		{
-			Perform();
-			emit Connected();
-			break;
-		}
-		case 322 : // RPL_LIST
-		{
-			emit AddGame(list[3]);
-			break;
-		}
-		case 353 : // RPL_NAMREPLY
-		{
-			QStringList ops = text.split(" ").filter(QRegExp("^@\\S+$"));
-			opCount += ops.size();
-			if (ops.size() == 1)
-			{
-				opnick = ops[0].mid(1);
-			}
-			break;
-		}
-		case 366 : // RPL_ENDOFNAMES
-		{
-			if (opCount != 1)
-			{
-				opnick = "";
-			}
-			opCount = 0;
-			break;
-		}
-		case 432 : // ERR_ERRONEUSNICKNAME
-		case 433 : // ERR_NICKNAMEINUSE
-		{
-			QMessageBox::information(0, "Your net nickname is in use or cannot be used", msg);
-			// ask for another nick
-		}
-	}
-}
-
-void HWNet::msgwho_cmd_targetHandler(const QString & msg)
-{
-	QStringList list = msg.split(" ");
-	QString who = list[0].mid(1).split("!")[0];
-	if (list[1] == "NICK")
-	{
-		if (mynick == who)
-			mynick = list[2];
-		if (opnick == who)
-			opnick = list[2];
-	}
-}
-
-void HWNet::msgwho_cmd_textHandler(const QString & msg)
-{
-	int pos = msg.indexOf(" :");
-	QString text = msg.mid(pos + 2);
-	QStringList list = msg.mid(0, pos).split(" ");
-	QString who = list[0].mid(1).split("!")[0];
-	if (list[1] == "JOIN")
-	{
-		if (who == mynick)
-		{
-			channel = text;
-			state = nsJoined;
-			emit EnteredGame();
-			RawSendNet(QString("PRIVMSG %1 :Hello!").arg(channel));
-		}
-	}
-}
-void HWNet::msgwho_cmd_target_textHandler(const QString & msg)
-{
-	int pos = msg.indexOf(" :");
-	QString text = msg.mid(pos + 2);
-	QStringList list = msg.mid(0, pos).split(" ");
-	QString who = list[0].mid(1).split("!")[0];
-	if (list[1] == "PRIVMSG")
-	{
-		if (list[2] == opnick)
-		{
-			hwp_opmsg(who, text);
-		} else
-		if (list[2] == channel)
-		{
-			hwp_chanmsg(who, text);
-		}
-	}
-}
-
-void HWNet::hwp_opmsg(const QString & who, const QString & msg)
-{
-	if (state != nsJoined)
-		return ;
-	if (!msg.startsWith(MAGIC_CHAR))
-		return ;
-	QStringList list = msg.split(MAGIC_CHAR, QString::SkipEmptyParts);
-	if (list[0] == "A")
-	{
-		list.removeFirst();
-		if (list.size() != 9)
-			return ;
-		if (teamsCount < 5)
-		{
-			teams[teamsCount].nick = who;
-			teams[teamsCount].hhs = list;
-			teamsCount++;
-			QString teamnames;
-			for(int i = 0; i < teamsCount; i++)
-			{
-				teamnames += MAGIC_CHAR;
-				teamnames += teams[i].hhs[0];
-			}
-			QString tmsg = QString(MAGIC_CHAR"=%2").arg(teamnames);
-			RawSendNet(QString("PRIVMSG %1 :").arg(channel) + tmsg);
-			hwp_chanmsg(mynick, tmsg);
-		}
-	}
-}
-
-void HWNet::ConfigAsked()
-{
-	configasks++;
-	if (configasks == playerscnt)
-	{
-		quint32 color = 65535;
-			#define ADD(a) { \
-							QByteArray strmsg; \
-							strmsg.append(a); \
-							quint8 sz = strmsg.size(); \
-							cache.append(QByteArray((char *)&sz, 1)); \
-							cache.append(strmsg); \
-							}
-		{
-			QByteArray cache;
-			ADD("eseed " + seed);
-			ADD("e$gmflags 0");
-			ADD(QString("etheme %1").arg(config->GetRandomTheme()));
-			QString _msg = MAGIC_CHAR MAGIC_CHAR + QString(cache.toBase64());
-			RawSendNet(QString("PRIVMSG %1 :%2").arg(channel, _msg));
-			hwp_chanmsg(mynick, _msg);
-		}
-		for (int i = 0; i < teamsCount; i++)
-		{
-			QString msg;
-			msg = MAGIC_CHAR "T" MAGIC_CHAR + teams[i].nick + MAGIC_CHAR + teams[i].hhs.join(MAGIC_CHAR);
-			RawSendNet(QString("PRIVMSG %1 :%2").arg(channel, msg));
-			hwp_chanmsg(mynick, msg);
-			QByteArray cache;
-			ADD(QString("ecolor %1").arg(color));
-			ADD("eadd hh0 0");
-			ADD("eadd hh1 0");
-			ADD("eadd hh2 0");
-			ADD("eadd hh3 0");
-			ADD("eadd hh4 0");
-			#undef ADD
-			QString _msg = MAGIC_CHAR MAGIC_CHAR + QString(cache.toBase64());
-			RawSendNet(QString("PRIVMSG %1 :%2").arg(channel, _msg));
-			hwp_chanmsg(mynick, _msg);
-			color <<= 8;
-		}
-		SENDCFGSTRNET("!");
-	}
-}
-
-void HWNet::hwp_chanmsg(const QString & who, const QString & msg)
-{
-	if ((state < nsJoined) || (state > nsGaming))
-	{
-		return ;
-	}
-	if (state == nsJoined)
-	{
-		if (msg.startsWith(MAGIC_CHAR"Start!") && (who == opnick))
-		{
-			state = nsStarting;
-			RunGame();
-			return ;
-		}
-		if (msg.startsWith(MAGIC_CHAR"="MAGIC_CHAR) && (who == opnick))
-		{
-			emit ChangeInTeams(msg.mid(3).split(MAGIC_CHAR));
-		}
-	}
-	if (state == nsStarting)
-	{
-		if (msg == MAGIC_CHAR MAGIC_CHAR "AUM=")
-		{
-			if (mynick == opnick) ConfigAsked();
-			return ;
-		}
-		if (msg == MAGIC_CHAR MAGIC_CHAR "ASE=")
-		{
-			state = nsGaming;
-			TimerFlusher = new QTimer();
-			connect(TimerFlusher, SIGNAL(timeout()), this, SLOT(FlushNetBuf()));
-			TimerFlusher->start(2000);
-		}
-		if (msg.startsWith(MAGIC_CHAR"T"MAGIC_CHAR))
-		{
-			NetTeamAdded(msg.mid(3));
-		}
-	}
-	if ((state < nsStarting) || (state > nsGaming))
-	{
-		return;
-	}
-	if (msg.startsWith(MAGIC_CHAR MAGIC_CHAR)) // HWP message
-	{
-		QByteArray em = QByteArray::fromBase64(msg.mid(2).toAscii());
-		emit FromNet(em);
-	} else // smth other
-	{
-
-	}
-}
-
-void HWNet::NetTeamAdded(const QString & msg)
-{
-	QStringList list = msg.split(MAGIC_CHAR, QString::SkipEmptyParts);
-	if (list.size() != 10)
-		return ;
-	SENDCFGSTRLOC("eaddteam");
-	if (list[0] == mynick)
-	{
-		emit LocalCFG(list[1]);
-	} else
-	{
-		SENDCFGSTRLOC("erdriven");
-		SENDCFGSTRLOC(QString("ename team %1").arg(list[1]));
-		for (int i = 0; i < 8; i++)
-		{
-			SENDCFGSTRLOC(QString("ename hh%1 ").arg(i) + list[i + 2]);
-		}
-	}
-}
-
-void HWNet::AddTeam(const HWTeam & team)
-{
-	if (state != nsJoined)
-	{
-		return ;
-	}
-	RawSendNet(QString("PRIVMSG %1 :").arg(opnick) + MAGIC_CHAR "A" MAGIC_CHAR +
-			team.TeamName + MAGIC_CHAR + team.HHName[0] + MAGIC_CHAR + team.HHName[1] + MAGIC_CHAR +
-			team.HHName[2] + MAGIC_CHAR + team.HHName[3] + MAGIC_CHAR + team.HHName[4] + MAGIC_CHAR +
-			team.HHName[5] + MAGIC_CHAR + team.HHName[6] + MAGIC_CHAR + team.HHName[7]);
-}
-
-void HWNet::StartGame()
-{
-	if ((opnick != mynick) || (state != nsJoined))
-	{
-		return ;
-	}
-	QStringList players;
-	for (int i = 0; i < teamsCount; i++)
-	{
-		if (!players.contains(teams[i].nick))
-		{
-			players.append(teams[i].nick);
-		}
-	}
-	playerscnt = players.size();
-	configasks = 0;
-
-	seed = QUuid::createUuid().toString();
-	QString msg = QString(MAGIC_CHAR"Start!");
-	RawSendNet(QString("PRIVMSG %1 :%2").arg(channel, msg));
-	hwp_chanmsg(mynick, msg);
-}
-
-void HWNet::RunGame()
-{
-	HWGame * game = new HWGame(config, 0);
-	connect(game, SIGNAL(SendNet(const QByteArray &)), this, SLOT(SendNet(const QByteArray &)));
-	connect(this, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)));
-	connect(this, SIGNAL(LocalCFG(const QString &)), game, SLOT(LocalCFG(const QString &)));
-	game->StartNet();
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QMessageBox>
+#include <QUuid>
+#include "netclient.h"
+#include "game.h"
+#include "gameuiconfig.h"
+
+HWNet::HWNet(GameUIConfig * config)
+	: QObject()
+{
+	this->config = config;
+	state = nsDisconnected;
+	IRCmsg_cmd_text = new QRegExp("^[A-Z]+ :.+$");
+	IRCmsg_number_param = new QRegExp("^:\\S+ [0-9]{3} .+$");
+	IRCmsg_who_cmd_target = new QRegExp("^:\\S+ [A-Z]+ \\S+$"); // last \\S should mean 'the 1st char is not ":"'
+	IRCmsg_who_cmd_text = new QRegExp("^:\\S+ [A-Z]+ :.+$");
+	IRCmsg_who_cmd_target_text = new QRegExp("^:\\S+ [A-Z]+ \\S+ :.+$");
+	isOp = false;
+	teamsCount = 0;
+
+	connect(&NetSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
+	connect(&NetSocket, SIGNAL(connected()), this, SLOT(OnConnect()));
+	connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect()));
+	connect(&NetSocket, SIGNAL(error(QAbstractSocket::SocketError)), this,
+			SLOT(displayError(QAbstractSocket::SocketError)));
+}
+
+void HWNet::ClientRead()
+{
+	while (NetSocket.canReadLine())
+	{
+		ParseLine(NetSocket.readLine().trimmed());
+	}
+}
+
+void HWNet::displayError(QAbstractSocket::SocketError socketError)
+{
+	switch (socketError)
+	{
+		case QAbstractSocket::RemoteHostClosedError:
+			break;
+		case QAbstractSocket::HostNotFoundError:
+			QMessageBox::information(0, tr("Error"),
+					tr("The host was not found. Please check the host name and port settings."));
+			break;
+		case QAbstractSocket::ConnectionRefusedError:
+			QMessageBox::information(0, tr("Error"),
+					tr("Connection refused"));
+			break;
+		default:
+			QMessageBox::information(0, tr("Error"),
+					NetSocket.errorString());
+    }
+}
+
+void HWNet::Connect(const QString & hostName, quint16 port, const QString & nick)
+{
+	state = nsConnecting;
+	NetSocket.connectToHost(hostName, port);
+	mynick = nick;
+	opnick = "";
+	opCount = 0;
+}
+
+
+void HWNet::OnConnect()
+{
+	state = nsConnected;
+	RawSendNet(QString("USER hwgame 1 2 Hedgewars game"));
+	RawSendNet(QString("NICK %1").arg(mynick));
+}
+
+void HWNet::OnDisconnect()
+{
+	state = nsDisconnected;
+}
+
+void HWNet::Perform()
+{
+
+}
+
+void HWNet::JoinGame(const QString & game)
+{
+	state = nsJoining;
+	RawSendNet(QString("JOIN %1").arg(game));
+}
+
+void HWNet::Disconnect()
+{
+	switch (state)
+	{
+		case nsDisconnected:
+		{
+			break;
+		}
+		case nsConnecting:
+		case nsQuitting:
+		{
+			NetSocket.disconnect();
+			break;
+		}
+		default:
+		{
+			state = nsQuitting;
+			RawSendNet(QString("QUIT :oops"));
+		}
+	}
+}
+
+void HWNet::RawSendNet(const QString & str)
+{
+	RawSendNet(str.toUtf8());
+}
+
+void HWNet::RawSendNet(const QByteArray & buf)
+{
+	if (buf.size() > 510) return;
+	NetSocket.write(buf);
+	NetSocket.write("\x0d\x0a", 2);
+}
+
+void HWNet::SendNet(const QByteArray & buf)
+{
+	if ((state == nsGaming) || (state == nsStarting))
+	{
+		QString msg = QString(buf.toBase64());
+		if ((msg == "AUM=") && (mynick == opnick))
+		{
+			ConfigAsked();
+		} else
+		if (msg == "AT8=")
+		{
+			// its ping ("?")
+		} else
+		{
+			if (state == nsGaming)
+			{
+				NetBuffer += buf;
+			} else
+			{
+				RawSendNet(QString("PRIVMSG %1 :"MAGIC_CHAR MAGIC_CHAR"%2").arg(channel, msg));
+			}
+		}
+	}
+}
+
+void HWNet::FlushNetBuf()
+{
+	if (NetBuffer.size() > 0)
+	{
+		RawSendNet(QString("PRIVMSG %1 :"MAGIC_CHAR MAGIC_CHAR"%2").arg(channel, QString(NetBuffer.toBase64())));
+		NetBuffer.clear();
+	}
+}
+
+void HWNet::ParseLine(const QByteArray & line)
+{
+	QString msg = QString::fromUtf8 (line.data(), line.size());
+	//QMessageBox::information(0, "", msg);
+	if (IRCmsg_cmd_text->exactMatch(msg))
+	{
+		msgcmd_textHandler(msg);
+	} else
+	if (IRCmsg_number_param->exactMatch(msg))
+	{
+		msgnumber_paramHandler(msg);
+	} else
+	if (IRCmsg_who_cmd_text->exactMatch(msg))
+	{
+		msgwho_cmd_textHandler(msg);
+	} else
+	if (IRCmsg_who_cmd_target->exactMatch(msg))
+	{
+		msgwho_cmd_targetHandler(msg);
+	} else
+	if (IRCmsg_who_cmd_target_text->exactMatch(msg))
+	{
+		msgwho_cmd_target_textHandler(msg);
+	}
+}
+
+void HWNet::msgcmd_textHandler(const QString & msg)
+{
+	QStringList list = msg.split(" :");
+	if (list[0] == "PING")
+	{
+		RawSendNet(QString("PONG %1").arg(list[1]));
+	}
+}
+
+void HWNet::msgnumber_paramHandler(const QString & msg)
+{
+	int pos = msg.indexOf(" :");
+	QString text = msg.mid(pos + 2);
+	QStringList list = msg.mid(0, pos).split(" ");
+	bool ok;
+	quint16 number = list[1].toInt(&ok);
+	if (!ok)
+		return ;
+	switch (number)
+	{
+		case 001 :
+		{
+			Perform();
+			emit Connected();
+			break;
+		}
+		case 322 : // RPL_LIST
+		{
+			emit AddGame(list[3]);
+			break;
+		}
+		case 353 : // RPL_NAMREPLY
+		{
+			QStringList ops = text.split(" ").filter(QRegExp("^@\\S+$"));
+			opCount += ops.size();
+			if (ops.size() == 1)
+			{
+				opnick = ops[0].mid(1);
+			}
+			break;
+		}
+		case 366 : // RPL_ENDOFNAMES
+		{
+			if (opCount != 1)
+			{
+				opnick = "";
+			}
+			opCount = 0;
+			break;
+		}
+		case 432 : // ERR_ERRONEUSNICKNAME
+		case 433 : // ERR_NICKNAMEINUSE
+		{
+			QMessageBox::information(0, "Your net nickname is in use or cannot be used", msg);
+			// ask for another nick
+		}
+	}
+}
+
+void HWNet::msgwho_cmd_targetHandler(const QString & msg)
+{
+	QStringList list = msg.split(" ");
+	QString who = list[0].mid(1).split("!")[0];
+	if (list[1] == "NICK")
+	{
+		if (mynick == who)
+			mynick = list[2];
+		if (opnick == who)
+			opnick = list[2];
+	}
+}
+
+void HWNet::msgwho_cmd_textHandler(const QString & msg)
+{
+	int pos = msg.indexOf(" :");
+	QString text = msg.mid(pos + 2);
+	QStringList list = msg.mid(0, pos).split(" ");
+	QString who = list[0].mid(1).split("!")[0];
+	if (list[1] == "JOIN")
+	{
+		if (who == mynick)
+		{
+			channel = text;
+			state = nsJoined;
+			emit EnteredGame();
+			RawSendNet(QString("PRIVMSG %1 :Hello!").arg(channel));
+		}
+	}
+}
+void HWNet::msgwho_cmd_target_textHandler(const QString & msg)
+{
+	int pos = msg.indexOf(" :");
+	QString text = msg.mid(pos + 2);
+	QStringList list = msg.mid(0, pos).split(" ");
+	QString who = list[0].mid(1).split("!")[0];
+	if (list[1] == "PRIVMSG")
+	{
+		if (list[2] == opnick)
+		{
+			hwp_opmsg(who, text);
+		} else
+		if (list[2] == channel)
+		{
+			hwp_chanmsg(who, text);
+		}
+	}
+}
+
+void HWNet::hwp_opmsg(const QString & who, const QString & msg)
+{
+	if (state != nsJoined)
+		return ;
+	if (!msg.startsWith(MAGIC_CHAR))
+		return ;
+	QStringList list = msg.split(MAGIC_CHAR, QString::SkipEmptyParts);
+	if (list[0] == "A")
+	{
+		list.removeFirst();
+		if (list.size() != 9)
+			return ;
+		if (teamsCount < 5)
+		{
+			teams[teamsCount].nick = who;
+			teams[teamsCount].hhs = list;
+			teamsCount++;
+			QString teamnames;
+			for(int i = 0; i < teamsCount; i++)
+			{
+				teamnames += MAGIC_CHAR;
+				teamnames += teams[i].hhs[0];
+			}
+			QString tmsg = QString(MAGIC_CHAR"=%2").arg(teamnames);
+			RawSendNet(QString("PRIVMSG %1 :").arg(channel) + tmsg);
+			hwp_chanmsg(mynick, tmsg);
+		}
+	}
+}
+
+void HWNet::ConfigAsked()
+{
+	configasks++;
+	if (configasks == playerscnt)
+	{
+		quint32 color = 65535;
+			#define ADD(a) { \
+							QByteArray strmsg; \
+							strmsg.append(a); \
+							quint8 sz = strmsg.size(); \
+							cache.append(QByteArray((char *)&sz, 1)); \
+							cache.append(strmsg); \
+							}
+		{
+			QByteArray cache;
+			ADD("eseed " + seed);
+			ADD("e$gmflags 0");
+			ADD(QString("etheme %1").arg(config->GetRandomTheme()));
+			QString _msg = MAGIC_CHAR MAGIC_CHAR + QString(cache.toBase64());
+			RawSendNet(QString("PRIVMSG %1 :%2").arg(channel, _msg));
+			hwp_chanmsg(mynick, _msg);
+		}
+		for (int i = 0; i < teamsCount; i++)
+		{
+			QString msg;
+			msg = MAGIC_CHAR "T" MAGIC_CHAR + teams[i].nick + MAGIC_CHAR + teams[i].hhs.join(MAGIC_CHAR);
+			RawSendNet(QString("PRIVMSG %1 :%2").arg(channel, msg));
+			hwp_chanmsg(mynick, msg);
+			QByteArray cache;
+			ADD(QString("ecolor %1").arg(color));
+			ADD("eadd hh0 0");
+			ADD("eadd hh1 0");
+			ADD("eadd hh2 0");
+			ADD("eadd hh3 0");
+			ADD("eadd hh4 0");
+			#undef ADD
+			QString _msg = MAGIC_CHAR MAGIC_CHAR + QString(cache.toBase64());
+			RawSendNet(QString("PRIVMSG %1 :%2").arg(channel, _msg));
+			hwp_chanmsg(mynick, _msg);
+			color <<= 8;
+		}
+		SENDCFGSTRNET("!");
+	}
+}
+
+void HWNet::hwp_chanmsg(const QString & who, const QString & msg)
+{
+	if ((state < nsJoined) || (state > nsGaming))
+	{
+		return ;
+	}
+	if (state == nsJoined)
+	{
+		if (msg.startsWith(MAGIC_CHAR"Start!") && (who == opnick))
+		{
+			state = nsStarting;
+			RunGame();
+			return ;
+		}
+		if (msg.startsWith(MAGIC_CHAR"="MAGIC_CHAR) && (who == opnick))
+		{
+			emit ChangeInTeams(msg.mid(3).split(MAGIC_CHAR));
+		}
+	}
+	if (state == nsStarting)
+	{
+		if (msg == MAGIC_CHAR MAGIC_CHAR "AUM=")
+		{
+			if (mynick == opnick) ConfigAsked();
+			return ;
+		}
+		if (msg == MAGIC_CHAR MAGIC_CHAR "ASE=")
+		{
+			state = nsGaming;
+			TimerFlusher = new QTimer();
+			connect(TimerFlusher, SIGNAL(timeout()), this, SLOT(FlushNetBuf()));
+			TimerFlusher->start(2000);
+		}
+		if (msg.startsWith(MAGIC_CHAR"T"MAGIC_CHAR))
+		{
+			NetTeamAdded(msg.mid(3));
+		}
+	}
+	if ((state < nsStarting) || (state > nsGaming))
+	{
+		return;
+	}
+	if (msg.startsWith(MAGIC_CHAR MAGIC_CHAR)) // HWP message
+	{
+		QByteArray em = QByteArray::fromBase64(msg.mid(2).toAscii());
+		emit FromNet(em);
+	} else // smth other
+	{
+
+	}
+}
+
+void HWNet::NetTeamAdded(const QString & msg)
+{
+	QStringList list = msg.split(MAGIC_CHAR, QString::SkipEmptyParts);
+	if (list.size() != 10)
+		return ;
+	SENDCFGSTRLOC("eaddteam");
+	if (list[0] == mynick)
+	{
+		emit LocalCFG(list[1]);
+	} else
+	{
+		SENDCFGSTRLOC("erdriven");
+		SENDCFGSTRLOC(QString("ename team %1").arg(list[1]));
+		for (int i = 0; i < 8; i++)
+		{
+			SENDCFGSTRLOC(QString("ename hh%1 ").arg(i) + list[i + 2]);
+		}
+	}
+}
+
+void HWNet::AddTeam(const HWTeam & team)
+{
+	if (state != nsJoined)
+	{
+		return ;
+	}
+	RawSendNet(QString("PRIVMSG %1 :").arg(opnick) + MAGIC_CHAR "A" MAGIC_CHAR +
+			team.TeamName + MAGIC_CHAR + team.HHName[0] + MAGIC_CHAR + team.HHName[1] + MAGIC_CHAR +
+			team.HHName[2] + MAGIC_CHAR + team.HHName[3] + MAGIC_CHAR + team.HHName[4] + MAGIC_CHAR +
+			team.HHName[5] + MAGIC_CHAR + team.HHName[6] + MAGIC_CHAR + team.HHName[7]);
+}
+
+void HWNet::StartGame()
+{
+	if ((opnick != mynick) || (state != nsJoined))
+	{
+		return ;
+	}
+	QStringList players;
+	for (int i = 0; i < teamsCount; i++)
+	{
+		if (!players.contains(teams[i].nick))
+		{
+			players.append(teams[i].nick);
+		}
+	}
+	playerscnt = players.size();
+	configasks = 0;
+
+	seed = QUuid::createUuid().toString();
+	QString msg = QString(MAGIC_CHAR"Start!");
+	RawSendNet(QString("PRIVMSG %1 :%2").arg(channel, msg));
+	hwp_chanmsg(mynick, msg);
+}
+
+void HWNet::RunGame()
+{
+	HWGame * game = new HWGame(config, 0);
+	connect(game, SIGNAL(SendNet(const QByteArray &)), this, SLOT(SendNet(const QByteArray &)));
+	connect(this, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)));
+	connect(this, SIGNAL(LocalCFG(const QString &)), game, SLOT(LocalCFG(const QString &)));
+	game->StartNet();
+}
--- a/QTfrontend/netclient.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/netclient.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,140 +1,140 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef NET_H
-#define NET_H
-
-#include <QObject>
-#include <QTcpSocket>
-#include <QRegExp>
-#include <QStringList>
-#include <QTimer>
-#include "team.h"
-
-#define MAGIC_CHAR "\x2f"
-
-struct netTeam
-{
-	QString nick;
-	QStringList hhs;
-};
-
-class GameUIConfig;
-
-class HWNet : public QObject
-{
-	Q_OBJECT
-
-public:
-    HWNet(GameUIConfig * config);
-	void Connect(const QString & hostName, quint16 port, const QString & nick);
-	void Disconnect();
-	void JoinGame(const QString & game);
-	void AddTeam(const HWTeam & team);
-	void StartGame();
-
-signals:
-	void Connected();
-	void AddGame(const QString & chan);
-	void EnteredGame();
-	void FromNet(const QByteArray & buf);
-	void LocalCFG(const QString & team);
-	void ChangeInTeams(const QStringList & teams);
-
-public slots:
-	void SendNet(const QByteArray & buf);
-
-private:
-	enum NetState {
-		nsDisconnected	= 0,
-		nsConnecting	= 1,
-		nsConnected	= 3,
-		nsJoining	= 4,
-		nsJoined	= 5,
-		nsStarting	= 6,
-		nsGaming	= 7,
-		nsQuitting	= 8
-	};
-
-	QTcpSocket NetSocket;
-	NetState state;
-	QRegExp * IRCmsg_cmd_text;
-	QRegExp * IRCmsg_number_param;
-	QRegExp * IRCmsg_who_cmd_target;
-	QRegExp * IRCmsg_who_cmd_target_text;
-	QRegExp * IRCmsg_who_cmd_text;
-	QString mynick;
-	QString opnick;
-	QString channel;
-	QString seed;
-	bool isOp;
-	quint32 opCount;
-	netTeam teams[5];
-	quint8 teamsCount;
-	int playerscnt;
-	int configasks;
-	QByteArray NetBuffer;
-	QTimer * TimerFlusher;
-	GameUIConfig * config;
-
-	void RawSendNet(const QString & buf);
-	void RawSendNet(const QByteArray & buf);
-
-	void ParseLine(const QByteArray & line);
-	void msgcmd_textHandler(const QString & msg);
-	void msgnumber_paramHandler(const QString & msg);
-	void msgwho_cmd_targetHandler(const QString & msg);
-	void msgwho_cmd_textHandler(const QString & msg);
-	void msgwho_cmd_target_textHandler(const QString & msg);
-
-	void hwp_opmsg(const QString & who, const QString & msg);
-	void hwp_chanmsg(const QString & who, const QString & msg);
-	void ConfigAsked();
-	void NetTeamAdded(const QString & msg);
-
-	void RunGame();
-
-
-private slots:
-	void ClientRead();
-	void OnConnect();
-	void OnDisconnect();
-	void Perform();
-	void displayError(QAbstractSocket::SocketError socketError);
-	void FlushNetBuf();
-};
-
-#define SENDCFGSTRNET(a)   {\
-							QByteArray strmsg; \
-							strmsg.append(a); \
-							quint8 sz = strmsg.size(); \
-							QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg; \
-							QString _msg = MAGIC_CHAR MAGIC_CHAR + QString(enginemsg.toBase64()); \
-							hwp_chanmsg(mynick, _msg); \
-							RawSendNet(QString("PRIVMSG %1 :").arg(channel) + _msg); \
-						}
-
-#define SENDCFGSTRLOC(a)   {\
-							QByteArray strmsg; \
-							strmsg.append(QString(a).toUtf8()); \
-							quint8 sz = strmsg.size(); \
-							QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg; \
-							emit FromNet(enginemsg); \
-						}
-
-#endif
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef NET_H
+#define NET_H
+
+#include <QObject>
+#include <QTcpSocket>
+#include <QRegExp>
+#include <QStringList>
+#include <QTimer>
+#include "team.h"
+
+#define MAGIC_CHAR "\x2f"
+
+struct netTeam
+{
+	QString nick;
+	QStringList hhs;
+};
+
+class GameUIConfig;
+
+class HWNet : public QObject
+{
+	Q_OBJECT
+
+public:
+    HWNet(GameUIConfig * config);
+	void Connect(const QString & hostName, quint16 port, const QString & nick);
+	void Disconnect();
+	void JoinGame(const QString & game);
+	void AddTeam(const HWTeam & team);
+	void StartGame();
+
+signals:
+	void Connected();
+	void AddGame(const QString & chan);
+	void EnteredGame();
+	void FromNet(const QByteArray & buf);
+	void LocalCFG(const QString & team);
+	void ChangeInTeams(const QStringList & teams);
+
+public slots:
+	void SendNet(const QByteArray & buf);
+
+private:
+	enum NetState {
+		nsDisconnected	= 0,
+		nsConnecting	= 1,
+		nsConnected	= 3,
+		nsJoining	= 4,
+		nsJoined	= 5,
+		nsStarting	= 6,
+		nsGaming	= 7,
+		nsQuitting	= 8
+	};
+
+	QTcpSocket NetSocket;
+	NetState state;
+	QRegExp * IRCmsg_cmd_text;
+	QRegExp * IRCmsg_number_param;
+	QRegExp * IRCmsg_who_cmd_target;
+	QRegExp * IRCmsg_who_cmd_target_text;
+	QRegExp * IRCmsg_who_cmd_text;
+	QString mynick;
+	QString opnick;
+	QString channel;
+	QString seed;
+	bool isOp;
+	quint32 opCount;
+	netTeam teams[5];
+	quint8 teamsCount;
+	int playerscnt;
+	int configasks;
+	QByteArray NetBuffer;
+	QTimer * TimerFlusher;
+	GameUIConfig * config;
+
+	void RawSendNet(const QString & buf);
+	void RawSendNet(const QByteArray & buf);
+
+	void ParseLine(const QByteArray & line);
+	void msgcmd_textHandler(const QString & msg);
+	void msgnumber_paramHandler(const QString & msg);
+	void msgwho_cmd_targetHandler(const QString & msg);
+	void msgwho_cmd_textHandler(const QString & msg);
+	void msgwho_cmd_target_textHandler(const QString & msg);
+
+	void hwp_opmsg(const QString & who, const QString & msg);
+	void hwp_chanmsg(const QString & who, const QString & msg);
+	void ConfigAsked();
+	void NetTeamAdded(const QString & msg);
+
+	void RunGame();
+
+
+private slots:
+	void ClientRead();
+	void OnConnect();
+	void OnDisconnect();
+	void Perform();
+	void displayError(QAbstractSocket::SocketError socketError);
+	void FlushNetBuf();
+};
+
+#define SENDCFGSTRNET(a)   {\
+							QByteArray strmsg; \
+							strmsg.append(a); \
+							quint8 sz = strmsg.size(); \
+							QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg; \
+							QString _msg = MAGIC_CHAR MAGIC_CHAR + QString(enginemsg.toBase64()); \
+							hwp_chanmsg(mynick, _msg); \
+							RawSendNet(QString("PRIVMSG %1 :").arg(channel) + _msg); \
+						}
+
+#define SENDCFGSTRLOC(a)   {\
+							QByteArray strmsg; \
+							strmsg.append(QString(a).toUtf8()); \
+							quint8 sz = strmsg.size(); \
+							QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg; \
+							emit FromNet(enginemsg); \
+						}
+
+#endif
--- a/QTfrontend/pages.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/pages.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,440 +1,440 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QGridLayout>
-#include <QDir>
-#include <QPushButton>
-#include <QGroupBox>
-#include <QComboBox>
-#include <QLabel>
-#include <QToolBox>
-#include <QLineEdit>
-#include <QListWidget>
-#include <QApplication>
-
-#include "pages.h"
-#include "sdlkeys.h"
-#include "hwconsts.h"
-#include "gamecfgwidget.h"
-#include "teamselect.h"
-#include "gamecfgwidget.h"
-#include "SquareLabel.h"
-#include "mapContainer.h"
-
-PageMain::PageMain(QWidget* parent) : QWidget(parent)
-{
-	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-	pageLayout->setMargin(25);
-	pageLayout->setColumnStretch(0, 1);
-	pageLayout->setColumnStretch(1, 2);
-	pageLayout->setColumnStretch(2, 1);
-
-	BtnSinglePlayer = new QPushButton(this);
-	BtnSinglePlayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	BtnSinglePlayer->setFont(*font14);
-	BtnSinglePlayer->setText(QPushButton::tr("Single Player"));
-	pageLayout->addWidget(BtnSinglePlayer, 1, 1);
-
-	BtnMultiplayer = new QPushButton(this);
-	BtnMultiplayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	BtnMultiplayer->setFont(*font14);
-	BtnMultiplayer->setText(QPushButton::tr("Multiplayer"));
-	pageLayout->addWidget(BtnMultiplayer, 2, 1);
-
-	BtnNet = new QPushButton(this);
-	BtnNet->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	BtnNet->setFont(*font14);
-	BtnNet->setText(QPushButton::tr("Net game"));
-	pageLayout->addWidget(BtnNet, 3, 1);
-
-	BtnDemos = new QPushButton(this);
-	BtnDemos->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	BtnDemos->setFont(*font14);
-	BtnDemos->setText(QPushButton::tr("Demos"));
-	pageLayout->addWidget(BtnDemos, 4, 1);
-
-	BtnSetup = new QPushButton(this);
-	BtnSetup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	BtnSetup->setFont(*font14);
-	BtnSetup->setText(QPushButton::tr("Setup"));
-	pageLayout->addWidget(BtnSetup, 5, 1);
-
-	BtnExit = new QPushButton(parent);
-	BtnExit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	BtnExit->setFont(*font14);
-	BtnExit->setText(QPushButton::tr("Exit"));
-	pageLayout->addWidget(BtnExit, 6, 1);
-}
-
-PageLocalGame::PageLocalGame(QWidget* parent) : QWidget(parent)
-{
-	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-	BtnBack =	new QPushButton(this);
-	BtnBack->setFont(*font14);
-	BtnBack->setText(QPushButton::tr("Back"));
-	pageLayout->addWidget(BtnBack, 1, 0);
-	BtnSimpleGame = new	QPushButton(this);
-	BtnSimpleGame->setFont(*font14);
-	BtnSimpleGame->setText(QPushButton::tr("Simple Game"));
-	pageLayout->addWidget(BtnSimpleGame, 1, 3);
-	gameCFG = new GameCFGWidget(this);
-	pageLayout->addWidget(gameCFG, 0, 0, 1, 2);
-}
-
-PageEditTeam::PageEditTeam(QWidget* parent) : QWidget(parent)
-{
-	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-	pageLayout->setColumnStretch(0, 100);
-	pageLayout->setColumnMinimumWidth(0, 150);
-	pageLayout->setColumnStretch(1, 100);
-	pageLayout->setColumnMinimumWidth(1, 200);
-	pageLayout->setColumnStretch(2, 250);
-	pageLayout->setColumnMinimumWidth(2, 250);
-
-	GBoxTeam = new QGroupBox(this);
-	GBoxTeam->setTitle(QGroupBox::tr("Team"));
-	GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-	QGridLayout * GBTLayout = new QGridLayout(GBoxTeam);
-	TeamNameEdit = new QLineEdit(GBoxTeam);
-	TeamNameEdit->setMaxLength(15);
-	GBTLayout->addWidget(TeamNameEdit);
-	pageLayout->addWidget(GBoxTeam, 0, 0);
-
-	GBoxHedgehogs = new	QGroupBox(this);
-	GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members"));
-	GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-	QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs);
-	for(int i = 0; i < 8; i++)
-	{
-		HHNameEdit[i] = new QLineEdit(GBoxHedgehogs);
-		HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20));
-		HHNameEdit[i]->setMaxLength(15);
-		GBHLayout->addWidget(HHNameEdit[i]);
-	}
-	pageLayout->addWidget(GBoxHedgehogs, 1, 0, 2, 1);
-
-	BtnTeamDiscard = new QPushButton(this);
-	BtnTeamDiscard->setFont(*font14);
-	BtnTeamDiscard->setText(QPushButton::tr("Discard"));
-	pageLayout->addWidget(BtnTeamDiscard, 4, 0);
-
-	GBoxBinds =	new QGroupBox(this);
-	GBoxBinds->setTitle(QGroupBox::tr("Key binds"));
-	QGridLayout * GBBLayout = new QGridLayout(GBoxBinds);
-	BindsBox = new QToolBox(GBoxBinds);
-	BindsBox->setLineWidth(0);
-	GBBLayout->addWidget(BindsBox);
-	page_A = new QWidget();
-	BindsBox->addItem(page_A, QToolBox::tr("Actions"));
-	page_W = new QWidget();
-	BindsBox->addItem(page_W, QToolBox::tr("Weapons"));
-	page_WP = new QWidget();
-	BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties"));
-	page_O = new QWidget();
-	BindsBox->addItem(page_O, QToolBox::tr("Other"));
-	pageLayout->addWidget(GBoxBinds, 0, 1, 5, 1);
-
-	QStringList binds;
-	for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++)
-	{
-		binds << sdlkeys[i][1];
-	}
-
-	quint16 widind = 0, i = 0;
-	while (i < BINDS_NUMBER) {
-		quint16 num = 0;
-		QGridLayout * pagelayout = new QGridLayout(BindsBox->widget(widind));
-		do {
-			LBind[i] = new QLabel(BindsBox->widget(widind));
-			LBind[i]->setText(QApplication::translate("binds", cbinds[i].name));
-			LBind[i]->setAlignment(Qt::AlignRight);
-			pagelayout->addWidget(LBind[i], num, 0);
-			CBBind[i] = new QComboBox(BindsBox->widget(widind));
-			CBBind[i]->addItems(binds);
-			pagelayout->addWidget(CBBind[i], num, 1);
-			num++;
-		} while (!cbinds[i++].chwidget);
-		pagelayout->addWidget(new QWidget(BindsBox->widget(widind)), num, 0, 1, 2);
-		widind++;
-	}
-
-	GBoxGrave =	new QGroupBox(this);
-	GBoxGrave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-	GBoxGrave->setTitle(QGroupBox::tr("Grave"));
-	QGridLayout * GBGLayout = new QGridLayout(GBoxGrave);
-	CBGrave = new QComboBox(GBoxGrave);
-	CBGrave->setMaxCount(65535);
-	GBGLayout->addWidget(CBGrave, 0, 0, 1, 3);
-	GravePreview = new QLabel(GBoxGrave);
-	GravePreview->setScaledContents(false);
-	GBGLayout->addWidget(GravePreview, 1, 1);
-	pageLayout->addWidget(GBoxGrave, 0, 2, 2, 1);
-
-	GBoxFort = new QGroupBox(this);
-	GBoxFort->setTitle(QGroupBox::tr("Fort"));
-	QGridLayout * GBFLayout = new QGridLayout(GBoxFort);
-	CBFort = new QComboBox(GBoxFort);
-	CBFort->setMaxCount(65535);
-	GBFLayout->addWidget(CBFort, 0, 0);
-	FortPreview	= new SquareLabel(GBoxFort);
-	FortPreview->setPixmap(QPixmap());
-	FortPreview->setScaledContents(true);
-	GBFLayout->addWidget(FortPreview, 1, 0);
-	pageLayout->addWidget(GBoxFort, 2, 2, 1, 1);
-
-	BtnTeamSave	= new QPushButton(this);
-	BtnTeamSave->setFont(*font14);
-	BtnTeamSave->setText(QPushButton::tr("Save"));
-	pageLayout->addWidget(BtnTeamSave, 4, 2);
-
-
-	QDir tmpdir;
-	tmpdir.cd(datadir->absolutePath());
-	tmpdir.cd("Forts");
-	tmpdir.setFilter(QDir::Files);
-
-	CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L.png"), "\\1"));
-	tmpdir.cd("../Graphics/Graves");
-	QStringList list = tmpdir.entryList(QStringList("*.png"));
-	for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
-	{
-		CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1"));
-	}
-
-	connect(CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &)));
-	connect(CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &)));
-}
-
-void PageEditTeam::CBGrave_activated(const QString & gravename)
-{
-	QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + gravename + ".png");
-	GravePreview->setPixmap(pix.copy(0, 0, 32, 32));
-}
-
-void PageEditTeam::CBFort_activated(const QString & fortname)
-{
-	QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png");
-	FortPreview->setPixmap(pix);
-}
-
-PageMultiplayer::PageMultiplayer(QWidget* parent) : QWidget(parent)
-{
-	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-
-	BtnBack = new QPushButton(this);
-	BtnBack->setFont(*font14);
-	BtnBack->setText(QPushButton::tr("Back"));
-	pageLayout->addWidget(BtnBack, 1, 0);
-	
-	//HWMapContainer* pMapContainer=new HWMapContainer(this);
-	//pageLayout->addWidget(pMapContainer, 1, 1);
-
-	gameCFG = new GameCFGWidget(this);
-	pageLayout->addWidget(gameCFG, 0, 0, 1, 2);
-	teamsSelect = new TeamSelWidget(this);
-	pageLayout->addWidget(teamsSelect, 0, 2, 1, 2);
-
-	BtnStartMPGame = new QPushButton(this);
-	BtnStartMPGame->setFont(*font14);
-	BtnStartMPGame->setText(QPushButton::tr("Start"));
-	pageLayout->addWidget(BtnStartMPGame, 1, 3);
-}
-
-PagePlayDemo::PagePlayDemo(QWidget* parent) : QWidget(parent)
-{
-	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-	pageLayout->setColumnStretch(0, 1);
-	pageLayout->setColumnStretch(1, 2);
-	pageLayout->setColumnStretch(2, 1);
-
-	BtnBack = new QPushButton(this);
-	BtnBack->setFont(*font14);
-	BtnBack->setText(QPushButton::tr("Back"));
-	pageLayout->addWidget(BtnBack, 1, 0);
-
-	BtnPlayDemo	= new QPushButton(this);
-	BtnPlayDemo->setGeometry(QRect(240,	330, 161, 41));
-	BtnPlayDemo->setFont(*font14);
-	BtnPlayDemo->setText(QPushButton::tr("Play demo"));
-	pageLayout->addWidget(BtnPlayDemo, 1, 2);
-
-	DemosList =	new QListWidget(this);
-	DemosList->setGeometry(QRect(170, 10, 311, 311));
-	pageLayout->addWidget(DemosList, 0, 1);
-}
-
-PageOptions::PageOptions(QWidget* parent) : QWidget(parent)
-{
-	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-	groupBox = new QGroupBox(this);
-	groupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-	groupBox->setTitle(QGroupBox::tr("Teams"));
-	pageLayout->addWidget(groupBox, 0, 0, 1, 3);
-
-	QGridLayout * GBTlayout = new QGridLayout(groupBox);
-	BtnNewTeam = new QPushButton(groupBox);
-	BtnNewTeam->setFont(*font14);
-	BtnNewTeam->setText(QPushButton::tr("New team"));
-	GBTlayout->addWidget(BtnNewTeam, 0, 0);
-
-	CBTeamName = new QComboBox(groupBox);
-	GBTlayout->addWidget(CBTeamName, 0, 1);
-
-	BtnEditTeam	= new QPushButton(groupBox);
-	BtnEditTeam->setFont(*font14);
-	BtnEditTeam->setText(QPushButton::tr("Edit team"));
-	GBTlayout->addWidget(BtnEditTeam, 0, 2);
-
-	AGGroupBox = new QGroupBox(this);
-	AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-	AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
-	pageLayout->addWidget(AGGroupBox, 1, 0, 1, 3);
-
-	QGridLayout * GBAlayout = new QGridLayout(AGGroupBox);
-	CBResolution = new QComboBox(AGGroupBox);
-	CBResolution->addItem("640x480");
-	CBResolution->addItem("800x600");
-	CBResolution->addItem("1024x768");
-	CBResolution->addItem("1280x1024");
-	GBAlayout->addWidget(CBResolution, 0, 0);
-
-	CBFullscreen = new QCheckBox(AGGroupBox);
-	CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
-	GBAlayout->addWidget(CBFullscreen, 0, 1);
-
-	CBEnableSound = new	QCheckBox(AGGroupBox);
-	CBEnableSound->setText(QCheckBox::tr("Enable sound"));
-	GBAlayout->addWidget(CBEnableSound, 0, 2);
-
-	pageLayout->addWidget(new QWidget(), 3, 0, 1, 3);
-
-	BtnSaveOptions = new QPushButton(this);
-	BtnSaveOptions->setFont(*font14);
-	BtnSaveOptions->setText(QPushButton::tr("Save"));
-	pageLayout->addWidget(BtnSaveOptions, 4, 2);
-
-	BtnBack = new QPushButton(this);
-	BtnBack->setFont(*font14);
-	BtnBack->setText(QPushButton::tr("Back"));
-	pageLayout->addWidget(BtnBack, 4, 0);
-}
-
-PageNet::PageNet(QWidget* parent) : QWidget(parent)
-{
-	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-	pageLayout->setColumnStretch(0, 1);
-	pageLayout->setColumnStretch(1, 1);
-	pageLayout->setColumnStretch(2, 1);
-
-	NNGroupBox = new QGroupBox(this);
-	NNGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-	NNGroupBox->setTitle(QGroupBox::tr("Net options"));
-	pageLayout->addWidget(NNGroupBox, 0, 1);
-
-	pageLayout->addWidget(new QWidget(), 1, 1);
-
-	QGridLayout * GBNlayout = new QGridLayout(NNGroupBox);
-	labelNN = new QLabel(NNGroupBox);
-	labelNN->setText(QLabel::tr("Net nick"));
-	GBNlayout->addWidget(labelNN, 0, 0);
-
-	editNetNick	= new QLineEdit(NNGroupBox);
-	editNetNick->setMaxLength(20);
-	editNetNick->setText(QLineEdit::tr("unnamed"));
-	GBNlayout->addWidget(editNetNick, 0, 1);
-
-	labelIP = new QLabel(NNGroupBox);
-	labelIP->setText(QLabel::tr("Server address"));
-	GBNlayout->addWidget(labelIP, 1, 0);
-
-	editIP = new QLineEdit(NNGroupBox);
-	editIP->setMaxLength(50);
-	GBNlayout->addWidget(editIP, 1, 1);
-
-	BtnNetConnect = new	QPushButton(this);
-	BtnNetConnect->setFont(*font14);
-	BtnNetConnect->setText(QPushButton::tr("Connect"));
-	pageLayout->addWidget(BtnNetConnect, 2, 2);
-
-	BtnBack = new QPushButton(this);
-	BtnBack->setFont(*font14);
-	BtnBack->setText(QPushButton::tr("Back"));
-	pageLayout->addWidget(BtnBack, 2, 0);
-}
-
-PageNetChat::PageNetChat(QWidget* parent) : QWidget(parent)
-{
-	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-	pageLayout->setColumnStretch(0, 1);
-	pageLayout->setColumnStretch(1, 1);
-	pageLayout->setColumnStretch(2, 1);
-
-	BtnDisconnect = new QPushButton(this);
-	BtnDisconnect->setFont(*font14);
-	BtnDisconnect->setText(QPushButton::tr("Disconnect"));
-	pageLayout->addWidget(BtnDisconnect, 2, 0);
-
-	ChannelsList = new QListWidget(this);
-	pageLayout->addWidget(ChannelsList, 0, 1);
-
-	BtnJoin = new QPushButton(this);
-	BtnJoin->setFont(*font14);
-	BtnJoin->setText(QPushButton::tr("Join"));
-	pageLayout->addWidget(BtnJoin, 2, 2);
-
-	BtnCreate = new QPushButton(this);
-	BtnCreate->setFont(*font14);
-	BtnCreate->setText(QPushButton::tr("Create"));
-	pageLayout->addWidget(BtnCreate, 1, 2);
-}
-
-
-PageNetGame::PageNetGame(QWidget* parent) : QWidget(parent)
-{
-	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-	pageLayout->setColumnStretch(0, 1);
-	pageLayout->setColumnStretch(1, 1);
-	pageLayout->setColumnStretch(2, 1);
-
-	BtnBack = new QPushButton(this);
-	BtnBack->setFont(*font14);
-	BtnBack->setText(QPushButton::tr("Back"));
-	pageLayout->addWidget(BtnBack, 2, 0);
-
-	BtnAddTeam = new QPushButton(this);
-	BtnAddTeam->setFont(*font14);
-	BtnAddTeam->setText(QPushButton::tr("Add Team"));
-	pageLayout->addWidget(BtnAddTeam, 1, 1);
-
-	BtnGo	= new QPushButton(this);
-	BtnGo->setFont(*font14);
-	BtnGo->setText(QPushButton::tr("Go!"));
-	pageLayout->addWidget(BtnGo, 2, 2);
-
-	listNetTeams = new QListWidget(this);
-	pageLayout->addWidget(listNetTeams, 0, 1);
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QGridLayout>
+#include <QDir>
+#include <QPushButton>
+#include <QGroupBox>
+#include <QComboBox>
+#include <QLabel>
+#include <QToolBox>
+#include <QLineEdit>
+#include <QListWidget>
+#include <QApplication>
+
+#include "pages.h"
+#include "sdlkeys.h"
+#include "hwconsts.h"
+#include "gamecfgwidget.h"
+#include "teamselect.h"
+#include "gamecfgwidget.h"
+#include "SquareLabel.h"
+#include "mapContainer.h"
+
+PageMain::PageMain(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+	pageLayout->setMargin(25);
+	pageLayout->setColumnStretch(0, 1);
+	pageLayout->setColumnStretch(1, 2);
+	pageLayout->setColumnStretch(2, 1);
+
+	BtnSinglePlayer = new QPushButton(this);
+	BtnSinglePlayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnSinglePlayer->setFont(*font14);
+	BtnSinglePlayer->setText(QPushButton::tr("Single Player"));
+	pageLayout->addWidget(BtnSinglePlayer, 1, 1);
+
+	BtnMultiplayer = new QPushButton(this);
+	BtnMultiplayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnMultiplayer->setFont(*font14);
+	BtnMultiplayer->setText(QPushButton::tr("Multiplayer"));
+	pageLayout->addWidget(BtnMultiplayer, 2, 1);
+
+	BtnNet = new QPushButton(this);
+	BtnNet->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnNet->setFont(*font14);
+	BtnNet->setText(QPushButton::tr("Net game"));
+	pageLayout->addWidget(BtnNet, 3, 1);
+
+	BtnDemos = new QPushButton(this);
+	BtnDemos->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnDemos->setFont(*font14);
+	BtnDemos->setText(QPushButton::tr("Demos"));
+	pageLayout->addWidget(BtnDemos, 4, 1);
+
+	BtnSetup = new QPushButton(this);
+	BtnSetup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnSetup->setFont(*font14);
+	BtnSetup->setText(QPushButton::tr("Setup"));
+	pageLayout->addWidget(BtnSetup, 5, 1);
+
+	BtnExit = new QPushButton(parent);
+	BtnExit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnExit->setFont(*font14);
+	BtnExit->setText(QPushButton::tr("Exit"));
+	pageLayout->addWidget(BtnExit, 6, 1);
+}
+
+PageLocalGame::PageLocalGame(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+	BtnBack =	new QPushButton(this);
+	BtnBack->setFont(*font14);
+	BtnBack->setText(QPushButton::tr("Back"));
+	pageLayout->addWidget(BtnBack, 1, 0);
+	BtnSimpleGame = new	QPushButton(this);
+	BtnSimpleGame->setFont(*font14);
+	BtnSimpleGame->setText(QPushButton::tr("Simple Game"));
+	pageLayout->addWidget(BtnSimpleGame, 1, 3);
+	gameCFG = new GameCFGWidget(this);
+	pageLayout->addWidget(gameCFG, 0, 0, 1, 2);
+}
+
+PageEditTeam::PageEditTeam(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+	pageLayout->setColumnStretch(0, 100);
+	pageLayout->setColumnMinimumWidth(0, 150);
+	pageLayout->setColumnStretch(1, 100);
+	pageLayout->setColumnMinimumWidth(1, 200);
+	pageLayout->setColumnStretch(2, 250);
+	pageLayout->setColumnMinimumWidth(2, 250);
+
+	GBoxTeam = new QGroupBox(this);
+	GBoxTeam->setTitle(QGroupBox::tr("Team"));
+	GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+	QGridLayout * GBTLayout = new QGridLayout(GBoxTeam);
+	TeamNameEdit = new QLineEdit(GBoxTeam);
+	TeamNameEdit->setMaxLength(15);
+	GBTLayout->addWidget(TeamNameEdit);
+	pageLayout->addWidget(GBoxTeam, 0, 0);
+
+	GBoxHedgehogs = new	QGroupBox(this);
+	GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members"));
+	GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+	QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs);
+	for(int i = 0; i < 8; i++)
+	{
+		HHNameEdit[i] = new QLineEdit(GBoxHedgehogs);
+		HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20));
+		HHNameEdit[i]->setMaxLength(15);
+		GBHLayout->addWidget(HHNameEdit[i]);
+	}
+	pageLayout->addWidget(GBoxHedgehogs, 1, 0, 2, 1);
+
+	BtnTeamDiscard = new QPushButton(this);
+	BtnTeamDiscard->setFont(*font14);
+	BtnTeamDiscard->setText(QPushButton::tr("Discard"));
+	pageLayout->addWidget(BtnTeamDiscard, 4, 0);
+
+	GBoxBinds =	new QGroupBox(this);
+	GBoxBinds->setTitle(QGroupBox::tr("Key binds"));
+	QGridLayout * GBBLayout = new QGridLayout(GBoxBinds);
+	BindsBox = new QToolBox(GBoxBinds);
+	BindsBox->setLineWidth(0);
+	GBBLayout->addWidget(BindsBox);
+	page_A = new QWidget();
+	BindsBox->addItem(page_A, QToolBox::tr("Actions"));
+	page_W = new QWidget();
+	BindsBox->addItem(page_W, QToolBox::tr("Weapons"));
+	page_WP = new QWidget();
+	BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties"));
+	page_O = new QWidget();
+	BindsBox->addItem(page_O, QToolBox::tr("Other"));
+	pageLayout->addWidget(GBoxBinds, 0, 1, 5, 1);
+
+	QStringList binds;
+	for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++)
+	{
+		binds << sdlkeys[i][1];
+	}
+
+	quint16 widind = 0, i = 0;
+	while (i < BINDS_NUMBER) {
+		quint16 num = 0;
+		QGridLayout * pagelayout = new QGridLayout(BindsBox->widget(widind));
+		do {
+			LBind[i] = new QLabel(BindsBox->widget(widind));
+			LBind[i]->setText(QApplication::translate("binds", cbinds[i].name));
+			LBind[i]->setAlignment(Qt::AlignRight);
+			pagelayout->addWidget(LBind[i], num, 0);
+			CBBind[i] = new QComboBox(BindsBox->widget(widind));
+			CBBind[i]->addItems(binds);
+			pagelayout->addWidget(CBBind[i], num, 1);
+			num++;
+		} while (!cbinds[i++].chwidget);
+		pagelayout->addWidget(new QWidget(BindsBox->widget(widind)), num, 0, 1, 2);
+		widind++;
+	}
+
+	GBoxGrave =	new QGroupBox(this);
+	GBoxGrave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+	GBoxGrave->setTitle(QGroupBox::tr("Grave"));
+	QGridLayout * GBGLayout = new QGridLayout(GBoxGrave);
+	CBGrave = new QComboBox(GBoxGrave);
+	CBGrave->setMaxCount(65535);
+	GBGLayout->addWidget(CBGrave, 0, 0, 1, 3);
+	GravePreview = new QLabel(GBoxGrave);
+	GravePreview->setScaledContents(false);
+	GBGLayout->addWidget(GravePreview, 1, 1);
+	pageLayout->addWidget(GBoxGrave, 0, 2, 2, 1);
+
+	GBoxFort = new QGroupBox(this);
+	GBoxFort->setTitle(QGroupBox::tr("Fort"));
+	QGridLayout * GBFLayout = new QGridLayout(GBoxFort);
+	CBFort = new QComboBox(GBoxFort);
+	CBFort->setMaxCount(65535);
+	GBFLayout->addWidget(CBFort, 0, 0);
+	FortPreview	= new SquareLabel(GBoxFort);
+	FortPreview->setPixmap(QPixmap());
+	FortPreview->setScaledContents(true);
+	GBFLayout->addWidget(FortPreview, 1, 0);
+	pageLayout->addWidget(GBoxFort, 2, 2, 1, 1);
+
+	BtnTeamSave	= new QPushButton(this);
+	BtnTeamSave->setFont(*font14);
+	BtnTeamSave->setText(QPushButton::tr("Save"));
+	pageLayout->addWidget(BtnTeamSave, 4, 2);
+
+
+	QDir tmpdir;
+	tmpdir.cd(datadir->absolutePath());
+	tmpdir.cd("Forts");
+	tmpdir.setFilter(QDir::Files);
+
+	CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L.png"), "\\1"));
+	tmpdir.cd("../Graphics/Graves");
+	QStringList list = tmpdir.entryList(QStringList("*.png"));
+	for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
+	{
+		CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1"));
+	}
+
+	connect(CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &)));
+	connect(CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &)));
+}
+
+void PageEditTeam::CBGrave_activated(const QString & gravename)
+{
+	QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + gravename + ".png");
+	GravePreview->setPixmap(pix.copy(0, 0, 32, 32));
+}
+
+void PageEditTeam::CBFort_activated(const QString & fortname)
+{
+	QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png");
+	FortPreview->setPixmap(pix);
+}
+
+PageMultiplayer::PageMultiplayer(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+
+	BtnBack = new QPushButton(this);
+	BtnBack->setFont(*font14);
+	BtnBack->setText(QPushButton::tr("Back"));
+	pageLayout->addWidget(BtnBack, 1, 0);
+	
+	//HWMapContainer* pMapContainer=new HWMapContainer(this);
+	//pageLayout->addWidget(pMapContainer, 1, 1);
+
+	gameCFG = new GameCFGWidget(this);
+	pageLayout->addWidget(gameCFG, 0, 0, 1, 2);
+	teamsSelect = new TeamSelWidget(this);
+	pageLayout->addWidget(teamsSelect, 0, 2, 1, 2);
+
+	BtnStartMPGame = new QPushButton(this);
+	BtnStartMPGame->setFont(*font14);
+	BtnStartMPGame->setText(QPushButton::tr("Start"));
+	pageLayout->addWidget(BtnStartMPGame, 1, 3);
+}
+
+PagePlayDemo::PagePlayDemo(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+	pageLayout->setColumnStretch(0, 1);
+	pageLayout->setColumnStretch(1, 2);
+	pageLayout->setColumnStretch(2, 1);
+
+	BtnBack = new QPushButton(this);
+	BtnBack->setFont(*font14);
+	BtnBack->setText(QPushButton::tr("Back"));
+	pageLayout->addWidget(BtnBack, 1, 0);
+
+	BtnPlayDemo	= new QPushButton(this);
+	BtnPlayDemo->setGeometry(QRect(240,	330, 161, 41));
+	BtnPlayDemo->setFont(*font14);
+	BtnPlayDemo->setText(QPushButton::tr("Play demo"));
+	pageLayout->addWidget(BtnPlayDemo, 1, 2);
+
+	DemosList =	new QListWidget(this);
+	DemosList->setGeometry(QRect(170, 10, 311, 311));
+	pageLayout->addWidget(DemosList, 0, 1);
+}
+
+PageOptions::PageOptions(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+	groupBox = new QGroupBox(this);
+	groupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+	groupBox->setTitle(QGroupBox::tr("Teams"));
+	pageLayout->addWidget(groupBox, 0, 0, 1, 3);
+
+	QGridLayout * GBTlayout = new QGridLayout(groupBox);
+	BtnNewTeam = new QPushButton(groupBox);
+	BtnNewTeam->setFont(*font14);
+	BtnNewTeam->setText(QPushButton::tr("New team"));
+	GBTlayout->addWidget(BtnNewTeam, 0, 0);
+
+	CBTeamName = new QComboBox(groupBox);
+	GBTlayout->addWidget(CBTeamName, 0, 1);
+
+	BtnEditTeam	= new QPushButton(groupBox);
+	BtnEditTeam->setFont(*font14);
+	BtnEditTeam->setText(QPushButton::tr("Edit team"));
+	GBTlayout->addWidget(BtnEditTeam, 0, 2);
+
+	AGGroupBox = new QGroupBox(this);
+	AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+	AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
+	pageLayout->addWidget(AGGroupBox, 1, 0, 1, 3);
+
+	QGridLayout * GBAlayout = new QGridLayout(AGGroupBox);
+	CBResolution = new QComboBox(AGGroupBox);
+	CBResolution->addItem("640x480");
+	CBResolution->addItem("800x600");
+	CBResolution->addItem("1024x768");
+	CBResolution->addItem("1280x1024");
+	GBAlayout->addWidget(CBResolution, 0, 0);
+
+	CBFullscreen = new QCheckBox(AGGroupBox);
+	CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
+	GBAlayout->addWidget(CBFullscreen, 0, 1);
+
+	CBEnableSound = new	QCheckBox(AGGroupBox);
+	CBEnableSound->setText(QCheckBox::tr("Enable sound"));
+	GBAlayout->addWidget(CBEnableSound, 0, 2);
+
+	pageLayout->addWidget(new QWidget(), 3, 0, 1, 3);
+
+	BtnSaveOptions = new QPushButton(this);
+	BtnSaveOptions->setFont(*font14);
+	BtnSaveOptions->setText(QPushButton::tr("Save"));
+	pageLayout->addWidget(BtnSaveOptions, 4, 2);
+
+	BtnBack = new QPushButton(this);
+	BtnBack->setFont(*font14);
+	BtnBack->setText(QPushButton::tr("Back"));
+	pageLayout->addWidget(BtnBack, 4, 0);
+}
+
+PageNet::PageNet(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+	pageLayout->setColumnStretch(0, 1);
+	pageLayout->setColumnStretch(1, 1);
+	pageLayout->setColumnStretch(2, 1);
+
+	NNGroupBox = new QGroupBox(this);
+	NNGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+	NNGroupBox->setTitle(QGroupBox::tr("Net options"));
+	pageLayout->addWidget(NNGroupBox, 0, 1);
+
+	pageLayout->addWidget(new QWidget(), 1, 1);
+
+	QGridLayout * GBNlayout = new QGridLayout(NNGroupBox);
+	labelNN = new QLabel(NNGroupBox);
+	labelNN->setText(QLabel::tr("Net nick"));
+	GBNlayout->addWidget(labelNN, 0, 0);
+
+	editNetNick	= new QLineEdit(NNGroupBox);
+	editNetNick->setMaxLength(20);
+	editNetNick->setText(QLineEdit::tr("unnamed"));
+	GBNlayout->addWidget(editNetNick, 0, 1);
+
+	labelIP = new QLabel(NNGroupBox);
+	labelIP->setText(QLabel::tr("Server address"));
+	GBNlayout->addWidget(labelIP, 1, 0);
+
+	editIP = new QLineEdit(NNGroupBox);
+	editIP->setMaxLength(50);
+	GBNlayout->addWidget(editIP, 1, 1);
+
+	BtnNetConnect = new	QPushButton(this);
+	BtnNetConnect->setFont(*font14);
+	BtnNetConnect->setText(QPushButton::tr("Connect"));
+	pageLayout->addWidget(BtnNetConnect, 2, 2);
+
+	BtnBack = new QPushButton(this);
+	BtnBack->setFont(*font14);
+	BtnBack->setText(QPushButton::tr("Back"));
+	pageLayout->addWidget(BtnBack, 2, 0);
+}
+
+PageNetChat::PageNetChat(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+	pageLayout->setColumnStretch(0, 1);
+	pageLayout->setColumnStretch(1, 1);
+	pageLayout->setColumnStretch(2, 1);
+
+	BtnDisconnect = new QPushButton(this);
+	BtnDisconnect->setFont(*font14);
+	BtnDisconnect->setText(QPushButton::tr("Disconnect"));
+	pageLayout->addWidget(BtnDisconnect, 2, 0);
+
+	ChannelsList = new QListWidget(this);
+	pageLayout->addWidget(ChannelsList, 0, 1);
+
+	BtnJoin = new QPushButton(this);
+	BtnJoin->setFont(*font14);
+	BtnJoin->setText(QPushButton::tr("Join"));
+	pageLayout->addWidget(BtnJoin, 2, 2);
+
+	BtnCreate = new QPushButton(this);
+	BtnCreate->setFont(*font14);
+	BtnCreate->setText(QPushButton::tr("Create"));
+	pageLayout->addWidget(BtnCreate, 1, 2);
+}
+
+
+PageNetGame::PageNetGame(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+	pageLayout->setColumnStretch(0, 1);
+	pageLayout->setColumnStretch(1, 1);
+	pageLayout->setColumnStretch(2, 1);
+
+	BtnBack = new QPushButton(this);
+	BtnBack->setFont(*font14);
+	BtnBack->setText(QPushButton::tr("Back"));
+	pageLayout->addWidget(BtnBack, 2, 0);
+
+	BtnAddTeam = new QPushButton(this);
+	BtnAddTeam->setFont(*font14);
+	BtnAddTeam->setText(QPushButton::tr("Add Team"));
+	pageLayout->addWidget(BtnAddTeam, 1, 1);
+
+	BtnGo	= new QPushButton(this);
+	BtnGo->setFont(*font14);
+	BtnGo->setText(QPushButton::tr("Go!"));
+	pageLayout->addWidget(BtnGo, 2, 2);
+
+	listNetTeams = new QListWidget(this);
+	pageLayout->addWidget(listNetTeams, 0, 1);
+}
--- a/QTfrontend/pages.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/pages.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,186 +1,186 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef PAGES_H
-#define PAGES_H
-
-#include <QWidget>
-
-#include "binds.h"
-
-class GameCFGWidget;
-class QPushButton;
-class QGroupBox;
-class QComboBox;
-class QLabel;
-class QToolBox;
-class QLineEdit;
-class TeamSelWidget;
-class DemosList;
-class QListWidget;
-class QCheckBox;
-class SquareLabel;
-
-class PageMain : public QWidget
-{
-	Q_OBJECT
-
-public:
-	PageMain(QWidget* parent = 0);
-
-	QPushButton *BtnSinglePlayer;
-	QPushButton *BtnMultiplayer;
-	QPushButton *BtnNet;
-	QPushButton *BtnSetup;
-	QPushButton *BtnDemos;
-	QPushButton *BtnExit;
-};
-
-class PageLocalGame : public QWidget
-{
-	Q_OBJECT
-
-public:
-	PageLocalGame(QWidget* parent = 0);
-
-	QPushButton *BtnSimpleGame;
-	QPushButton *BtnBack;
-	GameCFGWidget *gameCFG;
-};
-
-class PageEditTeam : public QWidget
-{
-	Q_OBJECT
-
-public:
-	PageEditTeam(QWidget* parent = 0);
-	QGroupBox *GBoxHedgehogs;
-	QGroupBox *GBoxTeam;
-	QGroupBox *GBoxFort;
-	QComboBox *CBFort;
-	SquareLabel *FortPreview;
-	QGroupBox *GBoxGrave;
-	QComboBox *CBGrave;
-	QLabel *GravePreview;
-	QGroupBox *GBoxBinds;
-	QToolBox *BindsBox;
-	QWidget *page_A;
-	QWidget *page_W;
-	QWidget *page_WP;
-	QWidget *page_O;
-	QPushButton *BtnTeamDiscard;
-	QPushButton *BtnTeamSave;
-	QLineEdit * TeamNameEdit;
-	QLineEdit * HHNameEdit[8];
-	QComboBox * CBBind[BINDS_NUMBER];
-
-public slots:
-	void CBGrave_activated(const QString & gravename);
-	void CBFort_activated(const QString & gravename);
-
-private:
-	QLabel * LBind[BINDS_NUMBER];
-};
-
-class PageMultiplayer : public QWidget
-{
-	Q_OBJECT
-
-public:
-	PageMultiplayer(QWidget* parent = 0);
-
-	QPushButton *BtnBack;
-	GameCFGWidget *gameCFG;
-	TeamSelWidget *teamsSelect;
-	QPushButton *BtnStartMPGame;
-};
-
-class PagePlayDemo : public QWidget
-{
-	Q_OBJECT
-
-public:
-	PagePlayDemo(QWidget* parent = 0);
-
-	QPushButton *BtnBack;
-	QPushButton *BtnPlayDemo;
-	QListWidget *DemosList;
-};
-
-class PageOptions : public QWidget
-{
-	Q_OBJECT
-
-public:
-	PageOptions(QWidget* parent = 0);
-
-	QPushButton *BtnBack;
-	QGroupBox *groupBox;
-	QPushButton *BtnNewTeam;
-	QPushButton *BtnEditTeam;
-	QComboBox *CBTeamName;
-	QGroupBox *AGGroupBox;
-	QComboBox *CBResolution;
-	QCheckBox *CBEnableSound;
-	QCheckBox *CBFullscreen;
-	QPushButton *BtnSaveOptions;
-};
-
-class PageNet : public QWidget
-{
-	Q_OBJECT
-
-public:
-	PageNet(QWidget* parent = 0);
-
-	QPushButton *BtnBack;
-	QPushButton *BtnNetConnect;
-	QGroupBox *NNGroupBox;
-	QLabel *labelNN;
-	QLineEdit *editNetNick;
-	QLabel *labelIP;
-	QLineEdit * editIP;
-};
-
-class PageNetChat : public QWidget
-{
-	Q_OBJECT
-
-public:
-	PageNetChat(QWidget* parent = 0);
-
-	QPushButton *BtnDisconnect;
-	QListWidget *ChannelsList;
-	QPushButton *BtnJoin;
-	QPushButton *BtnCreate;
-};
-
-class PageNetGame : public QWidget
-{
-	Q_OBJECT
-
-public:
-	PageNetGame(QWidget* parent = 0);
-
-	QPushButton *BtnBack;
-	QPushButton *BtnAddTeam;
-	QPushButton *BtnGo;
-	QListWidget *listNetTeams;
-};
-
-#endif // PAGES_H
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef PAGES_H
+#define PAGES_H
+
+#include <QWidget>
+
+#include "binds.h"
+
+class GameCFGWidget;
+class QPushButton;
+class QGroupBox;
+class QComboBox;
+class QLabel;
+class QToolBox;
+class QLineEdit;
+class TeamSelWidget;
+class DemosList;
+class QListWidget;
+class QCheckBox;
+class SquareLabel;
+
+class PageMain : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PageMain(QWidget* parent = 0);
+
+	QPushButton *BtnSinglePlayer;
+	QPushButton *BtnMultiplayer;
+	QPushButton *BtnNet;
+	QPushButton *BtnSetup;
+	QPushButton *BtnDemos;
+	QPushButton *BtnExit;
+};
+
+class PageLocalGame : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PageLocalGame(QWidget* parent = 0);
+
+	QPushButton *BtnSimpleGame;
+	QPushButton *BtnBack;
+	GameCFGWidget *gameCFG;
+};
+
+class PageEditTeam : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PageEditTeam(QWidget* parent = 0);
+	QGroupBox *GBoxHedgehogs;
+	QGroupBox *GBoxTeam;
+	QGroupBox *GBoxFort;
+	QComboBox *CBFort;
+	SquareLabel *FortPreview;
+	QGroupBox *GBoxGrave;
+	QComboBox *CBGrave;
+	QLabel *GravePreview;
+	QGroupBox *GBoxBinds;
+	QToolBox *BindsBox;
+	QWidget *page_A;
+	QWidget *page_W;
+	QWidget *page_WP;
+	QWidget *page_O;
+	QPushButton *BtnTeamDiscard;
+	QPushButton *BtnTeamSave;
+	QLineEdit * TeamNameEdit;
+	QLineEdit * HHNameEdit[8];
+	QComboBox * CBBind[BINDS_NUMBER];
+
+public slots:
+	void CBGrave_activated(const QString & gravename);
+	void CBFort_activated(const QString & gravename);
+
+private:
+	QLabel * LBind[BINDS_NUMBER];
+};
+
+class PageMultiplayer : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PageMultiplayer(QWidget* parent = 0);
+
+	QPushButton *BtnBack;
+	GameCFGWidget *gameCFG;
+	TeamSelWidget *teamsSelect;
+	QPushButton *BtnStartMPGame;
+};
+
+class PagePlayDemo : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PagePlayDemo(QWidget* parent = 0);
+
+	QPushButton *BtnBack;
+	QPushButton *BtnPlayDemo;
+	QListWidget *DemosList;
+};
+
+class PageOptions : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PageOptions(QWidget* parent = 0);
+
+	QPushButton *BtnBack;
+	QGroupBox *groupBox;
+	QPushButton *BtnNewTeam;
+	QPushButton *BtnEditTeam;
+	QComboBox *CBTeamName;
+	QGroupBox *AGGroupBox;
+	QComboBox *CBResolution;
+	QCheckBox *CBEnableSound;
+	QCheckBox *CBFullscreen;
+	QPushButton *BtnSaveOptions;
+};
+
+class PageNet : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PageNet(QWidget* parent = 0);
+
+	QPushButton *BtnBack;
+	QPushButton *BtnNetConnect;
+	QGroupBox *NNGroupBox;
+	QLabel *labelNN;
+	QLineEdit *editNetNick;
+	QLabel *labelIP;
+	QLineEdit * editIP;
+};
+
+class PageNetChat : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PageNetChat(QWidget* parent = 0);
+
+	QPushButton *BtnDisconnect;
+	QListWidget *ChannelsList;
+	QPushButton *BtnJoin;
+	QPushButton *BtnCreate;
+};
+
+class PageNetGame : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PageNetGame(QWidget* parent = 0);
+
+	QPushButton *BtnBack;
+	QPushButton *BtnAddTeam;
+	QPushButton *BtnGo;
+	QListWidget *listNetTeams;
+};
+
+#endif // PAGES_H
--- a/QTfrontend/predefteams.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/predefteams.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,82 +1,82 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef PREDEFTEAMS_H
-#define PREDEFTEAMS_H
-
-#include <QtGlobal>
-
-#define PREDEFTEAMS_COUNT 3
-
-struct PredefinedTeam
-{
-	const char * TeamName;
-	const char * hh0name;
-	const char * hh1name;
-	const char * hh2name;
-	const char * hh3name;
-	const char * hh4name;
-	const char * hh5name;
-	const char * hh6name;
-	const char * hh7name;
-	QString Grave;
-	QString Fort;
-};
-
-
-const PredefinedTeam pteams[PREDEFTEAMS_COUNT] =
-{
-	{
-		QT_TRANSLATE_NOOP("teams", "Hedgehogs"),
-		QT_TRANSLATE_NOOP("teams", "hedgehog 1"),
-		QT_TRANSLATE_NOOP("teams", "hedgehog 2"),
-		QT_TRANSLATE_NOOP("teams", "hedgehog 3"),
-		QT_TRANSLATE_NOOP("teams", "hedgehog 4"),
-		QT_TRANSLATE_NOOP("teams", "hedgehog 5"),
-		QT_TRANSLATE_NOOP("teams", "hedgehog 6"),
-		QT_TRANSLATE_NOOP("teams", "hedgehog 7"),
-		QT_TRANSLATE_NOOP("teams", "hedgehog 8"),
-		"Simple", "Island"
-	},
-	{
-		QT_TRANSLATE_NOOP("teams", "Goddess"),
-		QT_TRANSLATE_NOOP("teams", "Isis"),
-		QT_TRANSLATE_NOOP("teams", "Astarte"),
-		QT_TRANSLATE_NOOP("teams", "Diana"),
-		QT_TRANSLATE_NOOP("teams", "Aphrodite"),
-		QT_TRANSLATE_NOOP("teams", "Hecate"),
-		QT_TRANSLATE_NOOP("teams", "Demeter"),
-		QT_TRANSLATE_NOOP("teams", "Kali"),
-		QT_TRANSLATE_NOOP("teams", "Inanna"),
-		"Bone", "Island"
-	},
-	{
-		QT_TRANSLATE_NOOP("teams", "Fruits"),
-		QT_TRANSLATE_NOOP("teams", "Banana"),
-		QT_TRANSLATE_NOOP("teams", "Apple"),
-		QT_TRANSLATE_NOOP("teams", "Orange"),
-		QT_TRANSLATE_NOOP("teams", "Lemon"),
-		QT_TRANSLATE_NOOP("teams", "Pineapple"),
-		QT_TRANSLATE_NOOP("teams", "Mango"),
-		QT_TRANSLATE_NOOP("teams", "Peach"),
-		QT_TRANSLATE_NOOP("teams", "Plum"),
-		"coffin", "Barrelhouse"
-	}
-};
-
-#endif // PREDEFTEAMS_H
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef PREDEFTEAMS_H
+#define PREDEFTEAMS_H
+
+#include <QtGlobal>
+
+#define PREDEFTEAMS_COUNT 3
+
+struct PredefinedTeam
+{
+	const char * TeamName;
+	const char * hh0name;
+	const char * hh1name;
+	const char * hh2name;
+	const char * hh3name;
+	const char * hh4name;
+	const char * hh5name;
+	const char * hh6name;
+	const char * hh7name;
+	QString Grave;
+	QString Fort;
+};
+
+
+const PredefinedTeam pteams[PREDEFTEAMS_COUNT] =
+{
+	{
+		QT_TRANSLATE_NOOP("teams", "Hedgehogs"),
+		QT_TRANSLATE_NOOP("teams", "hedgehog 1"),
+		QT_TRANSLATE_NOOP("teams", "hedgehog 2"),
+		QT_TRANSLATE_NOOP("teams", "hedgehog 3"),
+		QT_TRANSLATE_NOOP("teams", "hedgehog 4"),
+		QT_TRANSLATE_NOOP("teams", "hedgehog 5"),
+		QT_TRANSLATE_NOOP("teams", "hedgehog 6"),
+		QT_TRANSLATE_NOOP("teams", "hedgehog 7"),
+		QT_TRANSLATE_NOOP("teams", "hedgehog 8"),
+		"Simple", "Island"
+	},
+	{
+		QT_TRANSLATE_NOOP("teams", "Goddess"),
+		QT_TRANSLATE_NOOP("teams", "Isis"),
+		QT_TRANSLATE_NOOP("teams", "Astarte"),
+		QT_TRANSLATE_NOOP("teams", "Diana"),
+		QT_TRANSLATE_NOOP("teams", "Aphrodite"),
+		QT_TRANSLATE_NOOP("teams", "Hecate"),
+		QT_TRANSLATE_NOOP("teams", "Demeter"),
+		QT_TRANSLATE_NOOP("teams", "Kali"),
+		QT_TRANSLATE_NOOP("teams", "Inanna"),
+		"Bone", "Island"
+	},
+	{
+		QT_TRANSLATE_NOOP("teams", "Fruits"),
+		QT_TRANSLATE_NOOP("teams", "Banana"),
+		QT_TRANSLATE_NOOP("teams", "Apple"),
+		QT_TRANSLATE_NOOP("teams", "Orange"),
+		QT_TRANSLATE_NOOP("teams", "Lemon"),
+		QT_TRANSLATE_NOOP("teams", "Pineapple"),
+		QT_TRANSLATE_NOOP("teams", "Mango"),
+		QT_TRANSLATE_NOOP("teams", "Peach"),
+		QT_TRANSLATE_NOOP("teams", "Plum"),
+		"coffin", "Barrelhouse"
+	}
+};
+
+#endif // PREDEFTEAMS_H
--- a/QTfrontend/sdlkeys.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/sdlkeys.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,148 +1,148 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-char sdlkeys[][2][16] = 
-{
-	{"mousel",	"mousel"},
-	{"mousem",	"mousem"},
-	{"mouser",	"mouser"},
-	{"backspace",	"backspace"},
-	{"tab",	"tab"},
-	{"clear",	"clear"},
-	{"return",	"return"},
-	{"pause",	"pause"},
-	{"escape",	"escape"},
-	{"space",	"space"},
-	{"!",	"!"},
-	{"\"",	"\""},
-	{"#",	"#"},
-	{"$",	"$"},
-	{"&",	"&"},
-	{"'",	"'"},
-	{"(",	"("},
-	{")",	")"},
-	{"*",	"*"},
-	{"+",	"+"},
-	{",",	","},
-	{"-",	"-"},
-	{".",	"."},
-	{"/",	"/"},
-	{"0",	"0"},
-	{"1",	"1"},
-	{"2",	"2"},
-	{"3",	"3"},
-	{"4",	"4"},
-	{"5",	"5"},
-	{"6",	"6"},
-	{"7",	"7"},
-	{"8",	"8"},
-	{"9",	"9"},
-	{":",	":"},
-	{";",	";"},
-	{"<",	"<"},
-	{"=",	"="},
-	{">",	">"},
-	{"?",	"?"},
-	{"@",	"@"},
-	{"[",	"["},
-	{"\\",	"\\"},
-	{"]",	"]"},
-	{"^",	"^"},
-	{"_",	"_"},
-	{"`",	"`"},
-	{"a",	"a"},
-	{"b",	"b"},
-	{"c",	"c"},
-	{"d",	"d"},
-	{"e",	"e"},
-	{"f",	"f"},
-	{"g",	"g"},
-	{"h",	"h"},
-	{"i",	"i"},
-	{"j",	"j"},
-	{"k",	"k"},
-	{"l",	"l"},
-	{"m",	"m"},
-	{"n",	"n"},
-	{"o",	"o"},
-	{"p",	"p"},
-	{"q",	"q"},
-	{"r",	"r"},
-	{"s",	"s"},
-	{"t",	"t"},
-	{"u",	"u"},
-	{"v",	"v"},
-	{"w",	"w"},
-	{"x",	"x"},
-	{"y",	"y"},
-	{"z",	"z"},
-	{"delete",	"delete"},
-	{"[0]",	"[0]"},
-	{"[1]",	"[1]"},
-	{"[2]",	"[2]"},
-	{"[3]",	"[3]"},
-	{"[4]",	"[4]"},
-	{"[5]",	"[5]"},
-	{"[6]",	"[6]"},
-	{"[7]",	"[7]"},
-	{"[8]",	"[8]"},
-	{"[9]",	"[9]"},
-	{"[.]",	"[.]"},
-	{"[/]",	"[/]"},
-	{"[*]",	"[*]"},
-	{"[-]",	"[-]"},
-	{"[+]",	"[+]"},
-	{"enter",	"enter"},
-	{"equals",	"equals"},
-	{"up",	"up"},
-	{"down",	"down"},
-	{"right",	"right"},
-	{"left",	"left"},
-	{"insert",	"insert"},
-	{"home",	"home"},
-	{"end",	"end"},
-	{"page up",	"page up"},
-	{"page down",	"page down"},
-	{"f1",	"f1"},
-	{"f2",	"f2"},
-	{"f3",	"f3"},
-	{"f4",	"f4"},
-	{"f5",	"f5"},
-	{"f6",	"f6"},
-	{"f7",	"f7"},
-	{"f8",	"f8"},
-	{"f9",	"f9"},
-	{"f10",	"f10"},
-	{"f11",	"f11"},
-	{"f12",	"f12"},
-	{"f13",	"f13"},
-	{"f14",	"f14"},
-	{"f15",	"f15"},
-	{"numlock",	"numlock"},
-	{"caps_lock",	"caps_lock"},
-	{"scroll_lock",	"scroll_lock"},
-	{"right_shift",	"right_shift"},
-	{"left_shift",	"left_shift"},
-	{"right_ctrl",	"right_ctrl"},
-	{"left_ctrl",	"left_ctrl"},
-	{"right_alt",	"right_alt"},
-	{"left_alt",	"left_alt"},
-	{"right_meta",	"right_meta"},
-	{"left_meta",	"left_meta"},
-	{"", ""}
-};
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+char sdlkeys[][2][16] = 
+{
+	{"mousel",	"mousel"},
+	{"mousem",	"mousem"},
+	{"mouser",	"mouser"},
+	{"backspace",	"backspace"},
+	{"tab",	"tab"},
+	{"clear",	"clear"},
+	{"return",	"return"},
+	{"pause",	"pause"},
+	{"escape",	"escape"},
+	{"space",	"space"},
+	{"!",	"!"},
+	{"\"",	"\""},
+	{"#",	"#"},
+	{"$",	"$"},
+	{"&",	"&"},
+	{"'",	"'"},
+	{"(",	"("},
+	{")",	")"},
+	{"*",	"*"},
+	{"+",	"+"},
+	{",",	","},
+	{"-",	"-"},
+	{".",	"."},
+	{"/",	"/"},
+	{"0",	"0"},
+	{"1",	"1"},
+	{"2",	"2"},
+	{"3",	"3"},
+	{"4",	"4"},
+	{"5",	"5"},
+	{"6",	"6"},
+	{"7",	"7"},
+	{"8",	"8"},
+	{"9",	"9"},
+	{":",	":"},
+	{";",	";"},
+	{"<",	"<"},
+	{"=",	"="},
+	{">",	">"},
+	{"?",	"?"},
+	{"@",	"@"},
+	{"[",	"["},
+	{"\\",	"\\"},
+	{"]",	"]"},
+	{"^",	"^"},
+	{"_",	"_"},
+	{"`",	"`"},
+	{"a",	"a"},
+	{"b",	"b"},
+	{"c",	"c"},
+	{"d",	"d"},
+	{"e",	"e"},
+	{"f",	"f"},
+	{"g",	"g"},
+	{"h",	"h"},
+	{"i",	"i"},
+	{"j",	"j"},
+	{"k",	"k"},
+	{"l",	"l"},
+	{"m",	"m"},
+	{"n",	"n"},
+	{"o",	"o"},
+	{"p",	"p"},
+	{"q",	"q"},
+	{"r",	"r"},
+	{"s",	"s"},
+	{"t",	"t"},
+	{"u",	"u"},
+	{"v",	"v"},
+	{"w",	"w"},
+	{"x",	"x"},
+	{"y",	"y"},
+	{"z",	"z"},
+	{"delete",	"delete"},
+	{"[0]",	"[0]"},
+	{"[1]",	"[1]"},
+	{"[2]",	"[2]"},
+	{"[3]",	"[3]"},
+	{"[4]",	"[4]"},
+	{"[5]",	"[5]"},
+	{"[6]",	"[6]"},
+	{"[7]",	"[7]"},
+	{"[8]",	"[8]"},
+	{"[9]",	"[9]"},
+	{"[.]",	"[.]"},
+	{"[/]",	"[/]"},
+	{"[*]",	"[*]"},
+	{"[-]",	"[-]"},
+	{"[+]",	"[+]"},
+	{"enter",	"enter"},
+	{"equals",	"equals"},
+	{"up",	"up"},
+	{"down",	"down"},
+	{"right",	"right"},
+	{"left",	"left"},
+	{"insert",	"insert"},
+	{"home",	"home"},
+	{"end",	"end"},
+	{"page up",	"page up"},
+	{"page down",	"page down"},
+	{"f1",	"f1"},
+	{"f2",	"f2"},
+	{"f3",	"f3"},
+	{"f4",	"f4"},
+	{"f5",	"f5"},
+	{"f6",	"f6"},
+	{"f7",	"f7"},
+	{"f8",	"f8"},
+	{"f9",	"f9"},
+	{"f10",	"f10"},
+	{"f11",	"f11"},
+	{"f12",	"f12"},
+	{"f13",	"f13"},
+	{"f14",	"f14"},
+	{"f15",	"f15"},
+	{"numlock",	"numlock"},
+	{"caps_lock",	"caps_lock"},
+	{"scroll_lock",	"scroll_lock"},
+	{"right_shift",	"right_shift"},
+	{"left_shift",	"left_shift"},
+	{"right_ctrl",	"right_ctrl"},
+	{"left_ctrl",	"left_ctrl"},
+	{"right_alt",	"right_alt"},
+	{"left_alt",	"left_alt"},
+	{"right_meta",	"right_meta"},
+	{"left_meta",	"left_meta"},
+	{"", ""}
+};
--- a/QTfrontend/tcpBase.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/tcpBase.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,151 +1,151 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "tcpBase.h"
-
-#include <QMessageBox>
-#include <QList>
-
-#include <QImage>
-#include <QTimer>
-
-#include "hwconsts.h"
-
-QList<TCPBase*> srvsList;
-
-TCPBase::TCPBase(bool demoMode) :
-  m_isDemoMode(demoMode)
-{
-  IPCServer = new QTcpServer(this);
-  connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
-  IPCServer->setMaxPendingConnections(1);
-}
-
-void TCPBase::NewConnection()
-{
-  QTcpSocket * client = IPCServer->nextPendingConnection();
-  if(!IPCSocket) {
-    IPCServer->close();
-    IPCSocket = client;
-    connect(client, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
-    connect(client, SIGNAL(readyRead()), this, SLOT(ClientRead()));
-    SendToClientFirst();
-  } else {
-    qWarning("2nd IPC client?!");
-    client->disconnectFromHost();
-  }
-}
-
-void TCPBase::RealStart()
-{
-  IPCSocket = 0;
-  if (!IPCServer->listen(QHostAddress::LocalHost, IPC_PORT)) {
-    QMessageBox::critical(0, tr("Error"),
-			  tr("Unable to start the server: %1.")
-			  .arg(IPCServer->errorString()));
-  }
-
-  QProcess * process;
-  process = new QProcess;
-  connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError)));
-  QStringList arguments=setArguments();
-  process->start(bindir->absolutePath() + "/hwengine", arguments);
-}
-
-void TCPBase::ClientDisconnect()
-{
-  IPCSocket->close();
-  IPCServer->close();
-
-  onClientDisconnect();
-
-  readbuffer.clear();
-
-  if(srvsList.size()==1) srvsList.pop_front();
-  emit isReadyNow();
-}
-
-void TCPBase::ClientRead()
-{
-  readbuffer.append(IPCSocket->readAll());
-  onClientRead();
-}
-
-void TCPBase::StartProcessError(QProcess::ProcessError error)
-{
-  QMessageBox::critical(0, tr("Error"),
-			tr("Unable to run engine: %1 (")
-			.arg(error) + bindir->absolutePath() + "/hwengine)");
-}
-
-void TCPBase::tcpServerReady()
-{
-  disconnect(srvsList.front(), SIGNAL(isReadyNow()), *(++srvsList.begin()), SLOT(tcpServerReady()));
-  srvsList.pop_front();
-
-  QTimer::singleShot(150, this, SLOT(RealStart()));
-}
-
-void TCPBase::Start()
-{
-  if(srvsList.isEmpty()) {
-    srvsList.push_back(this);
-  } else {
-    connect(srvsList.back(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
-    srvsList.push_back(this);
-    return;
-  }
-  RealStart();
-}
-
-void TCPBase::onClientRead()
-{
-}
-
-void TCPBase::onClientDisconnect()
-{
-}
-
-void TCPBase::SendToClientFirst()
-{
-}
-
-void TCPBase::SendIPC(const QByteArray & buf)
-{
-	if (buf.size() > MAXMSGCHARS) return;
-	quint8 len = buf.size();
-	RawSendIPC(QByteArray::fromRawData((char *)&len, 1) + buf);
-}
-
-void TCPBase::RawSendIPC(const QByteArray & buf)
-{
-	if (!IPCSocket)
-	{
-		toSendBuf += buf;
-	} else
-	{
-		if (toSendBuf.size() > 0)
-		{
-			IPCSocket->write(toSendBuf);
-			if(m_isDemoMode) demo->append(toSendBuf);
-			toSendBuf.clear();
-		}
-		IPCSocket->write(buf);
-		if(m_isDemoMode) demo->append(buf);
-	}
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "tcpBase.h"
+
+#include <QMessageBox>
+#include <QList>
+
+#include <QImage>
+#include <QTimer>
+
+#include "hwconsts.h"
+
+QList<TCPBase*> srvsList;
+
+TCPBase::TCPBase(bool demoMode) :
+  m_isDemoMode(demoMode)
+{
+  IPCServer = new QTcpServer(this);
+  connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
+  IPCServer->setMaxPendingConnections(1);
+}
+
+void TCPBase::NewConnection()
+{
+  QTcpSocket * client = IPCServer->nextPendingConnection();
+  if(!IPCSocket) {
+    IPCServer->close();
+    IPCSocket = client;
+    connect(client, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
+    connect(client, SIGNAL(readyRead()), this, SLOT(ClientRead()));
+    SendToClientFirst();
+  } else {
+    qWarning("2nd IPC client?!");
+    client->disconnectFromHost();
+  }
+}
+
+void TCPBase::RealStart()
+{
+  IPCSocket = 0;
+  if (!IPCServer->listen(QHostAddress::LocalHost, IPC_PORT)) {
+    QMessageBox::critical(0, tr("Error"),
+			  tr("Unable to start the server: %1.")
+			  .arg(IPCServer->errorString()));
+  }
+
+  QProcess * process;
+  process = new QProcess;
+  connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError)));
+  QStringList arguments=setArguments();
+  process->start(bindir->absolutePath() + "/hwengine", arguments);
+}
+
+void TCPBase::ClientDisconnect()
+{
+  IPCSocket->close();
+  IPCServer->close();
+
+  onClientDisconnect();
+
+  readbuffer.clear();
+
+  if(srvsList.size()==1) srvsList.pop_front();
+  emit isReadyNow();
+}
+
+void TCPBase::ClientRead()
+{
+  readbuffer.append(IPCSocket->readAll());
+  onClientRead();
+}
+
+void TCPBase::StartProcessError(QProcess::ProcessError error)
+{
+  QMessageBox::critical(0, tr("Error"),
+			tr("Unable to run engine: %1 (")
+			.arg(error) + bindir->absolutePath() + "/hwengine)");
+}
+
+void TCPBase::tcpServerReady()
+{
+  disconnect(srvsList.front(), SIGNAL(isReadyNow()), *(++srvsList.begin()), SLOT(tcpServerReady()));
+  srvsList.pop_front();
+
+  QTimer::singleShot(150, this, SLOT(RealStart()));
+}
+
+void TCPBase::Start()
+{
+  if(srvsList.isEmpty()) {
+    srvsList.push_back(this);
+  } else {
+    connect(srvsList.back(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
+    srvsList.push_back(this);
+    return;
+  }
+  RealStart();
+}
+
+void TCPBase::onClientRead()
+{
+}
+
+void TCPBase::onClientDisconnect()
+{
+}
+
+void TCPBase::SendToClientFirst()
+{
+}
+
+void TCPBase::SendIPC(const QByteArray & buf)
+{
+	if (buf.size() > MAXMSGCHARS) return;
+	quint8 len = buf.size();
+	RawSendIPC(QByteArray::fromRawData((char *)&len, 1) + buf);
+}
+
+void TCPBase::RawSendIPC(const QByteArray & buf)
+{
+	if (!IPCSocket)
+	{
+		toSendBuf += buf;
+	} else
+	{
+		if (toSendBuf.size() > 0)
+		{
+			IPCSocket->write(toSendBuf);
+			if(m_isDemoMode) demo->append(toSendBuf);
+			toSendBuf.clear();
+		}
+		IPCSocket->write(buf);
+		if(m_isDemoMode) demo->append(buf);
+	}
+}
--- a/QTfrontend/tcpBase.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/tcpBase.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,76 +1,76 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef _TCPBASE_INCLUDED
-#define _TCPBASE_INCLUDED
-
-#include <QObject>
-#include <QTcpServer>
-#include <QTcpSocket>
-#include <QByteArray>
-#include <QString>
-#include <QDir>
-#include <QProcess>
-
-#include <QImage>
-
-#define IPC_PORT 46631
-#define MAXMSGCHARS 255
-
-class TCPBase : public QObject
-{
-  Q_OBJECT
-
- public:
-  TCPBase(bool demoMode);
-
- signals:
-  void isReadyNow();
-
- protected:
-  void Start();
-
-  QByteArray readbuffer;
-
-  QByteArray toSendBuf;
-  QByteArray * demo;
-
-  void SendIPC(const QByteArray & buf);
-  void RawSendIPC(const QByteArray & buf);
-
-  virtual QStringList setArguments()=0;
-  virtual void onClientRead();
-  virtual void onClientDisconnect();
-  virtual void SendToClientFirst();
-
- private:
-  bool m_isDemoMode;
-  QTcpServer * IPCServer;
-  QTcpSocket * IPCSocket;
-
- private slots:
-  void RealStart();
-  void NewConnection();
-  void ClientDisconnect();
-  void ClientRead();
-  void StartProcessError(QProcess::ProcessError error);
-
-  void tcpServerReady();
-};
-
-#endif // _TCPBASE_INCLUDED
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef _TCPBASE_INCLUDED
+#define _TCPBASE_INCLUDED
+
+#include <QObject>
+#include <QTcpServer>
+#include <QTcpSocket>
+#include <QByteArray>
+#include <QString>
+#include <QDir>
+#include <QProcess>
+
+#include <QImage>
+
+#define IPC_PORT 46631
+#define MAXMSGCHARS 255
+
+class TCPBase : public QObject
+{
+  Q_OBJECT
+
+ public:
+  TCPBase(bool demoMode);
+
+ signals:
+  void isReadyNow();
+
+ protected:
+  void Start();
+
+  QByteArray readbuffer;
+
+  QByteArray toSendBuf;
+  QByteArray * demo;
+
+  void SendIPC(const QByteArray & buf);
+  void RawSendIPC(const QByteArray & buf);
+
+  virtual QStringList setArguments()=0;
+  virtual void onClientRead();
+  virtual void onClientDisconnect();
+  virtual void SendToClientFirst();
+
+ private:
+  bool m_isDemoMode;
+  QTcpServer * IPCServer;
+  QTcpSocket * IPCSocket;
+
+ private slots:
+  void RealStart();
+  void NewConnection();
+  void ClientDisconnect();
+  void ClientRead();
+  void StartProcessError(QProcess::ProcessError error);
+
+  void tcpServerReady();
+};
+
+#endif // _TCPBASE_INCLUDED
--- a/QTfrontend/team.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/team.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,201 +1,201 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QFile>
-#include <QTextStream>
-#include <QApplication>
-#include "team.h"
-#include "hwform.h"
-#include "predefteams.h"
-#include "pages.h"
-#include "hwconsts.h"
-
-HWTeam::HWTeam(const QString & teamname)
-{
-	TeamName = teamname;
-	for (int i = 0; i < 8; i++) HHName[i].sprintf("hedgehog %d", i);
-	Grave = "Simple";
-	Fort = "Barrelhouse";
-	for(int i = 0; i < BINDS_NUMBER; i++)
-	{
-		binds[i].action = cbinds[i].action;
-		binds[i].strbind = cbinds[i].strbind;
-	}
-}
-
-HWTeam::HWTeam(quint8 num)
-{
-	num %= PREDEFTEAMS_COUNT;
-	TeamName = QApplication::translate("teams", pteams[num].TeamName);
-	HHName[0] = QApplication::translate("teams", pteams[num].hh0name);
-	HHName[1] = QApplication::translate("teams", pteams[num].hh1name);
-	HHName[2] = QApplication::translate("teams", pteams[num].hh2name);
-	HHName[3] = QApplication::translate("teams", pteams[num].hh3name);
-	HHName[4] = QApplication::translate("teams", pteams[num].hh4name);
-	HHName[5] = QApplication::translate("teams", pteams[num].hh5name);
-	HHName[6] = QApplication::translate("teams", pteams[num].hh6name);
-	HHName[7] = QApplication::translate("teams", pteams[num].hh7name);
-	Grave = pteams[num].Grave;
-	Fort = pteams[num].Fort;
-	for(int i = 0; i < BINDS_NUMBER; i++)
-	{
-		binds[i].action = cbinds[i].action;
-		binds[i].strbind = cbinds[i].strbind;
-	}
-}
-
-
-bool HWTeam::LoadFromFile()
-{
-	QFile cfgfile(cfgdir->absolutePath() + "/" + TeamName + ".cfg");
-	if (!cfgfile.open(QIODevice::ReadOnly)) return false;
-	QTextStream stream(&cfgfile);
-	stream.setCodec("UTF-8");
-	QString str;
-	QString action;
-
-	while (!stream.atEnd())
-	{
-		str = stream.readLine();
-		if (str.startsWith(";")) continue;
-		if (str.startsWith("name team "))
-		{
-			str.remove(0, 10);
-			TeamName = str;
-		} else
-		if (str.startsWith("name hh"))
-		{
-			str.remove(0, 7);
-			long i = str.left(1).toLong();
-			if ((i < 0) || (i > 7)) continue;
-			str.remove(0, 2);
-			HHName[i] = str;
-		} else
-		if (str.startsWith("grave "))
-		{
-			str.remove(0, 6);
-			Grave = str;
-		} else
-		if (str.startsWith("fort "))
-		{
-			str.remove(0, 5);
-			Fort = str;
-		} else
-		if (str.startsWith("bind "))
-		{
-			str.remove(0, 5);
-			action = str.section(' ', 1);
-			str = str.section(' ', 0, 0);
-			str.truncate(15);
-			for (int i = 0; i < BINDS_NUMBER; i++)
-				if (action == binds[i].action)
-				{
-					binds[i].strbind = str;
-					break;
-				}
-		}
-	}
-	cfgfile.close();
-	return true;
-}
-
-bool HWTeam::SaveToFile()
-{
-	QFile cfgfile(cfgdir->absolutePath() + "/" + TeamName + ".cfg");
-	if (!cfgfile.open(QIODevice::WriteOnly)) return false;
-	QTextStream stream(&cfgfile);
-	stream.setCodec("UTF-8");
-	stream << "; Generated by Hedgewars, do not modify" << endl;
-	stream << "name team " << TeamName << endl;
-	for (int i = 0; i < 8; i++)
-		stream << "name hh" << i << " " << HHName[i] << endl;
-	stream << "grave " << Grave << endl;
-	stream << "fort " << Fort << endl;
-	for(int i = 0; i < BINDS_NUMBER; i++)
-	{
-		stream << "bind " << binds[i].strbind << " " << binds[i].action << endl;
-	}
-	cfgfile.close();
-	return true;
-}
-
-void HWTeam::SetToPage(HWForm * hwform)
-{
-	hwform->ui.pageEditTeam->TeamNameEdit->setText(TeamName);
-	for(int i = 0; i < 8; i++)
-	{
-		hwform->ui.pageEditTeam->HHNameEdit[i]->setText(HHName[i]);
-	}
-	hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave));
-	hwform->ui.pageEditTeam->CBGrave_activated(Grave);
-
-	hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(Fort));
-	hwform->ui.pageEditTeam->CBFort_activated(Fort);
-
-	for(int i = 0; i < BINDS_NUMBER; i++)
-	{
-		hwform->ui.pageEditTeam->CBBind[i]->setCurrentIndex(hwform->ui.pageEditTeam->CBBind[i]->findText(binds[i].strbind));
-	}
-}
-
-void HWTeam::GetFromPage(HWForm * hwform)
-{
-	TeamName  = hwform->ui.pageEditTeam->TeamNameEdit->text();
-	for(int i = 0; i < 8; i++)
-	{
-		HHName[i] = hwform->ui.pageEditTeam->HHNameEdit[i]->text();
-	}
-
-	Grave = hwform->ui.pageEditTeam->CBGrave->currentText();
-	Fort = hwform->ui.pageEditTeam->CBFort->currentText();
-	for(int i = 0; i < 8; i++)
-	{
-		binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->currentText();
-	}
-}
-
-QByteArray HWTeam::IPCTeamInfo() const
-{
-	QByteArray buf;
-	#define ADD(a) { \
-					QByteArray strmsg = a.toUtf8(); \
-					quint8 sz = strmsg.size(); \
-					buf.append(QByteArray((char *)&sz, 1)); \
-					buf.append(strmsg); \
-					}
-
-	ADD(QString("ename team " + TeamName));
-	for (int i = 0; i < 8; i++)
-		ADD(QString("ename hh%1 ").arg(i).append(HHName[i]));
-	ADD(QString("egrave " + Grave));
-	ADD(QString("efort " + Fort));
-	for(int i = 0; i < BINDS_NUMBER; i++)
-	{
-		ADD(QString("ebind " + binds[i].strbind + " " + binds[i].action));
-	}
-	#undef ADD
-	return buf;
-}
-
-bool HWTeam::operator==(const HWTeam& t1) const {
-  return TeamName==t1.TeamName;
-}
-
-bool HWTeam::operator<(const HWTeam& t1) const {
-  return TeamName<t1.TeamName;
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QFile>
+#include <QTextStream>
+#include <QApplication>
+#include "team.h"
+#include "hwform.h"
+#include "predefteams.h"
+#include "pages.h"
+#include "hwconsts.h"
+
+HWTeam::HWTeam(const QString & teamname)
+{
+	TeamName = teamname;
+	for (int i = 0; i < 8; i++) HHName[i].sprintf("hedgehog %d", i);
+	Grave = "Simple";
+	Fort = "Barrelhouse";
+	for(int i = 0; i < BINDS_NUMBER; i++)
+	{
+		binds[i].action = cbinds[i].action;
+		binds[i].strbind = cbinds[i].strbind;
+	}
+}
+
+HWTeam::HWTeam(quint8 num)
+{
+	num %= PREDEFTEAMS_COUNT;
+	TeamName = QApplication::translate("teams", pteams[num].TeamName);
+	HHName[0] = QApplication::translate("teams", pteams[num].hh0name);
+	HHName[1] = QApplication::translate("teams", pteams[num].hh1name);
+	HHName[2] = QApplication::translate("teams", pteams[num].hh2name);
+	HHName[3] = QApplication::translate("teams", pteams[num].hh3name);
+	HHName[4] = QApplication::translate("teams", pteams[num].hh4name);
+	HHName[5] = QApplication::translate("teams", pteams[num].hh5name);
+	HHName[6] = QApplication::translate("teams", pteams[num].hh6name);
+	HHName[7] = QApplication::translate("teams", pteams[num].hh7name);
+	Grave = pteams[num].Grave;
+	Fort = pteams[num].Fort;
+	for(int i = 0; i < BINDS_NUMBER; i++)
+	{
+		binds[i].action = cbinds[i].action;
+		binds[i].strbind = cbinds[i].strbind;
+	}
+}
+
+
+bool HWTeam::LoadFromFile()
+{
+	QFile cfgfile(cfgdir->absolutePath() + "/" + TeamName + ".cfg");
+	if (!cfgfile.open(QIODevice::ReadOnly)) return false;
+	QTextStream stream(&cfgfile);
+	stream.setCodec("UTF-8");
+	QString str;
+	QString action;
+
+	while (!stream.atEnd())
+	{
+		str = stream.readLine();
+		if (str.startsWith(";")) continue;
+		if (str.startsWith("name team "))
+		{
+			str.remove(0, 10);
+			TeamName = str;
+		} else
+		if (str.startsWith("name hh"))
+		{
+			str.remove(0, 7);
+			long i = str.left(1).toLong();
+			if ((i < 0) || (i > 7)) continue;
+			str.remove(0, 2);
+			HHName[i] = str;
+		} else
+		if (str.startsWith("grave "))
+		{
+			str.remove(0, 6);
+			Grave = str;
+		} else
+		if (str.startsWith("fort "))
+		{
+			str.remove(0, 5);
+			Fort = str;
+		} else
+		if (str.startsWith("bind "))
+		{
+			str.remove(0, 5);
+			action = str.section(' ', 1);
+			str = str.section(' ', 0, 0);
+			str.truncate(15);
+			for (int i = 0; i < BINDS_NUMBER; i++)
+				if (action == binds[i].action)
+				{
+					binds[i].strbind = str;
+					break;
+				}
+		}
+	}
+	cfgfile.close();
+	return true;
+}
+
+bool HWTeam::SaveToFile()
+{
+	QFile cfgfile(cfgdir->absolutePath() + "/" + TeamName + ".cfg");
+	if (!cfgfile.open(QIODevice::WriteOnly)) return false;
+	QTextStream stream(&cfgfile);
+	stream.setCodec("UTF-8");
+	stream << "; Generated by Hedgewars, do not modify" << endl;
+	stream << "name team " << TeamName << endl;
+	for (int i = 0; i < 8; i++)
+		stream << "name hh" << i << " " << HHName[i] << endl;
+	stream << "grave " << Grave << endl;
+	stream << "fort " << Fort << endl;
+	for(int i = 0; i < BINDS_NUMBER; i++)
+	{
+		stream << "bind " << binds[i].strbind << " " << binds[i].action << endl;
+	}
+	cfgfile.close();
+	return true;
+}
+
+void HWTeam::SetToPage(HWForm * hwform)
+{
+	hwform->ui.pageEditTeam->TeamNameEdit->setText(TeamName);
+	for(int i = 0; i < 8; i++)
+	{
+		hwform->ui.pageEditTeam->HHNameEdit[i]->setText(HHName[i]);
+	}
+	hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave));
+	hwform->ui.pageEditTeam->CBGrave_activated(Grave);
+
+	hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(Fort));
+	hwform->ui.pageEditTeam->CBFort_activated(Fort);
+
+	for(int i = 0; i < BINDS_NUMBER; i++)
+	{
+		hwform->ui.pageEditTeam->CBBind[i]->setCurrentIndex(hwform->ui.pageEditTeam->CBBind[i]->findText(binds[i].strbind));
+	}
+}
+
+void HWTeam::GetFromPage(HWForm * hwform)
+{
+	TeamName  = hwform->ui.pageEditTeam->TeamNameEdit->text();
+	for(int i = 0; i < 8; i++)
+	{
+		HHName[i] = hwform->ui.pageEditTeam->HHNameEdit[i]->text();
+	}
+
+	Grave = hwform->ui.pageEditTeam->CBGrave->currentText();
+	Fort = hwform->ui.pageEditTeam->CBFort->currentText();
+	for(int i = 0; i < 8; i++)
+	{
+		binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->currentText();
+	}
+}
+
+QByteArray HWTeam::IPCTeamInfo() const
+{
+	QByteArray buf;
+	#define ADD(a) { \
+					QByteArray strmsg = a.toUtf8(); \
+					quint8 sz = strmsg.size(); \
+					buf.append(QByteArray((char *)&sz, 1)); \
+					buf.append(strmsg); \
+					}
+
+	ADD(QString("ename team " + TeamName));
+	for (int i = 0; i < 8; i++)
+		ADD(QString("ename hh%1 ").arg(i).append(HHName[i]));
+	ADD(QString("egrave " + Grave));
+	ADD(QString("efort " + Fort));
+	for(int i = 0; i < BINDS_NUMBER; i++)
+	{
+		ADD(QString("ebind " + binds[i].strbind + " " + binds[i].action));
+	}
+	#undef ADD
+	return buf;
+}
+
+bool HWTeam::operator==(const HWTeam& t1) const {
+  return TeamName==t1.TeamName;
+}
+
+bool HWTeam::operator<(const HWTeam& t1) const {
+  return TeamName<t1.TeamName;
+}
--- a/QTfrontend/team.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/team.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,50 +1,50 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef TEAM_H
-#define TEAM_H
-
-#include <QString>
-#include "binds.h"
-
-class HWForm;
-class GameUIConfig;
-
-class HWTeam
-{
-	public:
-		HWTeam(const QString & teamname);
-		HWTeam(quint8 num);
-
-		QString TeamName;
-		QString HHName[8];
-		QString	Grave;
-		QString Fort;
-		BindAction binds[BINDS_NUMBER];
-
-		bool LoadFromFile();
-		bool SaveToFile();
-		void SetToPage(HWForm * hwform);
-		void GetFromPage(HWForm * hwform);
-		QByteArray IPCTeamInfo() const;
-
-		bool operator==(const HWTeam& t1) const;
-		bool operator<(const HWTeam& t1) const;
-};
-
-#endif
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef TEAM_H
+#define TEAM_H
+
+#include <QString>
+#include "binds.h"
+
+class HWForm;
+class GameUIConfig;
+
+class HWTeam
+{
+	public:
+		HWTeam(const QString & teamname);
+		HWTeam(quint8 num);
+
+		QString TeamName;
+		QString HHName[8];
+		QString	Grave;
+		QString Fort;
+		BindAction binds[BINDS_NUMBER];
+
+		bool LoadFromFile();
+		bool SaveToFile();
+		void SetToPage(HWForm * hwform);
+		void GetFromPage(HWForm * hwform);
+		QByteArray IPCTeamInfo() const;
+
+		bool operator==(const HWTeam& t1) const;
+		bool operator<(const HWTeam& t1) const;
+};
+
+#endif
--- a/QTfrontend/teamselect.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/teamselect.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,133 +1,133 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QLabel>
-#include <QPixmap>
-#include <QPushButton>
-#include <QFrame>
-#include <QDebug>
-
-#include <vertScrollArea.h>
-#include "teamselect.h"
-#include "teamselhelper.h"
-#include "frameTeam.h"
-
-void TeamSelWidget::addTeam(HWTeam team)
-{
-  frameDontPlaying->addTeam(team, false);
-  curDontPlayingTeams.push_back(team);
-  QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
-		   this, SLOT(changeTeamStatus(HWTeam)));
-}
-
-//void TeamSelWidget::removeTeam(__attribute__ ((unused)) HWTeam team)
-//{
-  //curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team));
-//}
-
-void TeamSelWidget::changeTeamStatus(HWTeam team)
-{
-  list<HWTeam>::iterator itDontPlay=std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team);
-  list<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
-
-  bool willBePlaying=itDontPlay!=curDontPlayingTeams.end();
-
-  if(!willBePlaying) {
-    // playing team => dont playing
-    curDontPlayingTeams.push_back(*itPlay);
-    curPlayingTeams.erase(itPlay);
-  } else {
-    // return if max playing teams reached
-    if(framePlaying->isFullTeams()) return;
-    // dont playing team => playing
-    curPlayingTeams.push_back(*itDontPlay);
-    curDontPlayingTeams.erase(itDontPlay);
-  }
-
-  FrameTeams* pRemoveTeams;
-  FrameTeams* pAddTeams;
-  if(!willBePlaying) {
-    pRemoveTeams=framePlaying;
-    pAddTeams=frameDontPlaying;
-  } else {
-    pRemoveTeams=frameDontPlaying;
-    pAddTeams=framePlaying;
-  }
-
-  pAddTeams->addTeam(team, willBePlaying);
-  pRemoveTeams->removeTeam(team);
-  QObject::connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
-		   this, SLOT(changeTeamStatus(HWTeam)));
-
-  QSize szh=pAddTeams->sizeHint();
-  QSize szh1=pRemoveTeams->sizeHint();
-  if(szh.isValid() && szh1.isValid()) {
-    pAddTeams->resize(pAddTeams->size().width(), szh.height());
-    pRemoveTeams->resize(pRemoveTeams->size().width(), szh1.height());
-  }
-}
-
-void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color)
-{
-  VertScrArea* area=new VertScrArea(color);
-  area->setWidget(pfteams);
-  mainLayout.addWidget(area, 30);
-}
-
-TeamSelWidget::TeamSelWidget(QWidget* parent) :
-  QWidget(parent), mainLayout(this)
-{
-  framePlaying=new FrameTeams();
-  frameDontPlaying=new FrameTeams();
-  addScrArea(framePlaying, QColor("DarkTurquoise"));
-  addScrArea(frameDontPlaying, QColor("LightGoldenrodYellow"));
-}
-
-void TeamSelWidget::resetPlayingTeams(const QStringList& teamslist)
-{
-  list<HWTeam>::iterator it;
-  for(it=curPlayingTeams.begin(); it!=curPlayingTeams.end(); it++) {
-    framePlaying->removeTeam(*it);
-  }
-  curPlayingTeams.clear();
-  for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) {
-    frameDontPlaying->removeTeam(*it);
-  }
-  curDontPlayingTeams.clear();
-
-  for (QStringList::ConstIterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
-    addTeam(*it);
-  }
-}
-
-bool TeamSelWidget::isPlaying(HWTeam team) const
-{
-  return std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team)!=curPlayingTeams.end();
-}
-
-list<HWTeam> TeamSelWidget::getPlayingTeams() const
-{
-  return curPlayingTeams;
-}
-
-unsigned char TeamSelWidget::numHedgedogs(HWTeam team) const
-{
-  const TeamShowWidget* tsw=dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team));
-  if(!tsw) return 0;
-  return tsw->getHedgehogsNum();
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QLabel>
+#include <QPixmap>
+#include <QPushButton>
+#include <QFrame>
+#include <QDebug>
+
+#include <vertScrollArea.h>
+#include "teamselect.h"
+#include "teamselhelper.h"
+#include "frameTeam.h"
+
+void TeamSelWidget::addTeam(HWTeam team)
+{
+  frameDontPlaying->addTeam(team, false);
+  curDontPlayingTeams.push_back(team);
+  QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
+		   this, SLOT(changeTeamStatus(HWTeam)));
+}
+
+//void TeamSelWidget::removeTeam(__attribute__ ((unused)) HWTeam team)
+//{
+  //curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team));
+//}
+
+void TeamSelWidget::changeTeamStatus(HWTeam team)
+{
+  list<HWTeam>::iterator itDontPlay=std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team);
+  list<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
+
+  bool willBePlaying=itDontPlay!=curDontPlayingTeams.end();
+
+  if(!willBePlaying) {
+    // playing team => dont playing
+    curDontPlayingTeams.push_back(*itPlay);
+    curPlayingTeams.erase(itPlay);
+  } else {
+    // return if max playing teams reached
+    if(framePlaying->isFullTeams()) return;
+    // dont playing team => playing
+    curPlayingTeams.push_back(*itDontPlay);
+    curDontPlayingTeams.erase(itDontPlay);
+  }
+
+  FrameTeams* pRemoveTeams;
+  FrameTeams* pAddTeams;
+  if(!willBePlaying) {
+    pRemoveTeams=framePlaying;
+    pAddTeams=frameDontPlaying;
+  } else {
+    pRemoveTeams=frameDontPlaying;
+    pAddTeams=framePlaying;
+  }
+
+  pAddTeams->addTeam(team, willBePlaying);
+  pRemoveTeams->removeTeam(team);
+  QObject::connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
+		   this, SLOT(changeTeamStatus(HWTeam)));
+
+  QSize szh=pAddTeams->sizeHint();
+  QSize szh1=pRemoveTeams->sizeHint();
+  if(szh.isValid() && szh1.isValid()) {
+    pAddTeams->resize(pAddTeams->size().width(), szh.height());
+    pRemoveTeams->resize(pRemoveTeams->size().width(), szh1.height());
+  }
+}
+
+void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color)
+{
+  VertScrArea* area=new VertScrArea(color);
+  area->setWidget(pfteams);
+  mainLayout.addWidget(area, 30);
+}
+
+TeamSelWidget::TeamSelWidget(QWidget* parent) :
+  QWidget(parent), mainLayout(this)
+{
+  framePlaying=new FrameTeams();
+  frameDontPlaying=new FrameTeams();
+  addScrArea(framePlaying, QColor("DarkTurquoise"));
+  addScrArea(frameDontPlaying, QColor("LightGoldenrodYellow"));
+}
+
+void TeamSelWidget::resetPlayingTeams(const QStringList& teamslist)
+{
+  list<HWTeam>::iterator it;
+  for(it=curPlayingTeams.begin(); it!=curPlayingTeams.end(); it++) {
+    framePlaying->removeTeam(*it);
+  }
+  curPlayingTeams.clear();
+  for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) {
+    frameDontPlaying->removeTeam(*it);
+  }
+  curDontPlayingTeams.clear();
+
+  for (QStringList::ConstIterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
+    addTeam(*it);
+  }
+}
+
+bool TeamSelWidget::isPlaying(HWTeam team) const
+{
+  return std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team)!=curPlayingTeams.end();
+}
+
+list<HWTeam> TeamSelWidget::getPlayingTeams() const
+{
+  return curPlayingTeams;
+}
+
+unsigned char TeamSelWidget::numHedgedogs(HWTeam team) const
+{
+  const TeamShowWidget* tsw=dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team));
+  if(!tsw) return 0;
+  return tsw->getHedgehogsNum();
+}
--- a/QTfrontend/teamselect.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/teamselect.h	Thu Oct 05 17:02:09 2006 +0000
@@ -2,33 +2,18 @@
  * Hedgewars, a worms-like game
  * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
  *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
  *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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
  */
 
 #ifndef _TEAM_SELECT_INCLUDED
--- a/QTfrontend/teamselhelper.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/teamselhelper.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,72 +1,72 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "teamselhelper.h"
-#include "hwconsts.h"
-
-#include <QPixmap>
-#include <QPushButton>
-#include <QPainter>
-
-void TeamLabel::teamButtonClicked()
-{
-  emit teamActivated(text());
-}
-
-TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) :
-  QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0)
-{
-  mainLayout.setSpacing(1);
-  mainLayout.setMargin(2);
-  this->setMaximumHeight(35);
-  QPixmap* px=new QPixmap(QPixmap(datadir->absolutePath() + "/Forts/" + m_team.Fort + "L.png").scaled(40, 40));
-
-  QPalette newPalette = palette();
-  newPalette.setColor(QPalette::Button, palette().color(backgroundRole()));
-
-  QPushButton* butt=new QPushButton(*px, "", this);
-  butt->setFlat(true);
-  butt->setGeometry(0, 0, 30, 30);
-  butt->setMaximumWidth(30);
-  butt->setPalette(newPalette);
-  mainLayout.addWidget(butt);
-  butt->setIconSize(butt->size());
-
-  QPushButton* bText=new QPushButton(team.TeamName, this);
-  bText->setPalette(newPalette);
-  bText->setFlat(true);
-  mainLayout.addWidget(bText);
-
-  if(m_isPlaying) {
-    phhoger=new CHedgehogerWidget(this);
-    mainLayout.addWidget(phhoger);
-  }
-
-  QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam()));
-  QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
-}
-
-void TeamShowWidget::activateTeam()
-{
-  emit teamStatusChanged(m_team);
-}
-
-unsigned char TeamShowWidget::getHedgehogsNum() const
-{
-  return phhoger ? phhoger->getHedgehogsNum() : 0;
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "teamselhelper.h"
+#include "hwconsts.h"
+
+#include <QPixmap>
+#include <QPushButton>
+#include <QPainter>
+
+void TeamLabel::teamButtonClicked()
+{
+  emit teamActivated(text());
+}
+
+TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) :
+  QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0)
+{
+  mainLayout.setSpacing(1);
+  mainLayout.setMargin(2);
+  this->setMaximumHeight(35);
+  QPixmap* px=new QPixmap(QPixmap(datadir->absolutePath() + "/Forts/" + m_team.Fort + "L.png").scaled(40, 40));
+
+  QPalette newPalette = palette();
+  newPalette.setColor(QPalette::Button, palette().color(backgroundRole()));
+
+  QPushButton* butt=new QPushButton(*px, "", this);
+  butt->setFlat(true);
+  butt->setGeometry(0, 0, 30, 30);
+  butt->setMaximumWidth(30);
+  butt->setPalette(newPalette);
+  mainLayout.addWidget(butt);
+  butt->setIconSize(butt->size());
+
+  QPushButton* bText=new QPushButton(team.TeamName, this);
+  bText->setPalette(newPalette);
+  bText->setFlat(true);
+  mainLayout.addWidget(bText);
+
+  if(m_isPlaying) {
+    phhoger=new CHedgehogerWidget(this);
+    mainLayout.addWidget(phhoger);
+  }
+
+  QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam()));
+  QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
+}
+
+void TeamShowWidget::activateTeam()
+{
+  emit teamStatusChanged(m_team);
+}
+
+unsigned char TeamShowWidget::getHedgehogsNum() const
+{
+  return phhoger ? phhoger->getHedgehogsNum() : 0;
+}
--- a/QTfrontend/teamselhelper.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/teamselhelper.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,67 +1,67 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef _TEAMSEL_HELPER_INCLUDED
-#define _TEAMSEL_HELPER_INCLUDED
-
-#include <QLabel>
-#include <QWidget>
-#include <QString>
-
-#include "teamselect.h"
-#include "hedgehogerWidget.h"
-
-class TeamLabel : public QLabel
-{
- Q_OBJECT
-
- public:
- TeamLabel(const QString& inp_str) : QLabel(inp_str) {};
-
- signals:
- void teamActivated(QString team_name);
-
- public slots:
- void teamButtonClicked();
-
-};
-
-class TeamShowWidget : public QWidget
-{
- Q_OBJECT
-
- private slots:
- void activateTeam();
-
- public:
- TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent);
- void setPlaying(bool isPlaying);
- unsigned char getHedgehogsNum() const;
- 
- private:
- TeamShowWidget();
- QHBoxLayout mainLayout;
- HWTeam m_team;
- bool m_isPlaying;
- CHedgehogerWidget* phhoger;
-
- signals:
- void teamStatusChanged(HWTeam team);
-};
-
-#endif // _TEAMSEL_HELPER_INCLUDED
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef _TEAMSEL_HELPER_INCLUDED
+#define _TEAMSEL_HELPER_INCLUDED
+
+#include <QLabel>
+#include <QWidget>
+#include <QString>
+
+#include "teamselect.h"
+#include "hedgehogerWidget.h"
+
+class TeamLabel : public QLabel
+{
+ Q_OBJECT
+
+ public:
+ TeamLabel(const QString& inp_str) : QLabel(inp_str) {};
+
+ signals:
+ void teamActivated(QString team_name);
+
+ public slots:
+ void teamButtonClicked();
+
+};
+
+class TeamShowWidget : public QWidget
+{
+ Q_OBJECT
+
+ private slots:
+ void activateTeam();
+
+ public:
+ TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent);
+ void setPlaying(bool isPlaying);
+ unsigned char getHedgehogsNum() const;
+ 
+ private:
+ TeamShowWidget();
+ QHBoxLayout mainLayout;
+ HWTeam m_team;
+ bool m_isPlaying;
+ CHedgehogerWidget* phhoger;
+
+ signals:
+ void teamStatusChanged(HWTeam team);
+};
+
+#endif // _TEAMSEL_HELPER_INCLUDED
--- a/QTfrontend/ui_hwform.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/ui_hwform.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,82 +1,82 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include <QVBoxLayout>
-#include <QGridLayout>
-#include "ui_hwform.h"
-#include "pages.h"
-
-void Ui_HWForm::setupUi(QMainWindow *HWForm)
-{
-	SetupFonts();
-
-	HWForm->setObjectName(QString::fromUtf8("HWForm"));
-	HWForm->resize(QSize(620, 430).expandedTo(HWForm->minimumSizeHint()));
-	HWForm->setMinimumSize(QSize(620, 430));
-	HWForm->setWindowTitle(QMainWindow::tr("-= by unC0Rr =-"));
-	centralWidget = new QWidget(HWForm);
-	centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
-
-	centralWidget = new QWidget(HWForm);
-	centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
-
-	SetupPages(centralWidget);
-
-	HWForm->setCentralWidget(centralWidget);
-
-	Pages->setCurrentIndex(0);
-
-	QMetaObject::connectSlotsByName(HWForm);
-}
-
-void Ui_HWForm::SetupFonts()
-{
-	font14 = new QFont("MS Shell Dlg", 14);
-}
-
-void Ui_HWForm::SetupPages(QWidget *Parent)
-{
-	Pages =	new QStackedLayout(Parent);
-
-	pageLocalGame = new PageLocalGame();
-	Pages->addWidget(pageLocalGame);
-
-	pageEditTeam = new PageEditTeam();
-	Pages->addWidget(pageEditTeam);
-
-	pageOptions = new PageOptions();
-	Pages->addWidget(pageOptions);
-
-	pageMultiplayer = new PageMultiplayer();
-	Pages->addWidget(pageMultiplayer);
-
-	pagePlayDemo =	new PagePlayDemo();
-	Pages->addWidget(pagePlayDemo);
-
-	pageNet = new PageNet();
-	Pages->addWidget(pageNet);
-
-	pageNetChat	= new PageNetChat();
-	Pages->addWidget(pageNetChat);
-
-	pageNetGame	= new PageNetGame();
-	Pages->addWidget(pageNetGame);
-
-	pageMain = new PageMain();
-	Pages->addWidget(pageMain);
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include <QVBoxLayout>
+#include <QGridLayout>
+#include "ui_hwform.h"
+#include "pages.h"
+
+void Ui_HWForm::setupUi(QMainWindow *HWForm)
+{
+	SetupFonts();
+
+	HWForm->setObjectName(QString::fromUtf8("HWForm"));
+	HWForm->resize(QSize(620, 430).expandedTo(HWForm->minimumSizeHint()));
+	HWForm->setMinimumSize(QSize(620, 430));
+	HWForm->setWindowTitle(QMainWindow::tr("-= by unC0Rr =-"));
+	centralWidget = new QWidget(HWForm);
+	centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
+
+	centralWidget = new QWidget(HWForm);
+	centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
+
+	SetupPages(centralWidget);
+
+	HWForm->setCentralWidget(centralWidget);
+
+	Pages->setCurrentIndex(0);
+
+	QMetaObject::connectSlotsByName(HWForm);
+}
+
+void Ui_HWForm::SetupFonts()
+{
+	font14 = new QFont("MS Shell Dlg", 14);
+}
+
+void Ui_HWForm::SetupPages(QWidget *Parent)
+{
+	Pages =	new QStackedLayout(Parent);
+
+	pageLocalGame = new PageLocalGame();
+	Pages->addWidget(pageLocalGame);
+
+	pageEditTeam = new PageEditTeam();
+	Pages->addWidget(pageEditTeam);
+
+	pageOptions = new PageOptions();
+	Pages->addWidget(pageOptions);
+
+	pageMultiplayer = new PageMultiplayer();
+	Pages->addWidget(pageMultiplayer);
+
+	pagePlayDemo =	new PagePlayDemo();
+	Pages->addWidget(pagePlayDemo);
+
+	pageNet = new PageNet();
+	Pages->addWidget(pageNet);
+
+	pageNetChat	= new PageNetChat();
+	Pages->addWidget(pageNetChat);
+
+	pageNetGame	= new PageNetGame();
+	Pages->addWidget(pageNetGame);
+
+	pageMain = new PageMain();
+	Pages->addWidget(pageMain);
+}
--- a/QTfrontend/ui_hwform.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/ui_hwform.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,74 +1,74 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
- #ifndef UI_HWFORM_H
-#define UI_HWFORM_H
-
-#include <QtCore/QVariant>
-#include <QtGui/QAction>
-#include <QtGui/QApplication>
-#include <QtGui/QButtonGroup>
-#include <QtGui/QCheckBox>
-#include <QtGui/QComboBox>
-#include <QtGui/QGroupBox>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
-#include <QtGui/QListWidget>
-#include <QtGui/QMainWindow>
-#include <QtGui/QPushButton>
-#include <QtGui/QStackedWidget>
-#include <QtGui/QToolBox>
-#include <QtGui/QWidget>
-#include <QStackedLayout>
-
-class PageMain;
-class PageLocalGame;
-class PageEditTeam;
-class PageMultiplayer;
-class PagePlayDemo;
-class PageOptions;
-class PageNet;
-class PageNetChat;
-class PageNetGame;
-
-class Ui_HWForm
-{
-public:
-	QWidget *centralWidget;
-
-	PageMain *pageMain;
-	PageLocalGame *pageLocalGame;
-	PageEditTeam *pageEditTeam;
-	PageMultiplayer *pageMultiplayer;
-	PagePlayDemo *pagePlayDemo;
-	PageOptions *pageOptions;
-	PageNet *pageNet;
-	PageNetChat *pageNetChat;
-	PageNetGame *pageNetGame;
-
-	QStackedLayout *Pages;
-	QFont *font14;
-
-	void setupUi(QMainWindow *HWForm);
-	void SetupFonts();
-	void SetupPages(QWidget *Parent);
-	void SetupPageNetChat(QWidget *Parent);
-	void SetupPageNetGame(QWidget *Parent);
-};
-
-#endif // UI_HWFORM_H
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+ #ifndef UI_HWFORM_H
+#define UI_HWFORM_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QCheckBox>
+#include <QtGui/QComboBox>
+#include <QtGui/QGroupBox>
+#include <QtGui/QLabel>
+#include <QtGui/QLineEdit>
+#include <QtGui/QListWidget>
+#include <QtGui/QMainWindow>
+#include <QtGui/QPushButton>
+#include <QtGui/QStackedWidget>
+#include <QtGui/QToolBox>
+#include <QtGui/QWidget>
+#include <QStackedLayout>
+
+class PageMain;
+class PageLocalGame;
+class PageEditTeam;
+class PageMultiplayer;
+class PagePlayDemo;
+class PageOptions;
+class PageNet;
+class PageNetChat;
+class PageNetGame;
+
+class Ui_HWForm
+{
+public:
+	QWidget *centralWidget;
+
+	PageMain *pageMain;
+	PageLocalGame *pageLocalGame;
+	PageEditTeam *pageEditTeam;
+	PageMultiplayer *pageMultiplayer;
+	PagePlayDemo *pagePlayDemo;
+	PageOptions *pageOptions;
+	PageNet *pageNet;
+	PageNetChat *pageNetChat;
+	PageNetGame *pageNetGame;
+
+	QStackedLayout *Pages;
+	QFont *font14;
+
+	void setupUi(QMainWindow *HWForm);
+	void SetupFonts();
+	void SetupPages(QWidget *Parent);
+	void SetupPageNetChat(QWidget *Parent);
+	void SetupPageNetGame(QWidget *Parent);
+};
+
+#endif // UI_HWFORM_H
--- a/QTfrontend/vertScrollArea.cpp	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/vertScrollArea.cpp	Thu Oct 05 17:02:09 2006 +0000
@@ -1,34 +1,34 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "vertScrollArea.h"
-
-#include <QResizeEvent>
-
-VertScrArea::VertScrArea(QColor frameColor, QWidget * parent) :
-  QScrollArea(parent)
-{
-	QPalette newPalette = palette();
-	newPalette.setColor(QPalette::Background, frameColor);
-	setPalette(newPalette);
-}
-
-void VertScrArea::resizeEvent(QResizeEvent * event)
-{
-	widget()->resize(event->size().width(), widget()->sizeHint().height());
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "vertScrollArea.h"
+
+#include <QResizeEvent>
+
+VertScrArea::VertScrArea(QColor frameColor, QWidget * parent) :
+  QScrollArea(parent)
+{
+	QPalette newPalette = palette();
+	newPalette.setColor(QPalette::Background, frameColor);
+	setPalette(newPalette);
+}
+
+void VertScrArea::resizeEvent(QResizeEvent * event)
+{
+	widget()->resize(event->size().width(), widget()->sizeHint().height());
+}
--- a/QTfrontend/vertScrollArea.h	Thu Oct 05 16:33:18 2006 +0000
+++ b/QTfrontend/vertScrollArea.h	Thu Oct 05 17:02:09 2006 +0000
@@ -1,35 +1,35 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#ifndef _VERT_SCROLL_AREA_INCLUDED
-#define _VERT_SCROLL_AREA_INCLUDED
-
-#include <QScrollArea>
-
-class VertScrArea : public QScrollArea
-{
-	Q_OBJECT
-
-public:
-	VertScrArea(QColor frameColor, QWidget * parent = 0);
-
-protected:
-	virtual void resizeEvent(QResizeEvent * event);
-};
-
-#endif // _VERT_SCROLL_AREA_INCLUDED
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2006 Ulyanov Igor <iulyanov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef _VERT_SCROLL_AREA_INCLUDED
+#define _VERT_SCROLL_AREA_INCLUDED
+
+#include <QScrollArea>
+
+class VertScrArea : public QScrollArea
+{
+	Q_OBJECT
+
+public:
+	VertScrArea(QColor frameColor, QWidget * parent = 0);
+
+protected:
+	virtual void resizeEvent(QResizeEvent * event);
+};
+
+#endif // _VERT_SCROLL_AREA_INCLUDED
--- a/hedgewars/CMakeLists.txt	Thu Oct 05 16:33:18 2006 +0000
+++ b/hedgewars/CMakeLists.txt	Thu Oct 05 17:02:09 2006 +0000
@@ -1,42 +1,42 @@
-set(dcc32_tryexe dcc32.exe)
-set(fpc_tryexe fpc)
-set(hwengine_project "hwengine.dpr")
-
-find_program(dcc32_executable ${dcc32_tryexe})
-find_program(fpc_executable ${fpc_tryexe})
-
-if (dcc32_executable)
-	 exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output)
-endif (dcc32_executable)
-
-if (fpc_executable)
-	 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
-endif (fpc_executable)
-
-string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
-if (dcc32version)
-	set(pascal_compiler ${dcc32_executable})
-	set(pascal_compiler_flags "-B" "-W" ${hwengine_project})
-else (dcc32version)
-	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
-	if (fpc_version)
-		string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
-		string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
-		string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
-		math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
-		if (${fpc_ver} LESS "010906")
-			message("Minimum required version of FreePascal is 2.0.5")
-		else (${fpc_ver} LESS "010906")
-			set(pascal_compiler ${fpc_executable})
-			set(pascal_compiler_flags "-B" "-Sd" "-Xs" "-OG" "-O2" "-Cs2000000" ${hwengine_project})
-		endif (${fpc_ver} LESS "010906")
-	endif (fpc_version)
-endif (dcc32version)
-
-if (NOT pascal_compiler)
-	message(FATAL_ERROR "No Pascal compiler found!")
-endif (NOT pascal_compiler)
-
-add_custom_target(hwengine ALL COMMAND "${pascal_compiler}" ${pascal_compiler_flags})
-
-install(PROGRAMS "hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
+set(dcc32_tryexe dcc32.exe)
+set(fpc_tryexe fpc)
+set(hwengine_project "hwengine.dpr")
+
+find_program(dcc32_executable ${dcc32_tryexe})
+find_program(fpc_executable ${fpc_tryexe})
+
+if (dcc32_executable)
+	 exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output)
+endif (dcc32_executable)
+
+if (fpc_executable)
+	 exec_program(${fpc_executable} ARGS "-h" OUTPUT_VARIABLE fpc_output)
+endif (fpc_executable)
+
+string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
+if (dcc32version)
+	set(pascal_compiler ${dcc32_executable})
+	set(pascal_compiler_flags "-B" "-W" ${hwengine_project})
+else (dcc32version)
+	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
+	if (fpc_version)
+		string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
+		string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
+		string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
+		math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
+		if (${fpc_ver} LESS "010906")
+			message("Minimum required version of FreePascal is 2.0.5")
+		else (${fpc_ver} LESS "010906")
+			set(pascal_compiler ${fpc_executable})
+			set(pascal_compiler_flags "-B" "-Sd" "-Xs" "-OG" "-O2" "-Cs2000000" ${hwengine_project})
+		endif (${fpc_ver} LESS "010906")
+	endif (fpc_version)
+endif (dcc32version)
+
+if (NOT pascal_compiler)
+	message(FATAL_ERROR "No Pascal compiler found!")
+endif (NOT pascal_compiler)
+
+add_custom_target(hwengine ALL COMMAND "${pascal_compiler}" ${pascal_compiler_flags})
+
+install(PROGRAMS "hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
--- a/hedgewars/checksdl.dpr	Thu Oct 05 16:33:18 2006 +0000
+++ b/hedgewars/checksdl.dpr	Thu Oct 05 17:02:09 2006 +0000
@@ -1,31 +1,31 @@
-program checksdl;
-{$APPTYPE CONSOLE}
-uses
-  SDLh;
-
-procedure fail;
-begin
-writeln('fail');
-halt
-end;
-
-var SDLPrimSurface: PSDL_Surface;
-    Color: Longword;
-begin
-Write('Init SDL... ');
-if SDL_Init(SDL_INIT_VIDEO) < 0 then fail;
-WriteLn('ok');
-
-Write('Create primsurface... ');
-SDLPrimSurface:= SDL_SetVideoMode(640, 480, 16, 0);
-if (SDLPrimSurface = nil) then fail;
-WriteLn('ok');
-
-Write('Try map color... ');
-Color:= $FFFFFF;
-Color:= SDL_MapRGB(SDLPrimSurface^.format, (Color shr 16) and $FF, (Color shr 8) and $FF, Color and $FF);
-Writeln('ok');
-Writeln('Result = ', Color);
-
-SDL_Quit()
+program checksdl;
+{$APPTYPE CONSOLE}
+uses
+  SDLh;
+
+procedure fail;
+begin
+writeln('fail');
+halt
+end;
+
+var SDLPrimSurface: PSDL_Surface;
+    Color: Longword;
+begin
+Write('Init SDL... ');
+if SDL_Init(SDL_INIT_VIDEO) < 0 then fail;
+WriteLn('ok');
+
+Write('Create primsurface... ');
+SDLPrimSurface:= SDL_SetVideoMode(640, 480, 16, 0);
+if (SDLPrimSurface = nil) then fail;
+WriteLn('ok');
+
+Write('Try map color... ');
+Color:= $FFFFFF;
+Color:= SDL_MapRGB(SDLPrimSurface^.format, (Color shr 16) and $FF, (Color shr 8) and $FF, Color and $FF);
+Writeln('ok');
+Writeln('Result = ', Color);
+
+SDL_Quit()
 end.
\ No newline at end of file
--- a/hedgewars/tunsetborder.inc	Thu Oct 05 16:33:18 2006 +0000
+++ b/hedgewars/tunsetborder.inc	Thu Oct 05 17:02:09 2006 +0000
@@ -1,8 +1,8 @@
-        begin
-        X:= X + dX;
-        Y:= Y + dY;
-        tx:= round(X);
-        ty:= round(Y);
-        if ((ty and $FFFFFC00) = 0) and ((tx and $FFFFF800) = 0)and (Land[ty, tx] = $FFFFFF) then
-           SetLandPixel(ty, tx)
+        begin
+        X:= X + dX;
+        Y:= Y + dY;
+        tx:= round(X);
+        ty:= round(Y);
+        if ((ty and $FFFFFC00) = 0) and ((tx and $FFFFF800) = 0)and (Land[ty, tx] = $FFFFFF) then
+           SetLandPixel(ty, tx)
 	end;
\ No newline at end of file
--- a/hedgewars/uLandGraphics.pas	Thu Oct 05 16:33:18 2006 +0000
+++ b/hedgewars/uLandGraphics.pas	Thu Oct 05 17:02:09 2006 +0000
@@ -1,250 +1,250 @@
-unit uLandGraphics;
-interface
-
-type PRangeArray = ^TRangeArray;
-     TRangeArray = array[0..31] of record
-                                   Left, Right: integer;
-                                   end;
-
-procedure DrawExplosion(X, Y, Radius: integer);
-procedure DrawHLinesExplosions(ar: PRangeArray; Radius: integer; y, dY: integer; Count: Byte);
-procedure DrawTunnel(X, Y, dX, dY: Double; ticks, HalfWidth: integer);
-procedure FillRoundInLand(X, Y, Radius: integer; Value: Longword);
-
-implementation
-uses SDLh, uStore, uMisc, uLand, uConsts;
-
-procedure FillCircleLines(x, y, dx, dy: integer; Value: Longword);
-var i: integer;
-begin
-if ((y + dy) and $FFFFFC00) = 0 then
-   for i:= max(x - dx, 0) to min(x + dx, 2047) do Land[y + dy, i]:= Value;
-if ((y - dy) and $FFFFFC00) = 0 then
-   for i:= max(x - dx, 0) to min(x + dx, 2047) do Land[y - dy, i]:= Value;
-if ((y + dx) and $FFFFFC00) = 0 then
-   for i:= max(x - dy, 0) to min(x + dy, 2047) do Land[y + dx, i]:= Value;
-if ((y - dx) and $FFFFFC00) = 0 then
-   for i:= max(x - dy, 0) to min(x + dy, 2047) do Land[y - dx, i]:= Value;
-end;
-
-procedure FillRoundInLand(X, Y, Radius: integer; Value: Longword);
-var dx, dy, d: integer;
-begin
-  dx:= 0;
-  dy:= Radius;
-  d:= 3 - 2 * Radius;
-  while (dx < dy) do
-     begin
-     FillCircleLines(x, y, dx, dy, Value);
-     if (d < 0)
-     then d:= d + 4 * dx + 6
-     else begin
-          d:= d + 4 * (dx - dy) + 10;
-          dec(dy)
-          end;
-     inc(dx)
-     end;
-  if (dx = dy) then FillCircleLines(x, y, dx, dy, Value);
-end;
-
-procedure ClearLandPixel(y, x: integer);
-var p: PByteArray;
-begin
-p:= @PByteArray(LandSurface.pixels)^[LandSurface.pitch*y];
-case LandSurface.format.BytesPerPixel of
-     1: ;// not supported
-     2: PWord(@p[x * 2])^:= 0;
-     3: begin
-        p[x * 3 + 0]:= 0;
-        p[x * 3 + 1]:= 0;
-        p[x * 3 + 2]:= 0;
-        end;
-     4: PLongword(@p[x * 4])^:= 0;
-     end
-end;
-
-procedure SetLandPixel(y, x: integer);
-var p: PByteArray;
-begin
-p:= @PByteArray(LandSurface.pixels)^[LandSurface.pitch*y];
-case LandSurface.format.BytesPerPixel of
-     1: ;// not supported
-     2: PWord(@p[x * 2])^:= cExplosionBorderColor;
-     3: begin
-        p[x * 3 + 0]:= cExplosionBorderColor and $FF;
-        p[x * 3 + 1]:= (cExplosionBorderColor shr 8) and $FF;
-        p[x * 3 + 2]:= cExplosionBorderColor shr 16;
-        end;
-     4: PLongword(@p[x * 4])^:= cExplosionBorderColor;
-     end
-end;
-
-procedure FillLandCircleLines0(x, y, dx, dy: integer);
-var i: integer;
-begin
-if ((y + dy) and $FFFFFC00) = 0 then
-   for i:= max(x - dx, 0) to min(x + dx, 2047) do ClearLandPixel(y + dy, i);
-if ((y - dy) and $FFFFFC00) = 0 then
-   for i:= max(x - dx, 0) to min(x + dx, 2047) do ClearLandPixel(y - dy, i);
-if ((y + dx) and $FFFFFC00) = 0 then
-   for i:= max(x - dy, 0) to min(x + dy, 2047) do ClearLandPixel(y + dx, i);
-if ((y - dx) and $FFFFFC00) = 0 then
-   for i:= max(x - dy, 0) to min(x + dy, 2047) do ClearLandPixel(y - dx, i);
-end;
-
-procedure FillLandCircleLinesEBC(x, y, dx, dy: integer);
-var i: integer;
-begin
-if ((y + dy) and $FFFFFC00) = 0 then
-   for i:= max(x - dx, 0) to min(x + dx, 2047) do
-       if Land[y + dy, i] = COLOR_LAND then SetLandPixel(y + dy, i);
-if ((y - dy) and $FFFFFC00) = 0 then
-   for i:= max(x - dx, 0) to min(x + dx, 2047) do
-       if Land[y - dy, i] = COLOR_LAND then SetLandPixel(y - dy, i);
-if ((y + dx) and $FFFFFC00) = 0 then
-   for i:= max(x - dy, 0) to min(x + dy, 2047) do
-       if Land[y + dx, i] = COLOR_LAND then SetLandPixel(y + dx, i);
-if ((y - dx) and $FFFFFC00) = 0 then
-   for i:= max(x - dy, 0) to min(x + dy, 2047) do
-       if Land[y - dx, i] = COLOR_LAND then SetLandPixel(y - dx, i);
-end;
-
-procedure DrawExplosion(X, Y, Radius: integer);
-var dx, dy, d: integer;
-begin
-FillRoundInLand(X, Y, Radius, 0);
-
-if SDL_MustLock(LandSurface) then
-   SDLTry(SDL_LockSurface(LandSurface) >= 0, true);
-
-  dx:= 0;
-  dy:= Radius;
-  d:= 3 - 2 * Radius;
-  while (dx < dy) do
-     begin
-     FillLandCircleLines0(x, y, dx, dy);
-     if (d < 0)
-     then d:= d + 4 * dx + 6
-     else begin
-          d:= d + 4 * (dx - dy) + 10;
-          dec(dy)
-          end;
-     inc(dx)
-     end;
-  if (dx = dy) then FillLandCircleLines0(x, y, dx, dy);
-  inc(Radius, 4);
-  dx:= 0;
-  dy:= Radius;
-  d:= 3 - 2 * Radius;
-  while (dx < dy) do
-     begin
-     FillLandCircleLinesEBC(x, y, dx, dy);
-     if (d < 0)
-     then d:= d + 4 * dx + 6
-     else begin
-          d:= d + 4 * (dx - dy) + 10;
-          dec(dy)
-          end;
-     inc(dx)
-     end;
-  if (dx = dy) then FillLandCircleLinesEBC(x, y, dx, dy);  
-  
-if SDL_MustLock(LandSurface) then
-   SDL_UnlockSurface(LandSurface);
-end;
-
-procedure DrawHLinesExplosions(ar: PRangeArray; Radius: integer; y, dY: integer; Count: Byte);
-var tx, ty, i: LongInt;
-begin
-if SDL_MustLock(LandSurface) then
-   SDL_LockSurface(LandSurface);
-
-for i:= 0 to Pred(Count) do
-    begin
-    for ty:= max(-Radius, -y) to min(Radius, 1023 - y) do
-        for tx:= max(0, ar[i].Left - Radius) to min(2047, ar[i].Right + Radius) do
-            ClearLandPixel(y + ty, tx);
-    inc(y, dY)
-    end;
-
-inc(Radius, 4);
-dec(y, Count*dY);
-
-for i:= 0 to Pred(Count) do
-    begin
-    for ty:= max(-Radius, -y) to min(Radius, 1023 - y) do
-        for tx:= max(0, ar[i].Left - Radius) to min(2047, ar[i].Right + Radius) do
-            if Land[y + ty, tx] = $FFFFFF then
-                  SetLandPixel(y + ty, tx);
-    inc(y, dY)
-    end;
-
-if SDL_MustLock(LandSurface) then
-   SDL_UnlockSurface(LandSurface);
-end;
-
-//
-//  - (dX, dY) - direction, vector of length = 0.5
-//
-procedure DrawTunnel(X, Y, dX, dY: Double; ticks, HalfWidth: integer);
-var nx, ny: Double;
-    i, t, tx, ty: Longint;
-begin  // (-dY, dX) is (dX, dY) rotated by PI/2
-if SDL_MustLock(LandSurface) then
-   SDL_LockSurface(LandSurface);
-
-nx:= X + dY * (HalfWidth + 8);
-ny:= Y - dX * (HalfWidth + 8);
-
-for i:= 0 to 7 do
-    begin
-    X:= nx - 8 * dX;
-    Y:= ny - 8 * dY;
-    for t:= -8 to ticks + 8 do
-        {$include tunsetborder.inc}
-    nx:= nx - dY;
-    ny:= ny + dX;
-    end;
-
-for i:= -HalfWidth to HalfWidth do
-    begin
-    X:= nx - dX * 8;
-    Y:= ny - dY * 8;
-    for t:= 0 to 7 do
-        {$include tunsetborder.inc}
-    X:= nx;
-    Y:= ny;
-    for t:= 0 to ticks do
-        begin
-        X:= X + dX;
-        Y:= Y + dY;
-        tx:= round(X);
-        ty:= round(Y);
-        if ((ty and $FFFFFC00) = 0) and ((tx and $FFFFF800) = 0) then
-           begin
-           Land[ty, tx]:= 0;
-           ClearLandPixel(ty, tx);
-           end
-        end;
-    for t:= 0 to 7 do
-        {$include tunsetborder.inc}
-    nx:= nx - dY;
-    ny:= ny + dX;
-    end;
-
-for i:= 0 to 7 do
-    begin
-    X:= nx - 8 * dX;
-    Y:= ny - 8 * dY;
-    for t:= -8 to ticks + 8 do
-        {$include tunsetborder.inc}
-    nx:= nx - dY;
-    ny:= ny + dX;
-    end;
-
-if SDL_MustLock(LandSurface) then
-   SDL_UnlockSurface(LandSurface)
-end;
-
-
-end.
+unit uLandGraphics;
+interface
+
+type PRangeArray = ^TRangeArray;
+     TRangeArray = array[0..31] of record
+                                   Left, Right: integer;
+                                   end;
+
+procedure DrawExplosion(X, Y, Radius: integer);
+procedure DrawHLinesExplosions(ar: PRangeArray; Radius: integer; y, dY: integer; Count: Byte);
+procedure DrawTunnel(X, Y, dX, dY: Double; ticks, HalfWidth: integer);
+procedure FillRoundInLand(X, Y, Radius: integer; Value: Longword);
+
+implementation
+uses SDLh, uStore, uMisc, uLand, uConsts;
+
+procedure FillCircleLines(x, y, dx, dy: integer; Value: Longword);
+var i: integer;
+begin
+if ((y + dy) and $FFFFFC00) = 0 then
+   for i:= max(x - dx, 0) to min(x + dx, 2047) do Land[y + dy, i]:= Value;
+if ((y - dy) and $FFFFFC00) = 0 then
+   for i:= max(x - dx, 0) to min(x + dx, 2047) do Land[y - dy, i]:= Value;
+if ((y + dx) and $FFFFFC00) = 0 then
+   for i:= max(x - dy, 0) to min(x + dy, 2047) do Land[y + dx, i]:= Value;
+if ((y - dx) and $FFFFFC00) = 0 then
+   for i:= max(x - dy, 0) to min(x + dy, 2047) do Land[y - dx, i]:= Value;
+end;
+
+procedure FillRoundInLand(X, Y, Radius: integer; Value: Longword);
+var dx, dy, d: integer;
+begin
+  dx:= 0;
+  dy:= Radius;
+  d:= 3 - 2 * Radius;
+  while (dx < dy) do
+     begin
+     FillCircleLines(x, y, dx, dy, Value);
+     if (d < 0)
+     then d:= d + 4 * dx + 6
+     else begin
+          d:= d + 4 * (dx - dy) + 10;
+          dec(dy)
+          end;
+     inc(dx)
+     end;
+  if (dx = dy) then FillCircleLines(x, y, dx, dy, Value);
+end;
+
+procedure ClearLandPixel(y, x: integer);
+var p: PByteArray;
+begin
+p:= @PByteArray(LandSurface.pixels)^[LandSurface.pitch*y];
+case LandSurface.format.BytesPerPixel of
+     1: ;// not supported
+     2: PWord(@p[x * 2])^:= 0;
+     3: begin
+        p[x * 3 + 0]:= 0;
+        p[x * 3 + 1]:= 0;
+        p[x * 3 + 2]:= 0;
+        end;
+     4: PLongword(@p[x * 4])^:= 0;
+     end
+end;
+
+procedure SetLandPixel(y, x: integer);
+var p: PByteArray;
+begin
+p:= @PByteArray(LandSurface.pixels)^[LandSurface.pitch*y];
+case LandSurface.format.BytesPerPixel of
+     1: ;// not supported
+     2: PWord(@p[x * 2])^:= cExplosionBorderColor;
+     3: begin
+        p[x * 3 + 0]:= cExplosionBorderColor and $FF;
+        p[x * 3 + 1]:= (cExplosionBorderColor shr 8) and $FF;
+        p[x * 3 + 2]:= cExplosionBorderColor shr 16;
+        end;
+     4: PLongword(@p[x * 4])^:= cExplosionBorderColor;
+     end
+end;
+
+procedure FillLandCircleLines0(x, y, dx, dy: integer);
+var i: integer;
+begin
+if ((y + dy) and $FFFFFC00) = 0 then
+   for i:= max(x - dx, 0) to min(x + dx, 2047) do ClearLandPixel(y + dy, i);
+if ((y - dy) and $FFFFFC00) = 0 then
+   for i:= max(x - dx, 0) to min(x + dx, 2047) do ClearLandPixel(y - dy, i);
+if ((y + dx) and $FFFFFC00) = 0 then
+   for i:= max(x - dy, 0) to min(x + dy, 2047) do ClearLandPixel(y + dx, i);
+if ((y - dx) and $FFFFFC00) = 0 then
+   for i:= max(x - dy, 0) to min(x + dy, 2047) do ClearLandPixel(y - dx, i);
+end;
+
+procedure FillLandCircleLinesEBC(x, y, dx, dy: integer);
+var i: integer;
+begin
+if ((y + dy) and $FFFFFC00) = 0 then
+   for i:= max(x - dx, 0) to min(x + dx, 2047) do
+       if Land[y + dy, i] = COLOR_LAND then SetLandPixel(y + dy, i);
+if ((y - dy) and $FFFFFC00) = 0 then
+   for i:= max(x - dx, 0) to min(x + dx, 2047) do
+       if Land[y - dy, i] = COLOR_LAND then SetLandPixel(y - dy, i);
+if ((y + dx) and $FFFFFC00) = 0 then
+   for i:= max(x - dy, 0) to min(x + dy, 2047) do
+       if Land[y + dx, i] = COLOR_LAND then SetLandPixel(y + dx, i);
+if ((y - dx) and $FFFFFC00) = 0 then
+   for i:= max(x - dy, 0) to min(x + dy, 2047) do
+       if Land[y - dx, i] = COLOR_LAND then SetLandPixel(y - dx, i);
+end;
+
+procedure DrawExplosion(X, Y, Radius: integer);
+var dx, dy, d: integer;
+begin
+FillRoundInLand(X, Y, Radius, 0);
+
+if SDL_MustLock(LandSurface) then
+   SDLTry(SDL_LockSurface(LandSurface) >= 0, true);
+
+  dx:= 0;
+  dy:= Radius;
+  d:= 3 - 2 * Radius;
+  while (dx < dy) do
+     begin
+     FillLandCircleLines0(x, y, dx, dy);
+     if (d < 0)
+     then d:= d + 4 * dx + 6
+     else begin
+          d:= d + 4 * (dx - dy) + 10;
+          dec(dy)
+          end;
+     inc(dx)
+     end;
+  if (dx = dy) then FillLandCircleLines0(x, y, dx, dy);
+  inc(Radius, 4);
+  dx:= 0;
+  dy:= Radius;
+  d:= 3 - 2 * Radius;
+  while (dx < dy) do
+     begin
+     FillLandCircleLinesEBC(x, y, dx, dy);
+     if (d < 0)
+     then d:= d + 4 * dx + 6
+     else begin
+          d:= d + 4 * (dx - dy) + 10;
+          dec(dy)
+          end;
+     inc(dx)
+     end;
+  if (dx = dy) then FillLandCircleLinesEBC(x, y, dx, dy);  
+  
+if SDL_MustLock(LandSurface) then
+   SDL_UnlockSurface(LandSurface);
+end;
+
+procedure DrawHLinesExplosions(ar: PRangeArray; Radius: integer; y, dY: integer; Count: Byte);
+var tx, ty, i: LongInt;
+begin
+if SDL_MustLock(LandSurface) then
+   SDL_LockSurface(LandSurface);
+
+for i:= 0 to Pred(Count) do
+    begin
+    for ty:= max(-Radius, -y) to min(Radius, 1023 - y) do
+        for tx:= max(0, ar[i].Left - Radius) to min(2047, ar[i].Right + Radius) do
+            ClearLandPixel(y + ty, tx);
+    inc(y, dY)
+    end;
+
+inc(Radius, 4);
+dec(y, Count*dY);
+
+for i:= 0 to Pred(Count) do
+    begin
+    for ty:= max(-Radius, -y) to min(Radius, 1023 - y) do
+        for tx:= max(0, ar[i].Left - Radius) to min(2047, ar[i].Right + Radius) do
+            if Land[y + ty, tx] = $FFFFFF then
+                  SetLandPixel(y + ty, tx);
+    inc(y, dY)
+    end;
+
+if SDL_MustLock(LandSurface) then
+   SDL_UnlockSurface(LandSurface);
+end;
+
+//
+//  - (dX, dY) - direction, vector of length = 0.5
+//
+procedure DrawTunnel(X, Y, dX, dY: Double; ticks, HalfWidth: integer);
+var nx, ny: Double;
+    i, t, tx, ty: Longint;
+begin  // (-dY, dX) is (dX, dY) rotated by PI/2
+if SDL_MustLock(LandSurface) then
+   SDL_LockSurface(LandSurface);
+
+nx:= X + dY * (HalfWidth + 8);
+ny:= Y - dX * (HalfWidth + 8);
+
+for i:= 0 to 7 do
+    begin
+    X:= nx - 8 * dX;
+    Y:= ny - 8 * dY;
+    for t:= -8 to ticks + 8 do
+        {$include tunsetborder.inc}
+    nx:= nx - dY;
+    ny:= ny + dX;
+    end;
+
+for i:= -HalfWidth to HalfWidth do
+    begin
+    X:= nx - dX * 8;
+    Y:= ny - dY * 8;
+    for t:= 0 to 7 do
+        {$include tunsetborder.inc}
+    X:= nx;
+    Y:= ny;
+    for t:= 0 to ticks do
+        begin
+        X:= X + dX;
+        Y:= Y + dY;
+        tx:= round(X);
+        ty:= round(Y);
+        if ((ty and $FFFFFC00) = 0) and ((tx and $FFFFF800) = 0) then
+           begin
+           Land[ty, tx]:= 0;
+           ClearLandPixel(ty, tx);
+           end
+        end;
+    for t:= 0 to 7 do
+        {$include tunsetborder.inc}
+    nx:= nx - dY;
+    ny:= ny + dX;
+    end;
+
+for i:= 0 to 7 do
+    begin
+    X:= nx - 8 * dX;
+    Y:= ny - 8 * dY;
+    for t:= -8 to ticks + 8 do
+        {$include tunsetborder.inc}
+    nx:= nx - dY;
+    ny:= ny + dX;
+    end;
+
+if SDL_MustLock(LandSurface) then
+   SDL_UnlockSurface(LandSurface)
+end;
+
+
+end.
--- a/hedgewars/uLandObjects.pas	Thu Oct 05 16:33:18 2006 +0000
+++ b/hedgewars/uLandObjects.pas	Thu Oct 05 17:02:09 2006 +0000
@@ -1,448 +1,448 @@
-(*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- *)
-
-unit uLandObjects;
-interface
-uses SDLh;
-{$include options.inc}
-
-procedure AddObjects(InSurface, Surface: PSDL_Surface);
-procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface);
-
-implementation
-uses uLand, uStore, uConsts, uMisc, uConsole, uRandom;
-const MaxRects = 256;
-      MAXOBJECTRECTS = 16;
-      MAXTHEMEOBJECTS = 32;
-
-type PRectArray = ^TRectsArray;
-     TRectsArray = array[0..MaxRects] of TSDL_Rect;
-     TThemeObject = record
-                    Surf: PSDL_Surface;
-                    inland: TSDL_Rect;
-                    outland: array[0..Pred(MAXOBJECTRECTS)] of TSDL_Rect;
-                    rectcnt: Longword;
-                    Width, Height: Longword;
-                    Maxcnt: Longword;
-                    end;
-     TThemeObjects = record
-                     Count: integer;
-                     objs: array[0..Pred(MAXTHEMEOBJECTS)] of TThemeObject;
-                     end;
-     TSprayObject = record
-                    Surf: PSDL_Surface;
-                    Width, Height: Longword;
-                    Maxcnt: Longword;
-                    end;
-     TSprayObjects = record
-                     Count: integer;
-                     objs: array[0..Pred(MAXTHEMEOBJECTS)] of TSprayObject
-                     end;
-
-var Rects: PRectArray;
-    RectCount: Longword;
-
-procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface);
-var p: PByteArray;
-    x, y: Longword;
-    bpp: integer;
-    r: TSDL_Rect;
-begin
-r.x:= cpX;
-r.y:= cpY;
-SDL_UpperBlit(Image, nil, Surface, @r);
-WriteToConsole('Generating collision info... ');
-
-if SDL_MustLock(Image) then
-   SDLTry(SDL_LockSurface(Image) >= 0, true);
-
-bpp:= Image.format.BytesPerPixel;
-WriteToConsole('('+inttostr(bpp)+') ');
-p:= Image.pixels;
-case bpp of
-     1: OutError('We don''t work with 8 bit surfaces', true);
-     2: for y:= 0 to Pred(Image.h) do
-            begin
-            for x:= 0 to Pred(Image.w) do
-                if PWord(@p[x * 2])^ <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND;
-            p:= @p[Image.pitch];
-            end;
-     3: for y:= 0 to Pred(Image.h) do
-            begin
-            for x:= 0 to Pred(Image.w) do
-                if  (p[x * 3 + 0] <> 0)
-                 or (p[x * 3 + 1] <> 0)
-                 or (p[x * 3 + 2] <> 0) then Land[cpY + y, cpX + x]:= COLOR_LAND;
-            p:= @p[Image.pitch];
-            end;
-     4: for y:= 0 to Pred(Image.h) do
-            begin
-            for x:= 0 to Pred(Image.w) do
-                if PLongword(@p[x * 4])^ <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND;
-            p:= @p[Image.pitch];
-            end;
-     end;
-if SDL_MustLock(Image) then
-   SDL_UnlockSurface(Image);
-WriteLnToConsole(msgOK)
-end;
-
-procedure AddRect(x1, y1, w1, h1: integer);
-begin
-with Rects[RectCount] do
-     begin
-     x:= x1;
-     y:= y1;
-     w:= w1;
-     h:= h1
-     end;
-inc(RectCount);
-TryDo(RectCount < MaxRects, 'AddRect: overflow', true)
-end;
-
-procedure InitRects;
-begin
-RectCount:= 0;
-New(Rects)
-end;
-
-procedure FreeRects;
-begin
-Dispose(rects)
-end;
-
-function CheckIntersect(x1, y1, w1, h1: integer): boolean;
-var i: Longword;
-begin
-Result:= false;
-i:= 0;
-if RectCount > 0 then
-   repeat
-   with Rects[i] do
-        Result:= (x < x1 + w1) and (x1 < x + w) and
-                 (y < y1 + h1) and (y1 < y + h);
-   inc(i)
-   until (i = RectCount) or (Result)
-end;
-
-function AddGirder(gX: integer; Surface: PSDL_Surface): boolean;
-var tmpsurf: PSDL_Surface;
-    x1, x2, y, k, i: integer;
-    r, rr: TSDL_Rect;
-
-    function CountNonZeroz(x, y: integer): Longword;
-    var i: integer;
-    begin
-    Result:= 0;
-    for i:= y to y + 15 do
-        if Land[i, x] <> 0 then inc(Result)
-    end;
-
-begin
-y:= 150;
-repeat
-  inc(y, 24);
-  x1:= gX;
-  x2:= gX;
-  while (x1 > 100) and (CountNonZeroz(x1, y) = 0) do dec(x1, 2);
-  i:= x1 - 12;
-  repeat
-    k:= CountNonZeroz(x1, y);
-    dec(x1, 2)
-  until (x1 < 100) or (k = 0) or (k = 16) or (x1 < i);
-  inc(x1, 2);
-  if k = 16 then
-     begin
-     while (x2 < 1900) and (CountNonZeroz(x2, y) = 0) do inc(x2, 2);
-     i:= x2 + 12;
-     repeat
-       k:= CountNonZeroz(x2, y);
-       inc(x2, 2)
-     until (x2 > 1900) or (k = 0) or (k = 16) or (x2 > i);
-     if (x2 < 1900) and (k = 16) and (x2 - x1 > 250)
-        and not CheckIntersect(x1 - 32, y - 64, x2 - x1 + 64, 144) then break;
-     end;
-x1:= 0;
-until y > 900;
-if x1 > 0 then
-   begin
-   Result:= true;
-   tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder', false);
-   rr.x:= x1;
-   rr.y:= y;
-   while rr.x + 100 < x2 do
-         begin
-         SDL_UpperBlit(tmpsurf, nil, Surface, @rr);
-         inc(rr.x, 100);
-         end;
-   r.x:= 0;
-   r.y:= 0;
-   r.w:= x2 - rr.x;
-   r.h:= 16;
-   SDL_UpperBlit(tmpsurf, @r, Surface, @rr);
-   SDL_FreeSurface(tmpsurf);
-   AddRect(x1 - 8, y - 32, x2 - x1 + 16, 80);
-   for k:= y to y + 15 do
-       for i:= x1 to x2 do Land[k, i]:= $FFFFFF
-   end else Result:= false
-end;
-
-function CheckLand(rect: TSDL_Rect; dX, dY, Color: Longword): boolean;
-var i: Longword;
-begin
-Result:= true;
-inc(rect.x, dX);
-inc(rect.y, dY);
-i:= 0;
-{$WARNINGS OFF}
-while (i <= rect.w) and Result do
-      begin
-      Result:= (Land[rect.y, rect.x + i] = Color) and (Land[rect.y + rect.h, rect.x + i] = Color);
-      inc(i)
-      end;
-i:= 0;
-while (i <= rect.h) and Result do
-      begin
-      Result:= (Land[rect.y + i, rect.x] = Color) and (Land[rect.y + i, rect.x + rect.w] = Color);
-      inc(i)
-      end;
-{$WARNINGS ON}
-end;
-
-function CheckCanPlace(x, y: Longword; var Obj: TThemeObject): boolean;
-var i: Longword;
-begin
-with Obj do
-     if CheckLand(inland, x, y, $FFFFFF) then
-        begin
-        Result:= true;
-        i:= 1;
-        while Result and (i <= rectcnt) do
-              begin
-              Result:= CheckLand(outland[i], x, y, 0);
-              inc(i)
-              end;
-        if Result then
-           Result:= not CheckIntersect(x, y, Width, Height)
-        end else
-        Result:= false
-end;
-
-function TryPut(var Obj: TThemeObject; Surface: PSDL_Surface): boolean; overload;
-const MaxPointsIndex = 2047;
-var x, y: Longword;
-    ar: array[0..MaxPointsIndex] of TPoint;
-    cnt, i: Longword;
-begin
-cnt:= 0;
-with Obj do
-     begin
-     if Maxcnt = 0 then
-        begin
-        Result:= false;
-        exit
-        end;
-     x:= 0;
-     repeat
-         y:= 0;
-         repeat
-             if CheckCanPlace(x, y, Obj) then
-                begin
-                ar[cnt].x:= x;
-                ar[cnt].y:= y;
-                inc(cnt);
-                if cnt > MaxPointsIndex then // buffer is full, do not check the rest land
-                   begin
-                   y:= 5000;
-                   x:= 5000;
-                   end
-                end;
-             inc(y, 3);
-         until y > 1023 - Height;
-         inc(x, getrandom(6) + 3)
-     until x > 2047 - Width;
-     Result:= cnt <> 0;
-     if Result then
-        begin
-        i:= getrandom(cnt);
-        BlitImageAndGenerateCollisionInfo(ar[i].x, ar[i].y, Obj.Surf, Surface);
-        AddRect(ar[i].x, ar[i].y, Width, Height);
-        dec(Maxcnt)
-        end else Maxcnt:= 0
-     end
-end;
-
-function TryPut(var Obj: TSprayObject; Surface: PSDL_Surface): boolean; overload;
-const MaxPointsIndex = 8095;
-var x, y: Longword;
-    ar: array[0..MaxPointsIndex] of TPoint;
-    cnt, i: Longword;
-    r: TSDL_Rect;
-begin
-cnt:= 0;
-with Obj do
-     begin
-     if Maxcnt = 0 then
-        begin
-        Result:= false;
-        exit
-        end;
-     x:= 0;
-     r.x:= 0;
-     r.y:= 0;
-     r.w:= Width;
-     r.h:= Height + 16;
-     repeat
-         y:= 8;
-         repeat
-             if CheckLand(r, x, y - 8, $FFFFFF)
-                and not CheckIntersect(x, y, Width, Height) then
-                begin
-                ar[cnt].x:= x;
-                ar[cnt].y:= y;
-                inc(cnt);
-                if cnt > MaxPointsIndex then // buffer is full, do not check the rest land
-                   begin
-                   y:= 5000;
-                   x:= 5000;
-                   end
-                end;
-             inc(y, 12);
-         until y > 1023 - Height - 8;
-         inc(x, getrandom(12) + 12)
-     until x > 2047 - Width;
-     Result:= cnt <> 0;
-     if Result then
-        begin
-        i:= getrandom(cnt);
-        r.x:= ar[i].X;
-        r.y:= ar[i].Y;
-        r.w:= Width;
-        r.h:= Height;
-        SDL_UpperBlit(Obj.Surf, nil, Surface, @r);
-        AddRect(ar[i].x - 32, ar[i].y - 32, Width + 64, Height + 64);
-        dec(Maxcnt)
-        end else Maxcnt:= 0
-     end
-end;
-
-procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects);
-var s: string;
-    f: textfile;
-    i, ii: integer;
-begin
-s:= Pathz[ptCurrTheme] + '/' + cThemeCFGFilename;
-WriteLnToConsole('Reading objects info...');
-AssignFile(f, s);
-{$I-}
-Reset(f);
-Readln(f, s); // skip color
-Readln(f, ThemeObjects.Count);
-for i:= 0 to Pred(ThemeObjects.Count) do
-    begin
-    Readln(f, s); // filename
-    with ThemeObjects.objs[i] do
-         begin
-         Surf:= LoadImage(Pathz[ptCurrTheme] + '/' + s, false);
-         Read(f, Width, Height);
-         with inland do Read(f, x, y, w, h);
-         Read(f, rectcnt);
-         for ii:= 1 to rectcnt do
-             with outland[ii] do Read(f, x, y, w, h);
-         Maxcnt:= 3;
-         ReadLn(f)
-         end;
-    end;
-
-Readln(f, SprayObjects.Count);
-for i:= 0 to Pred(SprayObjects.Count) do
-    begin
-    Readln(f, s); // filename
-    with SprayObjects.objs[i] do
-         begin
-         Surf:= LoadImage(Pathz[ptCurrTheme] + '/' + s, false);
-         Width:= Surf.w;
-         Height:= Surf.h;
-         ReadLn(f, Maxcnt)
-         end;
-    end;
-Closefile(f);
-{$I+}
-TryDo(IOResult = 0, 'Bad data or cannot access file ' + cThemeCFGFilename, true)
-end;
-
-procedure AddThemeObjects(Surface: PSDL_Surface; var ThemeObjects: TThemeObjects; MaxCount: integer);
-var i, ii, t: integer;
-    b: boolean;
-begin
-if ThemeObjects.Count = 0 then exit;
-WriteLnToConsole('Adding theme objects...');
-i:= 1;
-repeat
-    t:= getrandom(ThemeObjects.Count);
-    ii:= t;
-    repeat
-      inc(ii);
-      if ii = ThemeObjects.Count then ii:= 0;
-      b:= TryPut(ThemeObjects.objs[ii], Surface)
-    until b or (ii = t);
-    inc(i)
-until (i > MaxCount) or not b;
-end;
-
-procedure AddSprayObjects(Surface: PSDL_Surface; var SprayObjects: TSprayObjects; MaxCount: Longword);
-var i: Longword;
-    ii, t: integer;
-    b: boolean;
-begin
-if SprayObjects.Count = 0 then exit;
-WriteLnToConsole('Adding spray objects...');
-i:= 1;
-repeat
-    t:= getrandom(SprayObjects.Count);
-    ii:= t;
-    repeat
-      inc(ii);
-      if ii = SprayObjects.Count then ii:= 0;
-      b:= TryPut(SprayObjects.objs[ii], Surface)
-    until b or (ii = t);
-    inc(i)
-until (i > MaxCount) or not b;
-end;
-
-procedure AddObjects(InSurface, Surface: PSDL_Surface);
-var ThemeObjects: TThemeObjects;
-    SprayObjects: TSprayObjects;
-begin
-InitRects;
-AddGirder(256, Surface);
-AddGirder(512, Surface);
-AddGirder(768, Surface);
-AddGirder(1024, Surface);
-AddGirder(1280, Surface);
-AddGirder(1536, Surface);
-AddGirder(1792, Surface);
-ReadThemeInfo(ThemeObjects, SprayObjects);
-AddThemeObjects(Surface, ThemeObjects, 8);
-AddProgress;
-SDL_UpperBlit(InSurface, nil, Surface, nil);
-AddSprayObjects(Surface, SprayObjects, 10);
-FreeRects
-end;
-
-end.
+(*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *)
+
+unit uLandObjects;
+interface
+uses SDLh;
+{$include options.inc}
+
+procedure AddObjects(InSurface, Surface: PSDL_Surface);
+procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface);
+
+implementation
+uses uLand, uStore, uConsts, uMisc, uConsole, uRandom;
+const MaxRects = 256;
+      MAXOBJECTRECTS = 16;
+      MAXTHEMEOBJECTS = 32;
+
+type PRectArray = ^TRectsArray;
+     TRectsArray = array[0..MaxRects] of TSDL_Rect;
+     TThemeObject = record
+                    Surf: PSDL_Surface;
+                    inland: TSDL_Rect;
+                    outland: array[0..Pred(MAXOBJECTRECTS)] of TSDL_Rect;
+                    rectcnt: Longword;
+                    Width, Height: Longword;
+                    Maxcnt: Longword;
+                    end;
+     TThemeObjects = record
+                     Count: integer;
+                     objs: array[0..Pred(MAXTHEMEOBJECTS)] of TThemeObject;
+                     end;
+     TSprayObject = record
+                    Surf: PSDL_Surface;
+                    Width, Height: Longword;
+                    Maxcnt: Longword;
+                    end;
+     TSprayObjects = record
+                     Count: integer;
+                     objs: array[0..Pred(MAXTHEMEOBJECTS)] of TSprayObject
+                     end;
+
+var Rects: PRectArray;
+    RectCount: Longword;
+
+procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface);
+var p: PByteArray;
+    x, y: Longword;
+    bpp: integer;
+    r: TSDL_Rect;
+begin
+r.x:= cpX;
+r.y:= cpY;
+SDL_UpperBlit(Image, nil, Surface, @r);
+WriteToConsole('Generating collision info... ');
+
+if SDL_MustLock(Image) then
+   SDLTry(SDL_LockSurface(Image) >= 0, true);
+
+bpp:= Image.format.BytesPerPixel;
+WriteToConsole('('+inttostr(bpp)+') ');
+p:= Image.pixels;
+case bpp of
+     1: OutError('We don''t work with 8 bit surfaces', true);
+     2: for y:= 0 to Pred(Image.h) do
+            begin
+            for x:= 0 to Pred(Image.w) do
+                if PWord(@p[x * 2])^ <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND;
+            p:= @p[Image.pitch];
+            end;
+     3: for y:= 0 to Pred(Image.h) do
+            begin
+            for x:= 0 to Pred(Image.w) do
+                if  (p[x * 3 + 0] <> 0)
+                 or (p[x * 3 + 1] <> 0)
+                 or (p[x * 3 + 2] <> 0) then Land[cpY + y, cpX + x]:= COLOR_LAND;
+            p:= @p[Image.pitch];
+            end;
+     4: for y:= 0 to Pred(Image.h) do
+            begin
+            for x:= 0 to Pred(Image.w) do
+                if PLongword(@p[x * 4])^ <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND;
+            p:= @p[Image.pitch];
+            end;
+     end;
+if SDL_MustLock(Image) then
+   SDL_UnlockSurface(Image);
+WriteLnToConsole(msgOK)
+end;
+
+procedure AddRect(x1, y1, w1, h1: integer);
+begin
+with Rects[RectCount] do
+     begin
+     x:= x1;
+     y:= y1;
+     w:= w1;
+     h:= h1
+     end;
+inc(RectCount);
+TryDo(RectCount < MaxRects, 'AddRect: overflow', true)
+end;
+
+procedure InitRects;
+begin
+RectCount:= 0;
+New(Rects)
+end;
+
+procedure FreeRects;
+begin
+Dispose(rects)
+end;
+
+function CheckIntersect(x1, y1, w1, h1: integer): boolean;
+var i: Longword;
+begin
+Result:= false;
+i:= 0;
+if RectCount > 0 then
+   repeat
+   with Rects[i] do
+        Result:= (x < x1 + w1) and (x1 < x + w) and
+                 (y < y1 + h1) and (y1 < y + h);
+   inc(i)
+   until (i = RectCount) or (Result)
+end;
+
+function AddGirder(gX: integer; Surface: PSDL_Surface): boolean;
+var tmpsurf: PSDL_Surface;
+    x1, x2, y, k, i: integer;
+    r, rr: TSDL_Rect;
+
+    function CountNonZeroz(x, y: integer): Longword;
+    var i: integer;
+    begin
+    Result:= 0;
+    for i:= y to y + 15 do
+        if Land[i, x] <> 0 then inc(Result)
+    end;
+
+begin
+y:= 150;
+repeat
+  inc(y, 24);
+  x1:= gX;
+  x2:= gX;
+  while (x1 > 100) and (CountNonZeroz(x1, y) = 0) do dec(x1, 2);
+  i:= x1 - 12;
+  repeat
+    k:= CountNonZeroz(x1, y);
+    dec(x1, 2)
+  until (x1 < 100) or (k = 0) or (k = 16) or (x1 < i);
+  inc(x1, 2);
+  if k = 16 then
+     begin
+     while (x2 < 1900) and (CountNonZeroz(x2, y) = 0) do inc(x2, 2);
+     i:= x2 + 12;
+     repeat
+       k:= CountNonZeroz(x2, y);
+       inc(x2, 2)
+     until (x2 > 1900) or (k = 0) or (k = 16) or (x2 > i);
+     if (x2 < 1900) and (k = 16) and (x2 - x1 > 250)
+        and not CheckIntersect(x1 - 32, y - 64, x2 - x1 + 64, 144) then break;
+     end;
+x1:= 0;
+until y > 900;
+if x1 > 0 then
+   begin
+   Result:= true;
+   tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder', false);
+   rr.x:= x1;
+   rr.y:= y;
+   while rr.x + 100 < x2 do
+         begin
+         SDL_UpperBlit(tmpsurf, nil, Surface, @rr);
+         inc(rr.x, 100);
+         end;
+   r.x:= 0;
+   r.y:= 0;
+   r.w:= x2 - rr.x;
+   r.h:= 16;
+   SDL_UpperBlit(tmpsurf, @r, Surface, @rr);
+   SDL_FreeSurface(tmpsurf);
+   AddRect(x1 - 8, y - 32, x2 - x1 + 16, 80);
+   for k:= y to y + 15 do
+       for i:= x1 to x2 do Land[k, i]:= $FFFFFF
+   end else Result:= false
+end;
+
+function CheckLand(rect: TSDL_Rect; dX, dY, Color: Longword): boolean;
+var i: Longword;
+begin
+Result:= true;
+inc(rect.x, dX);
+inc(rect.y, dY);
+i:= 0;
+{$WARNINGS OFF}
+while (i <= rect.w) and Result do
+      begin
+      Result:= (Land[rect.y, rect.x + i] = Color) and (Land[rect.y + rect.h, rect.x + i] = Color);
+      inc(i)
+      end;
+i:= 0;
+while (i <= rect.h) and Result do
+      begin
+      Result:= (Land[rect.y + i, rect.x] = Color) and (Land[rect.y + i, rect.x + rect.w] = Color);
+      inc(i)
+      end;
+{$WARNINGS ON}
+end;
+
+function CheckCanPlace(x, y: Longword; var Obj: TThemeObject): boolean;
+var i: Longword;
+begin
+with Obj do
+     if CheckLand(inland, x, y, $FFFFFF) then
+        begin
+        Result:= true;
+        i:= 1;
+        while Result and (i <= rectcnt) do
+              begin
+              Result:= CheckLand(outland[i], x, y, 0);
+              inc(i)
+              end;
+        if Result then
+           Result:= not CheckIntersect(x, y, Width, Height)
+        end else
+        Result:= false
+end;
+
+function TryPut(var Obj: TThemeObject; Surface: PSDL_Surface): boolean; overload;
+const MaxPointsIndex = 2047;
+var x, y: Longword;
+    ar: array[0..MaxPointsIndex] of TPoint;
+    cnt, i: Longword;
+begin
+cnt:= 0;
+with Obj do
+     begin
+     if Maxcnt = 0 then
+        begin
+        Result:= false;
+        exit
+        end;
+     x:= 0;
+     repeat
+         y:= 0;
+         repeat
+             if CheckCanPlace(x, y, Obj) then
+                begin
+                ar[cnt].x:= x;
+                ar[cnt].y:= y;
+                inc(cnt);
+                if cnt > MaxPointsIndex then // buffer is full, do not check the rest land
+                   begin
+                   y:= 5000;
+                   x:= 5000;
+                   end
+                end;
+             inc(y, 3);
+         until y > 1023 - Height;
+         inc(x, getrandom(6) + 3)
+     until x > 2047 - Width;
+     Result:= cnt <> 0;
+     if Result then
+        begin
+        i:= getrandom(cnt);
+        BlitImageAndGenerateCollisionInfo(ar[i].x, ar[i].y, Obj.Surf, Surface);
+        AddRect(ar[i].x, ar[i].y, Width, Height);
+        dec(Maxcnt)
+        end else Maxcnt:= 0
+     end
+end;
+
+function TryPut(var Obj: TSprayObject; Surface: PSDL_Surface): boolean; overload;
+const MaxPointsIndex = 8095;
+var x, y: Longword;
+    ar: array[0..MaxPointsIndex] of TPoint;
+    cnt, i: Longword;
+    r: TSDL_Rect;
+begin
+cnt:= 0;
+with Obj do
+     begin
+     if Maxcnt = 0 then
+        begin
+        Result:= false;
+        exit
+        end;
+     x:= 0;
+     r.x:= 0;
+     r.y:= 0;
+     r.w:= Width;
+     r.h:= Height + 16;
+     repeat
+         y:= 8;
+         repeat
+             if CheckLand(r, x, y - 8, $FFFFFF)
+                and not CheckIntersect(x, y, Width, Height) then
+                begin
+                ar[cnt].x:= x;
+                ar[cnt].y:= y;
+                inc(cnt);
+                if cnt > MaxPointsIndex then // buffer is full, do not check the rest land
+                   begin
+                   y:= 5000;
+                   x:= 5000;
+                   end
+                end;
+             inc(y, 12);
+         until y > 1023 - Height - 8;
+         inc(x, getrandom(12) + 12)
+     until x > 2047 - Width;
+     Result:= cnt <> 0;
+     if Result then
+        begin
+        i:= getrandom(cnt);
+        r.x:= ar[i].X;
+        r.y:= ar[i].Y;
+        r.w:= Width;
+        r.h:= Height;
+        SDL_UpperBlit(Obj.Surf, nil, Surface, @r);
+        AddRect(ar[i].x - 32, ar[i].y - 32, Width + 64, Height + 64);
+        dec(Maxcnt)
+        end else Maxcnt:= 0
+     end
+end;
+
+procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjec