merge default sdl2transition
authorsheepluva
Tue, 10 Nov 2015 20:43:13 +0100
branchsdl2transition
changeset 11362 ed5a6478e710
parent 11361 31570b766315 (current diff)
parent 11344 852bf1e052f4 (diff)
child 11363 9006e158a81f
merge default
CMakeLists.txt
INSTALL
QTfrontend/CMakeLists.txt
QTfrontend/gameuiconfig.cpp
QTfrontend/main.cpp
QTfrontend/res/xml/tips.xml
QTfrontend/ui/widget/about.cpp
QTfrontend/util/SDLInteraction.cpp
QTfrontend/util/SDLInteraction.h
README
cmake_modules/FindFFMPEG.cmake
cmake_modules/platform.cmake
hedgewars/CMakeLists.txt
hedgewars/SDLh.pas
hedgewars/hwengine.ico
hedgewars/hwengine.pas
hedgewars/hwengine.rc
hedgewars/options.inc
hedgewars/uAI.pas
hedgewars/uChat.pas
hedgewars/uDebug.pas
hedgewars/uIO.pas
hedgewars/uInputHandler.pas
hedgewars/uLand.pas
hedgewars/uLandGraphics.pas
hedgewars/uLandObjects.pas
hedgewars/uMisc.pas
hedgewars/uRenderUtils.pas
hedgewars/uSound.pas
hedgewars/uStore.pas
hedgewars/uTextures.pas
hedgewars/uWorld.pas
misc/libphyslayer/CMakeLists.txt
project_files/HedgewarsMobile/Classes/Appirater.h
project_files/HedgewarsMobile/Classes/Appirater.m
project_files/HedgewarsMobile/Classes/SettingsContainerViewController.h
project_files/HedgewarsMobile/Classes/SettingsContainerViewController.m
project_files/HedgewarsMobile/Locale/Turkish.lproj/About.strings
project_files/HedgewarsMobile/Locale/Turkish.lproj/Localizable.strings
project_files/HedgewarsMobile/Locale/Turkish.lproj/Scheme.strings
project_files/hedgewars.pro
share/hedgewars/Data/Fonts/DroidSansFallback.ttf
share/hedgewars/Data/Forts/CakeR.png
share/hedgewars/Data/Forts/CastleR.png
share/hedgewars/Data/Forts/EvilChickenR.png
share/hedgewars/Data/Forts/FlowerhogR.png
share/hedgewars/Data/Forts/HydrantR.png
share/hedgewars/Data/Forts/LegoR.png
share/hedgewars/Data/Forts/PlaneR.png
share/hedgewars/Data/Forts/StatueR.png
share/hedgewars/Data/Forts/SteelTowerR.png
share/hedgewars/Data/Forts/TankR.png
share/hedgewars/Data/Forts/UFOR.png
share/hedgewars/Data/Forts/WoodR.png
share/hedgewars/Data/Graphics/TARDIS.png
share/hedgewars/Data/Locale/missions_tr.txt
share/hedgewars/Data/Locale/tr.lua
share/hedgewars/Data/Locale/tr.txt
share/hedgewars/Data/Maps/Basketball/map.png
share/hedgewars/Data/Maps/Basketball/mask.png
share/hedgewars/Data/Missions/Campaign/01#Boot_Camp.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Cluster_Bomb.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Shotgun.lua
tools/CMakeLists.txt
--- a/.hgignore	Tue Nov 10 18:16:35 2015 +0100
+++ b/.hgignore	Tue Nov 10 20:43:13 2015 +0100
@@ -26,7 +26,7 @@
 glob:*.diff
 glob:vittorio.*
 glob:project_files/HedgewarsMobile/Data/
-glob:project_files/HedgewarsMobile/build/
+glob:project_files/HedgewarsMobile/Build/
 glob:gameServer/dist/
 glob:misc/liblua/Xcode/build/
 glob:misc/libphysfs/Xcode/build/
@@ -40,6 +40,8 @@
 glob:*.orig
 glob:*.bak
 glob:*.rej
