# HG changeset patch # User koda # Date 1370773373 -7200 # Node ID fc46e75f6b7299dad4ddd32c714a39f5cea94151 # Parent 78f087fd3e5bd0d26d287b976b95925622436787# Parent 3e9d4bbc4053961438fdd92f97ecca79ea0d443d update with default diff -r 78f087fd3e5b -r fc46e75f6b72 CMakeLists.txt --- a/CMakeLists.txt Tue Jun 04 23:56:17 2013 +0200 +++ b/CMakeLists.txt Sun Jun 09 12:22:53 2013 +0200 @@ -2,13 +2,6 @@ #initialise cmake environment cmake_minimum_required(VERSION 2.6.0) -if(CMAKE_VERSION VERSION_LESS "2.8") - set(WARNING "WARNING: ") - set(allow_parse_args FALSE) -else() - set(WARNING WARNING) - set(allow_parse_args TRUE) -endif() foreach(hwpolicy CMP0003 CMP0012 CMP0017) if(POLICY ${hwpolicy}) cmake_policy(SET ${hwpolicy} NEW) @@ -46,50 +39,13 @@ endif() -#detect Mercurial revision and init rev/hash information -find_program(HGCOMMAND hg) -if(HGCOMMAND AND (EXISTS ${CMAKE_SOURCE_DIR}/.hg)) - execute_process(COMMAND ${HGCOMMAND} identify -in - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE internal_version - ERROR_QUIET - ) - #check local repo status - string(REGEX REPLACE "[^+]" "" HGCHANGED ${internal_version}) - string(REGEX REPLACE "[0-9a-zA-Z]+(.*) ([0-9]+)(.*)" "\\2" HEDGEWARS_REVISION ${internal_version}) - string(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" HEDGEWARS_HASH ${internal_version}) - - if(HGCHANGED) - message(${WARNING} "You have uncommitted changes in your repository!") - endif() - #let's assume that if you have hg you might be interested in debugging - set(default_build_type "DEBUG") - #write down hash and rev for easy picking should hg be missing - file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${HEDGEWARS_REVISION}\nhash ${HEDGEWARS_HASH}\n") -else() - set(default_build_type "RELEASE") - # when compiling outside rev control, fetch revision and hash information from version_info.txt - find_file(version_info version_info.txt PATH ${CMAKE_SOURCE_DIR}/share) - if(version_info) - file(STRINGS ${version_info} internal_version REGEX "rev") - string(REGEX REPLACE "rev ([0-9]*)" "\\1" HEDGEWARS_REVISION ${internal_version}) - file(STRINGS ${version_info} internal_version REGEX "hash") - string(REGEX REPLACE "hash ([a-zA-Z0-9]*)" "\\1" HEDGEWARS_HASH ${internal_version}) - else() - message(${WARNING} "${CMAKE_SOURCE_DIR}/share/version_info.txt not found, revision information " - "will be incorrect!!! Contact your source provider to fix this!") - set(HEDGEWARS_REVISION "0000") - set(HEDGEWARS_HASH "unknown") - endif() -endif() - - #versioning set(CPACK_PACKAGE_VERSION_MAJOR 0) set(CPACK_PACKAGE_VERSION_MINOR 9) -set(CPACK_PACKAGE_VERSION_PATCH 19) -set(HEDGEWARS_PROTO_VER 45) +set(CPACK_PACKAGE_VERSION_PATCH 20) +set(HEDGEWARS_PROTO_VER 46) set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +include(${CMAKE_MODULE_PATH}/revinfo.cmake) set(required_clang_version 3.0) message(STATUS "Building ${HEDGEWARS_VERSION}-r${HEDGEWARS_REVISION} (${HEDGEWARS_HASH})") @@ -138,79 +94,8 @@ endif() endif() - -if(APPLE) - set(CMAKE_FIND_FRAMEWORK "FIRST") - - #what system are we building for - set(minimum_macosx_version $ENV{MACOSX_DEPLOYMENT_TARGET}) - - #detect on which system we are: if sw_vers cannot be found for any reason (re)use minimum_macosx_version - find_program(sw_vers sw_vers) - if(sw_vers) - execute_process(COMMAND ${sw_vers} "-productVersion" - OUTPUT_VARIABLE current_macosx_version - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" current_macosx_version ${current_macosx_version}) - else() - if(NOT minimum_macosx_version) - message(FATAL_ERROR "sw_vers not found! Need explicit MACOSX_DEPLOYMENT_TARGET variable set") - else() - message(${WARNING} "sw_vers not found! Fallback to MACOSX_DEPLOYMENT_TARGET variable") - set(current_macosx_version ${minimum_macosx_version}) - endif() - endif() - - #if nothing is set, we deploy only for the current system - if(NOT minimum_macosx_version) - set(minimum_macosx_version ${current_macosx_version}) - endif() - - #lower systems don't have enough processing power anyway - if (minimum_macosx_version VERSION_LESS "10.4") - message(FATAL_ERROR "Hedgewars is not supported on Mac OS X pre-10.4") - endif() - - #workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2) - if(current_macosx_version VERSION_EQUAL "10.4") - find_package(SDL_mixer REQUIRED) - set(DYLIB_SMPEG "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg") - set(DYLIB_MIKMOD "-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod") - set(CMAKE_C_FLAGS "${DYLIB_SMPEG} ${DYLIB_MIKMOD}") - list(APPEND pascal_flags "-k${DYLIB_SMPEG}" "-k${DYLIB_MIKMOD}") - endif() - - #CMAKE_OSX_ARCHITECTURES and CMAKE_OSX_SYSROOT need to be set for universal binary and correct linking - if(NOT CMAKE_OSX_ARCHITECTURES) - if(current_macosx_version VERSION_LESS "10.6") - if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "powerpc*") - set(CMAKE_OSX_ARCHITECTURES "ppc7400") - else() - set(CMAKE_OSX_ARCHITECTURES "i386") - endif() - else() - set(CMAKE_OSX_ARCHITECTURES "x86_64") - endif() - endif() - - #CMAKE_OSX_SYSROOT is set at the system version we are supposed to build on - #we need to provide the correct one when host and target differ - if(NOT ${minimum_macosx_version} VERSION_EQUAL ${current_macosx_version}) - if(minimum_macosx_version VERSION_EQUAL "10.4") - set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/") - set(CMAKE_C_COMPILER "/Developer/usr/bin/gcc-4.0") - set(CMAKE_CXX_COMPILER "/Developer/usr/bin/g++-4.0") - else() - string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" sdk_version ${minimum_macosx_version}) - set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/") - endif() - endif() - - #add user framework directory, other paths can be passed via FPFLAGS - list(APPEND pascal_flags "-Ff~/Library/Frameworks") - #set deployment target - list(APPEND pascal_flags "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}") -endif(APPLE) +#platform specific init code +include(${CMAKE_MODULE_PATH}/platform.cmake) #when build type is not specified, assume Debug/Release according to build version information @@ -225,12 +110,11 @@ endif (CMAKE_BUILD_TYPE) +#perform safe check that enable/disable compilation features +include(${CMAKE_MODULE_PATH}/compilerchecks.cmake) + #set default flags values for all projects (unless MINIMAL_FLAGS is true) if(NOT ${MINIMAL_FLAGS}) - if(WINDOWS) - #this flags prevents a few dll hell problems - set(CMAKE_C_FLAGS "-static-libgcc ${CMAKE_C_FLAGS}") - endif(WINDOWS) set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG ${CMAKE_C_FLAGS_DEBUG}") @@ -245,36 +129,13 @@ set(CMAKE_CXX_FLAGS_DEBUG "-Wall -DDEBUG") endif() - -#TESTING TIME -include(CheckCCompilerFlag) - -#check for noexecstack on ELF, should be set on Gentoo and similar -set(CMAKE_REQUIRED_FLAGS "-Wl,-z -Wl,noexecstack") -check_c_compiler_flag("" HAVE_NOEXECSTACK) #empty because we are testing a linker flag -if(HAVE_NOEXECSTACK) - list(APPEND pascal_flags "-k-z" "-knoexecstack") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_REQUIRED_FLAGS}") -endif() -unset(CMAKE_REQUIRED_FLAGS) - -#check for ASLR and DEP security features on Windows -#both supported in binutils >= 2.20, available since Vista and XP SP2 respectively -set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat -Wl,--dynamicbase") -check_c_compiler_flag("" HAVE_WINASLRDEP) #empty because we are testing a linker flag -if(HAVE_WINASLRDEP) - list(APPEND pascal_flags "-k--nxcompat" "-k--dynamicbase") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_REQUIRED_FLAGS}") -endif() -unset(CMAKE_REQUIRED_FLAGS) - #parse additional parameters if(FPFLAGS OR GHFLAGS) - if(${allow_parse_args}) + if(CMAKE_VERSION VERSION_GREATER "2.6") separate_arguments(fpflags_parsed UNIX_COMMAND ${FPFLAGS}) separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS}) else() - message(${WARNING} "FPFLAGS and GHFLAGS are available only when using CMake >= 2.8") + message("*** FPFLAGS and GHFLAGS are available only when using CMake >= 2.8 ***") endif() endif() diff -r 78f087fd3e5b -r fc46e75f6b72 ChangeLog.txt --- a/ChangeLog.txt Tue Jun 04 23:56:17 2013 +0200 +++ b/ChangeLog.txt Sun Jun 09 12:22:53 2013 +0200 @@ -1,6 +1,9 @@ + features * bugfixes +0.9.19 -> ???: + * increase precision in damage calcs; extra damage affects fire properly now + 0.9.18 -> 0.9.19: + New Freezer weapon - freezes terrain, water, hedgehogs, mines, cases, explosives + Saucer can aim weapons and fire underwater @@ -59,6 +62,7 @@ + Reduce amount of memory needed for engine to store land data + Countless other small fixes and improvements + Detect desyncs early + + Mudball will not cause any direct damage anymore * Fix cake getting stuck in barrels, crates and hedgehogs * Fix all knowns bugs which caused network game hang when players close engine or quit * Fix drill strike bug when drill's timer gets ridiculously high value instead of explosion diff -r 78f087fd3e5b -r fc46e75f6b72 QTfrontend/res/Hedgehog.png Binary file QTfrontend/res/Hedgehog.png has changed diff -r 78f087fd3e5b -r fc46e75f6b72 QTfrontend/ui/page/pagevideos.cpp --- a/QTfrontend/ui/page/pagevideos.cpp Tue Jun 04 23:56:17 2013 +0200 +++ b/QTfrontend/ui/page/pagevideos.cpp Sun Jun 09 12:22:53 2013 +0200 @@ -508,8 +508,8 @@ else { QString path = item->path(); - desc += tr("Date: %1\n").arg(QFileInfo(path).created().toString(Qt::DefaultLocaleLongDate)); - desc += tr("Size: %1\n").arg(FileSizeStr(path)); + desc += tr("Date: %1").arg(QFileInfo(path).created().toString(Qt::DefaultLocaleLongDate)) + "\n"; + desc += tr("Size: %1").arg(FileSizeStr(path)) + "\n"; if (item->desc.isEmpty()) { // Extract description from file; diff -r 78f087fd3e5b -r fc46e75f6b72 QTfrontend/ui/qaspectratiolayout.cpp --- a/QTfrontend/ui/qaspectratiolayout.cpp Tue Jun 04 23:56:17 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation. - */ - -#include "qaspectratiolayout.h" - -QAspectRatioLayout::QAspectRatioLayout(QWidget* parent, int spacing) : QLayout(parent) -{ - init(spacing); -} - -QAspectRatioLayout::QAspectRatioLayout(int spacing) -{ - init(spacing); -} - -QAspectRatioLayout::~QAspectRatioLayout() -{ - delete item; - delete lastReceivedRect; - delete _geometry; -} - -void QAspectRatioLayout::init(int spacing) -{ - item = 0; - lastReceivedRect = new QRect(0, 0, 0, 0); - _geometry = new QRect(0, 0, 0, 0); - setSpacing(spacing); -} - - -/* Adds item if place isn't already taken. */ -void QAspectRatioLayout::add(QLayoutItem* item) -{ - if(!hasItem()) - { - replaceItem(item); - } -} - -/* Adds item if place isn't already taken. */ -void QAspectRatioLayout::addItem(QLayoutItem* item) -{ - if(!hasItem()) - { - replaceItem(item); - } -} - -/* Adds widget if place isn't already taken. */ -void QAspectRatioLayout::addWidget(QWidget* widget) -{ - if(!hasItem()) - { - replaceItem(new QWidgetItem(widget)); - } -} - -/* Returns the item pointer and dereferences it here. */ -QLayoutItem* QAspectRatioLayout::take() -{ - QLayoutItem* item = 0; - if(this->hasItem()) - { - item = this->item; - this->item = 0; - } - return item; -} - -/* Returns the item pointer and dereferences it here. */ -QLayoutItem* QAspectRatioLayout::takeAt(int index) -{ - if(index != 0) - { - return 0; - } - return this->take(); -} - -/* Returns the item pointer. */ -QLayoutItem* QAspectRatioLayout::itemAt(int index) const -{ - if(index != 0) - { - return 0; - } - if(hasItem()) - { - return this->item; - } - return 0; -} - -/* Checks if we have an item. */ -bool QAspectRatioLayout::hasItem() const -{ - return this->item != 0; -} - -/* Returns the count of items which can be either 0 or 1. */ -int QAspectRatioLayout::count() const -{ - int returnValue = 0; - if(hasItem()) - { - returnValue = 1; - } - return returnValue; -} - -/* Replaces the item with the new and returns the old. */ -QLayoutItem* QAspectRatioLayout::replaceItem(QLayoutItem* item) -{ - QLayoutItem* old = 0; - if(this->hasItem()) - { - old = this->item; - } - this->item = item; - setGeometry(*this->_geometry); - return old; -} - -/* Tells which way layout expands. */ -Qt::Orientations QAspectRatioLayout::expandingDirections() const -{ - return Qt::Horizontal | Qt::Vertical; -} - -/* Tells which size is preferred. */ -QSize QAspectRatioLayout::sizeHint() const -{ - return this->item->minimumSize(); -} - -/* Tells minimum size. */ -QSize QAspectRatioLayout::minimumSize() const -{ - return this->item->minimumSize(); -} - -/* - * Tells if heightForWidth calculations is handled. - * It isn't since width isn't enough to calculate - * proper size. - */ -bool QAspectRatioLayout::hasHeightForWidth() const -{ - return false; -} - -/* Replaces lastReceivedRect. */ -void QAspectRatioLayout::setLastReceivedRect(const QRect& rect) -{ - QRect* oldRect = this->lastReceivedRect; - this->lastReceivedRect = new QRect(rect.topLeft(), rect.size()); - delete oldRect; -} - -/* Returns geometry */ -QRect QAspectRatioLayout::geometry() -{ - return QRect(*this->_geometry); -} - -/* Sets geometry to given size. */ -void QAspectRatioLayout::setGeometry(const QRect& rect) -{ - /* - * We check if the item is set and - * if size is the same previously received. - * If either is false nothing is done. - */ - if(!this->hasItem() || - areRectsEqual(*this->lastReceivedRect, rect)) - { - return; - } - /* Replace the last received rectangle. */ - setLastReceivedRect(rect); - /* Calculate proper size for the item relative to the received size. */ - QSize properSize = calculateProperSize(rect.size()); - /* Calculate center location in the rect and with item size. */ - QPoint properLocation = calculateCenterLocation(rect.size(), properSize); - /* Set items geometry */ - this->item->setGeometry(QRect(properLocation, properSize)); - QRect* oldRect = this->_geometry; - /* Cache the calculated geometry. */ - this->_geometry = new QRect(properLocation, properSize); - delete oldRect; - /* Super classes setGeometry */ - QLayout::setGeometry(*this->_geometry); -} - -/* Takes the shortest side and creates QSize - * with the shortest side as width and height. */ -QSize QAspectRatioLayout::calculateProperSize(QSize from) const -{ - QSize properSize; - if(from.height() * 2 < from.width()) - { - properSize.setHeight(from.height() - this->margin()); - properSize.setWidth(from.height() * 2 - this->margin()); - } - else - { - properSize.setWidth(from.width() - this->margin()); - properSize.setHeight(from.width() / 2 - this->margin()); - } - return properSize; -} - -/* Calculates center location from the given height and width for item size. */ -QPoint QAspectRatioLayout::calculateCenterLocation(QSize from, - QSize itemSize) const -{ - QPoint centerLocation; - if((from.width() - itemSize.width()) > 0) - { - centerLocation.setX((from.width() - itemSize.width())/2); - } - if((from.height() - itemSize.height()) > 0) - { - centerLocation.setY((from.height() - itemSize.height())/2); - } - return centerLocation; -} - -/* Compares if two QRects are equal. */ -bool QAspectRatioLayout::areRectsEqual(const QRect& a, - const QRect& b) const -{ - bool result = false; - if(a.x() == b.x() && - a.y() == b.y() && - a.height() == b.height() && - a.width() == b.width()) - { - result = true; - } - return result; -} diff -r 78f087fd3e5b -r fc46e75f6b72 QTfrontend/ui/qaspectratiolayout.h --- a/QTfrontend/ui/qaspectratiolayout.h Tue Jun 04 23:56:17 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation. - */ - -#ifndef QASPECTRATIOLAYOUT_H_ -#define QASPECTRATIOLAYOUT_H_ - -#include -#include -#include -#include -#include - - -class QAspectRatioLayout : public QLayout -{ - Q_OBJECT - - public: - QAspectRatioLayout(QWidget* parent, int spacing =-1); - QAspectRatioLayout(int spacing = -1); - ~QAspectRatioLayout(); - - /* Convenience method */ - virtual void add(QLayoutItem* item); - - /* http://doc.trolltech.com/qlayout.html#addItem */ - virtual void addItem(QLayoutItem* item); - /* http://doc.trolltech.com/qlayout.html#addWidget */ - virtual void addWidget(QWidget* widget); - /* http://doc.trolltech.com/qlayout.html#takeAt */ - virtual QLayoutItem* takeAt(int index); - /* http://doc.trolltech.com/qlayout.html#itemAt */ - virtual QLayoutItem* itemAt(int index) const; - /* http://doc.trolltech.com/qlayout.html#count */ - virtual int count() const; - - /* - * These are ours since we do have only one item. - */ - virtual QLayoutItem* replaceItem(QLayoutItem* item); - virtual QLayoutItem* take(); - virtual bool hasItem() const; - - /* http://doc.trolltech.com/qlayout.html#expandingDirections */ - virtual Qt::Orientations expandingDirections() const; - - /* - * This method contains most of the juice of this article. - * http://doc.trolltech.com/qlayoutitem.html#setGeometry - */ - virtual void setGeometry(const QRect& rect); - /* http://doc.trolltech.com/qlayoutitem.html#geometry */ - virtual QRect geometry(); - - /* http://doc.trolltech.com/qlayoutitem.html#sizeHint */ - virtual QSize sizeHint() const; - /* http://doc.trolltech.com/qlayout.html#minimumSize */ - virtual QSize minimumSize() const; - /* http://doc.trolltech.com/qlayoutitem.html#hasHeightForWidth */ - virtual bool hasHeightForWidth() const; - - private: - /* Saves the last received rect. */ - void setLastReceivedRect(const QRect& rect); - /* Used to initialize the object. */ - void init(int spacing); - /* Calculates the maximum size for the item from the assigned size. */ - QSize calculateProperSize(QSize from) const; - /* Calculates the center location from the assigned size and - * the items size. */ - QPoint calculateCenterLocation(QSize from, QSize itemSize) const; - /* Check if two QRects are equal */ - bool areRectsEqual(const QRect& a, const QRect& b) const; - /* Contains item reference */ - QLayoutItem* item; - /* - * Used for caching so we won't do calculations every time - * setGeometry is called. - */ - QRect* lastReceivedRect; - /* Contains geometry */ - QRect* _geometry; - -}; - -#endif /* QASPECTRATIOLAYOUT_H_ */ diff -r 78f087fd3e5b -r fc46e75f6b72 QTfrontend/ui/widget/about.cpp --- a/QTfrontend/ui/widget/about.cpp Tue Jun 04 23:56:17 2013 +0200 +++ b/QTfrontend/ui/widget/about.cpp Sun Jun 09 12:22:53 2013 +0200 @@ -52,11 +52,8 @@ QLabel *imageLabel = new QLabel; QImage image(":/res/Hedgehog.png"); imageLabel->setPixmap(QPixmap::fromImage(image)); - imageLabel->setScaledContents(true); - imageLabel->setMinimumWidth(2.8); - imageLabel->setMaximumWidth(280); - imageLabel->setMinimumHeight(30); - imageLabel->setMaximumHeight(300); + imageLabel->setFixedWidth(273); + imageLabel->setFixedHeight(300); leftLayout->addWidget(imageLabel, 0, Qt::AlignHCenter); diff -r 78f087fd3e5b -r fc46e75f6b72 QTfrontend/ui/widget/chatwidget.cpp --- a/QTfrontend/ui/widget/chatwidget.cpp Tue Jun 04 23:56:17 2013 +0200 +++ b/QTfrontend/ui/widget/chatwidget.cpp Sun Jun 09 12:22:53 2013 +0200 @@ -176,7 +176,7 @@ QWidget(parent), mainLayout(this) { - this->gameSettings = gameSettings; + this->gameSettings = NULL; this->notify = notify; m_isAdmin = false; diff -r 78f087fd3e5b -r fc46e75f6b72 QTfrontend/ui/widget/drawmapwidget.cpp --- a/QTfrontend/ui/widget/drawmapwidget.cpp Tue Jun 04 23:56:17 2013 +0200 +++ b/QTfrontend/ui/widget/drawmapwidget.cpp Sun Jun 09 12:22:53 2013 +0200 @@ -62,8 +62,43 @@ { Q_UNUSED(event); + int height = this->height(); + int width = this->width(); + + if ((m_scene->height() > 0) && (m_scene->width() > 0) && (height > 0)) + { + qreal saspect = m_scene->width() / m_scene->height(); + + qreal h = height; + qreal w = width; + qreal waspect = w / h; + + if (waspect < saspect) + { + h = w / saspect; + } + else if (waspect > saspect) + { + w = saspect * h; + } + + int fixedh = (int)h; + int fixedw = (int)w; + + if (ui->graphicsView->width() != fixedw) + { + ui->graphicsView->setFixedWidth(fixedw); + } + + if (ui->graphicsView->height() != fixedh) + { + ui->graphicsView->setFixedHeight(fixedh); + } + + } + if(ui->graphicsView && ui->graphicsView->scene()) - ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio); + ui->graphicsView->fitInView(m_scene->sceneRect(), Qt::KeepAspectRatio); } void DrawMapWidget::showEvent(QShowEvent * event) diff -r 78f087fd3e5b -r fc46e75f6b72 QTfrontend/ui/widget/drawmapwidget.h --- a/QTfrontend/ui/widget/drawmapwidget.h Tue Jun 04 23:56:17 2013 +0200 +++ b/QTfrontend/ui/widget/drawmapwidget.h Sun Jun 09 12:22:53 2013 +0200 @@ -25,7 +25,6 @@ #include #include -#include "qaspectratiolayout.h" #include "drawmapscene.h" @@ -61,12 +60,13 @@ QVBoxLayout * vbox = new QVBoxLayout(drawMapWidget); vbox->setMargin(0); lblPoints = new QLabel("0", drawMapWidget); - vbox->addWidget(lblPoints); - QAspectRatioLayout * arLayout = new QAspectRatioLayout(); - arLayout->setMargin(0); + QLayout * arLayout = new QVBoxLayout(); + arLayout->setAlignment(Qt::AlignCenter); vbox->addLayout(arLayout); graphicsView = new DrawMapView(drawMapWidget); + graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); arLayout->addWidget(graphicsView); retranslateUi(drawMapWidget); diff -r 78f087fd3e5b -r fc46e75f6b72 QTfrontend/util/LibavInteraction.cpp --- a/QTfrontend/util/LibavInteraction.cpp Tue Jun 04 23:56:17 2013 +0200 +++ b/QTfrontend/util/LibavInteraction.cpp Sun Jun 09 12:22:53 2013 +0200 @@ -278,7 +278,7 @@ return ""; int s = float(pContext->duration)/AV_TIME_BASE; - QString desc = QString(tr("Duration: %1m %2s\n")).arg(s/60).arg(s%60); + QString desc = tr("Duration: %1m %2s").arg(s/60).arg(s%60) + "\n"; for (int i = 0; i < (int)pContext->nb_streams; i++) { AVStream* pStream = pContext->streams[i]; @@ -290,11 +290,11 @@ if (pCodec->codec_type == AVMEDIA_TYPE_VIDEO) { - desc += QString(tr("Video: %1x%2, ")).arg(pCodec->width).arg(pCodec->height); + desc += QString(tr("Video: %1x%2")).arg(pCodec->width).arg(pCodec->height) + ", "; if (pStream->avg_frame_rate.den) { float fps = float(pStream->avg_frame_rate.num)/pStream->avg_frame_rate.den; - desc += QString(tr("%1 fps, ")).arg(fps, 0, 'f', 2); + desc += QString(tr("%1 fps")).arg(fps, 0, 'f', 2) + ", "; } } else if (pCodec->codec_type == AVMEDIA_TYPE_AUDIO) diff -r 78f087fd3e5b -r fc46e75f6b72 cmake_modules/compilerchecks.cmake --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake_modules/compilerchecks.cmake Sun Jun 09 12:22:53 2013 +0200 @@ -0,0 +1,75 @@ + +#TESTING TIME +include(CheckCCompilerFlag) +#when you need to check for a linker flag, just leave the argument of "check_c_compiler_flag" empty + +# CMAKE_C{XX}_FLAGS is for compiler flags (c and c++) +# CMAKE_EXE_LINKER_FLAGS is for linker flags (also add them to pascal_flags and haskell_flags) + + +#TODO: should there be two different checks for C and CXX? + +#stack protection +check_c_compiler_flag("-fstack-protector" HAVE_STACKPROTECTOR) +if(HAVE_STACKPROTECTOR) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector") +endif() + +#symbol visibility +check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITYH) +if(HAVE_VISIBILITYH) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") +endif() + + +#check for noexecstack on ELF, Gentoo security +set(CMAKE_REQUIRED_FLAGS "-Wl,-z,noexecstack") +check_c_compiler_flag("" HAVE_NOEXECSTACK) +if(HAVE_NOEXECSTACK) + list(APPEND pascal_flags "-k-z" "-knoexecstack") + list(APPEND haskell_flags "-optl" "-z" "-optl" "noexecstack") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}") +endif() + +#check for full relro on ELF, Debian security +set(CMAKE_REQUIRED_FLAGS "-Wl,-z,relro,-z,now") +check_c_compiler_flag("" HAVE_RELROFULL) +if(HAVE_RELROFULL) + list(APPEND pascal_flags "-k-z" "-krelro" "-k-z" "-know") + list(APPEND haskell_flags "-optl" "-z" "-optl" "relro" "-optl" "-z" "-optl" "now") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}") +else() + #if full relro is not available, try partial relro + set(CMAKE_REQUIRED_FLAGS "-Wl,-z,relro") + check_c_compiler_flag("" HAVE_RELROPARTIAL) + if(HAVE_RELROPARTIAL) + list(APPEND pascal_flags "-k-z" "-krelro") + list(APPEND haskell_flags "-optl" "-z" "-optl" "relro") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}") + endif() +endif() + +#check for ASLR on Windows Vista or later, requires binutils >= 2.20 +set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat") +check_c_compiler_flag("" HAVE_WINASLR) +if(HAVE_WINASLR) + list(APPEND pascal_flags "-k--nxcompat") + list(APPEND haskell_flags "-optl" "--nxcompat") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}") +endif() + +#check for DEP on Windows XP SP2 or later, requires binutils >= 2.20 +set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase") +check_c_compiler_flag("" HAVE_WINDEP) +if(HAVE_WINDEP) + list(APPEND pascal_flags "-k--dynamicbase") + list(APPEND haskell_flags "-optl" "--dynamicbase") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}") +endif() + + +#always unset or these flags will be spread everywhere +unset(CMAKE_REQUIRED_FLAGS) + diff -r 78f087fd3e5b -r fc46e75f6b72 cmake_modules/platform.cmake --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake_modules/platform.cmake Sun Jun 09 12:22:53 2013 +0200 @@ -0,0 +1,80 @@ + +if(APPLE) + set(CMAKE_FIND_FRAMEWORK "FIRST") + +#what system are we building for + set(minimum_macosx_version $ENV{MACOSX_DEPLOYMENT_TARGET}) + +#detect on which system we are: if sw_vers cannot be found for any reason (re)use minimum_macosx_version + find_program(sw_vers sw_vers) + if(sw_vers) + execute_process(COMMAND ${sw_vers} "-productVersion" + OUTPUT_VARIABLE current_macosx_version + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" current_macosx_version ${current_macosx_version}) + else() + if(NOT minimum_macosx_version) + message(FATAL_ERROR "sw_vers not found! Need explicit MACOSX_DEPLOYMENT_TARGET variable set") + else() + message("*** sw_vers not found! Fallback to MACOSX_DEPLOYMENT_TARGET variable ***") + set(current_macosx_version ${minimum_macosx_version}) + endif() + endif() + +#if nothing is set, we deploy only for the current system + if(NOT minimum_macosx_version) + set(minimum_macosx_version ${current_macosx_version}) + endif() + +#lower systems don't have enough processing power anyway + if (minimum_macosx_version VERSION_LESS "10.4") + message(FATAL_ERROR "Hedgewars is not supported on Mac OS X pre-10.4") + endif() + +#workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2) + if(current_macosx_version VERSION_EQUAL "10.4") + find_package(SDL_mixer REQUIRED) + set(DYLIB_SMPEG "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg") + set(DYLIB_MIKMOD "-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod") + set(CMAKE_C_FLAGS "${DYLIB_SMPEG} ${DYLIB_MIKMOD}") + list(APPEND pascal_flags "-k${DYLIB_SMPEG}" "-k${DYLIB_MIKMOD}") + endif() + +#CMAKE_OSX_ARCHITECTURES and CMAKE_OSX_SYSROOT need to be set for universal binary and correct linking + if(NOT CMAKE_OSX_ARCHITECTURES) + if(current_macosx_version VERSION_LESS "10.6") + if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "powerpc*") + set(CMAKE_OSX_ARCHITECTURES "ppc7400") + else() + set(CMAKE_OSX_ARCHITECTURES "i386") + endif() + else() + set(CMAKE_OSX_ARCHITECTURES "x86_64") + endif() + endif() + +#CMAKE_OSX_SYSROOT is set at the system version we are supposed to build on +#we need to provide the correct one when host and target differ + if(NOT ${minimum_macosx_version} VERSION_EQUAL ${current_macosx_version}) + if(minimum_macosx_version VERSION_EQUAL "10.4") + set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/") + set(CMAKE_C_COMPILER "/Developer/usr/bin/gcc-4.0") + set(CMAKE_CXX_COMPILER "/Developer/usr/bin/g++-4.0") + else() + string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" sdk_version ${minimum_macosx_version}) + set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/") + endif() + endif() + +#add user framework directory, other paths can be passed via FPFLAGS + list(APPEND pascal_flags "-Ff~/Library/Frameworks") +#set deployment target + list(APPEND pascal_flags "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}") + +endif(APPLE) + +if(WINDOWS) + #this flags prevents a few dll hell problems + set(CMAKE_C_FLAGS "-static-libgcc ${CMAKE_C_FLAGS}") +endif(WINDOWS) + diff -r 78f087fd3e5b -r fc46e75f6b72 cmake_modules/revinfo.cmake --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake_modules/revinfo.cmake Sun Jun 09 12:22:53 2013 +0200 @@ -0,0 +1,38 @@ +#detect Mercurial revision and init rev/hash information +find_program(HGCOMMAND hg) +if(HGCOMMAND AND (EXISTS ${CMAKE_SOURCE_DIR}/.hg)) + execute_process(COMMAND ${HGCOMMAND} identify -in + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE internal_version + ERROR_QUIET + ) + #check local repo status + string(REGEX REPLACE "[^+]" "" HGCHANGED ${internal_version}) + string(REGEX REPLACE "[0-9a-zA-Z]+(.*) ([0-9]+)(.*)" "\\2" HEDGEWARS_REVISION ${internal_version}) + string(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" HEDGEWARS_HASH ${internal_version}) + + if(HGCHANGED) + message("*** You have uncommitted changes in your repository ***") + endif() + #let's assume that if you have hg you might be interested in debugging + set(default_build_type "DEBUG") + #write down hash and rev for easy picking should hg be missing + file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${HEDGEWARS_REVISION}\nhash ${HEDGEWARS_HASH}\n") +else() + set(default_build_type "RELEASE") + # when compiling outside rev control, fetch revision and hash information from version_info.txt + find_file(version_info version_info.txt PATH ${CMAKE_SOURCE_DIR}/share) + if(version_info) + file(STRINGS ${version_info} internal_version REGEX "rev") + string(REGEX REPLACE "rev ([0-9]*)" "\\1" HEDGEWARS_REVISION ${internal_version}) + file(STRINGS ${version_info} internal_version REGEX "hash") + string(REGEX REPLACE "hash ([a-zA-Z0-9]*)" "\\1" HEDGEWARS_HASH ${internal_version}) + else() + message(WARNING "${CMAKE_SOURCE_DIR}/share/version_info.txt not found, revision information " + "will be incorrect!!! Contact your source provider to fix this!") + set(HEDGEWARS_REVISION "0000") + set(HEDGEWARS_HASH "unknown") + endif() +endif() + + diff -r 78f087fd3e5b -r fc46e75f6b72 gameServer/Actions.hs --- a/gameServer/Actions.hs Tue Jun 04 23:56:17 2013 +0200 +++ b/gameServer/Actions.hs Sun Jun 09 12:22:53 2013 +0200 @@ -162,7 +162,13 @@ rnc <- gets roomsClients io $ do - modifyClient rnc (\cl -> cl{teamsInGame = 0, isReady = False, isMaster = False, isInGame = False, clientClan = Nothing}) ci + modifyClient rnc ( + \cl -> cl{teamsInGame = 0 + , isReady = False + , isMaster = False + , isInGame = False + , isJoinedMidGame = False + , clientClan = Nothing}) ci modifyRoom rnc (\r -> r{playersIn = playersIn r + 1}) ri moveClientToRoom rnc ri ci @@ -290,7 +296,7 @@ pr <- client's clientProto mapM_ processAction [ AnswerClients (map sendChan roomPlayers) $ notReadyMessage pr . map nick . filter (not . isMaster) $ roomPlayers - , ModifyRoomClients (\cl -> cl{isReady = isMaster cl}) + , ModifyRoomClients (\cl -> cl{isReady = isMaster cl, isJoinedMidGame = False}) , ModifyRoom (\r -> r{readyPlayers = 1}) ] where @@ -301,10 +307,17 @@ rnc <- gets roomsClients ri <- clientRoomA thisRoomChans <- liftM (map sendChan) $ roomClientsS ri + joinedMidGame <- liftM (filter isJoinedMidGame) $ roomClientsS ri answerRemovedTeams <- io $ - room'sM rnc (map (\t -> AnswerClients thisRoomChans ["REMOVE_TEAM", t]) . leftTeams . fromJust . gameInfo) ri + room'sM rnc (\r -> let gi = fromJust $ gameInfo r in + concatMap (\c -> + (answerFullConfigParams c (mapParams r) (params r)) + ++ + (map (\t -> AnswerClients [sendChan c] ["REMOVE_TEAM", t]) $ leftTeams gi) + ) joinedMidGame + ) ri - mapM_ processAction $ + mapM_ processAction $ ( SaveReplay : ModifyRoom (\r -> r{ @@ -312,10 +325,11 @@ readyPlayers = 0 } ) - : UnreadyRoomClients : SendUpdateOnThisRoom : AnswerClients thisRoomChans ["ROUND_FINISHED"] : answerRemovedTeams + ) + ++ [UnreadyRoomClients] processAction (SendTeamRemovalMessage teamName) = do diff -r 78f087fd3e5b -r fc46e75f6b72 gameServer/CoreTypes.hs --- a/gameServer/CoreTypes.hs Tue Jun 04 23:56:17 2013 +0200 +++ b/gameServer/CoreTypes.hs Sun Jun 09 12:22:53 2013 +0200 @@ -107,6 +107,7 @@ isAdministrator :: Bool, isChecker :: Bool, isKickedFromServer :: Bool, + isJoinedMidGame :: Bool, clientClan :: !(Maybe B.ByteString), checkInfo :: Maybe CheckInfo, teamsInGame :: Word diff -r 78f087fd3e5b -r fc46e75f6b72 gameServer/HWProtoChecker.hs --- a/gameServer/HWProtoChecker.hs Tue Jun 04 23:56:17 2013 +0200 +++ b/gameServer/HWProtoChecker.hs Sun Jun 09 12:22:53 2013 +0200 @@ -1,17 +1,12 @@ {-# LANGUAGE OverloadedStrings #-} module HWProtoChecker where -import qualified Data.Map as Map import Data.Maybe -import Data.List import Control.Monad.Reader -------------------------------------- import CoreTypes import Actions -import Utils import HandlerUtils -import RoomsAndClients -import EngineInteraction handleCmd_checker :: CmdHandler diff -r 78f087fd3e5b -r fc46e75f6b72 gameServer/HWProtoLobbyState.hs --- a/gameServer/HWProtoLobbyState.hs Tue Jun 04 23:56:17 2013 +0200 +++ b/gameServer/HWProtoLobbyState.hs Sun Jun 09 12:22:53 2013 +0200 @@ -1,7 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} module HWProtoLobbyState where -import qualified Data.Map as Map import Data.Maybe import Data.List import Control.Monad.Reader @@ -51,7 +50,7 @@ [ AddRoom rName roomPassword , AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+hr", nick cl] - , ModifyClient (\c -> c{isMaster = True, isReady = True}) + , ModifyClient (\c -> c{isMaster = True, isReady = True, isJoinedMidGame = False}) , ModifyRoom (\r -> r{readyPlayers = 1}) ] @@ -87,12 +86,13 @@ else [ MoveToRoom jRI + , ModifyClient (\c -> c{isJoinedMidGame = isJust $ gameInfo jRoom}) , AnswerClients [sendChan cl] $ "JOINED" : nicks , AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl] , AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick] ] ++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients]) - ++ answerFullConfig cl (mapParams jRoom) (params jRoom) + ++ answerFullConfig cl jRoom ++ answerTeams cl jRoom ++ watchRound cl jRoom chans @@ -105,18 +105,9 @@ (ingame, inroomlobby) = partition isInGame clients f fl lst = ["CLIENT_FLAGS" : fl : map nick lst | not $ null lst] - toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs - - answerFullConfig cl mpr pr - | clientProto cl < 38 = map (toAnswer cl) $ - (reverse . map (\(a, b) -> (a, [b])) $ Map.toList mpr) - ++ (("SCHEME", pr Map.! "SCHEME") - : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr)) - - | otherwise = map (toAnswer cl) $ - ("FULLMAPCONFIG", Map.elems mpr) - : ("SCHEME", pr Map.! "SCHEME") - : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr) + -- get config from gameInfo if possible, otherwise from room + answerFullConfig cl jRoom = let f r g = (if isJust $ gameInfo jRoom then g . fromJust . gameInfo else r) jRoom + in answerFullConfigParams cl (f mapParams giMapParams) (f params giParams) answerTeams cl jRoom = let f = if isJust $ gameInfo jRoom then teamsAtStart . fromJust . gameInfo else teams in answerAllTeams cl $ f jRoom diff -r 78f087fd3e5b -r fc46e75f6b72 gameServer/HandlerUtils.hs --- a/gameServer/HandlerUtils.hs Tue Jun 04 23:56:17 2013 +0200 +++ b/gameServer/HandlerUtils.hs Sun Jun 09 12:22:53 2013 +0200 @@ -6,7 +6,7 @@ import RoomsAndClients import CoreTypes -import Actions + thisClient :: Reader (ClientIndex, IRnC) ClientInfo thisClient = do diff -r 78f087fd3e5b -r fc46e75f6b72 gameServer/NetRoutines.hs --- a/gameServer/NetRoutines.hs Tue Jun 04 23:56:17 2013 +0200 +++ b/gameServer/NetRoutines.hs Sun Jun 09 12:22:53 2013 +0200 @@ -44,6 +44,7 @@ False False False + False Nothing Nothing 0 diff -r 78f087fd3e5b -r fc46e75f6b72 gameServer/Utils.hs --- a/gameServer/Utils.hs Tue Jun 04 23:56:17 2013 +0200 +++ b/gameServer/Utils.hs Sun Jun 09 12:22:53 2013 +0200 @@ -137,5 +137,25 @@ head (Map.findWithDefault ["Default"] "AMMO" (params r)) ] + +answerFullConfigParams :: + ClientInfo + -> Map.Map B.ByteString B.ByteString + -> Map.Map B.ByteString [B.ByteString] + -> [Action] +answerFullConfigParams cl mpr pr + | clientProto cl < 38 = map (toAnswer cl) $ + (reverse . map (\(a, b) -> (a, [b])) $ Map.toList mpr) + ++ (("SCHEME", pr Map.! "SCHEME") + : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr)) + + | otherwise = map (toAnswer cl) $ + ("FULLMAPCONFIG", Map.elems mpr) + : ("SCHEME", pr Map.! "SCHEME") + : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr) + where + toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs + + loc :: B.ByteString -> B.ByteString loc = id diff -r 78f087fd3e5b -r fc46e75f6b72 hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Tue Jun 04 23:56:17 2013 +0200 +++ b/hedgewars/CMakeLists.txt Sun Jun 09 12:22:53 2013 +0200 @@ -103,7 +103,7 @@ ) if(${LIBENGINE}) - message(${WARNING} "Engine will be built as library (experimental)") + message("*** Engine will be built as library (experimental) ***") list(APPEND pascal_flags "-dHWLIBRARY") # create position independent code, only required for x68_64 builds, similar to -fPIC diff -r 78f087fd3e5b -r fc46e75f6b72 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Tue Jun 04 23:56:17 2013 +0200 +++ b/hedgewars/GSHandlers.inc Sun Jun 09 12:22:53 2013 +0200 @@ -5135,20 +5135,20 @@ end; procedure doStepIceGun(Gear: PGear); -const iceWaitCollision:Longint = 0; -const iceCollideWithGround:Longint = 1; +const iceWaitCollision = 0; +const iceCollideWithGround = 1; //const iceWaitNextTarget:Longint = 2; //const iceCollideWithHog:Longint = 4; -const iceCollideWithWater:Longint = 5; +const iceCollideWithWater = 5; //const waterFreezingTime:Longint = 500; -const groundFreezingTime:Longint = 1000; +const groundFreezingTime = 1000; const iceRadius = 32; const iceHeight = 40; var HHGear, iter: PGear; landRect: TSDL_Rect; ndX, ndY: hwFloat; - i, j, t, gX, gY: LongInt; + i, t, gX, gY: LongInt; hogs: PGearArrayS; vg: PVisualGear; begin @@ -5231,7 +5231,7 @@ if vg <> nil then begin i:= random(100) + 155; - vg^.Tint:= i shl 24 or i shl 16 or $FF shl 8 or Longword(random(200) + 55); + vg^.Tint:= (i shl 24) or (i shl 16) or ($FF shl 8) or (random(200) + 55); vg^.Angle:= random(360); vg^.dx:= 0.001 * random(80); vg^.dy:= 0.001 * random(80) diff -r 78f087fd3e5b -r fc46e75f6b72 hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Tue Jun 04 23:56:17 2013 +0200 +++ b/hedgewars/uAIAmmoTests.pas Sun Jun 09 12:22:53 2013 +0200 @@ -20,7 +20,7 @@ unit uAIAmmoTests; interface -uses SDLh, uConsts, uFloat, uTypes, uAIMisc; +uses uConsts, uFloat, uTypes, uAIMisc; const amtest_Rare = $00000001; // check only several positions amtest_NoTarget = $00000002; // each pos, but no targetting @@ -330,7 +330,7 @@ function TestMolotov(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; var Vx, Vy, r: real; Score, EX, EY, valueResult: LongInt; - TestTime: Longword; + TestTime: LongInt; x, y, dY, meX, meY: real; t: LongInt; begin @@ -382,7 +382,7 @@ const tDelta = 24; var Vx, Vy, r: real; Score, EX, EY, valueResult: LongInt; - TestTime: Longword; + TestTime: LongInt; x, y, meX, meY, dY: real; t: LongInt; begin @@ -681,7 +681,7 @@ function TestDesertEagle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; var Vx, Vy, x, y, t: real; d: Longword; - fallDmg, valueResult: LongInt; + {fallDmg, }valueResult: LongInt; begin if (Level > 4) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) then exit(BadTurn); Level:= Level; // avoid compiler hint @@ -724,7 +724,7 @@ function TestSniperRifle(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams): LongInt; var Vx, Vy, x, y, t, dmg: real; d: Longword; - fallDmg: LongInt; + //fallDmg: LongInt; begin if (Level > 3) or (Targ.Score < 0) or (Targ.Kind <> gtHedgehog) then exit(BadTurn); Level:= Level; // avoid compiler hint diff -r 78f087fd3e5b -r fc46e75f6b72 hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Tue Jun 04 23:56:17 2013 +0200 +++ b/hedgewars/uAIMisc.pas Sun Jun 09 12:22:53 2013 +0200 @@ -117,7 +117,7 @@ Targets.reset:= false; end; procedure FillTargets; -var i, t: Longword; +var //i, t: Longword; f, e: LongInt; Gear: PGear; begin diff -r 78f087fd3e5b -r fc46e75f6b72 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Tue Jun 04 23:56:17 2013 +0200 +++ b/hedgewars/uChat.pas Sun Jun 09 12:22:53 2013 +0200 @@ -48,8 +48,8 @@ LocalStrs: array[0 .. MaxStrIndex] of shortstring; missedCount: LongWord; lastStr: LongWord; - localLastStr: LongWord; - history: LongWord; + localLastStr: LongInt; + history: LongInt; visibleCount: LongWord; InputStr: TChatLine; InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char diff -r 78f087fd3e5b -r fc46e75f6b72 hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Tue Jun 04 23:56:17 2013 +0200 +++ b/hedgewars/uGearsHedgehog.pas Sun Jun 09 12:22:53 2013 +0200 @@ -807,7 +807,8 @@ var da: LongWord; begin with HHGear^.Hedgehog^ do - if ((CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amRope) and ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving)) + if (((CurAmmoType = amRope) or ((CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amRope))) and + ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving)) or ((CurAmmoType = amPortalGun) and ((HHGear^.State and gstMoving) <> 0)) then da:= 2 else da:= 1; diff -r 78f087fd3e5b -r fc46e75f6b72 hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Tue Jun 04 23:56:17 2013 +0200 +++ b/hedgewars/uGearsUtils.pas Sun Jun 09 12:22:53 2013 +0200 @@ -183,9 +183,9 @@ if (CurrentHedgehog <> nil) and CurrentHedgehog^.King then i:= _1_5; if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.King or (Gear^.Hedgehog^.Effects[heFrozen] > 0)) then - ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent * _0_5) + ModifyDamage:= hwRound(cDamageModifier * dmg * i * cDamagePercent * _0_5 * _0_01) else - ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent) + ModifyDamage:= hwRound(cDamageModifier * dmg * i * cDamagePercent * _0_01) end; procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource); diff -r 78f087fd3e5b -r fc46e75f6b72 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Tue Jun 04 23:56:17 2013 +0200 +++ b/hedgewars/uTeams.pas Sun Jun 09 12:22:53 2013 +0200 @@ -110,7 +110,7 @@ end; procedure SwitchHedgehog; -var c, i, t, j: LongWord; +var c, i, t: LongWord; PrevHH, PrevTeam : LongWord; begin TargetPoint.X:= NoPointX; @@ -190,18 +190,22 @@ CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber; until ((Hedgehogs[CurrHedgehog].Gear <> nil) and (Hedgehogs[CurrHedgehog].Effects[heFrozen] < 256)) or (CurrHedgehog = PrevHH) end - until ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] < 50256)) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0)) + until ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] < 256)) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0)) end; if (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear = nil) or (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] > 255) then begin - inc(CurrentTeam^.Clan^.TurnNumber); with CurrentTeam^.Clan^ do for t:= 0 to Pred(TeamsNumber) do with Teams[t]^ do for i:= 0 to Pred(HedgehogsNumber) do with Hedgehogs[i] do - if Effects[heFrozen] > 255 then - Effects[heFrozen]:= max(255,Effects[heFrozen]-50000) + begin + if Effects[heFrozen] > 255 then Effects[heFrozen]:= max(255,Effects[heFrozen]-50000); + if (Gear <> nil) and (Effects[heFrozen] < 256) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] > 255) then + CurrHedgehog:= i + end; + if (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear = nil) or (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] > 255) then + inc(CurrentTeam^.Clan^.TurnNumber); end until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] < 256); diff -r 78f087fd3e5b -r fc46e75f6b72 misc/libphysfs/CMakeLists.txt --- a/misc/libphysfs/CMakeLists.txt Tue Jun 04 23:56:17 2013 +0200 +++ b/misc/libphysfs/CMakeLists.txt Sun Jun 09 12:22:53 2013 +0200 @@ -60,7 +60,7 @@ # Add some gcc-specific command lines. if(CMAKE_COMPILER_IS_GNUCC) # Always build with debug symbols...you can strip it later. - add_definitions(-g -pipe -Werror -fsigned-char) + add_definitions(-g -fsigned-char) # Stupid BeOS generates warnings in the system headers. if(NOT BEOS) diff -r 78f087fd3e5b -r fc46e75f6b72 project_files/hedgewars.pro --- a/project_files/hedgewars.pro Tue Jun 04 23:56:17 2013 +0200 +++ b/project_files/hedgewars.pro Sun Jun 09 12:22:53 2013 +0200 @@ -44,7 +44,6 @@ ../QTfrontend/ui/page/pagenetserver.h \ ../QTfrontend/ui/page/pagegamestats.h \ ../QTfrontend/ui/dialog/input_ip.h \ - ../QTfrontend/ui/qaspectratiolayout.h \ ../QTfrontend/ui/widget/bgwidget.h \ ../QTfrontend/ui/widget/fpsedit.h \ ../QTfrontend/ui/widget/FreqSpinBox.h \ @@ -123,7 +122,6 @@ ../QTfrontend/model/MapModel.cpp \ ../QTfrontend/model/ThemeModel.cpp \ ../QTfrontend/model/netserverslist.cpp \ - ../QTfrontend/ui/qaspectratiolayout.cpp \ ../QTfrontend/ui/page/pagemain.cpp \ ../QTfrontend/ui/page/pagetraining.cpp \ ../QTfrontend/ui/page/pageroomslist.cpp \