+glob:project_files/hwc/*.c
+glob:project_files/hwc/*.h
 glob:project_files/Android-build/SDL-android-project/jni/**
 glob:project_files/Android-build/SDL-android-project/obj
 glob:project_files/Android-build/SDL-android-project/libs/armeabi*
@@ -63,3 +65,18 @@
 glob:*.tar.*
 glob:*.or
 glob:*.res
+glob:Hedgewars.app/*
+glob:tools/CreateMacBundle.cmake
+glob:share/Info.plist
+glob:CTestTestfile.cmake
+glob:arch.c
+glob:*.swp
+glob:*~.nib
+glob:*.pbxuser
+glob:*.perspective
+glob:*.perspectivev3
+glob:*.project.xcworkspace
+glob:*.xcuserdata
+glob:xcuserdata
+glob:*.mode1v3
+glob:*.mode2v3
--- a/.hgtags	Tue Nov 10 18:16:35 2015 +0100
+++ b/.hgtags	Tue Nov 10 20:43:13 2015 +0100
@@ -60,3 +60,13 @@
 0000000000000000000000000000000000000000 0.9.18-release
 2fc02902c7cbf3c29bfe08a50e5f37983582b251 0.9.18-release
 1617149e01a4fa25637e2ab655d0287ef9c21b7c 0.9.19-release
+af0520a6bf0061b27f8321514d35fcd2b1ef5f9c 0.9.20-release
+7e55468ffe384a3065524c483eb5e3cdb1658fd5 0.9.21-release
+7e55468ffe384a3065524c483eb5e3cdb1658fd5 fab746a3597e
+0f5961910e2712582b162abd08ae3eed330cc978 Nice one
+d9622394ec9c2974a84b9b4d9e6c0ac26c4060ff 0.9.22-RC
+0f5961910e2712582b162abd08ae3eed330cc978 Nice one
+0000000000000000000000000000000000000000 Nice one
+4c4f22cc3fa4e6c1e5cd6cce35350dd93478415f 0.9.22-release
+4c4f22cc3fa4e6c1e5cd6cce35350dd93478415f 0.9.22-release
+9621fdcad96589b3fd78713a0f31e72f26f068bb 0.9.22-release
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.travis.yml	Tue Nov 10 20:43:13 2015 +0100
@@ -0,0 +1,31 @@
+language: c
+branches:
+  except:
+    gh-pages
+compiler:
+  - gcc
+  - clang
+env:
+  - BUILD_ARGS="-DCMAKE_BUILD_TYPE=Release"
+  - BUILD_ARGS="-DCMAKE_BUILD_TYPE=Debug"
+  - BUILD_ARGS="-DNOSERVER=1 -DBUILD_ENGINE_C=1"
+  - BUILD_ARGS="-DNOSERVER=1 -DNOVIDEOREC=1 -DNOPNG=1"
+  - BUILD_ARGS="-DNOSERVER=1 -DLUA_SYSTEM=0 -DPHYSFS_SYSTEM=0"
+matrix:
+  allow_failures:
+    # Failures we expect here
+before_install:
+  - sudo apt-get update -qq
+  - sudo apt-get install debhelper cmake dpkg-dev libqt4-dev qt4-qmake libphysfs-dev libsdl1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-net1.2-dev bzip2 ghc libghc-mtl-dev libghc-parsec3-dev libghc-bytestring-show-dev libghc-vector-dev libghc-zlib-dev libghc-random-dev libghc-stm-dev libghc-network-dev libghc-dataenc-dev libghc-hslogger-dev libghc-utf8-string-dev libghc-sha-dev libghc-entropy-dev liblua5.1-0-dev imagemagick fpc fp-compiler fp-units-misc libpng-dev fp-units-gfx libavcodec-dev libavformat-dev freeglut3-dev libglew1.6-dev
+script: 
+  - mkdir build && cd build && cmake $BUILD_ARGS .. && make VERBOSE=1 && make test_verbose
+notifications:
+  email: false
+  irc:
+    channels:
+      - "chat.freenode.net#hedgewars"
+    template:
+      - "hw-build #%{build_number} (%{commit} by %{author}): %{message}"
+      - "See details at %{build_url}"
+    on_success: change
+    on_failure: always
--- a/CMakeLists.txt	Tue Nov 10 18:16:35 2015 +0100
+++ b/CMakeLists.txt	Tue Nov 10 20:43:13 2015 +0100
@@ -12,18 +12,18 @@
 include(${CMAKE_MODULE_PATH}/utils.cmake)
 
 #possible cmake configuration
-option(NOSERVER "Disable gameServer build (off)]" OFF)
+option(NOSERVER "Disable gameServer build (off)" OFF)
 option(NOPNG "Disable screenshoot compression (off)" OFF)
 option(NOVIDEOREC "Disable video recording (off)" OFF)
 
 #libraries are built shared unless explicitly added as a static
 option(BUILD_SHARED_LIBS "Build libraries as shared modules (on)" ON)
-#set this to ON when 2.1.0 becomes more widespread (and only for linux)
-option(PHYSFS_SYSTEM "Use system physfs (off)" OFF)
 
 if(WIN32 OR APPLE)
+    option(PHYSFS_SYSTEM "Use system physfs (off)" OFF)
     option(LUA_SYSTEM "Use system lua (off)" OFF)
 else()
+    option(PHYSFS_SYSTEM "Use system physfs (on)" ON)
     option(LUA_SYSTEM "Use system lua (on)" ON)
 endif()
 
@@ -32,18 +32,28 @@
 
 option(MINIMAL_FLAGS "Respect system flags as much as possible (off)" OFF)
 option(NOAUTOUPDATE "Disable OS X Sparkle update checking (off)" OFF)
+option(SKIPBUNDLE "Do not create relocate bundle (off)" OFF)
+
+option(BUILD_ENGINE_C "Compile hwengine as native C (off)" OFF)
+option(GL2 "Enable OpenGL 2 rendering !!!EXPERIMENTAL - DO NOT USE!!! [default: off)" OFF)
 
 set(GHFLAGS "" CACHE STRING "Additional Haskell flags")
 if(UNIX AND NOT APPLE)
     set(DATA_INSTALL_DIR "share/hedgewars" CACHE STRING "Resource folder path")
 endif()
 
+option(NOVERSIONINFOUPDATE "Disable update of version_info.txt. To be used if source is in a git/repo that is NOT the hedgewars repo" OFF)
+
+#system paths for finding required fonts (see share/hedgewars/Data/fonts)
+#subdirectories will NOT be searched.
+#all fonts that can't be found will be bundled with hedgewars
+set(FONTS_DIRS "" CACHE STRING "Additional paths to folders where required fonts can be found ( ; is separator)")
 
 #versioning
 set(CPACK_PACKAGE_VERSION_MAJOR 0)
 set(CPACK_PACKAGE_VERSION_MINOR 9)
-set(CPACK_PACKAGE_VERSION_PATCH 20)
-set(HEDGEWARS_PROTO_VER 46)
+set(CPACK_PACKAGE_VERSION_PATCH 23)
+set(HEDGEWARS_PROTO_VER 52)
 set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
 include(${CMAKE_MODULE_PATH}/revinfo.cmake)
 
@@ -53,20 +63,24 @@
 include(${CMAKE_MODULE_PATH}/paths.cmake)
 #general utilities
 include(${CMAKE_MODULE_PATH}/utils.cmake)
+#paths initialization
+include(${CMAKE_MODULE_PATH}/paths.cmake)
 #platform specific init code
 include(${CMAKE_MODULE_PATH}/platform.cmake)
 
 
 #when build type is not specified, assume Debug/Release according to build version information
-if (CMAKE_BUILD_TYPE)
-    string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
-    if ( NOT( (CMAKE_BUILD_TYPE MATCHES "RELEASE") OR (CMAKE_BUILD_TYPE MATCHES "DEBUG") ) )
-        set (CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release)" FORCE)
-        message (STATUS "Unknown build type, using default (${default_build_type})")
-    endif ()
-else (CMAKE_BUILD_TYPE)
-    set (CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release)" FORCE)
-endif (CMAKE_BUILD_TYPE)
+if(CMAKE_BUILD_TYPE)
+    string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
+    if(NOT((CMAKE_BUILD_TYPE MATCHES "RELEASE") OR
+           (CMAKE_BUILD_TYPE MATCHES "DEBUG") OR
+           (CMAKE_BUILD_TYPE MATCHES "RELWITHDEBINFO")))
+        set(CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release/RelWithDebInfo)" FORCE)
+        message(STATUS "Unknown build type ${CMAKE_BUILD_TYPE}, using default (${default_build_type})")
+    endif()
+else(CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Build type (Debug/Release/RelWithDebInfo)" FORCE)
+endif(CMAKE_BUILD_TYPE)
 
 
 #perform safe check that enable/disable compilation features
@@ -74,17 +88,14 @@
 
 #set default compiler flags
 add_flag_append(CMAKE_C_FLAGS "-Wall -pipe")
-add_flag_append(CMAKE_C_FLAGS_RELEASE "-Os")
+add_flag_append(CMAKE_C_FLAGS_RELEASE "-O2")
 add_flag_append(CMAKE_C_FLAGS_DEBUG "-Wextra -O0")
 add_flag_append(CMAKE_CXX_FLAGS "-Wall -pipe")
-add_flag_append(CMAKE_CXX_FLAGS_RELEASE "-Os")
+add_flag_append(CMAKE_CXX_FLAGS_RELEASE "-O2")
 add_flag_append(CMAKE_CXX_FLAGS_DEBUG "-Wextra -O0")
-add_flag_append(CMAKE_Pascal_FLAGS "-Cs2000000")
-add_flag_append(CMAKE_Pascal_FLAGS_DEBUG "-O- -gv")
-add_flag_append(CMAKE_Pascal_FLAGS_RELEASE "-Os -Xs")
 
 #CMake adds a lot of additional configuration flags, so let's clear them up
-if(${MINIMAL_FLAGS})
+if(MINIMAL_FLAGS)
     unset(CMAKE_C_FLAGS_RELEASE)
     unset(CMAKE_C_FLAGS_DEBUG)
     unset(CMAKE_CXX_FLAGS_RELEASE)
@@ -97,7 +108,7 @@
     if(${CMAKE_VERSION} VERSION_GREATER 2.6)
         separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS})
     else()
-        message(${WARNING} "GHFLAGS are available only when using CMake >= 2.8")
+        message("*** GHFLAGS are available only when using CMake >= 2.8 ***")
     endif()
 endif()
 
@@ -109,6 +120,7 @@
     list(APPEND haskell_flags "-Wall"       # all warnings
                               "-debug"      # debug mode
                               "-dcore-lint" # internal sanity check
+                              "-fno-warn-unused-do-bind"
                               )
 else()
     list(APPEND haskell_flags "-w" # no warnings
@@ -116,14 +128,32 @@
 endif()
 
 
+#build engine without freepascal
+if(BUILD_ENGINE_C)
+    find_package(Clang REQUIRED)
+
+    if(${CLANG_VERSION} VERSION_LESS "3.0")
+        message(FATAL_ERROR "LLVM/Clang compiler required version is 3.0 but version ${CLANG_VERSION} was found!")
+    endif()
+
+    set(CMAKE_C_COMPILER ${CLANG_EXECUTABLE})
+    set(CMAKE_CXX_COMPILER ${CLANG_EXECUTABLE})
+endif()
+
+
+#server
+if(NOT NOSERVER)
+    add_subdirectory(gameServer)
+endif()
+
+
 #lua discovery
-if (${LUA_SYSTEM})
-    if (NOT LUA_LIBRARY OR NOT LUA_INCLUDE_DIR)
+if(LUA_SYSTEM)
+    if(NOT LUA_LIBRARY OR NOT LUA_INCLUDE_DIR)
         find_package(Lua)
     endif()
 
-    if (LUA_LIBRARY AND LUA_INCLUDE_DIR)
-        set(LUA_FOUND TRUE)
+    if(LUA_LIBRARY AND LUA_INCLUDE_DIR)
         #use an IMPORTED tharget so that we can just use 'lua' to link
         add_library(lua UNKNOWN IMPORTED)
         set_target_properties(lua PROPERTIES IMPORTED_LOCATION ${LUA_LIBRARY})
@@ -131,7 +161,7 @@
         message(FATAL_ERROR "Missing Lua! Rerun cmake with -DLUA_SYSTEM=off to build the internal version")
     endif()
 else()
-    if (NOT LUA_LIBRARY OR NOT LUA_INCLUDE_DIR)
+    if(NOT LUA_LIBRARY OR NOT LUA_INCLUDE_DIR)
         message(STATUS "LUA will be provided by the bundled sources")
     endif()
     set(lua_output_name "hwlua")
@@ -140,8 +170,8 @@
 
 
 #physfs discovery
-if (${PHYSFS_SYSTEM})
-    if (NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
+if(PHYSFS_SYSTEM)
+    if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
         find_package(PhysFS)
     endif()
 
@@ -155,54 +185,71 @@
         string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}")
         set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}")
 
-        if (physfs_detected_ver VERSION_LESS "2.1.0")
-            message(FATAL_ERROR "PhysFS version is too old (dected ${physfs_detected_ver}, required 2.1.0)")
-            set(physfs_too_old true)
+        if(${physfs_detected_ver} VERSION_LESS 2.0.0)
+            message(FATAL_ERROR "PhysFS version is too old (detected ${physfs_detected_ver}, required 2.0.0)\n"
+                                "Perform an update or rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version")
         endif()
     endif()
 
-    if (NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
-        message(FATAL_ERROR "Missing PhysFS! Rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version")
-    else()
+    if(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR)
         #use an IMPORTED tharget so that we can just use 'physfs' to link
         add_library(physfs UNKNOWN IMPORTED)
         set_target_properties(physfs PROPERTIES IMPORTED_LOCATION ${PHYSFS_LIBRARY})
+    else()
+        message(FATAL_ERROR "Missing PhysFS! Rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version")
     endif()
 else()
-    if (NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
+    if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
         message(STATUS "PhysFS will be provided by the bundled sources")
     endif()
     set(physfs_output_name "hwphysfs")
     add_subdirectory(misc/libphysfs)
 endif()
 
-find_package_or_disable_msg(FFMPEG NOVIDEOREC "Video recording will not be built")
+find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built")
 
 #physfs helper library
 add_subdirectory(misc/libphyslayer)
 
-#server
-if(NOT NOSERVER)
-    add_subdirectory(gameServer)
+#maybe this could be merged inside hedgewars/CMakeLists.txt
+if(BUILD_ENGINE_C)
+    #pascal to c converter
+    add_subdirectory(tools/pas2c)
+    add_subdirectory(project_files/hwc)
+else()
+    #main pascal engine
+    add_subdirectory(hedgewars)
 endif()
 
-#main engine
-add_subdirectory(hedgewars)
-
 #Android related build scripts
+#TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set
 if(ANDROID)
-    #run cmake -DANDROID=1 to enable this
     add_subdirectory(project_files/Android-build)
-endif()
-
-#TODO: when ANDROID, BUILD_ENGINE_LIBRARY should be set
-if(NOT ANDROID)
+else(ANDROID)
     add_subdirectory(bin)
     add_subdirectory(QTfrontend)
     add_subdirectory(share)
     add_subdirectory(tools)
-endif()
-
+endif(ANDROID)
 
 include(${CMAKE_MODULE_PATH}/cpackvars.cmake)
 
+enable_testing()
+
+add_custom_target(test_normal  COMMAND ${CMAKE_CTEST_COMMAND} -E '^todo/' --timeout 300 --schedule-random)
+add_custom_target(test_verbose COMMAND ${CMAKE_CTEST_COMMAND} -E '^todo/' --timeout 300 --schedule-random -V)
+
+set(LUATESTS_DIR "${CMAKE_SOURCE_DIR}/tests/lua")
+set(TESTSDATA_DIR "${CMAKE_SOURCE_DIR}/share/hedgewars/Data")
+
+# set set this to "" if you want to see what's going on
+# TODO: engine should do this implicitly when running tests,
+# unless some env var like HWENGINE_SHOWTESTS is set or something
+set(STATSONLYFLAG "--stats-only")
+
+# add all lua tests
+file(GLOB_RECURSE luatests RELATIVE "${LUATESTS_DIR}" "${LUATESTS_DIR}/*.lua")
+foreach(luatest ${luatests})
+    add_test("${luatest}" "bin/hwengine" "--prefix" "${TESTSDATA_DIR}" "--nosound" "--nomusic" "${STATSONLYFLAG}" "--lua-test" "${LUATESTS_DIR}/${luatest}")
+endforeach(luatest)
+
--- a/COPYING	Tue Nov 10 18:16:35 2015 +0100
+++ b/COPYING	Tue Nov 10 20:43:13 2015 +0100
@@ -2,7 +2,7 @@
                    Version 2, June 1991
 
  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
@@ -305,7 +305,7 @@
 
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 
 Also add information on how to contact you by electronic and paper mail.
--- a/CREDITS	Tue Nov 10 18:16:35 2015 +0100
+++ b/CREDITS	Tue Nov 10 20:43:13 2015 +0100
@@ -25,6 +25,7 @@
 - Lortinak -> OldMan (2010), ShortHair (2010)
 - chujoii -> BrainSlug (2010), Dragon (2010), Ladle (2010), Laminaria (2010), Pantsu (2010), Pig (2010), Plunger (2010), SauceBoat (2010), ShaggyYeti (2010), SleepWalker (2010), SunWukong (2010), Teapot (2010), Teacup (2010), Zombi (2010)
 - Randy Broda -> Cyclops (2011), Soldier (2011)
+- Wohlstand -> PoliceGirl [based on policecap and sm_daisy] (2014)
 
 ==========
 = GRAVESTONES
@@ -45,6 +46,8 @@
 ==========
 - John Dum <fizzy@gmail.com> -> Nature theme
 - Jonatan Nilsson <jonatanfan@gmail.com> -> Pirate theme, City theme, Oriental theme, Snow theme
+- yd - http://opengameart.org/users/yd -> "oriented", used as Olympics SD theme
+- Kevin MacLeod - http://incompetech.com/ -> "hitman", used as basis for preliminary default SD theme
 
 ==========
 = THEMES
--- a/ChangeLog.txt	Tue Nov 10 18:16:35 2015 +0100
+++ b/ChangeLog.txt	Tue Nov 10 20:43:13 2015 +0100
@@ -1,9 +1,131 @@
 + features
 * bugfixes
 
-0.9.19 -> ???:
- * increase precision in damage calcs; extra damage affects fire properly now
- * visual enhancements for whip
+0.9.22 -> 0.9.23
+ * Hammer damage is now rounded down. This means it will cause NO DAMAGE to a hedgehog with less than 3 hp.
+ * Fixed bee not being affected by wrap world edge while still being thrown
+ * Fixed turn not ending when sticky mine was trapped on rubberband
+ * Various other fixes
+
+0.9.21 -> 0.9.22
+ + New Weapon / Map object: AirMine (floating mine that will follow nearby hedgehogs)
+ + Extensive changes to TechRacer: Variable terrain types, enhanced parameters, hwmap interpreter, fuel limiter, etc. 
+ + HedgeEditor - create missions/etc. in-game! see http://hedgewars.org/HedgeEditor
+ + Map previews can now take script parameters into account and preview waypoints in TechRacer
+ + Added a couple new flags
+ + Various tweaks to the interface and in-game chat
+ + Divided teams options will now just be ignored when more/less than 2 teams/clans, instead of displaying a fatal error
+ + Added 6 TechRacer maps to TechMaps
+ + Added 3 SpeedShoppa Challenges: Shoppa Love, Ropes and Crates, The Customer is King
+ + Hammer damage is now rounded up. This means it can be used to execute hedgehogs with only 1 hp.
+ + Improved "Art" theme.
+ * Generated bridges/girders are now connected better to the land mass
+ * Fixed rubberband sprite
+ * Fixed Wind-Indicator being wrong in certain situations
+ * Melon Bomb Pieces now bounce on Rubberband
+ * Reduced menu music volume
+ * The game will now fallback to default voicepack if a team's voicepack is not locally installed. (Instead of rendering team voiceless)
+ * Hammer now does more damage when the Extra-Damage utility is used
+ * Many other bug fixes
+
+Lua-API:
+ + New map parameter: MapFeatureSize -- numeric representation of detail slider below map preview; use within onGameInit()/onPreviewInit()
+ + New function: SetMaxBuildDistance([ distInPx ]) -- specify how many pixels away a hedgehog can still place girders/etc. set to 0 for no limit; call with no param to reset to default
+ + New hook: onSuddenDeath() -- called by engine when sudden death begins
+ * Previously missing gear states are now available (gstSubmersible, gstFrozen and gstNoGravity)
+ * Fixed OnHogAttack giving the incorrect AmmoType (amNothing) under certain conditions
+
+0.9.20 -> 0.9.21:
+ + New type of randomly generated maps: Perlin Maps.
+ + Old Random generated maps are more diverse now.
+ + Slider for adjusting land generation detail.
+ + Highlander gamemode can now be used with custom weapon schemes (1-8=How probable to get this weapon. 9=All hogs get it)
+ + New playable themes: "Hoggywood" and "Cake"
+ + New gameplay mode "Construction Mode"
+ + New gameplay mode "TechRacer"
+ + New game play mode "DiagonalMaze" (generates a simple diagonal maze)
+ + Add 7 target practice missions, now with simple scoring
+ + Update RC Plane Challenge: Stats screen reworked and shows now several facts, simple ranking system based on used planes, some taunts in the game
+ + New training/multiplayer mission: "Climb Home"
+ + Game scheme screen has a "Script parameter" field now. This allows to make more customizable scripts/modes.
+ + Network game rejoining. Note: Your team(s) will vanish after 3 turns.
+ + Visual and gameplay changes to "sea" - world edge, visual change to wrap world edge to allow seeing through the wrap, visual change to bounce worldedge 
+ + The map of the Basketball Mission can be selected for regular games again ("BasketballField")
+ + New engine command: /togglechat will disable/enable chat display (does not affect chat history display)
+ + Change to Racer: first weapon/utility available will be automatically selected on start
+ + Added some visual feedback to failed girder placement.
+ + Various performance tweaks, especially for very large maps.
+ + Allow switching through hogs in reverse order with PRECISE+HOGSWITCH (left shift + tab, by default)
+ + Added support for custom Sudden Death music to theme.cfg (e.g. sd-music=hell.ogg ).
+ + New Hats: policegirl, fr_tomato, cratehider
+ * Fixed drill rockets sometimes exploding on impact.
+ * Fixed trainings broken due to indestructable targets/crates.
+ * Fixes and tweaks for low qualily rendering.
+ * Sinegun won't shoot through -solid- land anymore
+ * Many bug fixes and tweaks.
+
+Frontend / Netgame:
+ + High resolution previews!
+ + Preview for dynamic maps generated by game style scripts (e.g. "ShoppaMap))!
+ + Moved room status filter to top left of rooms list.
+
+Lua API:
+ + New library: Params, makes parsing of script parameters easier
+ + New library: TargetPractice, used to generate target practice missions (the newly added missions use it)
+ + More helpful syntax error messages.
+ + New hooks:
+      onParameters(paramString) -- called when script parameters are configured. the parameter contains the parameter(s) as text string
+      onPreviewInit() -- called during map preview initialization
+      onGearWaterSkip(gearUid) -- called when a gear skims the water without drowning (when hitting it with high speed at low angle). By checking gearUid you can figure out which gear that was.
+ + New functions:
+      DismissTeam(teamname) -- removes a team from the game (note: if you used loc() on teamnames, don't forget to the translated teamname here too)
+      GetGameFlag(gameflag) -- returns true/false
+      PlaceSprite(x, y, sprite, frameIdx [, landFlag, ... ]) -- sprite refers to an id from the TSprite list
+      SetWaterLine(waterline) -- moves water level to the specified y. the current value is in read-only global waterline
+      SetNextWeapon() -- make current hedgehog switch to next weapon. e.g. use in trainings to preselect weapon
+      SetWeapon(ammoType) -- decide which weapon the current hedgehog should equip
+ + Map Drawing:
+      -- to be used in onGameInit() -- first set MapGen to mgDrawn and then use the commands below
+      AddPoint(x, y [, width [, erase] ]) -- takes x,y location, a width (means start of a new line) and erase (if line should erase, not draw)
+      FlushPoints() -- makes sure that all the points/lines specified using the command above are actually applied to the map
+ + New global enumerations:
+      Mapgens: mgRandom, mgMaze, mgPerlin, mgDrawn
+      TSprite values
+      LandFlags: lfIndestructible, lfIce, lfBouncy
+ + Changed functions:
+      HogSay(gearUid, text, manner [, vgState]) -- now also allows you to make NON-Hedgehog gears speak, e.g. barrels... wait what?!
+ + Changed hooks:
+      onHogAttack() can now be hooked with new parameter: onHogAttack(ammoType) - to conveniently find out which ammo/weapon is being used
+ * Fixes:
+      gfResetHealth is now a available like the other GameFlags
+0.9.19 -> 0.9.20:
+ + New campaign, A Space Adventure!
+ + Password protected rooms
+ + Shapes on drawn maps (ellipses, rectangles)  - constrain dimensions with ctrl, as with straight line tool.
+ + New rubber utility, lfBouncy mask (green) for maps.  lfBouncy is also anti-portal.
+ + Lazy loading of many aspects of frontend to improve startup time under Windows
+ + Set hog/team/health label defaults in config, toggle team health display using delete (left shift + delete for labels now)
+ + Usernames next to teams when playing online.
+ + Can now filter rooms by game style (such as Highlander). Filtering simplified since it is mostly unused.
+ + AFK mode.  Press p when not your turn online to trigger autoskip of your turn.
+ + Russian localisation of Default voice.
+ + Map edges can wrap or bounce.  Also a silly "connect to the sea" mode
+ + Sticky fire kicks you a bit less, fire interacts with frozen land/ice
+ + Generated map stays same if the template is the same between groups (all/large for example)
+ + Visual enhancements for whip and crosshair
+ + Option to draw maps with a "shoppa" border - used by ShoppaMap lua at present
+ + New hats
+ + Translation updates
+ + New lua script to control gravity.  May have unpredictable effects.  Try zero g shoppa.  Changes to allow lua to spawn poison clouds without interrupting turn.
+ + Speech bubbles are now echoed to chat for logging purposes with the hog's name.
+ * You should now thaw on your turn, not enemy's. AI frozen/unfrozen crate movement fix. Blowtorch can thaw frozen hogs.
+ * Prevent target crosshair moving around unpredictably when doing multiple airstrikes
+ * Rope should kick along surfaces more reliably, fix rope aim speed if you miss a shot, firing rope does not freeze timer, fix aiming on last rope
+ * Remember bounce/timer in reset wep modes like Highlander
+ * Increase precision in damage calcs; extra damage affects fire properly now
+ * Fixed video recording resolution
+ * Fixed context menu/cursor in text areas
+ * Many bugfixes. Keypad enter in chat, hog sliding freezing game, team name flaws in Windows, localisation of tips, crasher in slots with no weapons, frontend holiday css.
 
 0.9.18 -> 0.9.19:
  + New Freezer weapon - freezes terrain, water, hedgehogs, mines, cases, explosives
--- a/INSTALL	Tue Nov 10 18:16:35 2015 +0100
+++ b/INSTALL	Tue Nov 10 20:43:13 2015 +0100
@@ -1,14 +1,14 @@
 To compile and install you need:
  - CMake >= 2.6.0
- - FreePascal >= 2.2.0
- - Qt >= 4.5.0
+ - FreePascal >= 2.2.4
+ - Qt >= 4.7.0
  - SDL >= 2.0
  - SDL_net >= 2.0
  - SDL_mixer >= 2.0
  - SDL_image >= 2.0
  - SDL_ttf >= 2.0
- - Lua >= 5.1.0
- - Physfs >= 2.1.0
+ - Lua = 5.1.0
+ - Physfs >= 2.0.0
 For server:
  - Glasgow Haskell Compiler >= 6.10
  - bytestring-show package
@@ -16,7 +16,6 @@
  - hslogger package
 For videorecording:
  - FFmpeg or LibAV
- - GLUT (when SDL < 2)
 For compressed screenshots:
  - libpng
 
--- a/QTfrontend/CMakeLists.txt	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/CMakeLists.txt	Tue Nov 10 20:43:13 2015 +0100
@@ -1,5 +1,5 @@
 # Configure for Qt4
-set(QT_MIN_VERSION "4.5.0")
+set(QT_MIN_VERSION "4.7.0")
 include(CheckLibraryExists)
 
 set(QT_USE_QTCORE TRUE)
@@ -13,10 +13,11 @@
 find_package(Qt4 REQUIRED)
 include(${QT_USE_FILE})
 
+# https://bugreports.qt-project.org/browse/QTBUG-17333
 if(APPLE AND
    ${QTVERSION} VERSION_GREATER "4.7.0" AND
    ${QTVERSION} VERSION_LESS "4.7.4")
-    message(FATAL_ERROR "This version of QT is known *not* to work, please update or use a lower version")
+   message(FATAL_ERROR "This version of Qt is known *not* to work, please update or use a lower version")
 endif()
 
 find_package(SDL2 REQUIRED)
@@ -24,10 +25,10 @@
 include_directories(${SDL2_INCLUDE_DIR})
 include_directories(${SDL2MIXER_INCLUDE_DIR})
 
-if(${FFMPEG_FOUND})
+if(LIBAV_FOUND)
     add_definitions(-DVIDEOREC -D__STDC_CONSTANT_MACROS)
-    include_directories(${FFMPEG_INCLUDE_DIR})
-    list(APPEND HW_LINK_LIBS ${FFMPEG_LIBRARIES})
+    include_directories(${LIBAV_INCLUDE_DIR})
+    list(APPEND HW_LINK_LIBS ${LIBAV_LIBRARIES})
 endif()
 
 # server messages localization
@@ -61,9 +62,9 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/widget)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util/platform)
-include_directories(${PHYSFS_INCLUDE_DIR})
-include_directories(${PHYSLAYER_INCLUDE_DIR})
-
+include_directories(BEFORE ${PHYSFS_INCLUDE_DIR})
+include_directories(BEFORE ${PHYSLAYER_INCLUDE_DIR})
+include_directories(${LUA_INCLUDE_DIR}) #brought by physlayer hwpacksmounter.h
 
 if(UNIX)
     # HACK: in freebsd cannot find iconv.h included via SDL.h
@@ -152,10 +153,15 @@
 
 set(hwfr_rez hedgewars.qrc)
 
-if(${BUILD_ENGINE_LIBRARY})
+if(BUILD_ENGINE_LIBRARY)
     add_definitions(-DHWLIBRARY=1)
     set(hwlibname "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}")
     list(APPEND HW_LINK_LIBS ${hwlibname})
+
+    if(LIBAV_FOUND)
+#        add_subdirectory(avwrapper)
+        list(APPEND HW_LINK_LIBS avwrapper)
+    endif()
 endif()
 
 qt4_add_resources(hwfr_rez_src ${hwfr_rez})
@@ -184,9 +190,9 @@
 
 #when debugging, always prompt a console to see fronted messages
 #TODO: check it doesn't interfere on UNIX
-if(CMAKE_BUILD_TYPE MATCHES "RELEASE")
+if(CMAKE_BUILD_TYPE MATCHES "RELEASE" OR CMAKE_BUILD_TYPE MATCHES "RELWITHDEBINFO")
     set(console_access "WIN32")
-endif(CMAKE_BUILD_TYPE MATCHES "RELEASE")
+endif(CMAKE_BUILD_TYPE MATCHES "RELEASE" OR CMAKE_BUILD_TYPE MATCHES "RELWITHDEBINFO")
 
 add_executable(hedgewars ${console_access}
     ${hwfr_src}
@@ -204,7 +210,7 @@
     ${SDL2_LIBRARY}
     ${SDL2MIXER_LIBRARY}
     )
-
+    
 if(WIN32 AND NOT UNIX)
     if(NOT SDL_LIBRARY)
         list(APPEND HW_LINK_LIBS SDL)
@@ -218,6 +224,10 @@
         )
 endif()
 
+if(CMAKE_CXX_COMPILER MATCHES "clang*")
+    list(APPEND HW_LINK_LIBS stdc++ m)
+endif()
+
 target_link_libraries(hedgewars ${HW_LINK_LIBS})
 
 
--- a/QTfrontend/HWApplication.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/HWApplication.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -13,14 +13,13 @@
  *
  * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "HWApplication.h"
 #include <QFileOpenEvent>
 #include <QEvent>
 
-#include "hwform.h"
 #include "MessageDialog.h"
 
 #if !defined(Q_OS_WIN)
--- a/QTfrontend/HWApplication.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/HWApplication.h	Tue Nov 10 20:43:13 2015 +0100
@@ -13,13 +13,14 @@
  *
  * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef HWAPP_H
 #define HWAPP_H
 
 #include <QApplication>
+#include "hwform.h"
 
 class HWForm;
 class QEvent;
--- a/QTfrontend/achievements.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/achievements.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QObject>
--- a/QTfrontend/achievements.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/achievements.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef ACHIEVEMENTS_H
--- a/QTfrontend/binds.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/binds.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "binds.h"
@@ -46,7 +46,7 @@
     {"timer 5",   "5",          QT_TRANSLATE_NOOP("binds", "timer 5 sec"),     NULL, NULL},
     {"+attack",   "space",      QT_TRANSLATE_NOOP("binds", "attack"),          NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Fire your selected weapon or trigger an utility item:")},
     {"put",       "mousel",     QT_TRANSLATE_NOOP("binds", "put"),             NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Pick a weapon or a target location under the cursor:")},
-    {"findhh",    "h",          QT_TRANSLATE_NOOP("binds", "find hedgehog"),   QT_TRANSLATE_NOOP("binds (categories)", "Camera"), QT_TRANSLATE_NOOP("binds (descriptions)", "Move the camera to the active hog:")},
+    {"findhh",    "h",          QT_TRANSLATE_NOOP("binds", "autocam / find hedgehog"),QT_TRANSLATE_NOOP("binds (categories)", "Camera"), QT_TRANSLATE_NOOP("binds (descriptions)", "Toggle automatic camera / refocus on active hedgehog:")},
     {"+cur_u",    "[8]",        QT_TRANSLATE_NOOP("binds", "up"),              NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Move the cursor or camera without using the mouse:")},
     {"+cur_l",    "[4]",        QT_TRANSLATE_NOOP("binds", "left"),            NULL, NULL},
     {"+cur_r",    "[6]",        QT_TRANSLATE_NOOP("binds", "right"),           NULL, NULL},
@@ -65,6 +65,7 @@
     {"mute",      "8",          QT_TRANSLATE_NOOP("binds", "mute audio"),      NULL, NULL},
     {"fullscr",   "f12",        QT_TRANSLATE_NOOP("binds", "change mode"),     NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Toggle fullscreen mode:")},
     {"capture",   "c",          QT_TRANSLATE_NOOP("binds", "capture"),         NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Take a screenshot:")},
+    {"+speedup",  "s",          QT_TRANSLATE_NOOP("binds", "speed up replay"),         NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Demo replay:")},
     {"rotmask",   "delete",     QT_TRANSLATE_NOOP("binds", "hedgehog info"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Toggle labels above hedgehogs:")},
 #ifdef VIDEOREC
     {"record",    "r",          QT_TRANSLATE_NOOP("binds", "record"),          NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Record video:")}
--- a/QTfrontend/binds.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/binds.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef BINDS_H
@@ -22,9 +22,9 @@
 #include <QString>
 
 #ifdef VIDEOREC
-#define BINDS_NUMBER 46
+#define BINDS_NUMBER 47
 #else
-#define BINDS_NUMBER 45
+#define BINDS_NUMBER 46
 #endif
 
 struct BindAction
--- a/QTfrontend/campaign.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/campaign.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "campaign.h"
@@ -26,14 +26,31 @@
 QList<MissionInfo> getCampMissionList(QString & campaignName, QString & teamName)
 {
     QList<MissionInfo> missionInfoList;
-	QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + teamName + ".hwt", QSettings::IniFormat, 0);
+    QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + teamName + ".hwt", QSettings::IniFormat, 0);
     teamfile.setIniCodec("UTF-8");
+
+    // if entry not found check if there is written without _
+    // if then is found rename it to use _
+    QString spaceCampName = campaignName;
+    spaceCampName = spaceCampName.replace(QString("_"),QString(" "));
+    if (!teamfile.childGroups().contains("Campaign " + campaignName) and
+            teamfile.childGroups().contains("Campaign " + spaceCampName)){
+        teamfile.beginGroup("Campaign " + spaceCampName);
+        QStringList keys = teamfile.childKeys();
+        teamfile.endGroup();
+        for (int i=0;i<keys.size();i++) {
+            QVariant value = teamfile.value("Campaign " + spaceCampName + "/" + keys[i]);
+            teamfile.setValue("Campaign " + campaignName + "/" + keys[i], value);
+        }
+        teamfile.remove("Campaign " + spaceCampName);
+    }
+
     int progress = teamfile.value("Campaign " + campaignName + "/Progress", 0).toInt();
     int unlockedMissions = teamfile.value("Campaign " + campaignName + "/UnlockedMissions", 0).toInt();
-    
+
     QSettings campfile("physfs://Missions/Campaign/" + campaignName + "/campaign.ini", QSettings::IniFormat, 0);
     campfile.setIniCodec("UTF-8");
-    
+
     DataManager & dataMgr = DataManager::instance();
         // get locale
         QSettings settings(dataMgr.settingsFileName(),
@@ -52,42 +69,42 @@
 
         QSettings m_info(campaignDescFile, QSettings::IniFormat, 0);
         m_info.setIniCodec("UTF-8");
-    
+
     if(progress>=0 and unlockedMissions==0)
     {
-		for(unsigned int i=progress+1;i>0;i--)
-		{
-			MissionInfo missionInfo;
-			missionInfo.name = campfile.value(QString("Mission %1/Name").arg(i)).toString();
-			QString script = campfile.value(QString("Mission %1/Script").arg(i)).toString();
+        for(unsigned int i=progress+1;i>0;i--)
+        {
+            MissionInfo missionInfo;
+            missionInfo.name = campfile.value(QString("Mission %1/Name").arg(i)).toString();
+            QString script = campfile.value(QString("Mission %1/Script").arg(i)).toString();
             missionInfo.script = script;
-			missionInfo.description = m_info.value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
+            missionInfo.description = m_info.value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
                                             QObject::tr("No description available")).toString();
             QString image = campfile.value(QString("Mission %1/Script").arg(i)).toString().replace(QString(".lua"),QString(".png"));
             missionInfo.image = ":/res/campaign/"+campaignName+"/"+image;
             if (!QFile::exists(missionInfo.image))
-				missionInfo.image = ":/res/CampaignDefault.png";
-			missionInfoList.append(missionInfo);
-		}
-	} 
-	else if(unlockedMissions>0)
-	{
-		for(int i=1;i<=unlockedMissions;i++)
-		{
-			QString missionNum = QString("%1").arg(i);
-			int missionNumber = teamfile.value("Campaign " + campaignName + "/Mission"+missionNum, -1).toInt();
-			MissionInfo missionInfo;
-			missionInfo.name = campfile.value(QString("Mission %1/Name").arg(missionNumber)).toString();
-			QString script = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString();
+                missionInfo.image = ":/res/CampaignDefault.png";
+            missionInfoList.append(missionInfo);
+        }
+    }
+    else if(unlockedMissions>0)
+    {
+        for(int i=1;i<=unlockedMissions;i++)
+        {
+            QString missionNum = QString("%1").arg(i);
+            int missionNumber = teamfile.value("Campaign " + campaignName + "/Mission"+missionNum, -1).toInt();
+            MissionInfo missionInfo;
+            missionInfo.name = campfile.value(QString("Mission %1/Name").arg(missionNumber)).toString();
+            QString script = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString();
             missionInfo.script = script;
-			missionInfo.description = m_info.value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
+            missionInfo.description = m_info.value(campaignName+"-"+ script.replace(QString(".lua"),QString("")) + ".desc",
                                             QObject::tr("No description available")).toString();
             QString image = campfile.value(QString("Mission %1/Script").arg(missionNumber)).toString().replace(QString(".lua"),QString(".png"));
             missionInfo.image = ":/res/campaign/"+campaignName+"/"+image;
             if (!QFile::exists(missionInfo.image))
-				missionInfo.image = ":/res/CampaignDefault.png";
-			missionInfoList.append(missionInfo);
-		}
-	}
-	return missionInfoList;
+                missionInfo.image = ":/res/CampaignDefault.png";
+            missionInfoList.append(missionInfo);
+        }
+    }
+    return missionInfoList;
 }
--- a/QTfrontend/campaign.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/campaign.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef CAMPAIGN_H
@@ -23,11 +23,11 @@
 
 class MissionInfo
 {
-	public:
-		QString name;
-		QString description;
-		QString script;
-		QString image;
+    public:
+        QString name;
+        QString description;
+        QString script;
+        QString image;
 };
 
 QList<MissionInfo> getCampMissionList(QString & campaignName, QString & teamName);
--- a/QTfrontend/drawmapscene.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/drawmapscene.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGraphicsSceneMouseEvent>
@@ -304,6 +304,8 @@
 
 void DrawMapScene::decode(QByteArray data)
 {
+    hideCursor();
+
     bool erasing = m_isErasing;
 
     oldItems.clear();
@@ -324,7 +326,7 @@
         data.remove(0, 2);
         quint8 flags = *(quint8 *)data.data();
         data.remove(0, 1);
-        qDebug() << px << py;
+        //qDebug() << px << py;
         if(flags & 0x80)
         {
             isSpecial = false;
@@ -386,7 +388,7 @@
     int i = 1;
     while(i < points.size())
     {
-        if( (i != points.size() - 1)
+        if( ((i != points.size() - 1) || (prevPoint == points[i]))
                 && (sqr(prevPoint.x() - points[i].x()) + sqr(prevPoint.y() - points[i].y()) < 1000)
           )
             points.removeAt(i);
@@ -459,7 +461,7 @@
         l.append(center);
     } else
     {
-        qreal angleDelta = qMax(0.1, qMin(0.7, 120 / r));
+        qreal angleDelta = qMax(static_cast<qreal> (0.1), qMin(static_cast<qreal> (0.7), 120 / r));
         for(qreal angle = 0.0; angle < 2*M_PI; angle += angleDelta)
             l.append(center + QPointF(rx * cos(angle), ry * sin(angle)));
         l.append(l.first());
@@ -485,3 +487,51 @@
 
     return point;
 }
+
+void DrawMapScene::optimize()
+{
+    if(!paths.size()) return;
+
+    // break paths into segments
+    Paths pth;
+
+    foreach(const PathParams & pp, paths)
+    {
+        int l = pp.points.size();
+
+        if(l == 1)
+        {
+            pth.prepend(pp);
+        } else
+        {
+            for(int i = l - 2; i >= 0; --i)
+            {
+                PathParams p = pp;
+                p.points = QList<QPoint>() << p.points[i] << p.points[i + 1];
+                pth.prepend(pp);
+            }
+        }
+    }
+
+    // clear the scene
+    oldItems.clear();
+    oldPaths.clear();
+    clear();
+    paths.clear();
+    m_specialPoints.clear();
+
+    // render the result
+    foreach(const PathParams & p, pth)
+    {
+        if(p.erasing)
+            m_pen.setBrush(m_eraser);
+        else
+            m_pen.setBrush(m_brush);
+
+        m_pen.setWidth(deserializePenWidth(p.width));
+
+        addPath(pointsToPath(p.points), m_pen);
+    }
+
+    emit pathChanged();
+}
--- a/QTfrontend/drawmapscene.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/drawmapscene.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef DRAWMAPSCENE_H
@@ -58,6 +58,7 @@
         void undo();
         void clearMap();
         void simplifyLast();
+        void optimize();
         void setErasing(bool erasing);
         void showCursor();
         void hideCursor();
--- a/QTfrontend/game.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/game.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,9 +13,12 @@
  *
  * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <QApplication>
+#include <QClipboard>
+
 #include <QString>
 #include <QCheckBox>
 #include <QByteArray>
@@ -60,6 +63,9 @@
     lastGameCfg = gamecfg;
     lastGameAmmo = ammo;
     lastGameTeamSel = pTeamSelWidget;
+
+    gameState = gsNotStarted;
+    gameType = gtNone;
 }
 
 HWGame::~HWGame()
@@ -142,6 +148,7 @@
     HWProto::addStringToBuffer(teamscfg, "eseed " + QUuid::createUuid().toString());
 
     HWProto::addStringToBuffer(teamscfg, "e$template_filter 2");
+    HWProto::addStringToBuffer(teamscfg, "e$feature_size "+QString::number(rand()%18+4));
 
     HWTeam team1;
     team1.setDifficulty(0);
@@ -245,9 +252,27 @@
         case 'E':
         {
             int size = msg.size();
-            emit ErrorMessage(QString("Last two engine messages:\n") + QString().append(msg.mid(2)).left(size - 4));
+            emit ErrorMessage(
+                tr("A Fatal ERROR occured! - The game engine had to stop.\n\n"
+                "We are very sorry for the inconvenience :(\n\n"
+                "If this keeps happening, please click the '%1' button in the main menu!\n\n"
+                "Last two engine messages:\n%2")
+                .arg("Feedback")
+                .arg(QString::fromUtf8(msg.mid(2).left(size - 4))));
             return;
         }
+        case 'y':
+        {
+            // copy string to clipboard
+            QApplication::clipboard()->setText(QString::fromUtf8(msg.mid(2)));
+            break;
+        }
+        case 'Y':
+        {
+            // paste clipboard to game
+            SendIPC(QString("Y").toAscii() + QApplication::clipboard()->text().toUtf8().left(250).replace('\n', ' '));
+            break;
+        }
         case 'i':
         {
             emit GameStats(msg.at(2), QString::fromUtf8(msg.mid(3)));
@@ -303,6 +328,13 @@
             config->Form->ui.pageOptions->windowHeightEdit->setValue(wh[1].toInt());
             break;
         }
+        case '~':
+        {
+            int size = msg.size();
+            QString msgbody = QString::fromUtf8(msg.mid(2).left(size - 4));
+            emit SendConsoleCommand(msgbody);
+            break;
+        }
         default:
         {
             if (gameType == gtNet && !netSuspend)
--- a/QTfrontend/game.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/game.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef GAME_H
@@ -99,6 +99,7 @@
         void HaveRecord(RecordType type, const QByteArray & record);
         void ErrorMessage(const QString &);
         void CampStateChanged(int);
+        void SendConsoleCommand(const QString & command);
 
     public slots:
         void FromNet(const QByteArray & msg);
--- a/QTfrontend/gameuiconfig.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/gameuiconfig.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QCheckBox>
--- a/QTfrontend/gameuiconfig.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/gameuiconfig.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef GAMECONFIG_H
--- a/QTfrontend/hedgewars.qrc	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/hedgewars.qrc	Tue Nov 10 20:43:13 2015 +0100
@@ -124,7 +124,11 @@
         <file>res/iconHealth.png</file>
         <file>res/iconSuddenDeath.png</file>
         <file>res/iconDamage.png</file>
+        <file>res/iconDamageLockG.png</file>
+        <file>res/iconDamageLockR.png</file>
         <file>res/iconTime.png</file>
+        <file>res/iconTimeLockG.png</file>
+        <file>res/iconTimeLockR.png</file>
         <file>res/iconMine.png</file>
         <file>res/iconDud.png</file>
         <file>res/iconRope.png</file>
@@ -179,7 +183,6 @@
         <file>res/chat/ingame.png</file>
         <file>res/splash.png</file>
         <file>res/html/about.html</file>
-        <file>res/xml/tips.xml</file>
         <file>res/chat/hedgehogcontributor.png</file>
         <file>res/chat/hedgehogcontributor_gray.png</file>
         <file>res/chat/roomadmincontributor.png</file>
--- a/QTfrontend/hwconsts.cpp.in	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/hwconsts.cpp.in	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QStandardItemModel>
@@ -37,7 +37,7 @@
 bool custom_data = false;
 
 int cMaxTeams = 8;
-int cMinServerVersion = 1;
+int cMinServerVersion = 3;
 
 QString * cDefaultAmmoStore = new QString( AMMOLINE_DEFAULT_QT AMMOLINE_DEFAULT_PROB
                                            AMMOLINE_DEFAULT_DELAY AMMOLINE_DEFAULT_CRATE );
@@ -67,6 +67,15 @@
         << qMakePair(QString("One of Everything"), QString(
             AMMOLINE_ONEEVERY_QT AMMOLINE_ONEEVERY_PROB
             AMMOLINE_ONEEVERY_DELAY AMMOLINE_ONEEVERY_CRATE ))
+        << qMakePair(QString("Highlander"), QString(
+            AMMOLINE_HIGHLANDER_QT AMMOLINE_HIGHLANDER_PROB
+            AMMOLINE_HIGHLANDER_DELAY AMMOLINE_HIGHLANDER_CRATE ))
+		<< qMakePair(QString("Construction Mode"),   QString(
+            AMMOLINE_CONSTRUCTION_QT AMMOLINE_CONSTRUCTION_PROB
+            AMMOLINE_CONSTRUCTION_DELAY AMMOLINE_CONSTRUCTION_CRATE ))
+		<< qMakePair(QString("Shoppa Pro"), QString(
+            AMMOLINE_SHOPPAPRO_QT AMMOLINE_SHOPPAPRO_PROB
+            AMMOLINE_SHOPPAPRO_DELAY AMMOLINE_SHOPPAPRO_CRATE ))
         ;
 
 unsigned int colors[] = HW_TEAMCOLOR_ARRAY;
--- a/QTfrontend/hwconsts.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/hwconsts.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #if !defined(TARGET_OS_IPHONE)
--- a/QTfrontend/hwform.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/hwform.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDir>
@@ -164,14 +164,12 @@
     ui.pageVideos->init(config);
 #endif
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && defined(SPARKLE_ENABLED)
     if (config->isAutoUpdateEnabled())
     {
         AutoUpdater* updater = NULL;
 
-#ifdef SPARKLE_ENABLED
         updater = new SparkleAutoUpdater();
-#endif
         if (updater)
         {
             updater->checkForUpdates();
@@ -1675,7 +1673,7 @@
     connect(game, SIGNAL(CampStateChanged(int)), this, SLOT(UpdateCampaignPageProgress(int)));
     connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState)));
     connect(game, SIGNAL(GameStats(char, const QString &)), ui.pageGameStats, SLOT(GameStats(char, const QString &)));
-    connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection);
+    connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowFatalErrorMessage(const QString &)), Qt::QueuedConnection);
     connect(game, SIGNAL(HaveRecord(RecordType, const QByteArray &)), this, SLOT(GetRecord(RecordType, const QByteArray &)));
     m_lastDemo = QByteArray();
 }
@@ -1753,6 +1751,7 @@
 
     connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &)));
     connect(game, SIGNAL(SendChat(const QString &)), hwnet, SLOT(chatLineToNet(const QString &)));
+    connect(game, SIGNAL(SendConsoleCommand(const QString&)), hwnet, SLOT(consoleCommand(const QString&)));
     connect(game, SIGNAL(SendTeamMessage(const QString &)), hwnet, SLOT(SendTeamMessage(const QString &)));
     connect(hwnet, SIGNAL(chatStringFromNet(const QString &)), game, SLOT(FromNetChat(const QString &)), Qt::QueuedConnection);
 
@@ -1831,14 +1830,14 @@
     if (hwnet)
     {
         NetAmmoSchemeModel * netAmmo = new NetAmmoSchemeModel(hwnet);
-        connect(hwnet, SIGNAL(netSchemeConfig(QStringList &)), netAmmo, SLOT(setNetSchemeConfig(QStringList &)));
+        connect(hwnet, SIGNAL(netSchemeConfig(QStringList)), netAmmo, SLOT(setNetSchemeConfig(QStringList)));
 
         ui.pageNetGame->pGameCFG->GameSchemes->setModel(netAmmo);
 
         ui.pageNetGame->setRoomName(hwnet->getRoom());
 
         ui.pageNetGame->pGameCFG->GameSchemes->view()->disconnect(hwnet);
-        connect(hwnet, SIGNAL(netSchemeConfig(QStringList &)),
+        connect(hwnet, SIGNAL(netSchemeConfig(QStringList)),
                 this, SLOT(selectFirstNetScheme()));
     }
 
@@ -1903,15 +1902,15 @@
     Q_UNUSED(index);
     HWTeam team(ui.pageCampaign->CBTeam->currentText());
     QString campaignName = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
-    QString tName = team.name();    
-    
-    campaignMissionInfo = getCampMissionList(campaignName,tName);    
-	ui.pageCampaign->CBMission->clear();
-	
+    QString tName = team.name();
+
+    campaignMissionInfo = getCampMissionList(campaignName,tName);
+    ui.pageCampaign->CBMission->clear();
+
     for(int i=0;i<campaignMissionInfo.size();i++)
     {
         ui.pageCampaign->CBMission->addItem(QString(campaignMissionInfo[i].name), QString(campaignMissionInfo[i].name));
-	}
+    }
 }
 
 void HWForm::UpdateCampaignPageMission(int index)
@@ -1923,7 +1922,7 @@
     if(index > -1 && index < campaignMissionInfo.count()) {
         ui.pageCampaign->lbltitle->setText("<h2>"+ui.pageCampaign->CBMission->currentText()+"</h2>");
         ui.pageCampaign->lbldescription->setText(campaignMissionInfo[index].description);
-		ui.pageCampaign->btnPreview->setIcon(QIcon(campaignMissionInfo[index].image));
+        ui.pageCampaign->btnPreview->setIcon(QIcon(campaignMissionInfo[index].image));
     }
 }
 
@@ -1935,12 +1934,12 @@
     UpdateCampaignPage(0);
     for(int i=0;i<ui.pageCampaign->CBMission->count();i++)
     {
-		if (ui.pageCampaign->CBMission->itemText(i)==missionTitle)
-		{
-			ui.pageCampaign->CBMission->setCurrentIndex(i);
-			break;
-		}
-	}
+        if (ui.pageCampaign->CBMission->itemText(i)==missionTitle)
+        {
+            ui.pageCampaign->CBMission->setCurrentIndex(i);
+            break;
+        }
+    }
 }
 
 // used for --set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]
@@ -2094,9 +2093,9 @@
     }
 }
 
-void HWForm::ShowErrorMessage(const QString & msg)
+void HWForm::ShowFatalErrorMessage(const QString & msg)
 {
-    MessageDialog::ShowErrorMessage(msg, this);
+    MessageDialog::ShowFatalMessage(msg, this);
 }
 
 void HWForm::showFeedbackDialog()
--- a/QTfrontend/hwform.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/hwform.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef HWFORM_H
@@ -120,7 +120,7 @@
         void StartMPGame();
         void GameStateChanged(GameState gameState);
         void ForcedDisconnect(const QString & reason);
-        void ShowErrorMessage(const QString &);
+        void ShowFatalErrorMessage(const QString &);
         void GetRecord(RecordType type, const QByteArray & record);
         void CreateNetGame();
         void UpdateWeapons();
@@ -196,7 +196,7 @@
         AmmoSchemeModel * ammoSchemeModel;
         QStack<int> PagesStack;
         QString previousCampaignName;
-        QString previousTeamName;     
+        QString previousTeamName;
         QList<MissionInfo> campaignMissionInfo;
         QTime eggTimer;
         BGWidget * wBackground;
--- a/QTfrontend/main.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/main.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "HWApplication.h"
@@ -125,6 +125,28 @@
     }
 }
 
+QString getUsage()
+{
+    return QString(
+"%1: hedgewars [%2...] [%3]\n"
+"\n"
+"%4:\n"
+"  --help              %5\n"
+"  --config-dir=PATH   %6\n"
+"  --data-dir=PATH     %7\n"
+"\n"
+"%8"
+"\n"
+).arg(HWApplication::tr("Usage", "command-line"))
+.arg(HWApplication::tr("OPTION", "command-line"))
+.arg(HWApplication::tr("CONNECTSTRING", "command-line"))
+.arg(HWApplication::tr("Options", "command-line"))
+.arg(HWApplication::tr("Display this help", "command-line"))
+.arg(HWApplication::tr("Custom path for configuration data and user data", "command-line"))
+.arg(HWApplication::tr("Custom path to the game data folder", "command-line"))
+.arg(HWApplication::tr("Hedgewars can use a %1 (e.g. \"%2\") to connect on start.", "command-line").arg(HWApplication::tr("CONNECTSTRING", "command-line")).arg(QString("hwplay://") + NETGAME_DEFAULT_SERVER));
+}
+
 int main(int argc, char *argv[])
 {
     // Since we're calling this first, closeResources() will be the last thing called after main() returns.
@@ -137,8 +159,87 @@
     SDLInteraction::instance();
 
     HWApplication app(argc, argv);
+    app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
 
+    // file engine and splash. to be initialized later
+    engine = NULL;
     QLabel *splash = NULL;
+
+    // parse arguments
+
+    QStringList arguments = app.arguments();
+    QMap<QString, QString> parsedArgs;
+    {
+        QList<QString>::iterator i = arguments.begin();
+        while(i != arguments.end())
+        {
+            QString arg = *i;
+
+
+            QRegExp opt("--(\\S+)=(.+)");
+            if(opt.exactMatch(arg))
+            {
+                parsedArgs[opt.cap(1)] = opt.cap(2);
+                i = arguments.erase(i);
+            }
+            else
+            {
+                if(arg.startsWith("--")) {
+                    if(arg == "--help")
+                    {
+                        printf("%s", getUsage().toUtf8().constData());
+                        return 0;
+                    }
+                    // argument is something wrong
+                    fprintf(stderr, "%s\n\n%s",
+                        HWApplication::tr("Malformed option argument: %1", "command-line").arg(arg).toUtf8().constData(),
+                        getUsage().toUtf8().constData());
+                    return 1;
+                }
+
+                // if not starting with --, then always skip
+                // (because we can't determine if executable path/call or not - on windows)
+                ++i;
+            }
+        }
+    }
+
+    if(parsedArgs.contains("data-dir"))
+    {
+        QFileInfo f(parsedArgs["data-dir"]);
+        parsedArgs.remove("data-dir");
+        if(!f.exists())
+        {
+            qWarning() << "WARNING: Cannot open DATA_PATH=" << f.absoluteFilePath();
+        }
+        *cDataDir = f.absoluteFilePath();
+        custom_data = true;
+    }
+
+    if(parsedArgs.contains("config-dir"))
+    {
+        QFileInfo f(parsedArgs["config-dir"]);
+        parsedArgs.remove("config-dir");
+        cfgdir->setPath(f.absoluteFilePath());
+        custom_config = true;
+    }
+    else
+    {
+        cfgdir->setPath(QDir::homePath());
+        custom_config = false;
+    }
+
+    if (!parsedArgs.isEmpty()) {
+        foreach (const QString & key, parsedArgs.keys())
+        {
+            fprintf(stderr, "%s\n", HWApplication::tr("Unknown option argument: %1", "command-line").arg(QString("--") + key).toUtf8().constData());
+        }
+        fprintf(stderr, "\n%s", getUsage().toUtf8().constData());
+        return 1;
+    }
+
+    // end of parameter parsing
+
 #if defined Q_OS_WIN
     QPixmap pixmap(":res/splash.png");
     splash = new QLabel(0, Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
@@ -150,55 +251,6 @@
     splash->setPixmap(pixmap);
     splash->show();
 #endif
-
-    engine = new FileEngineHandler(argv[0]);
-
-    app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
-
-    QStringList arguments = app.arguments();
-    QMap<QString, QString> parsedArgs;
-    {
-        QList<QString>::iterator i = arguments.begin();
-        while(i != arguments.end())
-        {
-            QString arg = *i;
-
-            QRegExp opt("--(\\S+)=(.+)");
-            if(opt.exactMatch(arg))
-            {
-                parsedArgs[opt.cap(1)] = opt.cap(2);
-                i = arguments.erase(i);
-            }
-            else
-            {
-                ++i;
-            }
-        }
-    }
-
-    if(parsedArgs.contains("data-dir"))
-    {
-        QFileInfo f(parsedArgs["data-dir"]);
-        if(!f.exists())
-        {
-            qWarning() << "WARNING: Cannot open DATA_PATH=" << f.absoluteFilePath();
-        }
-        *cDataDir = f.absoluteFilePath();
-        custom_data = true;
-    }
-
-    if(parsedArgs.contains("config-dir"))
-    {
-        QFileInfo f(parsedArgs["config-dir"]);
-        cfgdir->setPath(f.absoluteFilePath());
-        custom_config = true;
-    }
-    else
-    {
-        cfgdir->setPath(QDir::homePath());
-        custom_config = false;
-    }
-
     app.setStyle(new QPlastiqueStyle());
 
     QDateTime now = QDateTime::currentDateTime();
@@ -259,6 +311,7 @@
     }
 
     // setup PhysFS
+    engine = new FileEngineHandler(argv[0]);
     engine->mount(datadir->absolutePath());
     engine->mount(cfgdir->absolutePath() + "/Data");
     engine->mount(cfgdir->absolutePath());
@@ -284,6 +337,7 @@
         if (!Translator.load(QString("physfs://Locale/hedgewars_%1").arg(cc)))
             qWarning("Failed to install translation (%s)", qPrintable(cc));
         app.installTranslator(&Translator);
+        app.setLayoutDirection(QLocale(cc).textDirection());
     }
 
 #ifdef _WIN32
--- a/QTfrontend/model/GameStyleModel.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/GameStyleModel.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/model/GameStyleModel.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/GameStyleModel.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/model/HatModel.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/HatModel.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/model/HatModel.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/HatModel.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/model/MapModel.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/MapModel.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
@@ -30,6 +30,7 @@
 
 MapModel::MapInfo MapModel::MapInfoRandom = {MapModel::GeneratedMap, "+rnd+", "", 0, "", "", "", false};
 MapModel::MapInfo MapModel::MapInfoMaze = {MapModel::GeneratedMaze, "+maze+", "", 0, "", "", "", false};
+MapModel::MapInfo MapModel::MapInfoPerlin = {MapModel::GeneratedMaze, "+perlin+", "", 0, "", "", "", false};
 MapModel::MapInfo MapModel::MapInfoDrawn = {MapModel::HandDrawnMap, "+drawn+", "", 0, "", "", "", false};
 
 
--- a/QTfrontend/model/MapModel.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/MapModel.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
@@ -49,6 +49,7 @@
             Invalid,
             GeneratedMap,
             GeneratedMaze,
+            GeneratedPerlin,
             HandDrawnMap,
             MissionMap,
             StaticMap
@@ -98,7 +99,7 @@
         QStandardItem * getMap(const QString & map);
 
         // Static MapInfos for drawn and generated maps
-        static MapInfo MapInfoRandom, MapInfoMaze, MapInfoDrawn;
+        static MapInfo MapInfoRandom, MapInfoMaze, MapInfoPerlin, MapInfoDrawn;
 
         /// Loads the maps
         bool loadMaps();
--- a/QTfrontend/model/ThemeModel.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/ThemeModel.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
@@ -62,7 +62,7 @@
 
 void ThemeModel::loadThemes() const
 {
-    qDebug("[LAZINESS ThemeModel::loadThemes()]");
+    qDebug("[LAZINESS] ThemeModel::loadThemes()");
 
     m_themesLoaded = true;
 
--- a/QTfrontend/model/ThemeModel.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/ThemeModel.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/model/ammoSchemeModel.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/ammoSchemeModel.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDebug>
@@ -58,13 +58,15 @@
                                 << QVariant(4)             // mines number   32
                                 << QVariant(0)             // mine dud pct   33
                                 << QVariant(2)             // explosives     34
-                                << QVariant(35)            // health case pct 35
-                                << QVariant(25)            // health case amt 36
-                                << QVariant(47)            // water rise amt 37
-                                << QVariant(5)             // health dec amt 38
-                                << QVariant(100)           // rope modfier   39
-                                << QVariant(100)           // get away time  40
-                                << QVariant(0)             // world edge     41
+                                << QVariant(0)             // air mines      35
+                                << QVariant(35)            // health case pct 36
+                                << QVariant(25)            // health case amt 37
+                                << QVariant(47)            // water rise amt 38
+                                << QVariant(5)             // health dec amt 39
+                                << QVariant(100)           // rope modfier   40
+                                << QVariant(100)           // get away time  41
+                                << QVariant(0)             // world edge     42
+                                << QVariant()              // scriptparam    43
                                 ;
 
 AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
@@ -83,6 +85,7 @@
                          << "Timeless"
                          << "Thinking with Portals"
                          << "King Mode"
+						 << "Construction Mode"
                          ;
 
     numberOfDefaultSchemes = predefSchemesNames.size();
@@ -123,13 +126,15 @@
               << "minesnum"            // 32
               << "minedudpct"          // 33
               << "explosives"          // 34
-              << "healthprobability"   // 35
-              << "healthcaseamount"    // 36
-              << "waterrise"           // 37
-              << "healthdecrease"      // 38
-              << "ropepct"             // 39
-              << "getawaytime"         // 40
-              << "worldedge"           // 41
+              << "airmines"            // 35
+              << "healthprobability"   // 36
+              << "healthcaseamount"    // 37
+              << "waterrise"           // 38
+              << "healthdecrease"      // 39
+              << "ropepct"             // 40
+              << "getawaytime"         // 41
+              << "worldedge"           // 42
+              << "scriptparam"         // scriptparam    43
               ;
 
     QList<QVariant> proMode;
@@ -169,13 +174,15 @@
             << QVariant(0)             // mines number   32
             << QVariant(0)             // mine dud pct   33
             << QVariant(2)             // explosives     34
-            << QVariant(35)            // health case pct 35
-            << QVariant(25)            // health case amt 36
-            << QVariant(47)            // water rise amt 37
-            << QVariant(5)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(0)             // air mines      35
+            << QVariant(35)            // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
     QList<QVariant> shoppa;
@@ -211,17 +218,19 @@
             << QVariant(100)           // init health    28
             << QVariant(50)            // sudden death   29
             << QVariant(1)             // case prob      30
-            << QVariant(3)             // mines time     31
+            << QVariant(0)             // mines time     31
             << QVariant(0)             // mines number   32
             << QVariant(0)             // mine dud pct   33
             << QVariant(0)             // explosives     34
-            << QVariant(0)             // health case pct 35
-            << QVariant(25)            // health case amt 36
-            << QVariant(47)            // water rise amt 37
-            << QVariant(5)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(8)             // air mines      35
+            << QVariant(0)             // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
     QList<QVariant> cleanslate;
@@ -261,13 +270,15 @@
             << QVariant(4)             // mines number   32
             << QVariant(0)             // mine dud pct   33
             << QVariant(2)             // explosives     34
-            << QVariant(35)            // health case pct 35
-            << QVariant(25)            // health case amt 36
-            << QVariant(47)            // water rise amt 37
-            << QVariant(5)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(0)             // air mines      35
+            << QVariant(35)            // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
     QList<QVariant> minefield;
@@ -304,16 +315,18 @@
             << QVariant(15)            // sudden death   29
             << QVariant(0)             // case prob      30
             << QVariant(0)             // mines time     31
-            << QVariant(80)            // mines number   32
+            << QVariant(200)           // mines number   32
             << QVariant(0)             // mine dud pct   33
             << QVariant(0)             // explosives     34
-            << QVariant(35)            // health case pct 35
-            << QVariant(25)            // health case amt 36
-            << QVariant(47)            // water rise amt 37
-            << QVariant(5)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(0)             // air mines      35
+            << QVariant(35)            // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
     QList<QVariant> barrelmayhem;
@@ -352,14 +365,16 @@
             << QVariant(0)             // mines time     31
             << QVariant(0)             // mines number   32
             << QVariant(0)             // mine dud pct   33
-            << QVariant(80)            // explosives     34
-            << QVariant(35)            // health case pct 35
-            << QVariant(25)            // health case amt 36
-            << QVariant(47)            // water rise amt 37
-            << QVariant(5)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(200)           // explosives     34
+            << QVariant(0)             // air mines      35
+            << QVariant(35)            // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
     QList<QVariant> tunnelhogs;
@@ -399,13 +414,15 @@
             << QVariant(10)            // mines number   32
             << QVariant(10)            // mine dud pct   33
             << QVariant(10)            // explosives     34
-            << QVariant(35)            // health case pct 35
-            << QVariant(25)            // health case amt 36
-            << QVariant(47)            // water rise amt 37
-            << QVariant(5)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(4)             // air mines      35
+            << QVariant(35)            // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
     QList<QVariant> forts;
@@ -445,13 +462,15 @@
             << QVariant(0)             // mines number   32
             << QVariant(0)             // mine dud pct   33
             << QVariant(0)             // explosives     34
-            << QVariant(35)            // health case pct 35
-            << QVariant(25)            // health case amt 36
-            << QVariant(47)            // water rise amt 37
-            << QVariant(5)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(0)             // air mines      35
+            << QVariant(35)            // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
     QList<QVariant> timeless;
@@ -491,13 +510,15 @@
             << QVariant(5)             // mines number   32
             << QVariant(10)            // mine dud pct   33
             << QVariant(2)             // explosives     34
-            << QVariant(35)            // health case pct 35
-            << QVariant(30)            // health case amt 36
-            << QVariant(0)             // water rise amt 37
-            << QVariant(0)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(0)             // air mines      35
+            << QVariant(35)            // health case pct 36
+            << QVariant(30)            // health case amt 37
+            << QVariant(0)             // water rise amt 38
+            << QVariant(0)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
     QList<QVariant> thinkingportals;
@@ -537,13 +558,15 @@
             << QVariant(5)             // mines number   32
             << QVariant(0)             // mine dud pct   33
             << QVariant(5)             // explosives     34
-            << QVariant(25)            // health case pct 35
-            << QVariant(25)            // health case amt 36
-            << QVariant(47)            // water rise amt 37
-            << QVariant(5)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(4)             // air mines      35
+            << QVariant(25)            // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
     QList<QVariant> kingmode;
@@ -583,16 +606,65 @@
             << QVariant(4)             // mines number   32
             << QVariant(0)             // mine dud pct   33
             << QVariant(2)             // explosives     34
-            << QVariant(35)            // health case pct 35
-            << QVariant(25)            // health case amt 36
-            << QVariant(47)            // water rise amt 37
-            << QVariant(5)             // health dec amt 38
-            << QVariant(100)           // rope modfier   39
-            << QVariant(100)           // get away time  40
-            << QVariant(0)             // world edge     41
+            << QVariant(0)             // air mines      35
+            << QVariant(35)            // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
             ;
 
-
+	QList<QVariant> construction;
+    construction
+            << predefSchemesNames[11]  // name           0
+            << QVariant(false)         // fortsmode      1
+            << QVariant(false)         // team divide    2
+            << QVariant(false)         // solid land     3
+            << QVariant(false)         // border         4
+            << QVariant(false)         // low gravity    5
+            << QVariant(false)         // laser sight    6
+            << QVariant(false)         // invulnerable   7
+            << QVariant(false)         // reset health   8
+            << QVariant(false)         // vampiric       9
+            << QVariant(false)         // karma          10
+            << QVariant(false)         // artillery      11
+            << QVariant(true)          // random order   12
+            << QVariant(false)          // king           13
+            << QVariant(false)         // place hog      14
+            << QVariant(false)         // shared ammo    15
+            << QVariant(true)         // disable girders 16
+            << QVariant(true)         // disable land objects 17
+            << QVariant(false)         // AI survival    18
+            << QVariant(true)         // inf. attack    19
+            << QVariant(false)         // reset weps     20
+            << QVariant(true)         // per hog ammo   21
+            << QVariant(false)         // no wind        22
+            << QVariant(false)         // more wind      23
+            << QVariant(false)         // tag team       24
+            << QVariant(false)         // bottom border  25
+            << QVariant(100)           // damage modfier 26
+            << QVariant(45)            // turn time      27
+            << QVariant(100)           // init health    28
+            << QVariant(15)            // sudden death   29
+            << QVariant(5)             // case prob      30
+            << QVariant(3)             // mines time     31
+            << QVariant(0)             // mines number   32
+            << QVariant(0)             // mine dud pct   33
+            << QVariant(0)             // explosives     34
+            << QVariant(0)             // air mines      35
+            << QVariant(35)            // health case pct 36
+            << QVariant(25)            // health case amt 37
+            << QVariant(47)            // water rise amt 38
+            << QVariant(5)             // health dec amt 39
+            << QVariant(100)           // rope modfier   40
+            << QVariant(100)           // get away time  41
+            << QVariant(0)             // world edge     42
+            << QVariant()              // scriptparam    43
+            ;
+			
     schemes.append(defaultScheme);
     schemes.append(proMode);
     schemes.append(shoppa);
@@ -604,6 +676,7 @@
     schemes.append(timeless);
     schemes.append(thinkingportals);
     schemes.append(kingmode);
+	schemes.append(construction);
 
 
     int size = fileConfig.beginReadArray("schemes");
@@ -688,7 +761,7 @@
     else
     {
         QList<QVariant> newScheme = schemes[row];
-        newScheme[0] = QVariant(tr("copy of") + " " + newScheme[0].toString());
+        newScheme[0] = QVariant(tr("copy of %1").arg(newScheme[0].toString()));
         schemes.insert(schemes.size(), newScheme);
     }
 
@@ -785,7 +858,7 @@
     return netScheme[index.column()];
 }
 
-void NetAmmoSchemeModel::setNetSchemeConfig(QStringList & cfg)
+void NetAmmoSchemeModel::setNetSchemeConfig(QStringList cfg)
 {
     if(cfg.size() != netScheme.size())
     {
@@ -793,6 +866,8 @@
         return;
     }
 
+    cfg[cfg.size()-1] = cfg[cfg.size()-1].mid(1);
+
     for(int i = 0; i < cfg.size(); ++i)
         netScheme[i] = QVariant(cfg[i]);
 
--- a/QTfrontend/model/ammoSchemeModel.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/ammoSchemeModel.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _AMMO_SCHEME_MODEL_INCLUDED
@@ -70,7 +70,7 @@
         QVariant data(const QModelIndex &index, int role) const;
 
     public slots:
-        void setNetSchemeConfig(QStringList & cfg);
+        void setNetSchemeConfig(QStringList cfg);
 
     private:
         QList<QVariant> netScheme;
--- a/QTfrontend/model/netserverslist.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/netserverslist.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QUdpSocket>
--- a/QTfrontend/model/netserverslist.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/netserverslist.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _NET_SERVERSLIST_INCLUDED
--- a/QTfrontend/model/playerslistmodel.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/playerslistmodel.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -237,6 +237,7 @@
         << index.data(InGame).toBool()
         << index.data(RoomFilterRole).toBool()
         << index.data(InRoom).toBool()
+        << index.data(Contributor).toBool()
         ;
 
     for(int i = flags.size() - 1; i >= 0; --i)
--- a/QTfrontend/model/playerslistmodel.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/playerslistmodel.h	Tue Nov 10 20:43:13 2015 +0100
@@ -23,6 +23,8 @@
         InGame      = Qt::UserRole + 6,
         InRoom      = Qt::UserRole + 7,
         Contributor = Qt::UserRole + 8
+        // if you add a role that will affect the player icon,
+        // then also add it to the flags Qlist in updateIcon()!
     };
 
     enum SpecialRoles {
--- a/QTfrontend/model/roomslistmodel.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/roomslistmodel.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
@@ -108,22 +108,38 @@
     if (role == Qt::DecorationRole)
     {
         const QIcon roomBusyIcon(":/res/iconDamage.png");
+        const QIcon roomBusyIconGreen(":/res/iconDamageLockG.png");
+        const QIcon roomBusyIconRed(":/res/iconDamageLockR.png");
         const QIcon roomWaitingIcon(":/res/iconTime.png");
+        const QIcon roomWaitingIconGreen(":/res/iconTimeLockG.png");
+        const QIcon roomWaitingIconRed(":/res/iconTimeLockR.png");
+
+        QString flags = m_data.at(row).at(StateColumn);
 
-        if (m_data.at(row).at(0).isEmpty())
-            return QVariant(roomWaitingIcon);
+        if (flags.contains("g"))
+        {
+            if (flags.contains("j"))
+                return QVariant(roomBusyIconRed);
+            else if (flags.contains("p"))
+                return QVariant(roomBusyIconGreen);
+            else
+                return QVariant(roomBusyIcon);
+        }
         else
-            return QVariant(roomBusyIcon);
+        {
+            if (flags.contains("j"))
+                return QVariant(roomWaitingIconRed);
+            else if (flags.contains("p"))
+                return QVariant(roomWaitingIconGreen);
+            else
+                return QVariant(roomWaitingIcon);
+        }
     }
 
     QString content = m_data.at(row).at(column);
 
     if (role == Qt::DisplayRole)
     {
-        // supply in progress flag as bool
-        if (column == 0)
-            return QVariant(QString(!content.isEmpty()));
-
         // display room names
         if (column == 5)
         {
@@ -132,6 +148,7 @@
             {
                 if (content == "+rnd+") return tr("Random Map");
                 if (content == "+maze+") return tr("Random Maze");
+                if (content == "+perlin+") return tr("Random Perlin");
                 if (content == "+drawn+") return tr("Hand-drawn");
             }
 
@@ -149,6 +166,7 @@
     {
         if (content == "+rnd+" ||
             content == "+maze+" ||
+            content == "+perlin+" ||
             content == "+drawn+" ||
             m_staticMapModel->mapExists(content) ||
             m_missionMapModel->mapExists(content))
@@ -188,7 +206,7 @@
             l.append(rooms[i + t]);
         }
 
-        m_data.append(roomInfo2RoomRecord(l));
+        m_data.append(l);
     }
 
     endResetModel();
@@ -199,7 +217,7 @@
 {
     beginInsertRows(QModelIndex(), 0, 0);
 
-    m_data.prepend(roomInfo2RoomRecord(info));
+    m_data.prepend(info);
 
     endInsertRows();
 }
@@ -248,24 +266,7 @@
     if (i < 0)
         return;
 
-    m_data[i] = roomInfo2RoomRecord(info);
+    m_data[i] = info;
 
     emit dataChanged(index(i, 0), index(i, columnCount(QModelIndex()) - 1));
 }
-
-
-QStringList RoomsListModel::roomInfo2RoomRecord(const QStringList & info)
-{
-    QStringList result;
-
-    result = info;
-
-    // for matters of less memory usage and quicker access store
-    // the boolean string as either "t" or empty
-    if (info[StateColumn].toLower() == "true")
-        result[StateColumn] = "t";
-    else
-        result[StateColumn] = QString();
-
-    return result;
-}
--- a/QTfrontend/model/roomslistmodel.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/model/roomslistmodel.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
@@ -66,8 +66,6 @@
     QStringList m_headerData;
     MapModel * m_staticMapModel;
     MapModel * m_missionMapModel;
-
-    QStringList roomInfo2RoomRecord(const QStringList & info);
 };
 
 #endif // HEDGEWARS_ROOMSLISTMODEL_H
--- a/QTfrontend/net/hwmap.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/hwmap.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Ulyanov Igor <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,15 +14,23 @@
  *
  * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <QPainter>
+#include <QBitmap>
+#include <QLinearGradient>
+
 #include "hwconsts.h"
 #include "hwmap.h"
 
 HWMap::HWMap(QObject * parent) :
     TCPBase(false, parent)
 {
+    templateFilter = 0;
+    m_mapgen = MAPGEN_REGULAR;
+    m_maze_size = 0;
+    m_feature_size = 50;
 }
 
 HWMap::~HWMap()
@@ -34,12 +42,15 @@
     return !m_hasStarted;
 }
 
-void HWMap::getImage(const QString & seed, int filter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData)
+void HWMap::getImage(const QString & seed, int filter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData, QString & script, QString & scriptparam, int feature_size)
 {
     m_seed = seed;
+    m_script = script;
+    m_scriptparam = scriptparam;
     templateFilter = filter;
     m_mapgen = mapgen;
     m_maze_size = maze_size;
+    m_feature_size = feature_size;
     if(mapgen == MAPGEN_DRAWN) m_drawMapData = drawMapData;
     Start(true);
 }
@@ -52,19 +63,57 @@
     arguments << QString("%1").arg(ipc_port);
     arguments << "--user-prefix";
     arguments << cfgdir->absolutePath();
+    arguments << "--prefix";
+    arguments << datadir->absolutePath();
     arguments << "--landpreview";
     return arguments;
 }
 
 void HWMap::onClientDisconnect()
-{
+{    
+    QLinearGradient linearGrad(QPoint(128, 0), QPoint(128, 128));
+    linearGrad.setColorAt(1, QColor(0, 0, 192));
+    linearGrad.setColorAt(0, QColor(66, 115, 225));
+
     if (readbuffer.size() == 128 * 32 + 1)
     {
         quint8 *buf = (quint8*) readbuffer.constData();
         QImage im(buf, 256, 128, QImage::Format_Mono);
         im.setNumColors(2);
+
+        QPixmap px(QSize(256, 128));
+        QPixmap pxres(px.size());
+        QPainter p(&pxres);
+
+        px.fill(Qt::yellow);
+        QBitmap bm = QBitmap::fromImage(im);
+        px.setMask(bm);
+
+        p.fillRect(pxres.rect(), linearGrad);
+        p.drawPixmap(0, 0, px);
+
         emit HHLimitReceived(buf[128 * 32]);
-        emit ImageReceived(im);
+        emit ImageReceived(px);
+    } else if (readbuffer.size() == 128 * 256 + 1)
+    {
+        QVector<QRgb> colorTable;
+        colorTable.resize(256);
+        for(int i = 0; i < 256; ++i)
+            colorTable[i] = qRgba(255, 255, 0, i);
+
+        const quint8 *buf = (const quint8*) readbuffer.constData();
+        QImage im(buf, 256, 128, QImage::Format_Indexed8);
+        im.setColorTable(colorTable);
+
+        QPixmap px = QPixmap::fromImage(im, Qt::ColorOnly);
+        QPixmap pxres(px.size());
+        QPainter p(&pxres);
+
+        p.fillRect(pxres.rect(), linearGrad);
+        p.drawPixmap(0, 0, px);
+
+        emit HHLimitReceived(buf[128 * 256]);
+        emit ImageReceived(px);
     }
 }
 
@@ -73,10 +122,17 @@
     SendIPC(QString("eseed %1").arg(m_seed).toUtf8());
     SendIPC(QString("e$template_filter %1").arg(templateFilter).toUtf8());
     SendIPC(QString("e$mapgen %1").arg(m_mapgen).toUtf8());
+    SendIPC(QString("e$feature_size %1").arg(m_feature_size).toUtf8());
+    if (!m_script.isEmpty())
+    {
+        SendIPC(QString("escript Scripts/Multiplayer/%1.lua").arg(m_script).toUtf8());
+        SendIPC(QString("e$scriptparam %1").arg(m_scriptparam).toUtf8());
+    }
 
     switch (m_mapgen)
     {
         case MAPGEN_MAZE:
+        case MAPGEN_PERLIN:
             SendIPC(QString("e$maze_size %1").arg(m_maze_size).toUtf8());
             break;
 
--- a/QTfrontend/net/hwmap.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/hwmap.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _HWMAP_INCLUDED
@@ -22,16 +22,17 @@
 
 #include <QByteArray>
 #include <QString>
-#include <QImage>
+#include <QPixmap>
 
 #include "tcpBase.h"
 
 enum MapGenerator
 {
-    MAPGEN_REGULAR,
-    MAPGEN_MAZE,
-    MAPGEN_DRAWN,
-    MAPGEN_MAP
+    MAPGEN_REGULAR = 0,
+    MAPGEN_MAZE = 1,
+    MAPGEN_PERLIN = 2,
+    MAPGEN_DRAWN = 3,
+    MAPGEN_MAP = 4
 };
 
 class HWMap : public TCPBase
@@ -41,7 +42,7 @@
     public:
         HWMap(QObject *parent = 0);
         virtual ~HWMap();
-        void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData);
+        void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData, QString & script, QString & scriptparam, int feature_size);
         bool couldBeRemoved();
 
     protected:
@@ -50,14 +51,17 @@
         virtual void SendToClientFirst();
 
     signals:
-        void ImageReceived(const QImage newImage);
+        void ImageReceived(const QPixmap & newImage);
         void HHLimitReceived(int hhLimit);
 
     private:
         QString m_seed;
+        QString m_script;
+        QString m_scriptparam;
         int templateFilter;
         MapGenerator m_mapgen;
-        int m_maze_size;
+        int m_maze_size;  // going to try and deprecate this one
+        int m_feature_size;
         QByteArray m_drawMapData;
 
     private slots:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/net/hwmapoptimizer.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -0,0 +1,54 @@
+#include "hwmapoptimizer.h"
+#include "hwconsts.h"
+
+HWMapOptimizer::HWMapOptimizer(QObject *parent) :
+    TCPBase(parent)
+{
+}
+
+bool HWMapOptimizer::couldBeRemoved()
+{
+    return !m_hasStarted;
+}
+
+void HWMapOptimizer::optimizeMap(const Paths &paths)
+{
+    m_paths = paths;
+
+    Start(true);
+}
+
+QStringList HWMapOptimizer::getArguments()
+{
+    QStringList arguments;
+    arguments << "--internal";
+    arguments << "--port";
+    arguments << QString("%1").arg(ipc_port);
+    arguments << "--user-prefix";
+    arguments << cfgdir->absolutePath();
+    arguments << "--prefix";
+    arguments << datadir->absolutePath();
+    arguments << "--landpreview";
+    return arguments;
+}
+
+void HWMapOptimizer::onClientDisconnect()
+{
+
+}
+
+void HWMapOptimizer::SendToClientFirst()
+{
+    SendIPC("e$mapgen 4");
+
+    /*QByteArray data = m_drawMapData;
+    while(data.size() > 0)
+    {
+        QByteArray tmp = data;
+        tmp.truncate(200);
+        SendIPC("edraw " + tmp);
+        data.remove(0, 200);
+    }
+
+    SendIPC("!");*/
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/net/hwmapoptimizer.h	Tue Nov 10 20:43:13 2015 +0100
@@ -0,0 +1,30 @@
+#ifndef HWMAPOPTIMIZER_H
+#define HWMAPOPTIMIZER_H
+
+#include "tcpBase.h"
+#include "drawmapscene.h"
+
+class HWMapOptimizer : public TCPBase
+{
+    Q_OBJECT
+public:
+    explicit HWMapOptimizer(QObject *parent = 0);
+
+    void optimizeMap(const Paths & paths);
+    bool couldBeRemoved();
+    
+signals:    
+    void optimizedMap(const Paths & paths);
+    
+public slots:
+
+protected:
+    QStringList getArguments();
+    void onClientDisconnect();
+    void SendToClientFirst();
+
+private:
+    Paths m_paths;
+};
+
+#endif // HWMAPOPTIMIZER_H
--- a/QTfrontend/net/netregister.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/netregister.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "netregister.h"
--- a/QTfrontend/net/netregister.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/netregister.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _NET_REGISTER_INCLUDED
--- a/QTfrontend/net/netserver.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/netserver.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "hwconsts.h"
--- a/QTfrontend/net/netserver.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/netserver.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _NETSERVER_INCLUDED
--- a/QTfrontend/net/netudpserver.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/netudpserver.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2007-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QUdpSocket>
--- a/QTfrontend/net/netudpserver.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/netudpserver.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2007-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _NET_UDPSERVER_INCLUDED
--- a/QTfrontend/net/netudpwidget.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/netudpwidget.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QUdpSocket>
--- a/QTfrontend/net/netudpwidget.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/netudpwidget.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _NET_UDPWIDGET_INCLUDED
--- a/QTfrontend/net/newnetclient.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/newnetclient.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,13 +14,14 @@
  *
  * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDebug>
 #include <QInputDialog>
 #include <QCryptographicHash>
 #include <QSortFilterProxyModel>
+#include <QUuid>
 
 #include "hwconsts.h"
 #include "newnetclient.h"
@@ -31,14 +32,16 @@
 #include "servermessages.h"
 #include "HWApplication.h"
 
-char delimeter='\n';
+char delimiter='\n';
 
 HWNewNet::HWNewNet() :
     isChief(false),
     m_game_connected(false),
-    loginStep(0),
     netClientState(Disconnected)
 {
+    m_private_game = false;
+    m_nick_registered = false;
+
     m_roomsListModel = new RoomsListModel(this);
 
     m_playersModel = new PlayersListModel(this);
@@ -71,7 +74,7 @@
 {
     if (m_game_connected)
     {
-        RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit"));
+        RawSendNet(QString("QUIT%1%2").arg(delimiter).arg("User quit"));
         emit disconnected(tr("User quit"));
     }
     NetSocket.flush();
@@ -88,7 +91,7 @@
 void HWNewNet::Disconnect()
 {
     if (m_game_connected)
-        RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit"));
+        RawSendNet(QString("QUIT%1%2").arg(delimiter).arg("User quit"));
     m_game_connected = false;
 
     NetSocket.disconnectFromHost();
@@ -105,9 +108,9 @@
     myroom = room;
 
     if(password.isEmpty())
-        RawSendNet(QString("CREATE_ROOM%1%2").arg(delimeter).arg(room));
+        RawSendNet(QString("CREATE_ROOM%1%2").arg(delimiter).arg(room));
     else
-        RawSendNet(QString("CREATE_ROOM%1%2%1%3").arg(delimeter).arg(room).arg(password));
+        RawSendNet(QString("CREATE_ROOM%1%2%1%3").arg(delimiter).arg(room).arg(password));
 
     isChief = true;
 }
@@ -123,29 +126,29 @@
     myroom = room;
 
     if(password.isEmpty())
-        RawSendNet(QString("JOIN_ROOM%1%2").arg(delimeter).arg(room));
+        RawSendNet(QString("JOIN_ROOM%1%2").arg(delimiter).arg(room));
     else
-        RawSendNet(QString("JOIN_ROOM%1%2%1%3").arg(delimeter).arg(room).arg(password));
+        RawSendNet(QString("JOIN_ROOM%1%2%1%3").arg(delimiter).arg(room).arg(password));
 
     isChief = false;
 }
 
 void HWNewNet::AddTeam(const HWTeam & team)
 {
-    QString cmd = QString("ADD_TEAM") + delimeter +
-                  team.name() + delimeter +
-                  QString::number(team.color()) + delimeter +
-                  team.grave() + delimeter +
-                  team.fort() + delimeter +
-                  team.voicepack() + delimeter +
-                  team.flag() + delimeter +
+    QString cmd = QString("ADD_TEAM") + delimiter +
+                  team.name() + delimiter +
+                  QString::number(team.color()) + delimiter +
+                  team.grave() + delimiter +
+                  team.fort() + delimiter +
+                  team.voicepack() + delimiter +
+                  team.flag() + delimiter +
                   QString::number(team.difficulty());
 
     for(int i = 0; i < HEDGEHOGS_PER_TEAM; ++i)
     {
-        cmd.append(delimeter);
+        cmd.append(delimiter);
         cmd.append(team.hedgehog(i).Name);
-        cmd.append(delimeter);
+        cmd.append(delimiter);
         cmd.append(team.hedgehog(i).Hat);
     }
     RawSendNet(cmd);
@@ -153,12 +156,12 @@
 
 void HWNewNet::RemoveTeam(const HWTeam & team)
 {
-    RawSendNet(QString("REMOVE_TEAM") + delimeter + team.name());
+    RawSendNet(QString("REMOVE_TEAM") + delimiter + team.name());
 }
 
 void HWNewNet::NewNick(const QString & nick)
 {
-    RawSendNet(QString("NICK%1%2").arg(delimeter).arg(nick));
+    RawSendNet(QString("NICK%1%2").arg(delimiter).arg(nick));
 }
 
 void HWNewNet::ToggleReady()
@@ -170,7 +173,7 @@
 {
     QString msg = QString(buf.toBase64());
 
-    RawSendNet(QString("EM%1%2").arg(delimeter).arg(msg));
+    RawSendNet(QString("EM%1%2").arg(delimiter).arg(msg));
 }
 
 void HWNewNet::RawSendNet(const QString & str)
@@ -238,7 +241,10 @@
 
 void HWNewNet::SendPasswordHash(const QString & hash)
 {
-    RawSendNet(QString("PASSWORD%1%2").arg(delimeter).arg(hash));
+    // don't send it immediately, only store and check if server asked us for a password
+    m_passwordHash = hash.toAscii();
+
+    maybeSendPassword();
 }
 
 void HWNewNet::ParseCmd(const QStringList & lst)
@@ -286,24 +292,46 @@
         {
             // TODO: Warn user, disconnect
             qWarning() << "Server too old";
-            RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("Server too old"));
+            RawSendNet(QString("QUIT%1%2").arg(delimiter).arg("Server too old"));
             Disconnect();
             emit disconnected(tr("The server is too old. Disconnecting now."));
             return;
         }
 
-        RawSendNet(QString("NICK%1%2").arg(delimeter).arg(mynick));
-        RawSendNet(QString("PROTO%1%2").arg(delimeter).arg(*cProtoVer));
+        RawSendNet(QString("NICK%1%2").arg(delimiter).arg(mynick));
+        RawSendNet(QString("PROTO%1%2").arg(delimiter).arg(*cProtoVer));
         netClientState = Connected;
         m_game_connected = true;
         emit adminAccess(false);
         return;
     }
 
+    if (lst[0] == "SERVER_AUTH")
+    {
+        if(lst.size() < 2)
+        {
+            qWarning("Net: Malformed SERVER_AUTH message");
+            return;
+        }
+
+        if(lst[1] != m_serverHash)
+        {
+            Error("Server authentication error");
+            Disconnect();
+        } else
+        {
+            // empty m_serverHash variable means no authentication was performed
+            // or server passed authentication
+            m_serverHash.clear();
+        }
+
+        return;
+    }
+
     if (lst[0] == "PING")
     {
         if (lst.size() > 1)
-            RawSendNet(QString("PONG%1%2").arg(delimeter).arg(lst[1]));
+            RawSendNet(QString("PONG%1%2").arg(delimiter).arg(lst[1]));
         else
             RawSendNet(QString("PONG"));
         return;
@@ -450,7 +478,7 @@
                 // flag indicating if a player is contributor
                 case 'c':
                         foreach(const QString & nick, nicks)
-                            m_playersModel->setFlag(nick, PlayersListModel::InRoom, setFlag);
+                            m_playersModel->setFlag(nick, PlayersListModel::Contributor, setFlag);
                         break;
                 // flag indicating if a player has engine running
                 case 'g':
@@ -515,6 +543,14 @@
         {
             if (lst[i] == mynick)
             {
+                // check if server is authenticated or no authentication was performed at all
+                if(!m_serverHash.isEmpty())
+                {
+                    Error(tr("Server authentication error"));
+
+                    Disconnect();
+                }
+
                 netClientState = InLobby;
                 RawSendNet(QString("LIST"));
                 emit connected();
@@ -545,7 +581,7 @@
         m_roomsListModel->updateRoom(roomName, tmp);
 
         // keep track of room name so correct name is displayed
-        if(myroom == roomName)
+        if(myroom == roomName && myroom != tmp[1])
         {
             myroom = tmp[1];
             emit roomNameUpdated(myroom);
@@ -578,8 +614,24 @@
 
     if (lst[0] == "ASKPASSWORD")
     {
+        // server should send us salt of at least 16 characters
+
+        if(lst.size() < 2 || lst[1].size() < 16)
+        {
+            qWarning("Net: Bad ASKPASSWORD message");
+            return;
+        }
+
         emit NickRegistered(mynick);
         m_nick_registered = true;
+
+        // store server salt
+        // when this variable is set, it is assumed that server asked us for a password
+        m_serverSalt = lst[1];
+        m_clientSalt = QUuid::createUuid().toString();
+
+        maybeSendPassword();
+
         return;
     }
 
@@ -696,7 +748,8 @@
             }
             QStringList tmp = lst;
             tmp.removeFirst();
-            emit AddNetTeam(tmp);
+            HWTeam team(tmp);
+            emit AddNetTeam(team);
             return;
         }
 
@@ -820,7 +873,7 @@
 {
     if (isChief)
         RawSendNet(QString("HH_NUM%1%2%1%3")
-                   .arg(delimeter)
+                   .arg(delimiter)
                    .arg(team.name())
                    .arg(team.numHedgehogs()));
 }
@@ -829,7 +882,7 @@
 {
     if (isChief)
         RawSendNet(QString("TEAM_COLOR%1%2%1%3")
-                   .arg(delimeter)
+                   .arg(delimiter)
                    .arg(team.name())
                    .arg(team.color()));
 }
@@ -839,9 +892,9 @@
     if (isChief)
         RawSendNet(
             QString("CFG%1%2%1%3")
-            .arg(delimeter)
+            .arg(delimiter)
             .arg(param)
-            .arg(value.join(QString(delimeter)))
+            .arg(value.join(QString(delimiter)))
         );
 }
 
@@ -858,7 +911,7 @@
 {
     if(str != "")
     {
-        RawSendNet(QString("CHAT") + delimeter + str);
+        RawSendNet(QString("CHAT") + delimiter + str);
         QString action = HWProto::chatStringToAction(str);
         if (action != NULL)
             emit(roomChatAction(mynick, action));
@@ -871,7 +924,7 @@
 {
     if(str != "")
     {
-        RawSendNet(QString("CHAT") + delimeter + str);
+        RawSendNet(QString("CHAT") + delimiter + str);
         QString action = HWProto::chatStringToAction(str);
         if (action != NULL)
             emit(lobbyChatAction(mynick, action));
@@ -882,7 +935,7 @@
 
 void HWNewNet::SendTeamMessage(const QString& str)
 {
-    RawSendNet(QString("TEAMCHAT") + delimeter + str);
+    RawSendNet(QString("TEAMCHAT") + delimiter + str);
 }
 
 void HWNewNet::askRoomsList()
@@ -925,23 +978,23 @@
     if (netClientState == InGame)
     {
         netClientState = InRoom;
-        RawSendNet(QString("ROUNDFINISHED%1%2").arg(delimeter).arg(correctly ? "1" : "0"));
+        RawSendNet(QString("ROUNDFINISHED%1%2").arg(delimiter).arg(correctly ? "1" : "0"));
     }
 }
 
 void HWNewNet::banPlayer(const QString & nick)
 {
-    RawSendNet(QString("BAN%1%2").arg(delimeter).arg(nick));
+    RawSendNet(QString("BAN%1%2").arg(delimiter).arg(nick));
 }
 
 void HWNewNet::banIP(const QString & ip, const QString & reason, int seconds)
 {
-    RawSendNet(QString("BANIP%1%2%1%3%1%4").arg(delimeter).arg(ip).arg(reason).arg(seconds));
+    RawSendNet(QString("BANIP%1%2%1%3%1%4").arg(delimiter).arg(ip).arg(reason).arg(seconds));
 }
 
 void HWNewNet::banNick(const QString & nick, const QString & reason, int seconds)
 {
-    RawSendNet(QString("BANNICK%1%2%1%3%1%4").arg(delimeter).arg(nick).arg(reason).arg(seconds));
+    RawSendNet(QString("BANNICK%1%2%1%3%1%4").arg(delimiter).arg(nick).arg(reason).arg(seconds));
 }
 
 void HWNewNet::getBanList()
@@ -951,31 +1004,31 @@
 
 void HWNewNet::removeBan(const QString & b)
 {
-    RawSendNet(QString("UNBAN%1%2").arg(delimeter).arg(b));
+    RawSendNet(QString("UNBAN%1%2").arg(delimiter).arg(b));
 }
 
 void HWNewNet::kickPlayer(const QString & nick)
 {
-    RawSendNet(QString("KICK%1%2").arg(delimeter).arg(nick));
+    RawSendNet(QString("KICK%1%2").arg(delimiter).arg(nick));
 }
 
 void HWNewNet::infoPlayer(const QString & nick)
 {
-    RawSendNet(QString("INFO%1%2").arg(delimeter).arg(nick));
+    RawSendNet(QString("INFO%1%2").arg(delimiter).arg(nick));
 }
 
 void HWNewNet::followPlayer(const QString & nick)
 {
     if (!isInRoom())
     {
-        RawSendNet(QString("FOLLOW%1%2").arg(delimeter).arg(nick));
+        RawSendNet(QString("FOLLOW%1%2").arg(delimiter).arg(nick));
         isChief = false;
     }
 }
 
 void HWNewNet::consoleCommand(const QString & cmd)
 {
-    RawSendNet(QString("CMD%1%2").arg(delimeter).arg(cmd));
+    RawSendNet(QString("CMD%1%2").arg(delimiter).arg(cmd));
 }
 
 bool HWNewNet::allPlayersReady()
@@ -994,7 +1047,7 @@
 
 void HWNewNet::updateRoomName(const QString & name)
 {
-    RawSendNet(QString("ROOM_NAME%1%2").arg(delimeter).arg(name));
+    RawSendNet(QString("ROOM_NAME%1%2").arg(delimiter).arg(name));
 }
 
 
@@ -1032,17 +1085,17 @@
 
 void HWNewNet::setServerMessageNew(const QString & msg)
 {
-    RawSendNet(QString("SET_SERVER_VAR%1MOTD_NEW%1%2").arg(delimeter).arg(msg));
+    RawSendNet(QString("SET_SERVER_VAR%1MOTD_NEW%1%2").arg(delimiter).arg(msg));
 }
 
 void HWNewNet::setServerMessageOld(const QString & msg)
 {
-    RawSendNet(QString("SET_SERVER_VAR%1MOTD_OLD%1%2").arg(delimeter).arg(msg));
+    RawSendNet(QString("SET_SERVER_VAR%1MOTD_OLD%1%2").arg(delimiter).arg(msg));
 }
 
 void HWNewNet::setLatestProtocolVar(int proto)
 {
-    RawSendNet(QString("SET_SERVER_VAR%1LATEST_PROTO%1%2").arg(delimeter).arg(proto));
+    RawSendNet(QString("SET_SERVER_VAR%1LATEST_PROTO%1%2").arg(delimiter).arg(proto));
 }
 
 void HWNewNet::askServerVars()
@@ -1083,3 +1136,34 @@
     if(!myroom.isEmpty())
         JoinRoom(myroom, password);
 }
+
+void HWNewNet::maybeSendPassword()
+{
+/* When we got password hash, and server asked us for a password, perform mutual authentication:
+ * at this point we have salt chosen by server
+ * client sends client salt and hash of secret (password hash) salted with client salt, server salt,
+ * and static salt (predefined string + protocol number)
+ * server should respond with hash of the same set in different order.
+ */
+
+    if(m_passwordHash.isEmpty() || m_serverSalt.isEmpty())
+        return;
+
+    QString hash = QCryptographicHash::hash(
+                m_clientSalt.toAscii()
+                .append(m_serverSalt.toAscii())
+                .append(m_passwordHash)
+                .append(cProtoVer->toAscii())
+                .append("!hedgewars")
+                , QCryptographicHash::Sha1).toHex();
+
+    m_serverHash = QCryptographicHash::hash(
+                m_serverSalt.toAscii()
+                .append(m_clientSalt.toAscii())
+                .append(m_passwordHash)
+                .append(cProtoVer->toAscii())
+                .append("!hedgewars")
+                , QCryptographicHash::Sha1).toHex();
+
+    RawSendNet(QString("PASSWORD%1%2%1%3").arg(delimiter).arg(hash).arg(m_clientSalt));
+}
--- a/QTfrontend/net/newnetclient.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/newnetclient.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _NEW_NETCLIENT_INCLUDED
@@ -36,7 +36,7 @@
 class QSortFilterProxyModel;
 class QAbstractItemModel;
 
-extern char delimeter;
+extern char delimiter;
 
 class HWNewNet : public QObject
 {
@@ -77,6 +77,10 @@
         QSortFilterProxyModel * m_lobbyPlayersModel;
         QSortFilterProxyModel * m_roomPlayersModel;
         QString m_lastRoom;
+        QString m_passwordHash;
+        QString m_serverSalt;
+        QString m_clientSalt;
+        QString m_serverHash;
 
         QStringList cmdbuf;
 
@@ -85,7 +89,8 @@
         void ParseCmd(const QStringList & lst);
         void handleNotice(int n);
 
-        int loginStep;
+        void maybeSendPassword();
+
         ClientState netClientState;
 
     signals:
@@ -106,7 +111,7 @@
         void roomNameUpdated(const QString & name);
         void askForRoomPassword();
 
-        void netSchemeConfig(QStringList &);
+        void netSchemeConfig(QStringList);
         void paramChanged(const QString & param, const QStringList & value);
         void configAsked();
 
--- a/QTfrontend/net/proto.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/proto.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "proto.h"
@@ -58,5 +58,5 @@
     if(string.left(4) == "/me ")
         return string.mid(4);
     else
-        return NULL;
+        return QString();
 }
--- a/QTfrontend/net/proto.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/proto.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _PROTO_H
--- a/QTfrontend/net/recorder.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/recorder.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QString>
@@ -37,6 +37,7 @@
 {
     this->config = config;
     this->prefix = prefix;
+    item = 0;
     finished = false;
     name = prefix + "." + LibavInteraction::instance().getExtension(config->AVFormat());
 }
@@ -143,3 +144,8 @@
 
     return arguments;
 }
+
+bool HWRecorder::simultaneousRun()
+{
+    return true;
+}
--- a/QTfrontend/net/recorder.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/recorder.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef RECORDER_H
@@ -35,6 +35,7 @@
         virtual ~HWRecorder();
 
         void EncodeVideo(const QByteArray & record);
+        bool simultaneousRun();
 
         VideoItem * item; // used by pagevideos
         QString name;
--- a/QTfrontend/net/tcpBase.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/tcpBase.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,51 +14,62 @@
  *
  * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "tcpBase.h"
-
 #include <QList>
 #include <QImage>
 #include <QThread>
+#include <QApplication>
 
+#include "tcpBase.h"
 #include "hwconsts.h"
 #include "MessageDialog.h"
 
 #ifdef HWLIBRARY
-extern "C" void Game(char**arguments);
-extern "C" void GenLandPreview(int port);
+extern "C" {
+    void RunEngine(int argc, char ** argv);
+
+    int operatingsystem_parameter_argc;
+    char ** operatingsystem_parameter_argv;
+}
 
 
 EngineInstance::EngineInstance(QObject *parent)
     : QObject(parent)
 {
-    port = 0;
+
 }
 
 EngineInstance::~EngineInstance()
 {
+    qDebug() << "EngineInstance delete" << QThread::currentThreadId();
+}
+
+void EngineInstance::setArguments(const QStringList & arguments)
+{
+    m_arguments.clear();
+    m_arguments << qApp->arguments().at(0).toUtf8();
+
+    m_argv.resize(arguments.size() + 1);
+    m_argv[0] = m_arguments.last().data();
+
+    int i = 1;
+    foreach(const QString & s, arguments)
+    {
+        m_arguments << s.toUtf8();
+        m_argv[i] = m_arguments.last().data();
+        ++i;
+    }
 }
 
 void EngineInstance::start()
 {
-#if 0
-    char *args[11];
-    args[0] = "65000";  //ipcPort
-    args[1] = "1024";   //cScreenWidth
-    args[2] = "768";    //cScreenHeight
-    args[3] = "0";      //cReducedQuality
-    args[4] = "en.txt"; //cLocaleFName
-    args[5] = "koda";   //UserNick
-    args[6] = "1";      //SetSound
-    args[7] = "1";      //SetMusic
-    args[8] = "0";      //cAltDamage
-    args[9]= datadir->absolutePath().toAscii().data(); //cPathPrefix
-    args[10]= NULL;     //recordFileName
-    Game(args);
-#endif
-    GenLandPreview(port);
+    qDebug() << "EngineInstance start" << QThread::currentThreadId();
+
+    RunEngine(m_argv.size(), m_argv.data());
+
+    emit finished();
 }
 
 #endif
@@ -68,6 +79,23 @@
 
 TCPBase::~TCPBase()
 {
+    if(m_hasStarted)
+    {
+        if(IPCSocket)
+            IPCSocket->close();
+
+        if(m_connected)
+        {
+#ifdef HWLIBRARY
+            if(!thread)
+                qDebug("WTF");
+            thread->quit();
+            thread->wait();
+#else
+            process->waitForFinished(1000);
+#endif
+        }
+    }
     // make sure this object is not in the server list anymore
     srvsList.removeOne(this);
 
@@ -80,8 +108,11 @@
     QObject(parent),
     m_hasStarted(false),
     m_isDemoMode(demoMode),
+    m_connected(false),
     IPCSocket(0)
 {
+    process = 0;
+
     if(!IPCServer)
     {
         IPCServer = new QTcpServer(0);
@@ -103,12 +134,23 @@
         // connection should be already finished
         return;
     }
+
     disconnect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
     IPCSocket = IPCServer->nextPendingConnection();
+
     if(!IPCSocket) return;
+
+    m_connected = true;
+
     connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
     connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
     SendToClientFirst();
+
+    if(simultaneousRun())
+    {
+        srvsList.removeOne(this);
+        emit isReadyNow();
+    }
 }
 
 void TCPBase::RealStart()
@@ -117,9 +159,9 @@
     IPCSocket = 0;
 
 #ifdef HWLIBRARY
-    QThread *thread = new QThread;
-    EngineInstance *instance = new EngineInstance;
-    instance->port = IPCServer->serverPort();
+    thread = new QThread(this);
+    EngineInstance *instance = new EngineInstance();
+    instance->setArguments(getArguments());
 
     instance->moveToThread(thread);
 
@@ -129,10 +171,12 @@
     connect(instance, SIGNAL(finished()), thread, SLOT(deleteLater()));
     thread->start();
 #else
-    QProcess * process;
-    process = new QProcess();
-    connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError)));
-    QStringList arguments=getArguments();
+    process = new QProcess(this);
+    connect(process, SIGNAL(error(QProcess::ProcessError)),
+        this, SLOT(StartProcessError(QProcess::ProcessError)));
+    connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
+        this, SLOT(onEngineDeath(int, QProcess::ExitStatus)));
+    QStringList arguments = getArguments();
 
 #ifdef QT_DEBUG
     // redirect everything written on stdout/stderr
@@ -149,17 +193,26 @@
     disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
     onClientDisconnect();
 
-    emit isReadyNow();
+    if(!simultaneousRun())
+    {
+#ifdef HWLIBRARY
+        thread->quit();
+        thread->wait();
+#endif
+        emit isReadyNow();
+    }
+
     IPCSocket->deleteLater();
+    IPCSocket = NULL;
 
     deleteLater();
 }
 
 void TCPBase::ClientRead()
 {
-    QByteArray readed=IPCSocket->readAll();
-    if(readed.isEmpty()) return;
-    readbuffer.append(readed);
+    QByteArray read = IPCSocket->readAll();
+    if(read.isEmpty()) return;
+    readbuffer.append(read);
     onClientRead();
 }
 
@@ -169,6 +222,38 @@
     ClientDisconnect();
 }
 
+void TCPBase::onEngineDeath(int exitCode, QProcess::ExitStatus exitStatus)
+{
+    Q_UNUSED(exitStatus);
+
+    ClientDisconnect();
+
+    // show error message if there was an error that was not an engine's
+    // fatal error - because that one already sent a info via IPC
+    if ((exitCode != 0) && (exitCode != 2))
+    {
+        // inform user that something bad happened
+        MessageDialog::ShowFatalMessage(
+            tr("The game engine died unexpectedly!\n"
+            "(exit code %1)\n\n"
+            "We are very sorry for the inconvenience :(\n\n"
+            "If this keeps happening, please click the '%2' button in the main menu!")
+            .arg(exitCode)
+            .arg("Feedback"));
+
+    }
+
+    // cleanup up
+    if (IPCSocket)
+    {
+        IPCSocket->close();
+        IPCSocket->deleteLater();
+    }
+
+    // plot suicide
+    deleteLater();
+}
+
 void TCPBase::tcpServerReady()
 {
     disconnect(srvsList.first(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
@@ -188,14 +273,15 @@
         TCPBase * last = srvsList.last();
         if(couldCancelPreviousRequest
             && last->couldBeRemoved()
+            && (last->isConnected() || !last->hasStarted())
             && (last->parent() == parent()))
         {
             srvsList.removeLast();
-            last->deleteLater();
+            delete last;
             Start(couldCancelPreviousRequest);
         } else
         {
-            connect(srvsList.last(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
+            connect(last, SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
             srvsList.push_back(this);
         }
     }
@@ -246,3 +332,18 @@
 {
     return false;
 }
+
+bool TCPBase::isConnected()
+{
+    return m_connected;
+}
+
+bool TCPBase::simultaneousRun()
+{
+    return false;
+}
+
+bool TCPBase::hasStarted()
+{
+    return m_hasStarted;
+}
--- a/QTfrontend/net/tcpBase.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/net/tcpBase.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _TCPBASE_INCLUDED
@@ -27,7 +27,10 @@
 #include <QString>
 #include <QDir>
 #include <QProcess>
+#include <QThread>
 #include <QPointer>
+#include <QVector>
+#include <QList>
 
 #include <QImage>
 
@@ -42,6 +45,9 @@
         virtual ~TCPBase();
 
         virtual bool couldBeRemoved();
+        virtual bool simultaneousRun();
+        bool isConnected();
+        bool hasStarted();
 
     signals:
         void isReadyNow();
@@ -67,8 +73,13 @@
 
     private:
         static QPointer<QTcpServer> IPCServer;
-
+#ifdef HWLIBRARY
+        QThread * thread;
+#else
+        QProcess * process;
+#endif
         bool m_isDemoMode;
+        bool m_connected;
         void RealStart();
         QPointer<QTcpSocket> IPCSocket;
 
@@ -77,6 +88,7 @@
         void ClientDisconnect();
         void ClientRead();
         void StartProcessError(QProcess::ProcessError error);
+        void onEngineDeath(int exitCode, QProcess::ExitStatus exitStatus);
 
         void tcpServerReady();
 };
@@ -89,12 +101,17 @@
     EngineInstance(QObject *parent = 0);
     ~EngineInstance();
 
-    int port;
+    void setArguments(const QStringList & arguments);
+
 public slots:
-    void start(void);
+    void start();
+
 signals:
-    void finished(void);
+    void finished();
+
 private:
+    QList<QByteArray> m_arguments;
+    QVector<char *> m_argv;
 };
 #endif
 
Binary file QTfrontend/res/Background.png has changed
Binary file QTfrontend/res/BackgroundChristmas.png has changed
Binary file QTfrontend/res/BackgroundEaster.png has changed
Binary file QTfrontend/res/Confetti.png has changed
Binary file QTfrontend/res/Egg.png has changed
Binary file QTfrontend/res/Exit.png has changed
Binary file QTfrontend/res/Flake.png has changed
Binary file QTfrontend/res/LocalPlay.png has changed
Binary file QTfrontend/res/NetworkPlayDisabled.png has changed
Binary file QTfrontend/res/PlaySound.png has changed
Binary file QTfrontend/res/Save.png has changed
Binary file QTfrontend/res/Settings.png has changed
Binary file QTfrontend/res/Star.png has changed
Binary file QTfrontend/res/Start.png has changed
Binary file QTfrontend/res/StatsBestKiller.png has changed
Binary file QTfrontend/res/StatsBestShot.png has changed
Binary file QTfrontend/res/StatsCustomAchievement.png has changed
Binary file QTfrontend/res/StatsD.png has changed
Binary file QTfrontend/res/StatsH.png has changed
Binary file QTfrontend/res/StatsHedgehogsKilled.png has changed
Binary file QTfrontend/res/StatsMedal1.png has changed
Binary file QTfrontend/res/StatsMedal2.png has changed
Binary file QTfrontend/res/StatsMedal3.png has changed
Binary file QTfrontend/res/StatsMedal4.png has changed
Binary file QTfrontend/res/StatsMostSelfDamage.png has changed
Binary file QTfrontend/res/StatsR.png has changed
Binary file QTfrontend/res/StatsSelfKilled.png has changed
Binary file QTfrontend/res/StatsSkipped.png has changed
Binary file QTfrontend/res/Trainings.png has changed
Binary file QTfrontend/res/addfriend.png has changed
Binary file QTfrontend/res/ammopic.png has changed
Binary file QTfrontend/res/botlevels/net0.png has changed
Binary file QTfrontend/res/botlevels/net1.png has changed
Binary file QTfrontend/res/botlevels/net2.png has changed
Binary file QTfrontend/res/botlevels/net3.png has changed
Binary file QTfrontend/res/botlevels/net4.png has changed
Binary file QTfrontend/res/botlevels/net5.png has changed
Binary file QTfrontend/res/btnArtillery.png has changed
Binary file QTfrontend/res/btnBorder.png has changed
Binary file QTfrontend/res/btnDisableLandObjects.png has changed
Binary file QTfrontend/res/btnForts.png has changed
Binary file QTfrontend/res/btnInvulnerable.png has changed
Binary file QTfrontend/res/btnKarma.png has changed
Binary file QTfrontend/res/btnKing.png has changed
Binary file QTfrontend/res/btnLaserSight.png has changed
Binary file QTfrontend/res/btnLowGravity.png has changed
Binary file QTfrontend/res/btnMoreWind.png has changed
Binary file QTfrontend/res/btnNoWind.png has changed
Binary file QTfrontend/res/btnOverlay.png has changed
Binary file QTfrontend/res/btnPlaceHog.png has changed
Binary file QTfrontend/res/btnRandomOrder.png has changed
Binary file QTfrontend/res/btnResetWeps.png has changed
Binary file QTfrontend/res/btnSharedAmmo.png has changed
Binary file QTfrontend/res/btnTeamsDivide.png has changed
Binary file QTfrontend/res/btnVampiric.png has changed
Binary file QTfrontend/res/camera.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/backstab.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/dragon.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/epil.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/family.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/journey.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/queen.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/shadow.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/united.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/cosmos.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/death01.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/death02.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/desert02.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/desert03.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/ice01.png has changed
Binary file QTfrontend/res/campaign/A_Space_Adventure/moon01.png has changed
Binary file QTfrontend/res/chat/friend.png has changed
Binary file QTfrontend/res/chat/hedgehog.png has changed
Binary file QTfrontend/res/chat/hedgehog_gray.png has changed
Binary file QTfrontend/res/chat/hedgehogcontributor.png has changed
Binary file QTfrontend/res/chat/hedgehogcontributor_gray.png has changed
Binary file QTfrontend/res/chat/ignore.png has changed
Binary file QTfrontend/res/chat/ingame.png has changed
Binary file QTfrontend/res/chat/lamp.png has changed
Binary file QTfrontend/res/chat/lamp_off.png has changed
Binary file QTfrontend/res/chat/roomadmin.png has changed
Binary file QTfrontend/res/chat/roomadmin_gray.png has changed
Binary file QTfrontend/res/chat/roomadmincontributor.png has changed
Binary file QTfrontend/res/chat/roomadmincontributor_gray.png has changed
Binary file QTfrontend/res/chat/serveradmin.png has changed
Binary file QTfrontend/res/chat/serveradmin_gray.png has changed
Binary file QTfrontend/res/checked.png has changed
--- a/QTfrontend/res/css/chat.css	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/res/css/chat.css	Tue Nov 10 20:43:13 2015 +0100
@@ -9,7 +9,7 @@
  *
  * In the QTfrontend of hedgewars also display:none; will work for class names
  * that start with msg_ and .timestamp -  as long as they are referenced
- * directly and not within any class hierachy.
+ * directly and not within any class hierarchy.
  * Note: Will only effect new lines!
  *
  ******************************************************************************
Binary file QTfrontend/res/delete.png has changed
Binary file QTfrontend/res/dropdown.png has changed
Binary file QTfrontend/res/edit.png has changed
Binary file QTfrontend/res/file_demo.png has changed
Binary file QTfrontend/res/file_save.png has changed
Binary file QTfrontend/res/follow.png has changed
Binary file QTfrontend/res/hh25x25.png has changed
Binary file QTfrontend/res/hh25x25grey.png has changed
Binary file QTfrontend/res/hh_small.png has changed
--- a/QTfrontend/res/html/about.html	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/res/html/about.html	Tue Nov 10 20:43:13 2015 +0100
@@ -35,6 +35,7 @@
         Keybinds, feedback, maps and hats interfaces: Drew Gottlieb &lt;<a href="mailto:gottlieb.drew@gmail.com">gottlieb.drew@gmail.com</a>&gt;<br>
         Login dialogs, frontend improvements: Ondrej Skopek &lt;<a href="mailto:skopekondrej@gmail.com">skopekondrej@gmail.com</a>&gt;<br>
         Icegun weapon: Julia Struchenko &lt;<a href="mailto:urbertar@gmail.com">urbertar@gmail.com</a>&gt;<br>
+        iPhone/iPad ports: Anton Malmygin &lt;<a href="mailto:antonc27@mail.ru">antonc27@mail.ru</a>&gt;<br>
         </p>
 
         <h2>Art:</h2>
@@ -72,17 +73,17 @@
             Czech: Petr Řezáček &lt;<a href="mailto:rezacek@gmail.com">rezacek@gmail.com</a>&gt;<br>
             Chinese: Jie Luo &lt;<a href="mailto:lililjlj@gmail.com">lililjlj@gmail.com</a>&gt;<br>
             English: Andrey Korotaev &lt;<a href="mailto:unC0Rr@gmail.com">unC0Rr@gmail.com</a>&gt;<br>
-            Finnish: Nina Kuisma &lt;<a href="mailto:ninnnu@gmail.com">ninnnu@gmail.com</a>&gt;<br>
+            Finnish: Nina Kuisma &lt;<a href="mailto:ninnnu@gmail.com">ninnnu@gmail.com</a>&gt;, Janne Uusitupa<br>
             French: Antoine Turmel &lt;<a href="mailto:geekshadow@gmail.com">geekshadow@gmail.com</a>&gt;, Clement Woitrain &lt;<a href="mailto:sphrixclement@gmail.com">sphrixclement@gmail.com</a>&gt;, Matisumi<br>
-            German: Peter Hüwe &lt;<a href="mailto:PeterHuewe@gmx.de">PeterHuewe@gmx.de</a>&gt;, Mario Liebisch &lt;<a href="mailto:mario.liebisch@gmail.com">mario.liebisch@gmail.com</a>&gt;, Richard Karolyi &lt;<a href="mailto:sheepluva@ercatec.net">sheepluva@ercatec.net</a>&gt;<br>
+            German: Peter Hüwe &lt;<a href="mailto:PeterHuewe@gmx.de">PeterHuewe@gmx.de</a>&gt;, Mario Liebisch &lt;<a href="mailto:mario.liebisch@gmail.com">mario.liebisch@gmail.com</a>&gt;, Richard Karolyi &lt;<a href="mailto:sheepluva@ercatec.net">sheepluva@ercatec.net</a>&gt;, Wuzzy &lt;<a href="mailto:almikes@aol.com">almikes@aol.com</a>&gt;<br>
             Greek: &lt;<a href="mailto:talos_kriti@yahoo.gr">talos_kriti@yahoo.gr</a>&gt;<br>
-            Italian: Luca Bonora &lt;<a href="mailto:bonora.luca@gmail.com">bonora.luca@gmail.com</a>&gt;, Marco Bresciani &lt;<a href="mailto:m.bresciani@email.it">m.bresciani@email.it</a>&gt;<br>
+            Italian: Luca Bonora &lt;<a href="mailto:bonora.luca@gmail.com">bonora.luca@gmail.com</a>&gt;, Marco Bresciani &lt;<a href="mailto:m.bresciani@email.it">m.bresciani@email.it</a>&gt;, Gianfranco Costamagna &lt;<a href="mailto:costamagnagianfranco@yahoo.it">costamagnagianfranco@yahoo.it</a>&gt;<br>
             Japanese: ADAM Etienne &lt;<a href="mailto:etienne.adam@gmail.com">etienne.adam@gmail.com</a>&gt;, Marco Bresciani &lt;<a href="mailto:m.bresciani@email.it">m.bresciani@email.it</a>&gt;<br>
             Korean: Anthony Bellew &lt;<a href="mailto:anthonyreflected@gmail.com">anthonyreflected@gmail.com</a>&gt;<br>
             Lithuanian: Lukas Urbonas &lt;<a href="mailto:lukasu08@gmail.com">lukasu08@gmail.com</a>&gt;<br>
             Polish: Maciej Mroziński &lt;<a href="mailto:mynick2@o2.pl">mynick2@o2.pl</a>&gt;, Wojciech Latkowski &lt;<a href="mailto:magik17l@gmail.com">magik17l@gmail.com</a>&gt;, Piotr Mitana, Maciej Górny<br>
             Portuguese: Fábio Canário &lt;<a href="mailto:inufabie@gmail.com">inufabie@gmail.com</a>&gt;<br>
-            Russian: Andrey Korotaev &lt;<a href="mailto:unC0Rr@gmail.com">unC0Rr@gmail.com</a>&gt;, Vitaly Novichkov &lt;<a href="mailto:admin@wohlnet.ru">admin@wohlnet.ru</a>&gt;<br>
+            Russian: Andrey Korotaev &lt;<a href="mailto:unC0Rr@gmail.com">unC0Rr@gmail.com</a>&gt;, Vitaly Novichkov &lt;<a href="mailto:admin@wohlnet.ru">admin@wohlnet.ru</a>&gt;, Anton Malmygin &lt;<a href="mailto:antonc27@mail.ru">antonc27@mail.ru</a>&gt;<br>
             Slovak: Jose Riha<br>
             Spanish: Carlos Vives &lt;<a href="mailto:mail@carlosvives.es">mail@carlosvives.es</a>&gt;<br>
             Swedish: Niklas Grahn &lt;<a href="mailto:raewolusjoon@yaoo.com">raewolusjoon@yaoo.com</a>&gt;, Henrik Rostedt &lt;<a href="mailto:henrik.rostedt@gmail.com">henrik.rostedt@gmail.com</a>&gt;<br>
Binary file QTfrontend/res/iconBox.png has changed
Binary file QTfrontend/res/iconDamage.png has changed
Binary file QTfrontend/res/iconDamageLockG.png has changed
Binary file QTfrontend/res/iconDamageLockR.png has changed
Binary file QTfrontend/res/iconDud.png has changed
Binary file QTfrontend/res/iconEarth.png has changed
Binary file QTfrontend/res/iconHealth.png has changed
Binary file QTfrontend/res/iconMine.png has changed
Binary file QTfrontend/res/iconRope.png has changed
Binary file QTfrontend/res/iconSuddenDeath.png has changed
Binary file QTfrontend/res/iconTime.png has changed
Binary file QTfrontend/res/iconTimeLockG.png has changed
Binary file QTfrontend/res/iconTimeLockR.png has changed
Binary file QTfrontend/res/ignore.png has changed
Binary file QTfrontend/res/infinity.png has changed
Binary file QTfrontend/res/info.png has changed
Binary file QTfrontend/res/inverse-corner-bl.png has changed
Binary file QTfrontend/res/kick.png has changed
Binary file QTfrontend/res/lightbulb_off.png has changed
Binary file QTfrontend/res/lightbulb_on.png has changed
Binary file QTfrontend/res/lock.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/res/locks.svg	Tue Nov 10 20:43:13 2015 +0100
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg2"
+   viewBox="0 0 225.52 116.94"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   width="100%"
+   height="100%"
+   sodipodi:docname="sloten.svg">
+  <defs
+     id="defs14" />
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1920"
+     inkscape:window-height="1028"
+     id="namedview12"
+     showgrid="false"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     inkscape:zoom="6.3586638"
+     inkscape:cx="102.46566"
+     inkscape:cy="54.65346"
+     inkscape:window-x="0"
+     inkscape:window-y="24"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg2">
+    <sodipodi:guide
+       orientation="0,1"
+       position="141.89589,74.728869"
+       id="guide3765" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="105.52531,92.000461"
+       id="guide3767" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="80.362796,66.52341"
+       id="guide3769" />
+  </sodipodi:namedview>
+  <path
+     style="fill:#dd2727"
+     inkscape:connector-curvature="0"
+     d="M 73.809216,100.09273 73.879916,44.786734 H 0.40991832 L -0.03314168,99.516734 C 0.03755832,119.84473 16.535858,116.77773 36.887858,116.77773 57.239856,116.77773 73.808856,120.44373 73.808856,100.09173 z"
+     id="path2865-1"
+     inkscape:export-xdpi="13.85"
+     inkscape:export-ydpi="13.85" />
+  <path
+     style="fill:#920312"
+     inkscape:connector-curvature="0"
+     d="M 37.036484,61.912734 C 33.023684,61.912734 29.788884,65.147534 29.788884,69.160334 29.788884,72.084634 31.494584,74.619834 33.984884,75.772234 L 31.299484,93.859234 H 43.760484 L 40.883284,75.327234 C 42.936484,74.043334 44.316384,71.760434 44.316384,69.160434 44.316384,65.147634 41.049784,61.912834 37.036984,61.912834 z"
+     id="path2860-7"
+     inkscape:export-filename="/home/nemo/hg/hedgewars/0.9.21/QTfrontend/res/path2865-1.png"
+     inkscape:export-xdpi="13.85"
+     inkscape:export-ydpi="13.85" />
+  <path
+     style="fill:#dd2727"
+     inkscape:connector-curvature="0"
+     d="M 4.7043898,42.314248 C 4.7043898,42.314248 3.1630898,0.18524828 36.55839,0.18524828 69.95369,0.18524828 67.89839,42.314248 67.89839,42.314248 H 59.16429 C 59.16429,42.314248 58.9074,10.460249 36.55829,9.6902482 14.20929,8.9195882 15.49329,42.314248 15.49329,42.314248 H 4.7042898 z"
+     id="path3743"
+     inkscape:export-filename="/home/nemo/hg/hedgewars/0.9.21/QTfrontend/res/path2865-1.png"
+     inkscape:export-xdpi="13.85"
+     inkscape:export-ydpi="13.85" />
+  <path
+     style="fill:#60df33"
+     inkscape:connector-curvature="0"
+     d="M 85.015528,42.497266 C 85.015528,42.497266 83.474228,0.36826574 116.86953,0.36826574 150.26483,0.36826574 148.20953,42.497266 148.20953,42.497266 H 139.47543 C 139.47543,42.497266 139.21854,10.643266 116.86943,9.8732657 94.520428,9.1026057 95.804428,42.497266 95.804428,42.497266 H 85.015428 z"
+     id="path2858"
+     inkscape:export-filename="/home/nemo/hg/hedgewars/0.9.21/QTfrontend/res/path2860.png"
+     inkscape:export-xdpi="13.85"
+     inkscape:export-ydpi="13.85" />
+  <path
+     style="fill:#60df33"
+     inkscape:connector-curvature="0"
+     d="M 154.04553,100.41727 154.11623,45.111266 H 80.646228 L 80.203168,99.841266 C 80.273868,120.16927 96.772168,117.10227 117.12417,117.10227 137.47617,117.10227 154.04517,120.76827 154.04517,100.41627 z"
+     id="path2865"
+     inkscape:export-filename="/home/nemo/hg/hedgewars/0.9.21/QTfrontend/res/path2860.png"
+     inkscape:export-xdpi="13.85"
+     inkscape:export-ydpi="13.85" />
+  <path
+     style="fill:#287f09"
+     inkscape:connector-curvature="0"
+     d="M 117.11553,62.227266 C 113.10273,62.227266 109.86793,65.462066 109.86793,69.474866 109.86793,72.399166 111.57363,74.934366 114.06393,76.086766 L 111.37853,94.173766 H 123.83953 L 120.96233,75.641766 C 123.01553,74.357866 124.39543,72.074966 124.39543,69.474966 124.39543,65.462166 121.12883,62.227366 117.11603,62.227366 z"
+     id="path2860"
+     inkscape:export-xdpi="13.85"
+     inkscape:export-ydpi="13.85" />
+  <metadata
+     id="metadata10">
+    <rdf:RDF>
+      <cc:Work>
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <cc:license
+           rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+        <dc:publisher>
+          <cc:Agent
+             rdf:about="http://openclipart.org/">
+            <dc:title>Openclipart</dc:title>
+          </cc:Agent>
+        </dc:publisher>
+        <dc:title>Open and closed lock</dc:title>
+        <dc:date>2013-11-07T10:50:32</dc:date>
+        <dc:description>Set of 2 locks, one opened and one closed.</dc:description>
+        <dc:source>https://openclipart.org/detail/188421/open-and-closed-lock-by-iyo-188421</dc:source>
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>Iyo</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <dc:subject>
+          <rdf:Bag>
+            <rdf:li>closed</rdf:li>
+            <rdf:li>lock</rdf:li>
+            <rdf:li>locks</rdf:li>
+            <rdf:li>open</rdf:li>
+            <rdf:li>pic</rdf:li>
+            <rdf:li>pictogram</rdf:li>
+            <rdf:li>sign</rdf:li>
+          </rdf:Bag>
+        </dc:subject>
+      </cc:Work>
+      <cc:License
+         rdf:about="http://creativecommons.org/licenses/publicdomain/">
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Reproduction" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Distribution" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+</svg>
Binary file QTfrontend/res/mapCustom.png has changed
Binary file QTfrontend/res/mapMaze.png has changed
Binary file QTfrontend/res/mapMissing.png has changed
Binary file QTfrontend/res/mapMission.png has changed
Binary file QTfrontend/res/mapRandom.png has changed
Binary file QTfrontend/res/miscicon.png has changed
Binary file QTfrontend/res/net.png has changed
Binary file QTfrontend/res/new.png has changed
Binary file QTfrontend/res/remfriend.png has changed
Binary file QTfrontend/res/spin_down.png has changed
Binary file QTfrontend/res/spin_up.png has changed
Binary file QTfrontend/res/splash.png has changed
Binary file QTfrontend/res/unchecked.png has changed
Binary file QTfrontend/res/unignore.png has changed
Binary file QTfrontend/res/unlock.png has changed
--- a/QTfrontend/res/xml/tips.xml	Tue Nov 10 18:16:35 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-# This is not xml actually, but it looks and behaves like it.
-# Including an xml library would need too much resources.
-# Tips between the platform specific tags are shown only on those platforms.
-# Do not escape characters or use the CDATA tag.
-<tips>
-    <tip>Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.</tip>
-    <tip>Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.</tip>
-    <tip>If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!</tip>
-    <tip>Want to save ropes? Release the rope in mid air and then shoot again. As long as you don't touch the ground or miss a shot you'll reuse your rope without wasting ammo!</tip>
-    <tip>If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.</tip>
-    <tip>You're bored of default gameplay? Try one of the missions - they'll offer different gameplay depending on the one you picked.</tip>
-    <tip>By default the game will always record the last game played as a demo. Select 'Local Game' and pick the 'Demos' button on the lower right corner to play or manage them.</tip>
-    <tip>Hedgewars is free software (Open Source) we create in our spare time. If you've got problems, ask on our forums or visit our IRC room!</tip>
-    <tip>Hedgewars is free software (Open Source) we create in our spare time. If you like it, help us with a small donation or contribute your own work!</tip>
-    <tip>Hedgewars is free software (Open Source) we create in our spare time. Share it with your family and friends as you like!</tip>
-    <tip>Hedgewars is free software (Open Source) we create in our spare time, just for fun! Meet the devs in <a href="irc://irc.freenode.net/hedgewars">#hedgewars</a>!</tip>
-    <tip>From time to time there will be official tournaments. Upcoming events will be announced at http://www.hedgewars.org/ some days in advance.</tip>
-    <tip>Hedgewars is available in many languages. If the translation in your language seems to be missing or outdated, feel free to contact us!</tip>
-    <tip>Hedgewars can be run on lots of different operating systems including Microsoft Windows, Mac OS X and GNU/Linux.</tip>
-    <tip>Always remember you're able to set up your own games in local and network/online play. You're not restricted to the 'Simple Game' option.</tip>
-    <tip>Connect one or more gamepads before starting the game to be able to assign their controls to your teams.</tip>
-    <tip>Create an account on <a href="http://www.hedgewars.org/">http://www.hedgewars.org/</a> to keep others from using your most favourite nickname while playing on the official server.</tip>
-    <tip>While playing you should give yourself a short break at least once an hour.</tip>
-    <tip>If your graphics card isn't able to provide hardware accelerated OpenGL, try to enable the low quality mode to improve performance.</tip>
-    <tip>If your graphics card isn't able to provide hardware accelerated OpenGL, try to update the associated drivers.</tip>
-    <tip>We're open to suggestions and constructive feedback. If you don't like something or got a great idea, let us know!</tip>
-    <tip>Especially while playing online be polite and always remember there might be some minors playing with or against you as well!</tip>
-    <tip>Special game modes such as 'Vampirism' or 'Karma' allow you to develop completely new tactics. Try them in a custom game!</tip>
-    <tip>You should never install Hedgewars on computers you don't own (school, university, work, etc.). Please ask the responsible person instead!</tip>
-    <tip>Hedgewars can be perfect for short games during breaks. Just ensure you don't add too many hedgehogs or use an huge map. Reducing time and health might help as well.</tip>
-    <tip>No hedgehogs were harmed in making this game.</tip>
-    <tip>There are three different jumps available. Tap [high jump] twice to do a very high/backwards jump.</tip>
-    <tip>Afraid of falling off a cliff? Hold down [precise] to turn [left] or [right] without actually moving.</tip>
-    <tip>Some weapons require special strategies or just lots of training, so don't give up on a particular tool if you miss an enemy once.</tip>
-    <tip>Most weapons won't work once they touch the water. The Homing Bee as well as the Cake are exceptions to this.</tip>
-    <tip>The Old Limbuger only causes a small explosion. However the wind affected smelly cloud can poison lots of hogs at once.</tip>
-    <tip>The Piano Strike is the most damaging air strike. You'll lose the hedgehog performing it, so there's a huge downside as well.</tip>
-    <tip>The Homing Bee can be tricky to use. Its turn radius depends on its velocity, so try to not use full power.</tip>
-    <tip>Sticky Mines are a perfect tool to create small chain reactions knocking enemy hedgehogs into dire situations ... or water.</tip>
-    <tip>The Hammer is most effective when used on bridges or girders. Hit hogs will just break through the ground.</tip>
-    <tip>If you're stuck behind an enemy hedgehog, use the Hammer to free yourself without getting damaged by an explosion.</tip>
-    <tip>The Cake's maximum walking distance depends on the ground it has to pass. Use [attack] to detonate it early.</tip>
-    <tip>The Flame Thrower is a weapon but it can be used for tunnel digging as well.</tip>
-    <tip>Use the Molotov or Flame Thrower to temporary keep hedgehogs from passing terrain such as tunnels or platforms.</tip>
-    <tip>Want to know who's behind the game? Click on the Hedgewars logo in the main menu to see the credits.</tip>
-    <tip>Like Hedgewars? Become a fan on <a href="http://www.facebook.com/Hedgewars">Facebook</a> or follow us on <a href="http://twitter.com/hedgewars">Twitter</a></tip>
-    <tip>Feel free to draw your own graves, hats, flags or even maps and themes! But note that you'll have to share them somewhere to use them online.</tip>
-    <tip>Keep your video card drivers up to date to avoid issues playing the game.</tip>
-    <tip>Heads or tails? Type '/rnd' in lobby and you'll find out. Also '/rnd rock paper scissors' works!</tip>
-    <tip>You're able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.</tip>
-    <windows-only>
-	    <tip>The version of Hedgewars supports <a href="http://www.xfire.com">Xfire</a>. Make sure to add Hedgewars to its game list so your friends can see you playing.</tip>
-        <tip>You can find your Hedgewars configuration files under "My Documents\Hedgewars". Create backups or take the files with you, but don't edit them by hand.</tip>
-    </windows-only>
-    <mac-only>
-        <tip>You can find your Hedgewars configuration files under "Library/Application Support/Hedgewars" in your home directory. Create backups or take the files with you, but don't edit them by hand.</tip>
-    </mac-only>
-    <linux-only>
-        <tip>lintip</tip>
-        <tip>You can find your Hedgewars configuration files under ".hedgewars" in your home directory. Create backups or take the files with you, but don't edit them by hand.</tip>
-    </linux-only>
-</tips>
--- a/QTfrontend/sdlkeys.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/sdlkeys.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 char sdlkeys[1024][2][128] =
--- a/QTfrontend/team.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/team.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QFile>
@@ -291,6 +291,12 @@
     return sl;
 }
 
+
+void HWTeam::setNetTeam(bool isNetTeam)
+{
+    m_isNetTeam = isNetTeam;
+}
+
 bool HWTeam::isNetTeam() const
 {
     return m_isNetTeam;
@@ -444,3 +450,4 @@
 {
     m_wins++;
 }
+
--- a/QTfrontend/team.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/team.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
  * Copyright (c) 2007 Igor Ulyanov <iulyanov@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef TEAM_H
@@ -39,6 +39,8 @@
     QString Name;
     QString Hat;
     int Rounds, Kills, Deaths, Suicides;
+
+    HWHog() : Rounds(0), Kills(0), Deaths(0), Suicides(0){}
 };
 
 // class representing a team
@@ -87,6 +89,7 @@
         void setName(const QString & name);
         void setNumHedgehogs(unsigned char num);
         void setVoicepack(const QString & voicepack);
+        void setNetTeam(bool isNetTeam);
 
         // increments for statistical info
         void incRounds();
--- a/QTfrontend/ui/dialog/ask_quit.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/dialog/ask_quit.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QVBoxLayout>
--- a/QTfrontend/ui/dialog/ask_quit.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/dialog/ask_quit.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef ASK_QUIT_H
--- a/QTfrontend/ui/dialog/bandialog.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/dialog/bandialog.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -22,16 +22,19 @@
     leReason = new QLineEdit(this);
     cbTime = new QComboBox(this);
 
-    cbTime->addItem(HWApplication::tr("%1 minutes", 0, 10).arg("10"), 5 * 60);
-    cbTime->addItem(HWApplication::tr("%1 minutes", 0, 30).arg("30"), 10 * 60);
-    cbTime->addItem(HWApplication::tr("%1 hour", 0, 10).arg("10"), 60 * 60);
-    cbTime->addItem(HWApplication::tr("%1 hours", 0, 3).arg("3"), 3 * 60 * 60);
-    cbTime->addItem(HWApplication::tr("%1 hours", 0, 5).arg("5"), 5 * 60 * 60);
-    cbTime->addItem(HWApplication::tr("%1 hours", 0, 12).arg("12"), 12 * 60 * 60);
-    cbTime->addItem(HWApplication::tr("%1 day", 0, 1).arg("1"), 24 * 60 * 60);
-    cbTime->addItem(HWApplication::tr("%1 days", 0, 3).arg("3"), 72 * 60 * 60);
-    cbTime->addItem(HWApplication::tr("%1 days", 0, 7).arg("7"), 168 * 60 * 60);
-    cbTime->addItem(HWApplication::tr("%1 days", 0, 14).arg("14"), 336 * 60 * 60);
+    const int min = 60;
+    const int hour = 60 * min;
+    const int day = 24 * hour;
+    cbTime->addItem(HWApplication::tr("%1 minutes", 0, 10).arg(10), 10 * min);
+    cbTime->addItem(HWApplication::tr("%1 minutes", 0, 30).arg(30), 30 * min);
+    cbTime->addItem(HWApplication::tr("%1 hour", 0, 1).arg(1), 1 * hour);
+    cbTime->addItem(HWApplication::tr("%1 hours", 0, 3).arg(3), 3 * hour);
+    cbTime->addItem(HWApplication::tr("%1 hours", 0, 5).arg(5), 5 * hour);
+    cbTime->addItem(HWApplication::tr("%1 hours", 0, 12).arg(12), 12 * hour);
+    cbTime->addItem(HWApplication::tr("%1 day", 0, 1).arg(1), 1 * day);
+    cbTime->addItem(HWApplication::tr("%1 days", 0, 3).arg(3), 3 * day);
+    cbTime->addItem(HWApplication::tr("%1 days", 0, 7).arg(7), 7 * day);
+    cbTime->addItem(HWApplication::tr("%1 days", 0, 14).arg(14), 14 * day);
     cbTime->addItem(tr("permanent"), 3650 * 24 * 60 * 60);
     cbTime->setCurrentIndex(0);
 
--- a/QTfrontend/ui/dialog/input_ip.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/dialog/input_ip.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QLineEdit>
--- a/QTfrontend/ui/dialog/input_ip.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/dialog/input_ip.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 
--- a/QTfrontend/ui/dialog/input_password.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/dialog/input_password.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QLineEdit>
@@ -56,7 +56,7 @@
     layout->addWidget(cbSave, 5, 0);
 
     QDialogButtonBox* dbbButtons = new QDialogButtonBox(this);
-    pbNewAccount = dbbButtons->addButton(QString("New Account"), QDialogButtonBox::ActionRole);
+    pbNewAccount = dbbButtons->addButton(tr("New Account"), QDialogButtonBox::ActionRole);
     QPushButton * pbOK = dbbButtons->addButton(QDialogButtonBox::Ok);
     QPushButton * pbCancel = dbbButtons->addButton(QDialogButtonBox::Cancel);
     layout->addWidget(dbbButtons, 6, 0);
--- a/QTfrontend/ui/dialog/input_password.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/dialog/input_password.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef INPUT_PASSWORD_H
--- a/QTfrontend/ui/dialog/upload_video.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/dialog/upload_video.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QLineEdit>
--- a/QTfrontend/ui/dialog/upload_video.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/dialog/upload_video.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef UPLOAD_VIDEO_H
--- a/QTfrontend/ui/mouseoverfilter.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/mouseoverfilter.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -22,6 +22,8 @@
 
 bool MouseOverFilter::eventFilter( QObject *dist, QEvent *event )
 {
+    AbstractPage* abstractpage;
+
     if (event->type() == QEvent::Enter)
     {
         QWidget * widget = dynamic_cast<QWidget*>(dist);
--- a/QTfrontend/ui/mouseoverfilter.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/mouseoverfilter.h	Tue Nov 10 20:43:13 2015 +0100
@@ -20,7 +20,6 @@
 
     private:
         Ui_HWForm *ui;
-        AbstractPage* abstractpage;
 
 };
 
--- a/QTfrontend/ui/page/AbstractPage.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/AbstractPage.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
@@ -67,7 +67,7 @@
     descLabel->setAlignment(Qt::AlignCenter);
     descLabel->setWordWrap(true);
     descLabel->setOpenExternalLinks(true);
-    descLabel->setFixedHeight(50);
+    descLabel->setFixedHeight(60);
     descLabel->setStyleSheet("font-size: 16px");
     bottomLeftLayout->addWidget(descLabel);
     pageLayout->addWidget(descLabel, 1, 1);
--- a/QTfrontend/ui/page/AbstractPage.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/AbstractPage.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/page/pageadmin.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageadmin.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
--- a/QTfrontend/ui/page/pageadmin.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageadmin.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_ADMIN_H
--- a/QTfrontend/ui/page/pagecampaign.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagecampaign.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
@@ -45,7 +45,7 @@
     btnPreview = formattedButton(":/res/campaign/A_Classic_Fairytale/first_blood.png", true);
     infoLayout->setAlignment(btnPreview, Qt::AlignHCenter | Qt::AlignVCenter);
 
-    lbldescription = new QLabel();
+    lbldescription = new QLabel(this);
     lbldescription->setAlignment(Qt::AlignHCenter| Qt::AlignTop);
     lbldescription->setWordWrap(true);
 
--- a/QTfrontend/ui/page/pagecampaign.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagecampaign.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_CAMPAIGN_H
--- a/QTfrontend/ui/page/pageconnecting.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageconnecting.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QVBoxLayout>
--- a/QTfrontend/ui/page/pageconnecting.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageconnecting.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_CONNECTING_H
--- a/QTfrontend/ui/page/pagedata.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagedata.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
@@ -26,6 +26,7 @@
 #include <QDebug>
 #include <QProgressBar>
 #include <QBuffer>
+#include <QDesktopServices>
 
 #include "pagedata.h"
 #include "databrowser.h"
@@ -48,10 +49,23 @@
     return pageLayout;
 }
 
+QLayout * PageDataDownload::footerLayoutDefinition()
+{
+    QHBoxLayout * bottomLayout = new QHBoxLayout();
+    bottomLayout->setStretch(0, 1);
+
+    pbOpenDir = addButton(tr("Open packages directory"), bottomLayout, 1, false);
+
+    bottomLayout->setStretch(2, 1);
+
+    return bottomLayout;
+}
+
 void PageDataDownload::connectSignals()
 {
     connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(request(const QUrl&)));
     connect(this, SIGNAL(goBack()), this, SLOT(onPageLeave()));
+    connect(pbOpenDir, SIGNAL(clicked()), this, SLOT(openPackagesDir()));
 }
 
 PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent)
@@ -193,3 +207,9 @@
         //DataManager::instance().reload();
     }
 }
+
+void PageDataDownload::openPackagesDir()
+{
+    QString path = QDir::toNativeSeparators(cfgdir->absolutePath() + "/Data");
+    QDesktopServices::openUrl(QUrl("file:///" + path));
+}
--- a/QTfrontend/ui/page/pagedata.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagedata.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_DATA_H
@@ -27,6 +27,7 @@
 class QNetworkReply;
 class QVBoxLayout;
 
+
 class PageDataDownload : public AbstractPage
 {
         Q_OBJECT
@@ -39,12 +40,14 @@
 
     protected:
         QLayout * bodyLayoutDefinition();
+        QLayout * footerLayoutDefinition();
         void connectSignals();
 
     private:
         DataBrowser *web;
         QHash<QNetworkReply*, QProgressBar *> progressBars;
         QVBoxLayout *progressBarsLayout;
+        QPushButtonWithSound * pbOpenDir;
 
         bool m_contentDownloaded; ///< true if something was downloaded since last page leave
 
@@ -54,6 +57,7 @@
         void pageDownloaded();
         void fileDownloaded();
         void downloadProgress(qint64, qint64);
+        void openPackagesDir();
 
         void onPageLeave();
 };
--- a/QTfrontend/ui/page/pagedrawmap.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagedrawmap.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
@@ -44,11 +44,13 @@
     rbPolyline->setChecked(true);
 
     pbClear = addButton(tr("Clear"), pageLayout, 5, 0);
-    pbLoad = addButton(tr("Load"), pageLayout, 6, 0);
-    pbSave = addButton(tr("Save"), pageLayout, 7, 0);
+    pbOptimize = addButton(tr("Optimize"), pageLayout, 6, 0);
+    pbOptimize->setVisible(false);
+    pbLoad = addButton(tr("Load"), pageLayout, 7, 0);
+    pbSave = addButton(tr("Save"), pageLayout, 8, 0);
 
     drawMapWidget = new DrawMapWidget(this);
-    pageLayout->addWidget(drawMapWidget, 0, 1, 9, 1);
+    pageLayout->addWidget(drawMapWidget, 0, 1, 10, 1);
 
     return pageLayout;
 }
@@ -58,6 +60,7 @@
     connect(cbEraser, SIGNAL(toggled(bool)), drawMapWidget, SLOT(setErasing(bool)));
     connect(pbUndo, SIGNAL(clicked()), drawMapWidget, SLOT(undo()));
     connect(pbClear, SIGNAL(clicked()), drawMapWidget, SLOT(clear()));
+    connect(pbOptimize, SIGNAL(clicked()), drawMapWidget, SLOT(optimize()));
     connect(pbLoad, SIGNAL(clicked()), this, SLOT(load()));
     connect(pbSave, SIGNAL(clicked()), this, SLOT(save()));
 
--- a/QTfrontend/ui/page/pagedrawmap.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagedrawmap.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_DRAWMAP_H
@@ -42,6 +42,7 @@
         QPushButton * pbClear;
         QPushButton * pbLoad;
         QPushButton * pbSave;
+        QPushButton * pbOptimize;
         QCheckBox * cbEraser;
         QRadioButton * rbPolyline;
         QRadioButton * rbRectangle;
--- a/QTfrontend/ui/page/pageeditteam.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
--- a/QTfrontend/ui/page/pageeditteam.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageeditteam.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_EDITTEAM_H
--- a/QTfrontend/ui/page/pagegamestats.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagegamestats.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QLabel>
@@ -40,13 +40,13 @@
 
 QLayout * PageGameStats::bodyLayoutDefinition()
 {
-	kindOfPoints = QString("");
-	defaultGraphTitle = true;	
+    kindOfPoints = QString("");
+    defaultGraphTitle = true;
     QGridLayout * pageLayout = new QGridLayout();
     pageLayout->setSpacing(20);
     pageLayout->setColumnStretch(0, 1);
     pageLayout->setColumnStretch(1, 1);
-    pageLayout->setRowStretch(0, 1);    
+    pageLayout->setRowStretch(0, 1);
     pageLayout->setRowStretch(1, 20);
     //pageLayout->setRowStretch(1, -1); this should work but there is unnecessary empty space betwin lines if used
     pageLayout->setContentsMargins(7, 7, 7, 0);
@@ -106,11 +106,11 @@
 QLayout * PageGameStats::footerLayoutDefinition()
 {
     QHBoxLayout * bottomLayout = new QHBoxLayout();
-    
+
     mainNote = new QLabel(this);
     mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
     mainNote->setWordWrap(true);
-    
+
     bottomLayout->addWidget(mainNote, 0);
     bottomLayout->setStretch(0,1);
 
@@ -159,41 +159,41 @@
 
 void PageGameStats::renderStats()
 {
-	graphic->show();
-	labelGraphTitle-> show();
-	if(defaultGraphTitle) {
-		labelGraphTitle->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>");
-	} else {
-		defaultGraphTitle = true;
-	}
-	// if not health data sent
-	if(healthPoints.size() == 0) {
-		labelGraphTitle->hide();
-		graphic->hide();
-	} else {
-		QGraphicsScene * scene = new QGraphicsScene();
+    graphic->show();
+    labelGraphTitle-> show();
+    if(defaultGraphTitle) {
+        labelGraphTitle->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>");
+    } else {
+        defaultGraphTitle = true;
+    }
+    // if not health data sent
+    if(healthPoints.size() == 0) {
+        labelGraphTitle->hide();
+        graphic->hide();
+    } else {
+        QGraphicsScene * scene = new QGraphicsScene();
 
-		QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin();
-		while (i != healthPoints.constEnd())
-		{
-			quint32 c = i.key();
-			//QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255));
-			QVector<quint32> hps = i.value();
+        QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin();
+        while (i != healthPoints.constEnd())
+        {
+            quint32 c = i.key();
+            //QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255));
+            QVector<quint32> hps = i.value();
 
-			QPainterPath path;
-			if (hps.size())
-				path.moveTo(0, hps[0]);
+            QPainterPath path;
+            if (hps.size())
+                path.moveTo(0, hps[0]);
 
-			for(int t = 1; t < hps.size(); ++t)
-				path.lineTo(t, hps[t]);
+            for(int t = 1; t < hps.size(); ++t)
+                path.lineTo(t, hps[t]);
 
-			scene->addPath(path, QPen(c));
-			++i;
-		}
+            scene->addPath(path, QPen(c));
+            ++i;
+        }
 
-		graphic->setScene(scene);
-		graphic->fitInView(graphic->sceneRect());
-	}
+        graphic->setScene(scene);
+        graphic->fitInView(graphic->sceneRect());
+    }
 }
 
 void PageGameStats::GameStats(char type, const QString & info)
@@ -208,7 +208,8 @@
         case 'D' :
         {
             int i = info.indexOf(' ');
-            QString message = "<p><img src=\":/res/StatsBestShot.png\"> " + PageGameStats::tr("The best shot award was won by <b>%1</b> with <b>%2</b> pts.").arg(info.mid(i + 1), info.left(i)) + "</p>";
+            int num = info.left(i).toInt();
+            QString message = "<p><img src=\":/res/StatsBestShot.png\"> " + PageGameStats::tr("The best shot award was won by <b>%1</b> with <b>%2</b> pts.", "", num).arg(info.mid(i + 1), info.left(i)) + "</p>";
             AddStatText(message);
             break;
         }
@@ -237,9 +238,9 @@
         }
         case 'g' :
         {
-			// TODO: change default picture or add change pic capability
-			defaultGraphTitle = false;
-			labelGraphTitle->setText("<br><h1><img src=\":/res/StatsR.png\"> " + info + "</h1>");
+            // TODO: change default picture or add change pic capability
+            defaultGraphTitle = false;
+            labelGraphTitle->setText("<br><h1><img src=\":/res/StatsR.png\"> " + info + "</h1>");
             break;
         }
         case 'T':   // local team stats
@@ -257,7 +258,7 @@
             }
             break;
         }
-		case 'p' :
+        case 'p' :
         {
             kindOfPoints = info;
             break;
@@ -300,11 +301,11 @@
             QString message;
             QString killstring;
             if(kindOfPoints.compare("") == 0) {
-				killstring = PageGameStats::tr("(%1 kill)", "", kills).arg(kills);
-			} else {
-				killstring = PageGameStats::tr("(%1 %2)", "", kills).arg(kills).arg(kindOfPoints);
-				kindOfPoints = QString("");
-			}
+                killstring = PageGameStats::tr("(%1 kill)", "", kills).arg(kills);
+            } else {
+                killstring = PageGameStats::tr("(%1 %2)", "", kills).arg(kills).arg(kindOfPoints);
+                kindOfPoints = QString("");
+            }
 
             message = QString("<p><h2>%1 %2. <font color=\"%4\">%3</font> ").arg(image, QString::number(playerPosition), playername, clanColor.name()) + killstring + "</h2></p>";
 
--- a/QTfrontend/ui/page/pagegamestats.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagegamestats.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef STATSPAGE_H
--- a/QTfrontend/ui/page/pageinfo.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageinfo.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
--- a/QTfrontend/ui/page/pageinfo.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageinfo.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_INFO_H
--- a/QTfrontend/ui/page/pageingame.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageingame.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QHBoxLayout>
--- a/QTfrontend/ui/page/pageingame.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageingame.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_INGAME_H
--- a/QTfrontend/ui/page/pagemain.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagemain.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
@@ -21,10 +21,12 @@
 #include <QPushButton>
 #include <QLabel>
 #include <QTime>
+#include <QSettings>
 
 #include "pagemain.h"
 #include "hwconsts.h"
 #include "hwform.h"
+#include "DataManager.h"
 
 QLayout * PageMain::bodyLayoutDefinition()
 {
@@ -119,6 +121,9 @@
 
 void PageMain::connectSignals()
 {
+#ifndef QT_DEBUG
+    connect(this, SIGNAL(pageEnter()), this, SLOT(updateTip()));
+#endif
     connect(BtnNet, SIGNAL(clicked()), this, SLOT(toggleNetworkChoice()));
     //connect(BtnNetLocal, SIGNAL(clicked()), this, SLOT(toggleNetworkChoice()));
     //connect(BtnNetOfficial, SIGNAL(clicked()), this, SLOT(toggleNetworkChoice()));
@@ -132,16 +137,19 @@
     if(frontendEffects)
         setAttribute(Qt::WA_NoSystemBackground, true);
     mainNote->setOpenExternalLinks(true);
-
 #ifdef QT_DEBUG
     setDefaultDescription(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game, while some features might be broken or incomplete!"));
 #else
     setDefaultDescription(QLabel::tr("Tip: %1").arg(randomTip()));
 #endif
-
 }
 
-QString PageMain::randomTip() const
+void PageMain::updateTip()
+{
+    setDefaultDescription(QLabel::tr("Tip: %1").arg(randomTip()));
+}
+
+QString PageMain::randomTip()
 {
 #ifdef _WIN32
     int platform = 1;
@@ -150,35 +158,62 @@
 #else
     int platform = 3;
 #endif
-    QStringList Tips;
-    QFile file(":/res/xml/tips.xml");
-    file.open(QIODevice::ReadOnly);
-    QTextStream in(&file);
-    QString line = in.readLine();
-    int tip_platform = 0;
-    while (!line.isNull()) {
-        if(line.contains("<windows-only>", Qt::CaseSensitive))
-            tip_platform = 1;
-        if(line.contains("<mac-only>", Qt::CaseSensitive))
-            tip_platform = 2;
-        if(line.contains("<linux-only>", Qt::CaseSensitive))
-            tip_platform = 3;
-        if(line.contains("</windows-only>", Qt::CaseSensitive) ||
-                line.contains("</mac-only>", Qt::CaseSensitive) ||
-                line.contains("</linux-only>", Qt::CaseSensitive)) {
-            tip_platform = 0;
+    if(!Tips.length())
+    {
+        DataManager & dataMgr = DataManager::instance();
+
+        // get locale
+        QSettings settings(dataMgr.settingsFileName(),
+                           QSettings::IniFormat);
+
+        QString loc = settings.value("misc/locale", "").toString();
+        if (loc.isEmpty())
+            loc = QLocale::system().name();
+
+        QString tipFile = QString("physfs://Locale/tips_" + loc + ".xml");
+
+        // if file is non-existant try with language only
+        if (!QFile::exists(tipFile))
+            tipFile = QString("physfs://Locale/tips_" + loc.remove(QRegExp("_.*$")) + ".xml");
+
+        // fallback if file for current locale is non-existant
+        if (!QFile::exists(tipFile))
+            tipFile = QString("physfs://Locale/tips_en.xml");
+
+        QFile file(tipFile);
+        file.open(QIODevice::ReadOnly);
+        QTextStream in(&file);
+        in.setCodec("UTF-8");
+        QString line = in.readLine();
+        int tip_platform = 0;
+        while (!line.isNull()) {
+            if(line.contains("<windows-only>", Qt::CaseSensitive))
+                tip_platform = 1;
+            if(line.contains("<mac-only>", Qt::CaseSensitive))
+                tip_platform = 2;
+            if(line.contains("<linux-only>", Qt::CaseSensitive))
+                tip_platform = 3;
+            if(line.contains("</windows-only>", Qt::CaseSensitive) ||
+                    line.contains("</mac-only>", Qt::CaseSensitive) ||
+                    line.contains("</linux-only>", Qt::CaseSensitive)) {
+                tip_platform = 0;
+            }
+            QStringList split_string = line.split(QRegExp("</?tip>"));
+            if((tip_platform == platform || tip_platform == 0) && split_string.size() != 1)
+                Tips << split_string[1];
+            line = in.readLine();
         }
-        QStringList split_string = line.split(QRegExp("</?tip>"));
-        if((tip_platform == platform || tip_platform == 0) && split_string.size() != 1)
-            Tips << tr(split_string[1].toLatin1().data(), "Tips");
-        line = in.readLine();
+        // The following tip will require links to app store entries first.
+        //Tips << tr("Want to play Hedgewars any time? Grab the Mobile version for %1 and %2.", "Tips").arg("").arg("");
+        // the ios version is located here: http://itunes.apple.com/us/app/hedgewars/id391234866
+
+        file.close();
     }
-    // The following tip will require links to app store entries first.
-    //Tips << tr("Want to play Hedgewars any time? Grab the Mobile version for %1 and %2.", "Tips").arg("").arg("");
-    // the ios version is located here: http://itunes.apple.com/us/app/hedgewars/id391234866
 
-    file.close();
-    return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()];
+    if(Tips.length())
+        return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()];
+    else
+        return QString();
 }
 
 void PageMain::toggleNetworkChoice()
--- a/QTfrontend/ui/page/pagemain.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagemain.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_MAIN_H
@@ -48,10 +48,12 @@
         void connectSignals();
         QIcon originalNetworkIcon, disabledNetworkIcon;
 
-        QString randomTip() const;
+        QString randomTip();
+        QStringList Tips;
 
     private slots:
         void toggleNetworkChoice();
+        void updateTip();
 };
 
 #endif
--- a/QTfrontend/ui/page/pagemultiplayer.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagemultiplayer.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/page/pagemultiplayer.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagemultiplayer.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_MULTIPLAYER_H
--- a/QTfrontend/ui/page/pagenet.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagenet.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
--- a/QTfrontend/ui/page/pagenet.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagenet.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_NET_H
--- a/QTfrontend/ui/page/pagenetgame.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagenetgame.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
--- a/QTfrontend/ui/page/pagenetgame.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagenetgame.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_NETGAME_H
--- a/QTfrontend/ui/page/pagenetserver.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagenetserver.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
@@ -124,7 +124,7 @@
 
 // This function assumes that the user wants to share his server while connected to
 // the Internet and that he/she is using direct access (eg no NATs). To determine the
-// IP we briefly connect to Hedgewars website and fallback to user intervention 
+// IP we briefly connect to Hedgewars website and fallback to user intervention
 // after 4 seconds of timeout.
 void PageNetServer::copyUrl()
 {
--- a/QTfrontend/ui/page/pagenetserver.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagenetserver.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_NETSERVER_H
--- a/QTfrontend/ui/page/pageoptions.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageoptions.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
@@ -397,7 +397,7 @@
             tagsLayout->addWidget(CBHogTag, 0);
             tagsLayout->addWidget(CBHealthTag, 0);
             tagsLayout->addWidget(CBTagOpacity, 0);
-            tagsLayout->addStretch(1); 
+            tagsLayout->addStretch(1);
         }
 
         { // group: frontend
--- a/QTfrontend/ui/page/pageoptions.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageoptions.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_OPTIONS_H
--- a/QTfrontend/ui/page/pageplayrecord.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageplayrecord.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "pageplayrecord.h"
--- a/QTfrontend/ui/page/pageplayrecord.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageplayrecord.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PLAYRECORDPAGE_H
--- a/QTfrontend/ui/page/pageroomslist.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageroomslist.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QVBoxLayout>
@@ -53,6 +53,8 @@
 
 QLayout * PageRoomsList::bodyLayoutDefinition()
 {
+    // TODO move stylesheet stuff into css/qt.css
+
     QVBoxLayout * pageLayout = new QVBoxLayout();
     pageLayout->setSpacing(0);
 
@@ -60,10 +62,37 @@
     topLayout->setSpacing(0);
     pageLayout->addLayout(topLayout, 0);
 
+    // State button
+
+    QPushButton * btnState = new QPushButton(tr("Room state"));
+    btnState->setStyleSheet("QPushButton { background-color: #F6CB1C; border-color: #F6CB1C; color: #130F2A; padding: 1px 3px 3px 3px; margin: 0px; border-bottom: none; border-radius: 0px; border-top-left-radius: 10px; } QPushButton:hover { background-color: #FFEB3C; border-color: #F6CB1C; color: #000000 } QPushButton:pressed { background-color: #FFEB3C; border-color: #F6CB1C; color: #000000; }");
+    btnState->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
+
+    // State menu
+
+    QMenu * stateMenu = new QMenu(btnState);
+    showGamesInLobby = new QAction(QAction::tr("Show games in lobby"), stateMenu);
+    showGamesInLobby->setCheckable(true);
+    showGamesInLobby->setChecked(true);
+    showGamesInProgress = new QAction(QAction::tr("Show games in-progress"), stateMenu);
+    showGamesInProgress->setCheckable(true);
+    showGamesInProgress->setChecked(true);
+    showPassword = new QAction(QAction::tr("Show password protected"), stateMenu);
+    showPassword->setCheckable(true);
+    showPassword->setChecked(true);
+    showJoinRestricted = new QAction(QAction::tr("Show join restricted"), stateMenu);
+    showJoinRestricted->setCheckable(true);
+    showJoinRestricted->setChecked(true);
+    stateMenu->addAction(showGamesInLobby);
+    stateMenu->addAction(showGamesInProgress);
+    stateMenu->addAction(showPassword);
+    stateMenu->addAction(showJoinRestricted);
+    btnState->setMenu(stateMenu);
+
     // Help/prompt message at top
     QLabel * lblDesc = new QLabel(tr("Search for a room:"));
     lblDesc->setObjectName("lblDesc");
-    lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-top-left-radius: 10px; padding: 4px 10px;}");
+    lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; padding: 5px 10px 3px 6px;}");
     lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     lblDesc->setFixedHeight(24);
     lblDesc->setMinimumWidth(0);
@@ -97,16 +126,17 @@
     BtnJoin->setEnabled(false);
 
     // Add widgets to top layout
-    topLayout->addWidget(lblDesc, 1, 0);
-    topLayout->addWidget(searchContainer, 1, 1);
-    topLayout->addWidget(corner, 1, 2, Qt::AlignBottom);
-    topLayout->addWidget(BtnCreate, 0, 4, 2, 1);
-    topLayout->addWidget(BtnJoin, 0, 5, 2, 1);
+    topLayout->addWidget(btnState, 1, 0);
+    topLayout->addWidget(lblDesc, 1, 1);
+    topLayout->addWidget(searchContainer, 1, 2);
+    topLayout->addWidget(corner, 1, 3, Qt::AlignBottom);
+    topLayout->addWidget(BtnCreate, 0, 5, 2, 1);
+    topLayout->addWidget(BtnJoin, 0, 6, 2, 1);
 
     // Top layout stretch
     topLayout->setRowStretch(0, 1);
     topLayout->setRowStretch(1, 0);
-    topLayout->setColumnStretch(3, 1);
+    topLayout->setColumnStretch(4, 1);
 
     // Rooms list and chat with splitter
     m_splitter = new QSplitter();
@@ -132,43 +162,6 @@
     roomsList->setFocusPolicy(Qt::NoFocus);
     roomsLayout->addWidget(roomsList, 200);
 
-    // Room filters container
-
-    QWidget * filtersContainer = new QWidget();
-    filtersContainer->setMaximumWidth(800);
-    filtersContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-
-    roomsLayout->addSpacing(7);
-    roomsLayout->addWidget(filtersContainer, 0, Qt::AlignHCenter);
-    roomsLayout->addSpacing(7);
-    
-    QHBoxLayout * filterLayout = new QHBoxLayout(filtersContainer);
-    filterLayout->setSpacing(0);
-    filterLayout->setMargin(0);
-
-    const int filterSpacing = 20;
-
-    // State button
-
-    QPushButton * btnState = new QPushButton(tr("Room state"));
-    btnState->setStyleSheet("QPushButton { padding: 2px 4px; } QPushButton:pressed { background-color: #ffcc00; border-color: #ffcc00; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; color: #11084A; }");
-    btnState->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
-    filterLayout->addWidget(btnState);
-    filterLayout->addSpacing(filterSpacing);
-
-    // State menu
-
-    QMenu * stateMenu = new QMenu(btnState);
-    showGamesInLobby = new QAction(QAction::tr("Show games in lobby"), stateMenu);
-    showGamesInLobby->setCheckable(true);
-    showGamesInLobby->setChecked(true);
-    showGamesInProgress = new QAction(QAction::tr("Show games in-progress"), stateMenu);
-    showGamesInProgress->setCheckable(true);
-    showGamesInProgress->setChecked(true);
-    stateMenu->addAction(showGamesInLobby);
-    stateMenu->addAction(showGamesInProgress);
-    btnState->setMenu(stateMenu);
-
     // Lobby chat
 
     chatWidget = new HWChatWidget(this, false);
@@ -201,6 +194,8 @@
     connect(roomsList, SIGNAL(clicked (const QModelIndex &)), searchText, SLOT(setFocus()));
     connect(showGamesInLobby, SIGNAL(triggered()), this, SLOT(onFilterChanged()));
     connect(showGamesInProgress, SIGNAL(triggered()), this, SLOT(onFilterChanged()));
+    connect(showPassword, SIGNAL(triggered()), this, SLOT(onFilterChanged()));
+    connect(showJoinRestricted, SIGNAL(triggered()), this, SLOT(onFilterChanged()));
     connect(searchText, SIGNAL(textChanged (const QString &)), this, SLOT(onFilterChanged()));
     connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection);
 
@@ -645,13 +640,29 @@
 
     bool stateLobby = showGamesInLobby->isChecked();
     bool stateProgress = showGamesInProgress->isChecked();
+    bool statePassword = showPassword->isChecked();
+    bool stateJoinRestricted = showJoinRestricted->isChecked();
 
-    if (stateLobby && stateProgress)
-        stateFilteredModel->setFilterFixedString(QString()); // "any"
-    else if (stateLobby != stateProgress)
-        stateFilteredModel->setFilterFixedString(QString(stateProgress));
+    QString filter;
+    if (!stateLobby && !stateProgress)
+        filter = "O_o";
+    else if (stateLobby && stateProgress && statePassword && stateJoinRestricted)
+        filter = "";
     else
-        stateFilteredModel->setFilterFixedString(QString("none")); // Basically, none.
+    {
+        QString exclude = "[^";
+        if (!stateProgress) exclude += "g";
+        if (!statePassword) exclude += "p";
+        if (!stateJoinRestricted) exclude += "j";
+        exclude += "]*";
+        if (stateProgress && statePassword && stateJoinRestricted) exclude = ".*";
+        filter = "^" + exclude;
+        if (!stateLobby) filter += "g" + exclude;
+        filter += "$";
+    }
+    //qDebug() << filter;
+
+    stateFilteredModel->setFilterRegExp(filter);
 }
 
 void PageRoomsList::setSettings(QSettings *settings)
--- a/QTfrontend/ui/page/pageroomslist.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageroomslist.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_ROOMLIST_H
@@ -96,6 +96,8 @@
         QSortFilterProxyModel * stateFilteredModel;
         QAction * showGamesInLobby;
         QAction * showGamesInProgress;
+        QAction * showPassword;
+        QAction * showJoinRestricted;
         QSplitter * m_splitter;
 
         AmmoSchemeModel * ammoSchemeModel;
--- a/QTfrontend/ui/page/pagescheme.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagescheme.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
@@ -335,7 +335,7 @@
     l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon
     glBSLayout->addWidget(l,11,1,1,1);
     SB_Mines = new QSpinBox(gbBasicSettings);
-    SB_Mines->setRange(0, 80);
+    SB_Mines->setRange(0, 200);
     SB_Mines->setValue(0);
     SB_Mines->setSingleStep(5);
     glBSLayout->addWidget(SB_Mines,11,2,1,1);
@@ -363,40 +363,69 @@
     l->setPixmap(QPixmap(":/res/iconDamage.png"));
     glBSLayout->addWidget(l,13,1,1,1);
     SB_Explosives = new QSpinBox(gbBasicSettings);
-    SB_Explosives->setRange(0, 40);
+    SB_Explosives->setRange(0, 200);
     SB_Explosives->setValue(0);
-    SB_Explosives->setSingleStep(1);
+    SB_Explosives->setSingleStep(3);
     glBSLayout->addWidget(SB_Explosives,13,2,1,1);
 
     l = new QLabel(gbBasicSettings);
-    l->setText(QLabel::tr("% Get Away Time"));
+    l->setText(QLabel::tr("Air Mines"));
     l->setWordWrap(true);
     glBSLayout->addWidget(l,14,0,1,1);
     l = new QLabel(gbBasicSettings);
     l->setFixedSize(32,32);
+    l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon
+    glBSLayout->addWidget(l,14,1,1,1);
+    SB_AirMines = new QSpinBox(gbBasicSettings);
+    SB_AirMines->setRange(0, 200);
+    SB_AirMines->setValue(0);
+    SB_AirMines->setSingleStep(5);
+    glBSLayout->addWidget(SB_AirMines,14,2,1,1);
+
+    l = new QLabel(gbBasicSettings);
+    l->setText(QLabel::tr("% Get Away Time"));
+    l->setWordWrap(true);
+    glBSLayout->addWidget(l,15,0,1,1);
+    l = new QLabel(gbBasicSettings);
+    l->setFixedSize(32,32);
     l->setPixmap(QPixmap(":/res/iconTime.png"));
-    glBSLayout->addWidget(l,14,1,1,1);
+    glBSLayout->addWidget(l,15,1,1,1);
     SB_GetAwayTime = new QSpinBox(gbBasicSettings);
     SB_GetAwayTime->setRange(0, 999);
     SB_GetAwayTime->setValue(100);
     SB_GetAwayTime->setSingleStep(25);
-    glBSLayout->addWidget(SB_GetAwayTime,14,2,1,1);
+    glBSLayout->addWidget(SB_GetAwayTime,15,2,1,1);
 
     l = new QLabel(gbBasicSettings);
     l->setText(QLabel::tr("World Edge"));
     l->setWordWrap(true);
-    glBSLayout->addWidget(l,15,0,1,1);
+    glBSLayout->addWidget(l,16,0,1,1);
     l = new QLabel(gbBasicSettings);
     l->setFixedSize(32,32);
     l->setPixmap(QPixmap(":/res/iconEarth.png"));
-    glBSLayout->addWidget(l,15,1,1,1);
+    glBSLayout->addWidget(l,16,1,1,1);
+
     CB_WorldEdge = new QComboBox(gbBasicSettings);
     CB_WorldEdge->insertItem(0, tr("None (Default)"));
     CB_WorldEdge->insertItem(1, tr("Wrap (World wraps)"));
     CB_WorldEdge->insertItem(2, tr("Bounce (Edges reflect)"));
     CB_WorldEdge->insertItem(3, tr("Sea (Edges connect to sea)"));
     /* CB_WorldEdge->insertItem(4, tr("Skybox")); */
-    glBSLayout->addWidget(CB_WorldEdge,15,2,1,1);
+    glBSLayout->addWidget(CB_WorldEdge,16,2,1,1);
+
+
+    l = new QLabel(gbBasicSettings);
+    l->setText(QLabel::tr("Script parameter"));
+    l->setWordWrap(true);
+    glBSLayout->addWidget(l,17,0,1,1);
+    l = new QLabel(gbBasicSettings);
+    l->setFixedSize(32,32);
+    l->setPixmap(QPixmap(":/res/iconBox.png"));
+    glBSLayout->addWidget(l,17,1,1,1);
+
+    LE_ScriptParam = new QLineEdit(gbBasicSettings);
+    LE_ScriptParam->setMaxLength(240);
+    glBSLayout->addWidget(LE_ScriptParam,17,2,1,1);
 
 
     l = new QLabel(gbBasicSettings);
@@ -482,13 +511,15 @@
     mapper->addMapping(SB_Mines, 32);
     mapper->addMapping(SB_MineDuds, 33);
     mapper->addMapping(SB_Explosives, 34);
-    mapper->addMapping(SB_HealthCrates, 35);
-    mapper->addMapping(SB_CrateHealth, 36);
-    mapper->addMapping(SB_WaterRise, 37);
-    mapper->addMapping(SB_HealthDecrease, 38);
-    mapper->addMapping(SB_RopeModifier, 39);
-    mapper->addMapping(SB_GetAwayTime, 40);
-    mapper->addMapping(CB_WorldEdge, 41, "currentIndex");
+    mapper->addMapping(SB_AirMines, 35);
+    mapper->addMapping(SB_HealthCrates, 36);
+    mapper->addMapping(SB_CrateHealth, 37);
+    mapper->addMapping(SB_WaterRise, 38);
+    mapper->addMapping(SB_HealthDecrease, 39);
+    mapper->addMapping(SB_RopeModifier, 40);
+    mapper->addMapping(SB_GetAwayTime, 41);
+    mapper->addMapping(CB_WorldEdge, 42, "currentIndex");
+    mapper->addMapping(LE_ScriptParam, 43);
 
     mapper->toFirst();
 }
--- a/QTfrontend/ui/page/pagescheme.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagescheme.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_SCHEME_H
@@ -87,12 +87,14 @@
         QSpinBox * SB_CrateHealth;
         QSpinBox * SB_MinesTime;
         QSpinBox * SB_Mines;
+        QSpinBox * SB_AirMines;
         QSpinBox * SB_MineDuds;
         QSpinBox * SB_Explosives;
         QSpinBox * SB_RopeModifier;
         QSpinBox * SB_GetAwayTime;
         QComboBox * CB_WorldEdge;
         QLineEdit * LE_name;
+        QLineEdit * LE_ScriptParam;
 
         QGroupBox * gbGameModes;
         QGroupBox * gbBasicSettings;
--- a/QTfrontend/ui/page/pageselectweapon.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageselectweapon.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
--- a/QTfrontend/ui/page/pageselectweapon.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pageselectweapon.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_SELECTWEAPON_H
--- a/QTfrontend/ui/page/pagesingleplayer.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagesingleplayer.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
--- a/QTfrontend/ui/page/pagesingleplayer.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagesingleplayer.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_SINGLE_PLAYER_H
--- a/QTfrontend/ui/page/pagetraining.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagetraining.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
--- a/QTfrontend/ui/page/pagetraining.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagetraining.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef PAGE_TRAINING_H
--- a/QTfrontend/ui/page/pagevideos.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagevideos.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
@@ -99,6 +99,7 @@
     pUploading = NULL;
     lastSizeUpdate = 0;
     progress = 0;
+    seen = false;
 }
 
 VideoItem::~VideoItem()
--- a/QTfrontend/ui/page/pagevideos.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/page/pagevideos.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 
--- a/QTfrontend/ui/widget/FreqSpinBox.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/FreqSpinBox.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/widget/FreqSpinBox.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/FreqSpinBox.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/widget/HistoryLineEdit.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/HistoryLineEdit.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/widget/HistoryLineEdit.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/HistoryLineEdit.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/widget/SmartLineEdit.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/SmartLineEdit.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/widget/SmartLineEdit.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/SmartLineEdit.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/widget/SquareLabel.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/SquareLabel.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QPaintEvent>
--- a/QTfrontend/ui/widget/SquareLabel.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/SquareLabel.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _SQUARELABEL_H
--- a/QTfrontend/ui/widget/about.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/about.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QGridLayout>
@@ -35,7 +35,9 @@
 #ifdef VIDEOREC
 extern "C"
 {
-#include "libavutil/avutil.h"
+    #include "libavcodec/version.h"
+    #include "libavformat/version.h"
+    #include "libavutil/avutil.h" // version.h only from 51.36.0
 }
 #endif
 
@@ -166,7 +168,15 @@
     libinfo.append(QString("<a href=\"http://qt-project.org/\">Qt</a> version: %1<br>").arg(QT_VERSION_STR));
 
 #ifdef VIDEOREC
-    libinfo.append(QString("<a href=\"http://libav.org\">Libav</a> version: %1.%2.%3<br>")
+    libinfo.append(QString("<a href=\"http://libav.org\">libavcodec</a> version: %1.%2.%3<br>")
+        .arg(LIBAVCODEC_VERSION_MAJOR)
+        .arg(LIBAVCODEC_VERSION_MINOR)
+        .arg(LIBAVCODEC_VERSION_MICRO));
+    libinfo.append(QString("<a href=\"http://libav.org\">libavformat</a> version: %1.%2.%3<br>")
+        .arg(LIBAVFORMAT_VERSION_MAJOR)
+        .arg(LIBAVFORMAT_VERSION_MINOR)
+        .arg(LIBAVFORMAT_VERSION_MICRO));
+    libinfo.append(QString("<a href=\"http://libav.org\">libavutil</a> version: %1.%2.%3<br>")
         .arg(LIBAVUTIL_VERSION_MAJOR)
         .arg(LIBAVUTIL_VERSION_MINOR)
         .arg(LIBAVUTIL_VERSION_MICRO));
--- a/QTfrontend/ui/widget/about.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/about.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _ABOUT_H
--- a/QTfrontend/ui/widget/bgwidget.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/bgwidget.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2009 Kristian Lehmann <email@thexception.net>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "bgwidget.h"
--- a/QTfrontend/ui/widget/bgwidget.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/bgwidget.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2009 Kristian Lehmann <email@thexception.net>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef BGWIDGET_H
--- a/QTfrontend/ui/widget/chatwidget.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDesktopServices>
@@ -179,9 +179,14 @@
     this->gameSettings = NULL;
     this->notify = notify;
 
+    m_usersModel = NULL;
+
     m_isAdmin = false;
     m_autoKickEnabled = false;
 
+    m_scrollToBottom = false;
+    m_scrollBarPos = 0;
+
     QStringList vpList =
          QStringList() << "Classic" << "Default" << "Mobster" << "Russian";
 
@@ -406,26 +411,27 @@
 void HWChatWidget::printChatString(
     const QString & nick, const QString & str, const QString & cssClassPart, bool highlight)
 {
-    QSortFilterProxyModel * playersSortFilterModel = qobject_cast<QSortFilterProxyModel *>(chatNicks->model());
-    if(!playersSortFilterModel)
-        return;
-
-    PlayersListModel * players = qobject_cast<PlayersListModel *>(playersSortFilterModel->sourceModel());
-
-    if(!players)
+    if(!m_usersModel)
         return;
 
     // don't show chat lines that are from ignored nicks
-    if (players->isFlagSet(nick, PlayersListModel::Ignore))
+    if (m_usersModel->isFlagSet(nick, PlayersListModel::Ignore))
         return;
 
-    bool isFriend = (!nick.isEmpty()) && players->isFlagSet(nick, PlayersListModel::Friend);
+    bool isFriend = (!nick.isEmpty()) && m_usersModel->isFlagSet(nick, PlayersListModel::Friend);
 
     QString cssClass = (isFriend ? "msg_Friend" : "msg_User") + cssClassPart;
 
     addLine(cssClass, str, highlight);
 }
 
+bool HWChatWidget::isInGame() {
+    if (!m_usersModel)
+        return false;
+
+    return m_usersModel->isFlagSet(m_userNick, PlayersListModel::InGame);
+}
+
 void HWChatWidget::addLine(const QString & cssClass, QString line, bool isHighlight)
 {
     if (s_displayNone->contains(cssClass))
@@ -449,7 +455,8 @@
     {
         line = QString("<span class=\"highlight\">%1</span>").arg(line);
         SDLInteraction::instance().playSoundFile(m_hilightSound);
-        HWApplication::alert(this, 800);
+        if (!isInGame())
+            HWApplication::alert(this, 800);
     }
 
     chatStrings.append(line);
@@ -544,7 +551,8 @@
     QString hlRegExp("^(.* )?%1[^-a-z0-9_]*( .*)?$");
     QRegExp whitespace("\\s");
 
-    m_highlights.append(QRegExp(hlRegExp.arg(m_userNick.toLower())));
+    if (!m_userNick.isEmpty())
+        m_highlights.append(QRegExp(hlRegExp.arg(QRegExp::escape(m_userNick.toLower()))));
 
     QFile file(cfgdir->absolutePath() + "/" + m_userNick.toLower() + "_highlight.txt");
 
@@ -589,9 +597,10 @@
 {
     addLine("msg_PlayerInfo", QString(" >>> %1 - <span class=\"ipaddress\">%2</span> <span class=\"version\">%3</span> <span class=\"location\">%4</span>")
         .arg(linkedNick(nick))
-        .arg(ip)
-        .arg(version)
-        .arg(roomInfo));
+        .arg(Qt::escape(ip == "[]"?"":ip))
+        .arg(Qt::escape(version))
+        .arg(Qt::escape(roomInfo))
+    );
 }
 
 void HWChatWidget::onKick()
@@ -717,14 +726,14 @@
 void HWChatWidget::adminAccess(bool b)
 {
     chatNicks->removeAction(acKick);
-    chatNicks->removeAction(acBan);
+    //chatNicks->removeAction(acBan);
 
     m_isAdmin = b;
 
     if(b)
     {
         chatNicks->insertAction(0, acKick);
-        chatNicks->insertAction(0, acBan);
+        //chatNicks->insertAction(0, acBan);
     }
 }
 
@@ -848,6 +857,12 @@
 
     chatNicks->setModel(model);
     chatNicks->setModelColumn(0);
+
+    QSortFilterProxyModel * sfpModel = qobject_cast<QSortFilterProxyModel *>(model);
+    if (sfpModel)
+        m_usersModel = qobject_cast<PlayersListModel*>(sfpModel->sourceModel());
+    else
+        m_usersModel = qobject_cast<PlayersListModel*>(model);
 }
 
 void HWChatWidget::nicksContextMenuRequested(const QPoint &pos)
--- a/QTfrontend/ui/widget/chatwidget.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/chatwidget.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _CHAT_WIDGET_INCLUDED
@@ -32,6 +32,7 @@
 #include "SDLInteraction.h"
 
 #include "SmartLineEdit.h"
+#include "playerslistmodel.h"
 
 class QTextBrowser;
 class QLineEdit;
@@ -87,6 +88,7 @@
         QString linkedNick(const QString & nickname);
         void beforeContentAdd();
         void afterContentAdd();
+        bool isInGame();
 
         /**
          * @brief Checks whether the message contains a highlight.
@@ -132,6 +134,7 @@
         void consoleCommand(const QString & command);
 
     private:
+        PlayersListModel* m_usersModel;
         bool m_isAdmin;
         QHBoxLayout mainLayout;
         QTextBrowser* chatText;
--- a/QTfrontend/ui/widget/databrowser.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/databrowser.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/widget/databrowser.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/databrowser.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/ui/widget/drawmapwidget.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/drawmapwidget.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QFile>
@@ -118,6 +118,11 @@
     if(m_scene) m_scene->clearMap();
 }
 
+void DrawMapWidget::optimize()
+{
+    if(m_scene) m_scene->optimize();
+}
+
 void DrawMapWidget::setErasing(bool erasing)
 {
     if(m_scene) m_scene->setErasing(erasing);
--- a/QTfrontend/ui/widget/drawmapwidget.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/drawmapwidget.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef DRAWMAPWIDGET_H
@@ -97,6 +97,7 @@
     public slots:
         void undo();
         void clear();
+        void optimize();
         void setErasing(bool erasing);
         void save(const QString & fileName);
         void load(const QString & fileName);
--- a/QTfrontend/ui/widget/feedbackdialog.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/feedbackdialog.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QHBoxLayout>
@@ -268,7 +268,7 @@
     number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
     quint32 pages = sysconf(_SC_PHYS_PAGES);
     quint32 page_size = sysconf(_SC_PAGE_SIZE);
-    quint32 total = pages * page_size / 1024 / 1024;
+    quint64 total = (quint64)pages * page_size / 1024 / 1024;
     total_ram += QString::number(total) + " MB\n";
     os_version += "GNU/Linux or BSD\n";
 #endif
--- a/QTfrontend/ui/widget/feedbackdialog.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/feedbackdialog.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef FEEDBACKDIALOG_H
--- a/QTfrontend/ui/widget/fpsedit.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/fpsedit.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "fpsedit.h"
--- a/QTfrontend/ui/widget/fpsedit.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/fpsedit.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _FPSEDIT_H
--- a/QTfrontend/ui/widget/frameTeam.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/frameTeam.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QResizeEvent>
@@ -28,7 +28,7 @@
 #include "DataManager.h"
 
 FrameTeams::FrameTeams(QWidget* parent) :
-    QFrame(parent), maxHedgehogsPerGame(48), overallHedgehogs(0), mainLayout(this), nonInteractive(false)
+    QFrame(parent), mainLayout(this), nonInteractive(false)
 {
     QPalette newPalette = palette();
     newPalette.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));
@@ -122,7 +122,7 @@
 
 bool FrameTeams::isFullTeams() const
 {
-    return overallHedgehogs==maxHedgehogsPerGame;
+    return teamToWidget.size() >= 8;
 }
 
 void FrameTeams::emitTeamColorChanged(const HWTeam& team)
--- a/QTfrontend/ui/widget/frameTeam.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/frameTeam.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _FRAME_TEAM_INCLUDED
@@ -53,8 +53,6 @@
         void removeTeam(HWTeam team);
 
     private:
-        const int maxHedgehogsPerGame;
-        int overallHedgehogs;
         int currentColor;
 
         void emitTeamColorChanged(const HWTeam& team);
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QResizeEvent>
@@ -163,6 +163,7 @@
     connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &)));
     connect(pMapContainer, SIGNAL(mapgenChanged(MapGenerator)), this, SLOT(mapgenChanged(MapGenerator)));
     connect(pMapContainer, SIGNAL(mazeSizeChanged(int)), this, SLOT(maze_sizeChanged(int)));
+    connect(pMapContainer, SIGNAL(mapFeatureSizeChanged(int)), this, SLOT(slMapFeatureSizeChanged(int)));
     connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &)));
     connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int)));
     connect(pMapContainer, SIGNAL(drawMapRequested()), this, SIGNAL(goToDrawMap()));
@@ -315,21 +316,25 @@
     bcfg << QString("e$minesnum %1").arg(schemeData(32).toInt()).toUtf8();
     bcfg << QString("e$minedudpct %1").arg(schemeData(33).toInt()).toUtf8();
     bcfg << QString("e$explosives %1").arg(schemeData(34).toInt()).toUtf8();
-    bcfg << QString("e$healthprob %1").arg(schemeData(35).toInt()).toUtf8();
-    bcfg << QString("e$hcaseamount %1").arg(schemeData(36).toInt()).toUtf8();
-    bcfg << QString("e$waterrise %1").arg(schemeData(37).toInt()).toUtf8();
-    bcfg << QString("e$healthdec %1").arg(schemeData(38).toInt()).toUtf8();
-    bcfg << QString("e$ropepct %1").arg(schemeData(39).toInt()).toUtf8();
-    bcfg << QString("e$getawaytime %1").arg(schemeData(40).toInt()).toUtf8();
-    bcfg << QString("e$worldedge %1").arg(schemeData(41).toInt()).toUtf8();
+    bcfg << QString("e$airmines %1").arg(schemeData(35).toInt()).toUtf8();
+    bcfg << QString("e$healthprob %1").arg(schemeData(36).toInt()).toUtf8();
+    bcfg << QString("e$hcaseamount %1").arg(schemeData(37).toInt()).toUtf8();
+    bcfg << QString("e$waterrise %1").arg(schemeData(38).toInt()).toUtf8();
+    bcfg << QString("e$healthdec %1").arg(schemeData(39).toInt()).toUtf8();
+    bcfg << QString("e$ropepct %1").arg(schemeData(40).toInt()).toUtf8();
+    bcfg << QString("e$getawaytime %1").arg(schemeData(41).toInt()).toUtf8();
+    bcfg << QString("e$worldedge %1").arg(schemeData(42).toInt()).toUtf8();
     bcfg << QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()).toUtf8();
+    bcfg << QString("e$feature_size %1").arg(pMapContainer->getFeatureSize()).toUtf8();
     bcfg << QString("e$mapgen %1").arg(mapgen).toUtf8();
-
+    if(!schemeData(43).isNull())
+        bcfg << QString("e$scriptparam %1").arg(schemeData(43).toString()).toUtf8();
 
 
     switch (mapgen)
     {
         case MAPGEN_MAZE:
+        case MAPGEN_PERLIN:
             bcfg << QString("e$maze_size %1").arg(pMapContainer->getMazeSize()).toUtf8();
             break;
 
@@ -400,6 +405,10 @@
 
     mapgenChanged(pMapContainer->get_mapgen());
     maze_sizeChanged(pMapContainer->getMazeSize());
+    slMapFeatureSizeChanged(pMapContainer->getFeatureSize());
+
+    if(pMapContainer->get_mapgen() == 2)
+        onDrawnMapChanged(pMapContainer->getDrawnMapData());
 
     // map must be the last
     QString map = pMapContainer->getCurrentMap();
@@ -437,6 +446,11 @@
             pMapContainer->setMapgen((MapGenerator)value.toUInt());
             return;
         }
+        if (param == "FEATURE_SIZE")
+        {
+            pMapContainer->setFeatureSize(value.toUInt());
+            return;
+        }
         if (param == "MAZE_SIZE")
         {
             pMapContainer->setMazeSize(value.toUInt());
@@ -445,6 +459,7 @@
         if (param == "SCRIPT")
         {
             Scripts->setCurrentIndex(Scripts->findText(value));
+            pMapContainer->setScript(Scripts->itemData(Scripts->currentIndex(), GameStyleModel::ScriptRole).toString().toUtf8(), schemeData(43).toString());
             return;
         }
         if (param == "DRAWNMAP")
@@ -463,18 +478,19 @@
         }
     }
 
-    if (slValue.size() == 5)
+    if (slValue.size() == 6)
     {
         if (param == "FULLMAPCONFIG")
         {
-            QString seed = slValue[3];
+            QString seed = slValue[4];
 
             pMapContainer->setAllMapParameters(
-                slValue[0],
-                (MapGenerator)slValue[1].toUInt(),
-                slValue[2].toUInt(),
+                slValue[1],
+                (MapGenerator)slValue[2].toUInt(),
+                slValue[3].toUInt(),
                 seed,
-                slValue[4].toUInt()
+                slValue[5].toUInt(),
+                slValue[0].toUInt()
             );
             return;
         }
@@ -512,8 +528,8 @@
             int num = GameSchemes->findText(pMapContainer->getCurrentScheme());
             if (num != -1)
                 GameSchemes->setCurrentIndex(num);
-            else
-                GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
+            //else
+            //    GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
         }
 
         if (pMapContainer->getCurrentWeapons() == "locked")
@@ -527,8 +543,8 @@
             int num = WeaponsName->findText(pMapContainer->getCurrentWeapons());
             if (num != -1)
                 WeaponsName->setCurrentIndex(num);
-            else
-                WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
+            //else
+            //    WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
         }
 
         if (pMapContainer->getCurrentScheme() != "locked" && pMapContainer->getCurrentWeapons() != "locked")
@@ -569,7 +585,11 @@
     for(int i = 0; i < size; ++i)
         sl << schemeData(i).toString();
 
-    if (sl.size()!=1) emit paramChanged("SCHEME", sl);  // this is a stupid hack for the fact that SCHEME is being sent once, empty. Still need to find out why.
+    if (sl.size() >= 42)
+    {
+        sl[sl.size()-1].prepend('!');
+        emit paramChanged("SCHEME", sl);  // this is a stupid hack for the fact that SCHEME is being sent once, empty. Still need to find out why.
+    }
 
     if (isEnabled() && bindEntries->isEnabled() && bindEntries->isChecked())
     {
@@ -586,6 +606,7 @@
             }
         }
     }
+    pMapContainer->setScript(Scripts->itemData(Scripts->currentIndex(), GameStyleModel::ScriptRole).toString().toUtf8(), schemeData(43).toString());
 }
 
 void GameCFGWidget::scriptChanged(int index)
@@ -609,8 +630,8 @@
             int num = GameSchemes->findText(scheme);
             if (num != -1)
                 GameSchemes->setCurrentIndex(num);
-            else
-                GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
+            //else
+            //    GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
         }
 
         if (weapons == "locked")
@@ -624,8 +645,8 @@
             int num = WeaponsName->findText(weapons);
             if (num != -1)
                 WeaponsName->setCurrentIndex(num);
-            else
-                WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
+            //else
+            //    WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
         }
 
         if (scheme != "locked" && weapons != "locked")
@@ -639,6 +660,14 @@
         WeaponsName->setEnabled(true);
         bindEntries->setEnabled(true);
     }
+    if (!index)
+    {
+        pMapContainer->setScript(QString(""), QString(""));
+    }
+    else
+    {
+        pMapContainer->setScript(Scripts->itemData(index, GameStyleModel::ScriptRole).toString().toUtf8(), schemeData(43).toString());
+    }
     emit paramChanged("SCRIPT", QStringList(name));
 }
 
@@ -652,6 +681,11 @@
     emit paramChanged("MAZE_SIZE", QStringList(QString::number(s)));
 }
 
+void GameCFGWidget::slMapFeatureSizeChanged(int s)
+{
+    emit paramChanged("FEATURE_SIZE", QStringList(QString::number(s)));
+}
+
 void GameCFGWidget::resendSchemeData()
 {
     schemeChanged(GameSchemes->currentIndex());
--- a/QTfrontend/ui/widget/gamecfgwidget.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/gamecfgwidget.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef GAMECONFIGWIDGET_H
@@ -48,7 +48,6 @@
         QComboBox * GameSchemes;
         QComboBox * WeaponsName;
         HWMapContainer* pMapContainer;
-        QTableView * tv;
         QVariant schemeData(int column) const;
         bool isMaster();
 
@@ -77,6 +76,7 @@
         void jumpToWeapons();
         void mapgenChanged(MapGenerator m);
         void maze_sizeChanged(int s);
+        void slMapFeatureSizeChanged(int s);
         void onDrawnMapChanged(const QByteArray & data);
         void updateModelViews();
 
--- a/QTfrontend/ui/widget/hatbutton.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/hatbutton.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDebug>
--- a/QTfrontend/ui/widget/hatbutton.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/hatbutton.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef HATBUTTON_H
--- a/QTfrontend/ui/widget/hatprompt.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/hatprompt.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDialog>
--- a/QTfrontend/ui/widget/hatprompt.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/hatprompt.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef HATPROMPT_H
--- a/QTfrontend/ui/widget/hedgehogerWidget.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/hedgehogerWidget.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2008 Ulyanov Igor <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "hedgehogerWidget.h"
--- a/QTfrontend/ui/widget/hedgehogerWidget.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/hedgehogerWidget.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Ulyanov Igor <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _HEDGEHOGER_WIDGET
@@ -46,7 +46,6 @@
 
     private:
         CHedgehogerWidget();
-        FrameTeams* pOurFrameTeams;
 };
 
 #endif // _HEDGEHOGER_WIDGET
--- a/QTfrontend/ui/widget/igbox.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/igbox.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QPainter>
--- a/QTfrontend/ui/widget/igbox.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/igbox.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _IGBOX_H
--- a/QTfrontend/ui/widget/itemNum.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/itemNum.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "itemNum.h"
--- a/QTfrontend/ui/widget/itemNum.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/itemNum.h	Tue Nov 10 20:43:13 2015 +0100
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QFrame>
--- a/QTfrontend/ui/widget/keybinder.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/keybinder.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "keybinder.h"
--- a/QTfrontend/ui/widget/keybinder.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/keybinder.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _KEY_BINDER_H
--- a/QTfrontend/ui/widget/lineeditcursor.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/lineeditcursor.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QKeyEvent>
--- a/QTfrontend/ui/widget/lineeditcursor.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/lineeditcursor.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef LINEEDITCURSOR_H
--- a/QTfrontend/ui/widget/mapContainer.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -13,30 +13,31 @@
  *
  * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <QPushButton>
+#include <QBitmap>
 #include <QBuffer>
-#include <QUuid>
-#include <QBitmap>
-#include <QPainter>
-#include <QLinearGradient>
 #include <QColor>
-#include <QTextStream>
-#include <QLabel>
-#include <QListView>
-#include <QVBoxLayout>
-#include <QIcon>
-#include <QLineEdit>
-#include <QStringListModel>
-#include <QListWidget>
-#include <QListWidgetItem>
 #include <QDebug>
 #include <QFile>
 #include <QFileDialog>
+#include <QIcon>
 #include <QInputDialog>
+#include <QLabel>
+#include <QLinearGradient>
+#include <QLineEdit>
+#include <QListView>
+#include <QListWidget>
+#include <QListWidgetItem>
 #include <QMessageBox>
+#include <QPainter>
+#include <QPushButton>
+#include <QSlider>
+#include <QStringListModel>
+#include <QTextStream>
+#include <QUuid>
+#include <QVBoxLayout>
 
 #include "hwconsts.h"
 #include "mapContainer.h"
@@ -59,6 +60,9 @@
     m_previewEnabled = false;
     m_missionsViewSetup = false;
     m_staticViewSetup = false;
+    m_script = QString();
+    m_prevMapFeatureSize = 12;
+    m_mapFeatureSize = 12;
 
     hhSmall.load(":/res/hh_small.png");
     hhLimit = 18;
@@ -104,6 +108,7 @@
     cType->insertItem(2, tr("Hand-drawn"), MapModel::HandDrawnMap);
     cType->insertItem(3, tr("Randomly generated"), MapModel::GeneratedMap);
     cType->insertItem(4, tr("Random maze"), MapModel::GeneratedMaze);
+    cType->insertItem(5, tr("Random perlin"), MapModel::GeneratedPerlin);
     connect(cType, SIGNAL(currentIndexChanged(int)), this, SLOT(mapTypeChanged(int)));
     m_childWidgets << cType;
 
@@ -145,7 +150,7 @@
     mapPreview = new QPushButton(this);
     mapPreview->setObjectName("mapPreview");
     mapPreview->setFlat(true);
-    mapPreview->setFixedSize(256, 128);
+    mapPreview->setFixedSize(256 + 6, 128 + 6);
     mapPreview->setContentsMargins(0, 0, 0, 0);
     leftLayout->addWidget(mapPreview, 0);
     connect(mapPreview, SIGNAL(clicked()), this, SLOT(previewClicked()));
@@ -157,12 +162,12 @@
 
     /* Map list label */
 
-    lblMapList = new QLabel();
+    lblMapList = new QLabel(this);
     rightLayout->addWidget(lblMapList, 0);
 
     /* Static maps list */
 
-    staticMapList = new QListView;
+    staticMapList = new QListView(this);
     rightLayout->addWidget(staticMapList, 1);
     m_childWidgets << staticMapList;
 
@@ -194,7 +199,7 @@
 
     /* Generator style list */
 
-    generationStyles = new QListWidget();
+    generationStyles = new QListWidget(this);
     new QListWidgetItem(tr("All"), generationStyles);
     new QListWidgetItem(tr("Small"), generationStyles);
     new QListWidgetItem(tr("Medium"), generationStyles);
@@ -207,7 +212,7 @@
 
     /* Maze style list */
 
-    mazeStyles = new QListWidget();
+    mazeStyles = new QListWidget(this);
     new QListWidgetItem(tr("Small tunnels"), mazeStyles);
     new QListWidgetItem(tr("Medium tunnels"), mazeStyles);
     new QListWidgetItem(tr("Large tunnels"), mazeStyles);
@@ -218,6 +223,18 @@
     m_childWidgets << mazeStyles;
     rightLayout->addWidget(mazeStyles, 1);
 
+    mapFeatureSize = new QSlider(Qt::Horizontal, this);
+    mapFeatureSize->setObjectName("mapFeatureSize");
+    //mapFeatureSize->setTickPosition(QSlider::TicksBelow);
+    mapFeatureSize->setMaximum(25);
+    mapFeatureSize->setMinimum(1);
+    //mapFeatureSize->setFixedWidth(259);
+    mapFeatureSize->setValue(m_mapFeatureSize);
+    mapFeatureSize->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    bottomLeftLayout->addWidget(mapFeatureSize, 0);
+    connect(mapFeatureSize, SIGNAL(valueChanged(int)), this, SLOT(setFeatureSize(int)));
+    m_childWidgets << mapFeatureSize;
+
     /* Mission description */
 
     lblDesc = new QLabel();
@@ -233,8 +250,10 @@
 
     /* Theme chooser */
 
-    btnTheme = new QPushButton();
+    btnTheme = new QPushButton(this);
     btnTheme->setFlat(true);
+    btnTheme->setIconSize(QSize(30, 30));
+    btnTheme->setFixedHeight(30);
     connect(btnTheme, SIGNAL(clicked()), this, SLOT(showThemePrompt()));
     m_childWidgets << btnTheme;
     bottomLeftLayout->addWidget(btnTheme, 0);
@@ -254,20 +273,9 @@
     changeMapType(MapModel::GeneratedMap);
 }
 
-void HWMapContainer::setImage(const QImage newImage)
+void HWMapContainer::setImage(const QPixmap &newImage)
 {
-    QPixmap px(m_previewSize);
-    QPixmap pxres(px.size());
-    QPainter p(&pxres);
-
-    px.fill(Qt::yellow);
-    QBitmap bm = QBitmap::fromImage(newImage);
-    px.setMask(bm);
-
-    p.fillRect(pxres.rect(), linearGrad);
-    p.drawPixmap(0, 0, px);
-
-    addInfoToPreview(pxres);
+    addInfoToPreview(newImage);
     pMap = 0;
 
     cType->setEnabled(isMaster());
@@ -279,43 +287,47 @@
 }
 
 // Should this add text to identify map size?
-void HWMapContainer::addInfoToPreview(QPixmap image)
+void HWMapContainer::addInfoToPreview(const QPixmap &image)
 {
     QPixmap finalImage = QPixmap(image.size());
-    finalImage.fill(QColor(0, 0, 0, 0));
+//finalImage.fill(QColor(0, 0, 0, 0));
 
     QPainter p(&finalImage);
-    p.drawPixmap(image.rect(), image);
+    p.fillRect(finalImage.rect(), linearGrad);
+    p.drawPixmap(finalImage.rect(), image);
     //p.setPen(QColor(0xf4,0x9e,0xe9));
     p.setPen(QColor(0xff,0xcc,0x00));
     p.setBrush(QColor(0, 0, 0));
-    p.drawRect(image.rect().width() - hhSmall.rect().width() - 28, 3, 40, 20);
+    p.drawRect(finalImage.rect().width() - hhSmall.rect().width() - 28, 3, 40, 20);
     p.setFont(QFont("MS Shell Dlg", 10));
     QString text = (hhLimit > 0) ? QString::number(hhLimit) : "?";
-    p.drawText(image.rect().width() - hhSmall.rect().width() - 14 - (hhLimit > 9 ? 10 : 0), 18, text);
-    p.drawPixmap(image.rect().width() - hhSmall.rect().width() - 5, 5, hhSmall.rect().width(), hhSmall.rect().height(), hhSmall);
+    p.drawText(finalImage.rect().width() - hhSmall.rect().width() - 14 - (hhLimit > 9 ? 10 : 0), 18, text);
+    p.drawPixmap(finalImage.rect().width() - hhSmall.rect().width() - 5, 5, hhSmall.rect().width(), hhSmall.rect().height(), hhSmall);
 
     // Shrink, crop, and center preview image
-    QPixmap centered(QSize(m_previewSize.width() - 6, m_previewSize.height() - 6));
+    /*QPixmap centered(QSize(m_previewSize.width() - 6, m_previewSize.height() - 6));
     QPainter pc(&centered);
     pc.fillRect(centered.rect(), linearGrad);
-    pc.drawPixmap(-3, -3, finalImage);
+    pc.drawPixmap(-3, -3, finalImage);*/
 
-    mapPreview->setIcon(QIcon(centered));
-    mapPreview->setIconSize(centered.size());
+    mapPreview->setIcon(QIcon(finalImage));
+    mapPreview->setIconSize(finalImage.size());
 }
 
 void HWMapContainer::askForGeneratedPreview()
 {
     pMap = new HWMap(this);
-    connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
+    connect(pMap, SIGNAL(ImageReceived(QPixmap)), this, SLOT(setImage(QPixmap)));
     connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int)));
     connect(pMap, SIGNAL(destroyed(QObject *)), this, SLOT(onPreviewMapDestroyed(QObject *)));
     pMap->getImage(m_seed,
                    getTemplateFilter(),
                    get_mapgen(),
                    getMazeSize(),
-                   getDrawnMapData()
+                   getDrawnMapData(),
+                   m_script,
+                   m_scriptparam,
+		           m_mapFeatureSize
                   );
 
     setHHLimit(0);
@@ -396,6 +408,11 @@
     return generationStyles->currentRow();
 }
 
+quint32 HWMapContainer::getFeatureSize() const
+{
+    return m_mapFeatureSize;
+}
+
 void HWMapContainer::resizeEvent ( QResizeEvent * event )
 {
     Q_UNUSED(event);
@@ -409,7 +426,20 @@
 void HWMapContainer::setSeed(const QString & seed)
 {
     intSetSeed(seed);
-    if ((m_mapInfo.type == MapModel::GeneratedMap) || (m_mapInfo.type == MapModel::GeneratedMaze))
+    if ((m_mapInfo.type == MapModel::GeneratedMap)
+            || (m_mapInfo.type == MapModel::GeneratedMaze)
+            || (m_mapInfo.type == MapModel::GeneratedPerlin))
+        updatePreview();
+}
+
+void HWMapContainer::setScript(const QString & script, const QString & scriptparam)
+{
+    m_script = script;
+    m_scriptparam = scriptparam;
+    if ((m_mapInfo.type == MapModel::GeneratedMap)
+            || (m_mapInfo.type == MapModel::GeneratedMaze)
+            || (m_mapInfo.type == MapModel::GeneratedPerlin)
+            || (m_mapInfo.type == MapModel::HandDrawnMap))
         updatePreview();
 }
 
@@ -417,15 +447,19 @@
 {
     if (map == "+rnd+")
     {
-        changeMapType(MapModel::GeneratedMap);
+        //changeMapType(MapModel::GeneratedMap);
     }
     else if (map == "+maze+")
     {
-        changeMapType(MapModel::GeneratedMaze);
+        //changeMapType(MapModel::GeneratedMaze);
+    }
+    else if (map == "+perlin+")
+    {
+        //changeMapType(MapModel::GeneratedPerlin);
     }
     else if (map == "+drawn+")
     {
-        changeMapType(MapModel::HandDrawnMap);
+        //changeMapType(MapModel::HandDrawnMap);
     }
     else if (m_staticMapModel->mapExists(map))
     {
@@ -465,6 +499,7 @@
     {
         case MapModel::GeneratedMap:
         case MapModel::GeneratedMaze:
+        case MapModel::GeneratedPerlin:
             setRandomTheme();
             break;
         case MapModel::MissionMap:
@@ -534,22 +569,31 @@
     {
         mapgen = m;
 
+        bool f = false;
         switch (m)
         {
             case MAPGEN_REGULAR:
                 m_mapInfo.type = MapModel::GeneratedMap;
+                f = true;
                 break;
             case MAPGEN_MAZE:
                 m_mapInfo.type = MapModel::GeneratedMaze;
+                f = true;
+                break;
+            case MAPGEN_PERLIN:
+                m_mapInfo.type = MapModel::GeneratedPerlin;
+                f = true;
                 break;
             case MAPGEN_DRAWN:
                 m_mapInfo.type = MapModel::HandDrawnMap;
+                f = true;
                 break;
             case MAPGEN_MAP:
                 switch (m_mapInfo.type)
                 {
                     case MapModel::GeneratedMap:
                     case MapModel::GeneratedMaze:
+                    case MapModel::GeneratedPerlin:
                     case MapModel::HandDrawnMap:
                         m_mapInfo.type = MapModel::Invalid;
                     default:
@@ -558,7 +602,8 @@
                 break;
         }
 
-        emit mapgenChanged(m);
+        if(f)
+            changeMapType(m_mapInfo.type, QModelIndex());
     }
 }
 
@@ -616,7 +661,7 @@
 
     if (pMap)
     {
-        disconnect(pMap, 0, this, SLOT(setImage(const QImage)));
+        disconnect(pMap, 0, this, SLOT(setImage(const QPixmap)));
         disconnect(pMap, 0, this, SLOT(setHHLimit(int)));
         pMap = 0;
     }
@@ -631,11 +676,8 @@
             mapPreview->setIconSize(failIcon.size());
             break;
         case MapModel::GeneratedMap:
-            askForGeneratedPreview();
-            break;
         case MapModel::GeneratedMaze:
-            askForGeneratedPreview();
-            break;
+        case MapModel::GeneratedPerlin:
         case MapModel::HandDrawnMap:
             askForGeneratedPreview();
             break;
@@ -654,7 +696,7 @@
     }
 }
 
-void HWMapContainer::setAllMapParameters(const QString &map, MapGenerator m, int mazesize, const QString &seed, int tmpl)
+void HWMapContainer::setAllMapParameters(const QString &map, MapGenerator m, int mazesize, const QString &seed, int tmpl, int featureSize)
 {
     intSetMapgen(m);
     intSetMazeSize(mazesize);
@@ -662,6 +704,8 @@
     intSetTemplateFilter(tmpl);
     // this one last because it will refresh the preview
     intSetMap(map);
+    intSetMazeSize(mazesize);
+    intSetFeatureSize(featureSize);
 }
 
 void HWMapContainer::updateModelViews()
@@ -706,6 +750,7 @@
     lblDesc->hide();
     btnLoadMap->hide();
     btnEditMap->hide();
+    mapFeatureSize->show();
 
     switch (type)
     {
@@ -723,10 +768,18 @@
             lblMapList->show();
             mazeStyles->show();
             break;
+        case MapModel::GeneratedPerlin:
+            mapgen = MAPGEN_PERLIN;
+            setMapInfo(MapModel::MapInfoPerlin);
+            lblMapList->setText(tr("Style:"));
+            lblMapList->show();
+            mazeStyles->show();
+            break;
         case MapModel::HandDrawnMap:
             mapgen = MAPGEN_DRAWN;
             setMapInfo(MapModel::MapInfoDrawn);
             btnLoadMap->show();
+            mapFeatureSize->hide();
             btnEditMap->show();
             break;
         case MapModel::MissionMap:
@@ -736,6 +789,7 @@
             lblMapList->setText(tr("Mission:"));
             lblMapList->show();
             missionMapList->show();
+            mapFeatureSize->hide();
             lblDesc->setText(m_mapInfo.desc);
             lblDesc->show();
             emit mapChanged(m_curMap);
@@ -746,6 +800,7 @@
             staticMapChanged(newMap.isValid() ? newMap : staticMapList->currentIndex());
             lblMapList->setText(tr("Map:"));
             lblMapList->show();
+            mapFeatureSize->hide();
             staticMapList->show();
             emit mapChanged(m_curMap);
             break;
@@ -771,9 +826,27 @@
     emit mapgenChanged(mapgen);
 }
 
+void HWMapContainer::intSetFeatureSize(int val)
+{
+    mapFeatureSize->setValue(val);    
+    emit mapFeatureSizeChanged(val);
+}
+void HWMapContainer::setFeatureSize(int val)
+{
+    m_mapFeatureSize = val;
+    intSetFeatureSize(val);
+    //m_mapFeatureSize = val>>2<<2;
+    //if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 4)
+    {
+        m_prevMapFeatureSize = m_mapFeatureSize;
+        updatePreview();
+    }
+}
+
+// unused because I needed the space for the slider
 void HWMapContainer::updateThemeButtonSize()
 {
-    if (m_mapInfo.type == MapModel::MissionMap)
+    if (m_mapInfo.type != MapModel::StaticMap && m_mapInfo.type != MapModel::HandDrawnMap)
     {
         btnTheme->setIconSize(QSize(30, 30));
         btnTheme->setFixedHeight(30);
@@ -804,9 +877,9 @@
     m_theme = selectedTheme = current.data(ThemeModel::ActualNameRole).toString();
     m_themeID = current.row();
     QIcon icon = qVariantValue<QIcon>(current.data(Qt::DecorationRole));
-    QSize iconSize = icon.actualSize(QSize(65535, 65535));
-    btnTheme->setFixedHeight(64);
-    btnTheme->setIconSize(iconSize);
+    //QSize iconSize = icon.actualSize(QSize(65535, 65535));
+    //btnTheme->setFixedHeight(64);
+    //btnTheme->setIconSize(iconSize);
     btnTheme->setIcon(icon);
     btnTheme->setText(tr("Theme: %1").arg(current.data(Qt::DisplayRole).toString()));
     updateThemeButtonSize();
@@ -855,11 +928,8 @@
         mapList->scrollTo(map);
     }
 
-    if (map.data(Qt::UserRole + 1).canConvert<MapModel::MapInfo>())
-        setMapInfo(map.data(Qt::UserRole + 1).value<MapModel::MapInfo>());
-    else
-        Q_ASSERT(false); // Houston, we have a problem.
-
+    Q_ASSERT(map.data(Qt::UserRole + 1).canConvert<MapModel::MapInfo>()); // Houston, we have a problem.
+    setMapInfo(map.data(Qt::UserRole + 1).value<MapModel::MapInfo>());
 }
 
 void HWMapContainer::setMapInfo(MapModel::MapInfo mapInfo)
--- a/QTfrontend/ui/widget/mapContainer.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/mapContainer.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,19 +14,20 @@
  *
  * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _HWMAP_CONTAINER_INCLUDED
 #define _HWMAP_CONTAINER_INCLUDED
 
-#include <QWidget>
-#include <QGridLayout>
-#include <QVBoxLayout>
+#include <QByteArray>
 #include <QComboBox>
+#include <QGridLayout>
 #include <QLabel>
-#include <QByteArray>
 #include <QLineEdit>
+#include <QSlider>
+#include <QVBoxLayout>
+#include <QWidget>
 
 #include "DataManager.h"
 
@@ -59,6 +60,7 @@
         QString getCurrentScheme() const;
         QString getCurrentWeapons() const;
         quint32 getTemplateFilter() const;
+        quint32 getFeatureSize() const;
         MapGenerator get_mapgen(void) const;
         int getMazeSize(void) const;
         bool getCurrentIsMission() const;
@@ -71,13 +73,15 @@
     public slots:
         void askForGeneratedPreview();
         void setSeed(const QString & seed);
+        void setScript(const QString & script, const QString & scriptparam);
         void setMap(const QString & map);
         void setTheme(const QString & theme);
         void setTemplateFilter(int);
         void setMapgen(MapGenerator m);
         void setMazeSize(int size);
+        void setFeatureSize(int size);
         void setDrawnMapData(const QByteArray & ar);
-        void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl);
+        void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl, int featureSize);
         void updateModelViews();
         void onPreviewMapDestroyed(QObject * map);
         void setMaster(bool master);
@@ -89,16 +93,17 @@
         void newTemplateFilter(int filter);
         void mapgenChanged(MapGenerator m);
         void mazeSizeChanged(int s);
+        void mapFeatureSizeChanged(int s);
         void drawMapRequested();
         void drawnMapChanged(const QByteArray & data);
 
     private slots:
-        void setImage(const QImage newImage);
+        void setImage(const QPixmap & newImage);
         void setHHLimit(int hhLimit);
         void setRandomSeed();
         void setRandomTheme();
         void setRandomMap();
-        void addInfoToPreview(QPixmap image);
+        void addInfoToPreview(const QPixmap & image);
         void setNewSeed(const QString & newSeed);
         void mapTypeChanged(int);
         void showThemePrompt();
@@ -116,6 +121,7 @@
     private:
         QVBoxLayout mainLayout;
         QPushButton* mapPreview;
+        QSlider* mapFeatureSize;
         QComboBox* chooseMap;
         MapModel * m_staticMapModel;
         MapModel * m_missionMapModel;
@@ -124,6 +130,8 @@
         ThemeModel * m_themeModel;
         HWMap* pMap;
         QString m_seed;
+        QString m_script;
+        QString m_scriptparam;
         QPushButton* seedSet;
         QLabel* seedLabel;
         int hhLimit;
@@ -159,6 +167,7 @@
         void intSetMapgen(MapGenerator m);
         void intSetTemplateFilter(int);
         void intSetMazeSize(int size);
+        void intSetFeatureSize(int size);
         void intSetIconlessTheme(const QString & name);
         void mapChanged(const QModelIndex & map, int type, const QModelIndex & old = QModelIndex());
         void setMapInfo(MapModel::MapInfo mapInfo);
@@ -170,6 +179,8 @@
 
         MapModel::MapInfo m_mapInfo;
         int m_themeID;
+        int m_prevMapFeatureSize;
+        int m_mapFeatureSize;
         QString m_theme;
         QString m_curMap;
 
--- a/QTfrontend/ui/widget/qpushbuttonwithsound.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/qpushbuttonwithsound.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDir>
--- a/QTfrontend/ui/widget/qpushbuttonwithsound.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/qpushbuttonwithsound.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef QPUSHBUTTONWITHSOUND_H
--- a/QTfrontend/ui/widget/roomnameprompt.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/roomnameprompt.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDialog>
--- a/QTfrontend/ui/widget/roomnameprompt.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/roomnameprompt.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef ROOMNAMEPROMPT_H
--- a/QTfrontend/ui/widget/seedprompt.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/seedprompt.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDialog>
--- a/QTfrontend/ui/widget/seedprompt.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/seedprompt.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef SEEDPROMPT_H
--- a/QTfrontend/ui/widget/selectWeapon.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/selectWeapon.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "selectWeapon.h"
@@ -93,7 +93,7 @@
     for(int i = 0; i < keys.size(); i++)
     {
         if (wconf->value(keys[i]).toString().size() != cDefaultAmmoStore->size())
-            wconf->remove(keys[i]);
+            wconf->setValue(keys[i], fixWeaponSet(wconf->value(keys[i]).toString()));
     }
 
     QString currentState = *cDefaultAmmoStore;
@@ -322,14 +322,33 @@
     if(wconf->contains(curWeaponsName))
     {
         QString ammo = getWeaponsString(curWeaponsName);
-        QString newName = tr("copy of") + " " + curWeaponsName;
+        QString newName = tr("copy of %1").arg(curWeaponsName);
         if(wconf->contains(newName))
         {
             //name already used -> look for an appropriate name:
             int i=2;
-            while(wconf->contains(newName = tr("copy of") + " " + curWeaponsName+QString::number(i++))) ;
+            while(wconf->contains(newName = tr("copy of %1").arg(curWeaponsName+QString::number(i++))));
         }
         setWeaponsName(newName);
         setWeapons(ammo);
     }
 }
+
+QString SelWeaponWidget::fixWeaponSet(const QString &s)
+{
+    int neededLength = cDefaultAmmoStore->size() / 4;
+    int thisSetLength = s.size() / 4;
+
+    QStringList sl;
+    sl
+            << s.left(thisSetLength)
+            << s.mid(thisSetLength, thisSetLength)
+            << s.mid(thisSetLength * 2, thisSetLength)
+            << s.right(thisSetLength)
+               ;
+
+    for(int i = sl.length() - 1; i >= 0; --i)
+        sl[i] = sl[i].leftJustified(neededLength, '0', true);
+
+    return sl.join(QString());
+}
--- a/QTfrontend/ui/widget/selectWeapon.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/selectWeapon.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _SELECT_WEAPON_INCLUDED
@@ -87,6 +87,8 @@
         QGridLayout* p2Layout;
         QGridLayout* p3Layout;
         QGridLayout* p4Layout;
+
+        QString fixWeaponSet(const QString & s);
 };
 
 #endif // _SELECT_WEAPON_INCLUDED
--- a/QTfrontend/ui/widget/teamselect.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/teamselect.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <algorithm>
@@ -121,26 +121,22 @@
 void TeamSelWidget::removeNetTeam(const HWTeam& team)
 {
     //qDebug() << QString("removeNetTeam: removing team '%1'").arg(team.TeamName);
-    for(;;)
+    QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
+    if(itPlay==curPlayingTeams.end())
     {
-        QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
-        if(itPlay==curPlayingTeams.end())
-        {
-            qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.name());
-            break;
-        }
-        if(itPlay->isNetTeam())
-        {
-            QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam)));
-            framePlaying->removeTeam(team);
-            curPlayingTeams.erase(itPlay);
-            break;
-        }
-        else
-        {
-            qWarning() << QString("removeNetTeam: team '%1' was actually a local team!").arg(team.name());
-            break;
-        }
+        qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.name());
+        return;
+    }
+
+    if(itPlay->isNetTeam())
+    {
+        QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam)));
+        framePlaying->removeTeam(team);
+        curPlayingTeams.erase(itPlay);
+    }
+    else
+    {
+        qWarning() << QString("removeNetTeam: team '%1' was actually a local team!").arg(team.name());
     }
     emit setEnabledGameStart(curPlayingTeams.size()>1);
 }
--- a/QTfrontend/ui/widget/teamselect.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/teamselect.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _TEAM_SELECT_INCLUDED
--- a/QTfrontend/ui/widget/teamselhelper.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/teamselhelper.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QPixmap>
--- a/QTfrontend/ui/widget/teamselhelper.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/teamselhelper.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _TEAMSEL_HELPER_INCLUDED
@@ -75,7 +75,7 @@
         FrameTeams * m_parentFrameTeams;
 
     signals:
-        void teamStatusChanged(HWTeam team);
+        void teamStatusChanged(const HWTeam &);
         void hhNmChanged(const HWTeam&);
         void teamColorChanged(const HWTeam&);
 };
--- a/QTfrontend/ui/widget/themeprompt.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/themeprompt.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QDialog>
--- a/QTfrontend/ui/widget/themeprompt.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/themeprompt.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef THEMEPROMPT_H
--- a/QTfrontend/ui/widget/togglebutton.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/togglebutton.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2009 Kristian Lehmann <email@thexception.net>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "togglebutton.h"
--- a/QTfrontend/ui/widget/togglebutton.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/togglebutton.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2009 Kristian Lehmann <email@thexception.net>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef TOGGLEBUTTONWIDGET_H
--- a/QTfrontend/ui/widget/vertScrollArea.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/vertScrollArea.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "vertScrollArea.h"
--- a/QTfrontend/ui/widget/vertScrollArea.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/vertScrollArea.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _VERT_SCROLL_AREA_INCLUDED
--- a/QTfrontend/ui/widget/weaponItem.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/weaponItem.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "weaponItem.h"
--- a/QTfrontend/ui/widget/weaponItem.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui/widget/weaponItem.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2006-2008 Igor Ulyanov <iulyanov@gmail.com>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef _WEAPON_ITEM
--- a/QTfrontend/ui_hwform.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui_hwform.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QVBoxLayout>
--- a/QTfrontend/ui_hwform.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/ui_hwform.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef UI_HWFORM_H
--- a/QTfrontend/util/DataManager.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/DataManager.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
@@ -47,6 +47,7 @@
     m_themeModel = NULL;
     m_colorsModel = NULL;
     m_bindsModel = NULL;
+    m_gameStyleModel = NULL;
 }
 
 
--- a/QTfrontend/util/DataManager.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/DataManager.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/util/FileEngine.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/FileEngine.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -2,8 +2,8 @@
  * TODO: add copyright header, determine license
  */
 
+#include "FileEngine.h"
 #include "hwpacksmounter.h"
-#include "FileEngine.h"
 
 
 const QString FileEngineHandler::scheme = "physfs:/";
--- a/QTfrontend/util/FileEngine.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/FileEngine.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,93 +1,93 @@
-#ifndef _FileEngine_h
-#define _FileEngine_h
-
-#include <QAbstractFileEngine>
-#include <QAbstractFileEngineHandler>
-#include <QAbstractFileEngineIterator>
-#include <QDateTime>
-
-#include "physfs.h"
-
-
-
-class FileEngine : public QAbstractFileEngine
-{
-    public:
-        FileEngine(const QString& filename);
-
-        virtual ~FileEngine();
-
-        virtual bool open(QIODevice::OpenMode openMode);
-        virtual bool close();
-        virtual bool flush();
-        virtual qint64 size() const;
-        virtual qint64 pos() const;
-        virtual bool setSize(qint64 size);
-        virtual bool seek(qint64 pos);
-        virtual bool isSequential() const;
-        virtual bool remove();
-        virtual bool mkdir(const QString &dirName, bool createParentDirectories) const;
-        virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const;
-        virtual bool caseSensitive() const;
-        virtual bool isRelativePath() const;
-        QAbstractFileEngineIterator *beginEntryList(QDir::Filters filters, const QStringList & filterNames);
-        virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const;
-        virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const;
-        virtual QString fileName(FileName file=DefaultName) const;
-        virtual QDateTime fileTime(FileTime time) const;
-        virtual void setFileName(const QString &file);
-        bool atEnd() const;
-
-        virtual qint64 read(char *data, qint64 maxlen);
-        virtual qint64 readLine(char *data, qint64 maxlen);
-        virtual qint64 write(const char *data, qint64 len);
-
-        bool isOpened() const;
-
-        QFile::FileError error() const;
-        QString errorString() const;
-
-        virtual bool supportsExtension(Extension extension) const;
-
-    private:
-        PHYSFS_file *m_handle;
-        qint64 m_size;
-        FileFlags m_flags;
-        QString m_fileName;
-        QDateTime m_date;
-        bool m_bufferSet;
-        bool m_readWrite;
-};
-
-class FileEngineHandler : public QAbstractFileEngineHandler
-{
-    public:
-        FileEngineHandler(char * argv0);
-        ~FileEngineHandler();
-
-        QAbstractFileEngine *create(const QString &filename) const;
-
-        static void mount(const QString & path);
-        static void mount(const QString & path, const QString & mountPoint);
-        static void setWriteDir(const QString & path);
-        static void mountPacks();
-        static QString errorStr();
-
-//    private:
-        static const QString scheme;
-};
-
-class FileEngineIterator : public QAbstractFileEngineIterator
-{
-public:
-        FileEngineIterator(QDir::Filters filters, const QStringList & nameFilters, const QStringList & entries);
-
-        bool hasNext() const;
-        QString next();
-        QString currentFileName() const;
-private:
-        QStringList m_entries;
-        int m_index;
-};
-
-#endif
+#ifndef _FileEngine_h
+#define _FileEngine_h
+
+#include <QAbstractFileEngine>
+#include <QAbstractFileEngineHandler>
+#include <QAbstractFileEngineIterator>
+#include <QDateTime>
+
+#include "physfs.h"
+
+
+
+class FileEngine : public QAbstractFileEngine
+{
+    public:
+        FileEngine(const QString& filename);
+
+        virtual ~FileEngine();
+
+        virtual bool open(QIODevice::OpenMode openMode);
+        virtual bool close();
+        virtual bool flush();
+        virtual qint64 size() const;
+        virtual qint64 pos() const;
+        virtual bool setSize(qint64 size);
+        virtual bool seek(qint64 pos);
+        virtual bool isSequential() const;
+        virtual bool remove();
+        virtual bool mkdir(const QString &dirName, bool createParentDirectories) const;
+        virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const;
+        virtual bool caseSensitive() const;
+        virtual bool isRelativePath() const;
+        QAbstractFileEngineIterator *beginEntryList(QDir::Filters filters, const QStringList & filterNames);
+        virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const;
+        virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const;
+        virtual QString fileName(FileName file=DefaultName) const;
+        virtual QDateTime fileTime(FileTime time) const;
+        virtual void setFileName(const QString &file);
+        bool atEnd() const;
+
+        virtual qint64 read(char *data, qint64 maxlen);
+        virtual qint64 readLine(char *data, qint64 maxlen);
+        virtual qint64 write(const char *data, qint64 len);
+
+        bool isOpened() const;
+
+        QFile::FileError error() const;
+        QString errorString() const;
+
+        virtual bool supportsExtension(Extension extension) const;
+
+    private:
+        PHYSFS_file *m_handle;
+        qint64 m_size;
+        FileFlags m_flags;
+        QString m_fileName;
+        QDateTime m_date;
+        bool m_bufferSet;
+        bool m_readWrite;
+};
+
+class FileEngineHandler : public QAbstractFileEngineHandler
+{
+    public:
+        FileEngineHandler(char * argv0);
+        ~FileEngineHandler();
+
+        QAbstractFileEngine *create(const QString &filename) const;
+
+        static void mount(const QString & path);
+        static void mount(const QString & path, const QString & mountPoint);
+        static void setWriteDir(const QString & path);
+        static void mountPacks();
+        static QString errorStr();
+
+//    private:
+        static const QString scheme;
+};
+
+class FileEngineIterator : public QAbstractFileEngineIterator
+{
+public:
+        FileEngineIterator(QDir::Filters filters, const QStringList & nameFilters, const QStringList & entries);
+
+        bool hasNext() const;
+        QString next();
+        QString currentFileName() const;
+private:
+        QStringList m_entries;
+        int m_index;
+};
+
+#endif
--- a/QTfrontend/util/LibavInteraction.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/LibavInteraction.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "LibavInteraction.h"
@@ -21,7 +21,9 @@
 #if VIDEOREC
 extern "C"
 {
+#include "libavcodec/avcodec.h"
 #include "libavformat/avformat.h"
+#include "libavutil/avutil.h"
 }
 
 #include <QVector>
@@ -30,13 +32,25 @@
 
 #include "HWApplication.h"
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 25, 0)
-#define CodecID AVCodecID
+// compatibility section
+#if LIBAVCODEC_VERSION_MAJOR < 55
+#define av_codec_is_encoder(x)          x->encode
+#define AVCodecID                       CodecID
+#endif
+
+#if LIBAVFORMAT_VERSION_MAJOR < 54
+#define avformat_find_stream_info(x, y) av_find_stream_info(x)
+#define avformat_close_input(x)         av_close_input_file(*(x))
+#endif
+
+#if LIBAVUTIL_VERSION_MAJOR < 54
+#define AVPixelFormat                   PixelFormat
+#define AV_PIX_FMT_YUV420P              PIX_FMT_YUV420P
 #endif
 
 struct Codec
 {
-    CodecID id;
+    AVCodecID id;
     bool isAudio;
     QString shortName; // used for identification
     QString longName; // used for displaying to user
@@ -56,7 +70,7 @@
 QMap<QString,Format> formats;
 
 // test if given format supports given codec
-bool FormatQueryCodec(AVOutputFormat *ofmt, enum CodecID codec_id)
+bool FormatQueryCodec(AVOutputFormat *ofmt, enum AVCodecID codec_id)
 {
 #if LIBAVFORMAT_VERSION_MAJOR >= 54
     return avformat_query_codec(ofmt, codec_id, FF_COMPLIANCE_NORMAL) == 1;
@@ -76,11 +90,7 @@
     AVCodec* pCodec = NULL;
     while ((pCodec = av_codec_next(pCodec)))
     {
-#if LIBAVCODEC_VERSION_MAJOR >= 54
         if (!av_codec_is_encoder(pCodec))
-#else
-        if (!pCodec->encode)
-#endif
             continue;
 
         if (pCodec->type != AVMEDIA_TYPE_VIDEO && pCodec->type != AVMEDIA_TYPE_AUDIO)
@@ -106,8 +116,8 @@
             if (!pCodec->pix_fmts)
                 continue;
             bool yuv420Supported = false;
-            for (const PixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
-                if (*pfmt == PIX_FMT_YUV420P)
+            for (const enum AVPixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
+                if (*pfmt == AV_PIX_FMT_YUV420P)
                 {
                     yuv420Supported = true;
                     break;
@@ -121,7 +131,7 @@
             if (!pCodec->sample_fmts)
                 continue;
             bool s16Supported = false;
-            for (const AVSampleFormat* pfmt = pCodec->sample_fmts; *pfmt != -1; pfmt++)
+            for (const enum AVSampleFormat* pfmt = pCodec->sample_fmts; *pfmt != -1; pfmt++)
                 if (*pfmt == AV_SAMPLE_FMT_S16)
                 {
                     s16Supported = true;
@@ -274,11 +284,7 @@
     QByteArray utf8path = filepath.toUtf8();
     if (avformat_open_input(&pContext, utf8path.data(), NULL, NULL) < 0)
         return "";
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-    if (av_find_stream_info(pContext) < 0)
-#else
     if (avformat_find_stream_info(pContext, NULL) < 0)
-#endif
         return "";
 
     int s = float(pContext->duration)/AV_TIME_BASE;
@@ -312,11 +318,7 @@
     AVDictionaryEntry* pComment = av_dict_get(pContext->metadata, "comment", NULL, 0);
     if (pComment)
         desc += QString("\n") + pComment->value;
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-    av_close_input_file(pContext);
-#else
     avformat_close_input(&pContext);
-#endif
     return desc;
 }
 
--- a/QTfrontend/util/LibavInteraction.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/LibavInteraction.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef LIBAV_INTERACTION
--- a/QTfrontend/util/MessageDialog.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/MessageDialog.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,12 +13,14 @@
  *
  * 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "MessageDialog.h"
 #include "HWApplication.h"
 
+
+
 int MessageDialog::ShowFatalMessage(const QString & msg, QWidget * parent)
 {
     return ShowMessage(QMessageBox::tr("Hedgewars - Error"),
@@ -45,7 +47,22 @@
 
 int MessageDialog::ShowMessage(const QString & title, const QString & msg, QMessageBox::Icon icon, QWidget * parent)
 {
-    QMessageBox msgMsg(parent ? parent : HWApplication::activeWindow());
+    // if no parent try to use active window
+    parent = parent ? parent : HWApplication::activeWindow();
+
+    // didn't work? make child of hwform (e.g. for style and because modal)
+    if (!parent)
+    {
+        try
+        {
+            HWApplication * app = dynamic_cast<HWApplication*>(HWApplication::instance());
+            if (app->form)
+                parent = app->form;
+        }
+        catch (...) { /* nothing */ }
+    }
+
+    QMessageBox msgMsg(parent);
     msgMsg.setWindowTitle(title != NULL ? title : "Hedgewars");
     msgMsg.setText(msg);
     msgMsg.setIcon(icon);
--- a/QTfrontend/util/MessageDialog.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/MessageDialog.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef MESSAGEDIALOG_H
--- a/QTfrontend/util/SDLInteraction.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/SDLInteraction.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
@@ -54,6 +54,7 @@
     m_music = NULL;
     m_musicTrack = "";
     m_isPlayingMusic = false;
+    lastchannel = 0;
     if(SDL_NumJoysticks())
         addGameControllerKeys();
     SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
@@ -174,6 +175,9 @@
         SDL_JoystickClose(joy);
     }
 
+    if(i >= 1024)
+        i = 1023;
+
     // Terminate the list
     sdlkeys[i][0][0] = '\0';
     sdlkeys[i][1][0] = '\0';   
@@ -241,7 +245,7 @@
     if (m_music == NULL)
         m_music = Mix_LoadMUS_RW(PHYSFSRWOPS_openRead(m_musicTrack.toLocal8Bit().constData()), 0);
 
-    Mix_VolumeMusic(MIX_MAX_VOLUME - 28);
+    Mix_VolumeMusic(MIX_MAX_VOLUME/4);
     Mix_FadeInMusic(m_music, -1, 1750);
 }
 
--- a/QTfrontend/util/SDLInteraction.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/SDLInteraction.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /**
--- a/QTfrontend/util/namegen.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/namegen.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2009 Martin Minarik <ttsmj@pokec.sk>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <QFile>
--- a/QTfrontend/util/namegen.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/namegen.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,7 +1,7 @@
 /*
  * Hedgewars, a free turn based strategy game
  * Copyright (c) 2009 Martin Minarik <ttsmj@pokec.sk>
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef NAMEGEN_H
--- a/QTfrontend/util/platform/CocoaInitializer.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/platform/CocoaInitializer.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 // see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
--- a/QTfrontend/util/platform/CocoaInitializer.mm	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/platform/CocoaInitializer.mm	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 // see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
--- a/QTfrontend/util/platform/InstallController.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/platform/InstallController.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "InstallController.h"
--- a/QTfrontend/util/platform/InstallController.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/platform/InstallController.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef INSTALLCONTROLLER_H
--- a/QTfrontend/util/platform/M3Panel.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/platform/M3Panel.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef M3PANEL_H
--- a/QTfrontend/util/platform/M3Panel.mm	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/platform/M3Panel.mm	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "M3Panel.h"
--- a/QTfrontend/util/platform/SparkleAutoUpdater.mm	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/platform/SparkleAutoUpdater.mm	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 // see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
--- a/QTfrontend/util/platform/xfire.cpp	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/platform/xfire.cpp	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <string>
--- a/QTfrontend/util/platform/xfire.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/util/platform/xfire.h	Tue Nov 10 20:43:13 2015 +0100
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2015 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
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef XFIRE_H
--- a/QTfrontend/weapons.h	Tue Nov 10 18:16:35 2015 +0100
+++ b/QTfrontend/weapons.h	Tue Nov 10 20:43:13 2015 +0100
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 
@@ -22,45 +22,61 @@
 //structure------------------------------------------------------------------|
 
 
-#define AMMOLINE_DEFAULT_QT     "93919294221991210322351110012000000002111001010111110001"
-#define AMMOLINE_DEFAULT_PROB   "04050405416006555465544647765766666661555101011154111111"
-#define AMMOLINE_DEFAULT_DELAY  "00000000000002055000000400070040000000002200000006000200"
-#define AMMOLINE_DEFAULT_CRATE  "13111103121111111231141111111111111112111111011111111111"
+#define AMMOLINE_DEFAULT_QT     "939192942219912103223511100120000000021110010101111100010"
+#define AMMOLINE_DEFAULT_PROB   "040504054160065554655446477657666666615551010111541111111"
+#define AMMOLINE_DEFAULT_DELAY  "000000000000020550000004000700400000000022000000060002000"
+#define AMMOLINE_DEFAULT_CRATE  "131111031211111112311411111111111111121111110111111111111"
 
-#define AMMOLINE_CRAZY_QT       "99999999999999999929999999999999992999999999099999929991"
-#define AMMOLINE_CRAZY_PROB     "11111101111111111111111111111111111111111111011111111111"
-#define AMMOLINE_CRAZY_DELAY    "00000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CRAZY_CRATE    "13111103121111111231141111111111111112111101011111111111"
+#define AMMOLINE_CRAZY_QT       "999999999999999999299999999999999929999999990999999299919"
+#define AMMOLINE_CRAZY_PROB     "111111011111111111111111111111111111111111110111111111111"
+#define AMMOLINE_CRAZY_DELAY    "000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CRAZY_CRATE    "131111031211111112311411111111111111121111010111111111111"
 
-#define AMMOLINE_PROMODE_QT     "90900090000000000000090000000000000000000000000000000000"
-#define AMMOLINE_PROMODE_PROB   "00000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_PROMODE_DELAY  "00000000000002055000000400070040000000002000000000000200"
-#define AMMOLINE_PROMODE_CRATE  "11111101111111111111111111111111111111111001011111111111"
+#define AMMOLINE_PROMODE_QT     "909000900000000000000900000000000000000000000000000000000"
+#define AMMOLINE_PROMODE_PROB   "000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_PROMODE_DELAY  "000000000000020550000004000700400000000020000000000002000"
+#define AMMOLINE_PROMODE_CRATE  "111111011111111111111111111111111111111110010111111111111"
 
-#define AMMOLINE_SHOPPA_QT      "00000099000000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPA_PROB    "44444100442444022101121212224220000000020004000100110010"
-#define AMMOLINE_SHOPPA_DELAY   "00000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPA_CRATE   "11111101111111111111111111111111111111111011011111111110"
+#define AMMOLINE_SHOPPA_QT      "000000990000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_PROB    "444441004424440221011212122242200000000200040001001100101"
+#define AMMOLINE_SHOPPA_DELAY   "000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPA_CRATE   "111111011111111111111111111111111111111110110111111111101"
+
+#define AMMOLINE_CLEAN_QT       "101000900001000001100000000000000000000000000000100000000"
+#define AMMOLINE_CLEAN_PROB     "040504054160065554655446477657666666615551010111541112111"
+#define AMMOLINE_CLEAN_DELAY    "000000000000000000000000000000000000000000000000000002000"
+#define AMMOLINE_CLEAN_CRATE    "131111031211111112311411111111111111121111110111111111111"
 
-#define AMMOLINE_CLEAN_QT       "10100090000100000110000000000000000000000000000010000000"
-#define AMMOLINE_CLEAN_PROB     "04050405416006555465544647765766666661555101011154111211"
-#define AMMOLINE_CLEAN_DELAY    "00000000000000000000000000000000000000000000000000000200"
-#define AMMOLINE_CLEAN_CRATE    "13111103121111111231141111111111111112111111011111111111"
+#define AMMOLINE_MINES_QT       "000000990009000000030000000000000000000000000000000000000"
+#define AMMOLINE_MINES_PROB     "000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_MINES_DELAY    "000000000000020550000004000700400000000020000000060002000"
+#define AMMOLINE_MINES_CRATE    "111111011111111111111111111111111111111111110111111111111"
 
-#define AMMOLINE_MINES_QT       "00000099000900000003000000000000000000000000000000000000"
-#define AMMOLINE_MINES_PROB     "00000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_MINES_DELAY    "00000000000002055000000400070040000000002000000006000200"
-#define AMMOLINE_MINES_CRATE    "11111101111111111111111111111111111111111111011111111111"
+#define AMMOLINE_PORTALS_QT     "900000900200000000210000000000000011000009000000000000000"
+#define AMMOLINE_PORTALS_PROB   "040504054160065554655446477657666666615551010111541112111"
+#define AMMOLINE_PORTALS_DELAY  "000000000000020550000004000700400000000020000000060002000"
+#define AMMOLINE_PORTALS_CRATE  "131111031211111112311411111111111111121111110111111111111"
+
+#define AMMOLINE_ONEEVERY_QT    "111111911111111111111111111111111111111111111111111111111"
+#define AMMOLINE_ONEEVERY_PROB  "111111011111111111111111111111111111111111111111111111111"
+#define AMMOLINE_ONEEVERY_DELAY "000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_ONEEVERY_CRATE "111111011111111111111111111111111111111111111111111111111"
 
-#define AMMOLINE_PORTALS_QT     "90000090020000000021000000000000001100000900000000000000"
-#define AMMOLINE_PORTALS_PROB   "04050405416006555465544647765766666661555101011154111211"
-#define AMMOLINE_PORTALS_DELAY  "00000000000002055000000400070040000000002000000006000200"
-#define AMMOLINE_PORTALS_CRATE  "13111103121111111231141111111111111112111111011111111111"
+#define AMMOLINE_HIGHLANDER_QT    "111111911111111111110191111111111001011111011110110011010"
+#define AMMOLINE_HIGHLANDER_PROB  "000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_HIGHLANDER_DELAY "000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_HIGHLANDER_CRATE "000000000000000000000000000000000000000000000000000000000"
 
-#define AMMOLINE_ONEEVERY_QT    "11111191111111111111111111111111111111111111111111111111"
-#define AMMOLINE_ONEEVERY_PROB  "11111101111111111111111111111111111111111111111111111111"
-#define AMMOLINE_ONEEVERY_DELAY "00000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_ONEEVERY_CRATE "11111101111111111111111111111111111111111111111111111111"
+#define AMMOLINE_CONSTRUCTION_QT    "110001900000001001000000000000000000000000000000000000000"
+#define AMMOLINE_CONSTRUCTION_PROB  "111111011111111111111111111111111111111111111111111111110"
+#define AMMOLINE_CONSTRUCTION_DELAY "000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_CONSTRUCTION_CRATE "111111011111111111111111111111111111111111111111111111110"
+
+#define AMMOLINE_SHOPPAPRO_QT      "000000990000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPAPRO_PROB    "444440004404440000000000000040000000000000000000000000000"
+#define AMMOLINE_SHOPPAPRO_DELAY   "000000000000000000000000000000000000000000000000000000000"
+#define AMMOLINE_SHOPPAPRO_CRATE   "111111011111111111111111111111111111111110110111111112110"
+
 
 //When adding new weapons also insert one element in cDefaultAmmos list (hwconsts.cpp.in)
 
--- a/README	Tue Nov 10 18:16:35 2015 +0100
+++ b/README	Tue Nov 10 20:43:13 2015 +0100
@@ -1,46 +1,1 @@
-Hedgewars - a turn based strategy game.
-=======================================
-
-Copyright 2004-2013 Andrey Korotaev <unC0Rr@gmail.com> and others.
-See QTfrontend/res/html/about.html and CREDITS for a complete list of authors.
-
-Licence:
---------
-Source code is distributed under the terms of the GNU General Public Licence
-version 2; images and sounds are distributed under the terms of the GNU Free
-Documentation Licence version 1.2. See the COPYING file for the full text of
-the licenses.
-
-Instructions:
--------------
-See our wiki at: https://code.google.com/p/hedgewars/wiki/BuildingHedgewars
-
-You can find an outline of the necessary dependencies in the INSTALL file.
-
-Source code:
-------------
-Our main repository is located at http://hedgewars.googlecode.com using
-Mercurial as DVCS. A Git repository is also available (mirrored daily)
-at https://github.com/hedgewars/hw
-
-Contribute:
------------
-If you see a bug or have any suggestion please use the official bug tracker at
-http://code.google.com/p/hedgewars/issues/list or the integrated feedback
-button.
-
-If you want to help or get to know the sources better you can do that with some
-easy tasks from http://code.google.com/p/hedgewars/wiki/TODO. We also have an
-extended API in LUA to customize your adventures in our wiki at
-http://code.google.com/p/hedgewars/wiki/LuaAPI.
-
-If you know your way through the code feel free to send a patch or open a pull
-request. The best LUA scripts get released in the official DLC page and later
-integrated in the next version.
-
-Contact:
---------
-* IRC channel     - irc://irc.freenode.net/hedgewars
-* community forum - http://www.hedgewars.org/forum
-* mailing list    - https://mail.gna.org/listinfo/hedgewars-dev
-
+README.md
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Tue Nov 10 20:43:13 2015 +0100
@@ -0,0 +1,46 @@
+Hedgewars - a turn based strategy game.
+=======================================
+
+Copyright 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> and others.
+See QTfrontend/res/html/about.html and CREDITS for a complete list of authors.
+
+Licence:
+--------
+Source code is distributed under the terms of the GNU General Public Licence
+version 2; images and sounds are distributed under the terms of the GNU Free
+Documentation Licence version 1.2. See the COPYING file for the full text of
+the licenses.
+
+Instructions:
+-------------
+See our wiki at: http://hedgewars.org/kb/BuildingHedgewars
+
+You can find an outline of the necessary dependencies in the INSTALL file.
+
+Source code:
+------------
+Our main repository is located at http://hg.hedgewars.org/hedgewars/ using
+Mercurial as DVCS. A Git repository is also available (mirrored daily)
+at https://github.com/hedgewars/hw
+
+Contribute:
+-----------
+If you see a bug or have any suggestion please use the official bug tracker at
+http://code.google.com/p/hedgewars/issues/list or the integrated feedback
+button.
+
+If you want to help or get to know the sources better you can do that with some
+easy tasks from http://hedgewars.org/kb/TODO. We also have an
+extended API in LUA to customize your adventures in our wiki at
+http://hedgewars.org/kb/LuaAPI.
+
+If you know your way through the code feel free to send a patch or open a pull
+request. The best LUA scripts get released in the official DLC page and later
+integrated in the next version.
+
+Contact:
+--------
+* IRC channel     - irc://irc.freenode.net/hedgewars
+* community forum - http://www.hedgewars.org/forum
+* mailing list    - https://mail.gna.org/listinfo/hedgewars-dev
+
--- a/cmake_modules/CMakePascalInformation.cmake	Tue Nov 10 18:16:35 2015 +0100
+++ b/cmake_modules/CMakePascalInformation.cmake	Tue Nov 10 20:43:13 2015 +0100
@@ -9,9 +9,9 @@
 include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
 
 # This section should actually be in Platform/${CMAKE_SYSTME_NAME}-fpc.cmake
-set(CMAKE_Pascal_FLAGS_DEBUG_INIT "-g -gl -gp -gh")
+set(CMAKE_Pascal_FLAGS_DEBUG_INIT "-O- -g -gl -gp -gh")
 set(CMAKE_Pascal_FLAGS_MINSIZEREL_INIT "-Os -dNDEBUG")
-set(CMAKE_Pascal_FLAGS_RELEASE_INIT "-O3 -dNDEBUG")
+set(CMAKE_Pascal_FLAGS_RELEASE_INIT "-O2 -dNDEBUG")
 set(CMAKE_Pascal_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -gl -gp")
 
 # This should be included before the _INIT variables are
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/CheckHaskellModuleExists.cmake	Tue Nov 10 20:43:13 2015 +0100
@@ -0,0 +1,52 @@
+# Based on CheckLibraryExists.cmake from CMake
+#=============================================================================
+# Copyright 2002-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+macro(CHECK_HASKELL_MODULE_EXISTS MODULE FUNCTION PARAMCOUNT LIBRARY)
+  set(VARIABLE "HS_MODULE_${LIBRARY}_${FUNCTION}")
+  if(${VARIABLE} MATCHES ^${VARIABLE}$)
+    message(STATUS "Looking for ${FUNCTION} in ${MODULE}")
+
+    set(PARAMETERS "")
+
+    if(PARAMCOUNT GREATER 0)
+        foreach(__TRASH__ RANGE 1 ${PARAMCOUNT})
+            set(PARAMETERS "${PARAMETERS} undefined")
+        endforeach()
+    endif()
+
+    set(PARAMETERS "")
+
+    execute_process(COMMAND ${GHC_EXECUTABLE}
+                    "-DMODULE=${MODULE}"
+                    "-DFUNCTION=${FUNCTION}"
+                    "-DPARAMETERS=${PARAMETERS}"
+                    -cpp
+                    -c "${CMAKE_MODULE_PATH}/checkModule.hs"
+                    RESULT_VARIABLE COMMAND_RESULT
+                    ERROR_VARIABLE BUILD_ERROR
+                    OUTPUT_STRIP_TRAILING_WHITESPACE
+                    )
+    if(${COMMAND_RESULT} EQUAL 0)
+      message(STATUS "Looking for ${FUNCTION} in ${MODULE} - found")
+      set(${VARIABLE} 1 CACHE INTERNAL "Have module ${MODULE}")
+      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+        "Determining if the function ${FUNCTION} exists in the ${MODULE} passed\n\n")
+    else()
+      message(STATUS "Looking for ${FUNCTION} in ${MODULE} - not found")
+      set(${VARIABLE} "" CACHE INTERNAL "Have module ${MODULE}")
+      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+        "Determining if the function ${FUNCTION} exists in the ${MODULE} "
+        "failed with the following output:\n"
+        "${BUILD_ERROR}\n\n")
+      message(FATAL_ERROR "Haskell library '${LIBRARY}' required")
+    endif()
+  endif()
+endmacro()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/FindClang.cmake	Tue Nov 10 20:43:13 2015 +0100
@@ -0,0 +1,36 @@
+# - Try to find the Clang/LLVM executable
+# Once done this will define
+#
+#  CLANG_FOUND       - system has Clang
+#  CLANG_VERSION     - Clang version
+#  CLANG_EXECUTABLE  - Clang executable
+#
+# Copyright (c) 2013, Vittorio Giovara <vittorio.giovara@gmail.com>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+find_program(CLANG_EXECUTABLE
+        NAMES clang-mp-3.3 clang-mp-3.2 clang-mp-3.1 clang-mp-3.0 clang
+        PATHS /opt/local/bin /usr/local/bin /usr/bin)
+
+if (CLANG_EXECUTABLE)
+    execute_process(COMMAND ${CLANG_EXECUTABLE} --version
+                    OUTPUT_VARIABLE CLANG_VERSION_OUTPUT
+                    ERROR_VARIABLE CLANG_VERSION_ERROR
+                    RESULT_VARIABLE CLANG_VERSION_RESULT
+                    OUTPUT_STRIP_TRAILING_WHITESPACE
+                    )
+
+    if(${CLANG_VERSION_RESULT} EQUAL 0)
+        string(REGEX MATCH "[0-9]+\\.[0-9]+" CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
+        string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" CLANG_VERSION "${CLANG_VERSION}")
+    else()
+        message(SEND_ERROR "Command \"${CLANG_EXECUTABLE} --version\" failed with output: ${CLANG_VERSION_ERROR}")
+    endif()
+endif()