From c071a03a8a90100892276ac7f3ea40f3a30333e3 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Fri, 5 Oct 2012 18:03:49 +0000 Subject: [PATCH] - fix for #1135 - merged wall_pos.json into town config - removed tower_shooter field from creatures.json --- AI/BattleAI/Makefile.in | 2 - AI/EmptyAI/Makefile.in | 2 - AI/FuzzyLite/Makefile.in | 2 - AI/Makefile.in | 2 - AI/StupidAI/Makefile.in | 2 - AI/VCAI/Makefile.in | 2 - CMakeLists.txt | 2 +- Makefile.in | 2 - Scripting/ERM/Makefile.in | 2 - aclocal.m4 | 1 - aclocal/m4/ax_boost_iostreams.m4 | 116 ----- client/BattleInterface/CBattleAnimations.cpp | 2 +- client/BattleInterface/CBattleInterface.cpp | 81 +-- .../CBattleInterfaceClasses.cpp | 6 +- client/Graphics.cpp | 17 - client/Graphics.h | 2 - client/Makefile.in | 2 - config/buildings.json | 477 +++++++++++++++++- config/creatures.json | 32 +- config/wall_pos.json | 280 ---------- configure | 240 --------- configure.ac | 1 - lib/CCreatureHandler.cpp | 4 - lib/CCreatureHandler.h | 3 +- lib/CTownHandler.cpp | 46 ++ lib/CTownHandler.h | 8 + lib/Makefile.in | 2 - server/Makefile.in | 2 - 28 files changed, 583 insertions(+), 757 deletions(-) delete mode 100644 aclocal/m4/ax_boost_iostreams.m4 delete mode 100644 config/wall_pos.json diff --git a/AI/BattleAI/Makefile.in b/AI/BattleAI/Makefile.in index db7b902e9..718121e77 100644 --- a/AI/BattleAI/Makefile.in +++ b/AI/BattleAI/Makefile.in @@ -39,7 +39,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -152,7 +151,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/AI/EmptyAI/Makefile.in b/AI/EmptyAI/Makefile.in index d7e98ee8c..093ed254f 100644 --- a/AI/EmptyAI/Makefile.in +++ b/AI/EmptyAI/Makefile.in @@ -39,7 +39,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -152,7 +151,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/AI/FuzzyLite/Makefile.in b/AI/FuzzyLite/Makefile.in index 4d5429b25..c68979b3f 100644 --- a/AI/FuzzyLite/Makefile.in +++ b/AI/FuzzyLite/Makefile.in @@ -39,7 +39,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -118,7 +117,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/AI/Makefile.in b/AI/Makefile.in index e886ea86e..f0d19ad4e 100644 --- a/AI/Makefile.in +++ b/AI/Makefile.in @@ -38,7 +38,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -113,7 +112,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/AI/StupidAI/Makefile.in b/AI/StupidAI/Makefile.in index e7eb300ff..637228b39 100644 --- a/AI/StupidAI/Makefile.in +++ b/AI/StupidAI/Makefile.in @@ -39,7 +39,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -152,7 +151,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/AI/VCAI/Makefile.in b/AI/VCAI/Makefile.in index ba9b7a0aa..cae3ffd58 100644 --- a/AI/VCAI/Makefile.in +++ b/AI/VCAI/Makefile.in @@ -39,7 +39,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -152,7 +151,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 493438329..eb6822ada 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ option(DISABLE_ERM "Disable compilation of ERM scripting module" OFF) # Building section # ############################################ -find_package(Boost 1.46.0 COMPONENTS program_options filesystem system thread iostreams REQUIRED) +find_package(Boost 1.46.0 COMPONENTS program_options filesystem system thread REQUIRED) find_package(SDL REQUIRED) find_package(SDL_image REQUIRED) find_package(SDL_mixer REQUIRED) diff --git a/Makefile.in b/Makefile.in index f77aa29b3..65313f235 100644 --- a/Makefile.in +++ b/Makefile.in @@ -41,7 +41,6 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -132,7 +131,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/Scripting/ERM/Makefile.in b/Scripting/ERM/Makefile.in index d0bbafe85..e6c5caceb 100644 --- a/Scripting/ERM/Makefile.in +++ b/Scripting/ERM/Makefile.in @@ -39,7 +39,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -152,7 +151,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/aclocal.m4 b/aclocal.m4 index 2b854d2bf..400191030 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1212,7 +1212,6 @@ AC_SUBST([am__untar]) m4_include([aclocal/m4/ax_boost_base.m4]) m4_include([aclocal/m4/ax_boost_filesystem.m4]) -m4_include([aclocal/m4/ax_boost_iostreams.m4]) m4_include([aclocal/m4/ax_boost_program_options.m4]) m4_include([aclocal/m4/ax_boost_system.m4]) m4_include([aclocal/m4/ax_boost_thread.m4]) diff --git a/aclocal/m4/ax_boost_iostreams.m4 b/aclocal/m4/ax_boost_iostreams.m4 deleted file mode 100644 index 0fef02f1c..000000000 --- a/aclocal/m4/ax_boost_iostreams.m4 +++ /dev/null @@ -1,116 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_iostreams.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_IOSTREAMS -# -# DESCRIPTION -# -# Test for IOStreams library from the Boost C++ libraries. The macro -# requires a preceding call to AX_BOOST_BASE. Further documentation is -# available at . -# -# This macro calls: -# -# AC_SUBST(BOOST_IOSTREAMS_LIB) -# -# And sets: -# -# HAVE_BOOST_IOSTREAMS -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 18 - -AC_DEFUN([AX_BOOST_IOSTREAMS], -[ - AC_ARG_WITH([boost-iostreams], - AS_HELP_STRING([--with-boost-iostreams@<:@=special-lib@:>@], - [use the IOStreams library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-iostreams=boost_iostreams-gcc-mt-d-1_33_1 ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_iostreams_lib="" - else - want_boost="yes" - ax_boost_user_iostreams_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::IOStreams library is available, - ax_cv_boost_iostreams, - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include - @%:@include - ]], - [[std::string input = "Hello World!"; - namespace io = boost::iostreams; - io::filtering_istream in(boost::make_iterator_range(input)); - return 0; - ]])], - ax_cv_boost_iostreams=yes, ax_cv_boost_iostreams=no) - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_iostreams" = "xyes"; then - AC_DEFINE(HAVE_BOOST_IOSTREAMS,,[define if the Boost::IOStreams library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - if test "x$ax_boost_user_iostreams_lib" = "x"; then - for libextension in `ls $BOOSTLIBDIR/libboost_iostreams*.so* $BOOSTLIBDIR/libboost_iostreams*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_iostreams.*\)\.so.*$;\1;' -e 's;^lib\(boost_iostreams.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break], - [link_iostreams="no"]) - done - if test "x$link_iostreams" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_iostreams*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_iostreams.*\)\.dll.*$;\1;' -e 's;^\(boost_iostreams.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break], - [link_iostreams="no"]) - done - fi - - else - for ax_lib in $ax_boost_user_iostreams_lib boost_iostreams-$ax_boost_user_iostreams_lib; do - AC_CHECK_LIB($ax_lib, main, - [BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break], - [link_iostreams="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) - fi - if test "x$link_iostreams" != "xyes"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/client/BattleInterface/CBattleAnimations.cpp b/client/BattleInterface/CBattleAnimations.cpp index 8d0538f93..ab380c189 100644 --- a/client/BattleInterface/CBattleAnimations.cpp +++ b/client/BattleInterface/CBattleAnimations.cpp @@ -762,7 +762,7 @@ bool CShootingAnimation::init() const CCreature *shooterInfo = shooter->getCreature(); if (shooterInfo->idNumber == 149) { - int creID = CGI->creh->factionToTurretCreature[owner->siegeH->town->town->typeID]; + int creID = owner->siegeH->town->town->clientInfo.siegeShooter; shooterInfo = CGI->creh->creatures[creID]; } diff --git a/client/BattleInterface/CBattleInterface.cpp b/client/BattleInterface/CBattleInterface.cpp index 424b72f2b..3e936bd03 100644 --- a/client/BattleInterface/CBattleInterface.cpp +++ b/client/BattleInterface/CBattleInterface.cpp @@ -158,8 +158,9 @@ CBattleInterface::CBattleInterface(const CCreatureSet * army1, const CCreatureSe SDL_Surface * moat = BitmapHandler::loadBitmap( siegeH->getSiegeName(13) ), * mlip = BitmapHandler::loadBitmap( siegeH->getSiegeName(14) ); - Point moatPos = graphics->wallPositions[siegeH->town->town->typeID][12], - mlipPos = graphics->wallPositions[siegeH->town->town->typeID][13]; + auto & info = siegeH->town->town->clientInfo; + Point moatPos(info.siegePositions[13].x, info.siegePositions[13].y); + Point mlipPos(info.siegePositions[14].x, info.siegePositions[14].y); if(moat) //eg. tower has no moat blitAt(moat, moatPos.x,moatPos.y, background); @@ -283,11 +284,17 @@ CBattleInterface::CBattleInterface(const CCreatureSet * army1, const CCreatureSe //loading projectiles for units BOOST_FOREACH(const CStack *s, stacks) { - //int creID = (s->getCreature()->idNumber == 149) ? CGI->creh->factionToTurretCreature[siegeH->town->town->typeID] : s->getCreature()->idNumber; //id of creature whose shots should be loaded if(s->getCreature()->isShooting()) { CDefHandler *&projectile = idToProjectile[s->getCreature()->idNumber]; - projectile = CDefHandler::giveDef(s->getCreature()->projectile); + + const CCreature * creature;//creature whose shots should be loaded + if (s->getCreature()->idNumber == 149) + creature = CGI->creh->creatures[siegeH->town->town->clientInfo.siegeShooter]; + else + creature = s->getCreature(); + + projectile = CDefHandler::giveDef(creature->projectile); if(projectile->ourImages.size() > 2) //add symmetric images { @@ -1331,7 +1338,7 @@ void CBattleInterface::newStack(const CStack * stack) if(stack->position < 0) //turret { - const CCreature & turretCreature = *CGI->creh->creatures[ CGI->creh->factionToTurretCreature[siegeH->town->town->typeID] ]; + const CCreature & turretCreature = *CGI->creh->creatures[siegeH->town->town->clientInfo.siegeShooter]; creAnims[stack->ID] = new CCreatureAnimation(turretCreature.animDefName); // Turret positions are read out of the /config/wall_pos.txt @@ -1351,8 +1358,8 @@ void CBattleInterface::newStack(const CStack * stack) if (posID != 0) { - coords.x = graphics->wallPositions[siegeH->town->town->typeID][posID - 1].x + this->pos.x; - coords.y = graphics->wallPositions[siegeH->town->town->typeID][posID - 1].y + this->pos.y; + coords.x = siegeH->town->town->clientInfo.siegePositions[posID].x + this->pos.x; + coords.y = siegeH->town->town->clientInfo.siegePositions[posID].y + this->pos.y; } } else @@ -2165,7 +2172,7 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to) if (creature->idNumber == 149) { // a turret creature has a limited height, so cut it at a certain position; turret creature has no standing anim - unitRect.h = graphics->wallPositions[siegeH->town->town->typeID][20].y; + unitRect.h = siegeH->town->town->clientInfo.siegeShooterCropHeight; } else { @@ -3541,8 +3548,6 @@ InfoAboutHero CBattleInterface::enemyHero() const return ret; } -std::string CBattleInterface::SiegeHelper::townTypeInfixes[GameConstants::F_NUMBER] = {"CS", "RM", "TW", "IN", "NC", "DN", "ST", "FR", "EL"}; - CBattleInterface::SiegeHelper::SiegeHelper(const CGTownInstance *siegeTown, const CBattleInterface * _owner) : owner(_owner), town(siegeTown) { @@ -3563,60 +3568,61 @@ CBattleInterface::SiegeHelper::~SiegeHelper() std::string CBattleInterface::SiegeHelper::getSiegeName(ui16 what, ui16 additInfo) const { if(what == 2 || what == 3 || what == 8) - { - if(additInfo == 3) additInfo = 2; - } - char buf[100]; - SDL_itoa(additInfo, buf, 10); - std::string addit(buf); + vstd::amin(additInfo, 2); + else + vstd::amin(additInfo, 3); + + std::string & prefix = town->town->clientInfo.siegePrefix; + std::string addit = boost::lexical_cast(additInfo); + switch(what) { case 0: //background - return "SG" + townTypeInfixes[town->town->typeID] + "BACK.BMP"; + return prefix + "BACK.BMP"; case 1: //background wall { switch(town->town->typeID) { case 5: case 4: case 1: case 6: - return "SG" + townTypeInfixes[town->town->typeID] + "TPW1.BMP"; + return prefix + "TPW1.BMP"; case 0: case 2: case 3: case 7: case 8: - return "SG" + townTypeInfixes[town->town->typeID] + "TPWL.BMP"; + return prefix + "TPWL.BMP"; default: return ""; } } case 2: //keep - return "SG" + townTypeInfixes[town->town->typeID] + "MAN" + addit + ".BMP"; + return prefix + "MAN" + addit + ".BMP"; case 3: //bottom tower - return "SG" + townTypeInfixes[town->town->typeID] + "TW1" + addit + ".BMP"; + return prefix + "TW1" + addit + ".BMP"; case 4: //bottom wall - return "SG" + townTypeInfixes[town->town->typeID] + "WA1" + addit + ".BMP"; + return prefix + "WA1" + addit + ".BMP"; case 5: //below gate - return "SG" + townTypeInfixes[town->town->typeID] + "WA3" + addit + ".BMP"; + return prefix + "WA3" + addit + ".BMP"; case 6: //over gate - return "SG" + townTypeInfixes[town->town->typeID] + "WA4" + addit + ".BMP"; + return prefix + "WA4" + addit + ".BMP"; case 7: //upper wall - return "SG" + townTypeInfixes[town->town->typeID] + "WA6" + addit + ".BMP"; + return prefix + "WA6" + addit + ".BMP"; case 8: //upper tower - return "SG" + townTypeInfixes[town->town->typeID] + "TW2" + addit + ".BMP"; + return prefix + "TW2" + addit + ".BMP"; case 9: //gate - return "SG" + townTypeInfixes[town->town->typeID] + "DRW" + addit + ".BMP"; + return prefix + "DRW" + addit + ".BMP"; case 10: //gate arch - return "SG" + townTypeInfixes[town->town->typeID] + "ARCH.BMP"; + return prefix + "ARCH.BMP"; case 11: //bottom static wall - return "SG" + townTypeInfixes[town->town->typeID] + "WA2.BMP"; + return prefix + "WA2.BMP"; case 12: //upper static wall - return "SG" + townTypeInfixes[town->town->typeID] + "WA5.BMP"; + return prefix + "WA5.BMP"; case 13: //moat - return "SG" + townTypeInfixes[town->town->typeID] + "MOAT.BMP"; + return prefix + "MOAT.BMP"; case 14: //mlip - return "SG" + townTypeInfixes[town->town->typeID] + "MLIP.BMP"; + return prefix + "MLIP.BMP"; case 15: //keep creature cover - return "SG" + townTypeInfixes[town->town->typeID] + "MANC.BMP"; + return prefix + "MANC.BMP"; case 16: //bottom turret creature cover - return "SG" + townTypeInfixes[town->town->typeID] + "TW1C.BMP"; + return prefix + "TW1C.BMP"; case 17: //upper turret creature cover - return "SG" + townTypeInfixes[town->town->typeID] + "TW2C.BMP"; + return prefix + "TW2C.BMP"; default: return ""; } @@ -3625,15 +3631,14 @@ std::string CBattleInterface::SiegeHelper::getSiegeName(ui16 what, ui16 additInf /// What: 1. background wall, 2. keep, 3. bottom tower, 4. bottom wall, 5. wall below gate, /// 6. wall over gate, 7. upper wall, 8. upper tower, 9. gate, 10. gate arch, 11. bottom static wall, 12. upper static wall, 13. moat, 14. mlip, /// 15. keep turret cover, 16. lower turret cover, 17. upper turret cover -/// Positions are loaded from the config file: /config/wall_pos.txt void CBattleInterface::SiegeHelper::printPartOfWall(SDL_Surface * to, int what) { Point pos = Point(-1, -1); if (what >= 1 && what <= 17) { - pos.x = graphics->wallPositions[town->town->typeID][what - 1].x + owner->pos.x; - pos.y = graphics->wallPositions[town->town->typeID][what - 1].y + owner->pos.y; + pos.x = owner->siegeH->town->town->clientInfo.siegePositions[what].x + owner->pos.x; + pos.y = owner->siegeH->town->town->clientInfo.siegePositions[what].y + owner->pos.y; } if(pos.x != -1) diff --git a/client/BattleInterface/CBattleInterfaceClasses.cpp b/client/BattleInterface/CBattleInterfaceClasses.cpp index dc899f012..7dd5d0bff 100644 --- a/client/BattleInterface/CBattleInterfaceClasses.cpp +++ b/client/BattleInterface/CBattleInterfaceClasses.cpp @@ -498,13 +498,13 @@ Point CClickableHex::getXYUnitAnim(const int & hexNum, const bool & attacker, co switch(stack->position) { case -2: //keep - ret = graphics->wallPositions[cbi->siegeH->town->town->typeID][17]; + ret = cbi->siegeH->town->town->clientInfo.siegePositions[18]; break; case -3: //lower turret - ret = graphics->wallPositions[cbi->siegeH->town->town->typeID][18]; + ret = cbi->siegeH->town->town->clientInfo.siegePositions[19]; break; case -4: //upper turret - ret = graphics->wallPositions[cbi->siegeH->town->town->typeID][19]; + ret = cbi->siegeH->town->town->clientInfo.siegePositions[20]; break; } } diff --git a/client/Graphics.cpp b/client/Graphics.cpp index 7b3eef836..2d12263bf 100644 --- a/client/Graphics.cpp +++ b/client/Graphics.cpp @@ -138,7 +138,6 @@ Graphics::Graphics() tasks += boost::bind(&Graphics::loadHeroFlags,this); tasks += boost::bind(&Graphics::loadHeroPortraits,this); tasks += boost::bind(&Graphics::initializeBattleGraphics,this); - tasks += boost::bind(&Graphics::loadWallPositions,this); tasks += boost::bind(&Graphics::loadErmuToPicture,this); tasks += GET_DEF_ESS(artDefs,"ARTIFACT.DEF"); tasks += GET_DEF_ESS(un44,"UN44.DEF"); @@ -202,22 +201,6 @@ void Graphics::loadHeroPortraits() } } -void Graphics::loadWallPositions() -{ - const JsonNode config(ResourceID("config/wall_pos.json")); - - BOOST_FOREACH(const JsonNode &town, config["towns"].Vector()) { - int townID = town["id"].Float(); - - BOOST_FOREACH(const JsonNode &coords, town["pos"].Vector()) { - Point pt(coords["x"].Float(), coords["y"].Float()); - wallPositions[townID].push_back(pt); - } - - assert(wallPositions[townID].size() == 21); - } -} - void Graphics::loadHeroAnims() { std::vector > rotations; //first - group number to be rotated1, second - group number after rotation1 diff --git a/client/Graphics.h b/client/Graphics.h index 597931811..d3e9994d2 100644 --- a/client/Graphics.h +++ b/client/Graphics.h @@ -71,7 +71,6 @@ public: std::vector< std::string > battleHeroes; //battleHeroes[hero type] - name of def that has hero animation for battle std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names CDefEssential * spellEffectsPics; //bitmaps representing spells affecting a stack in battle - std::vector< Point > wallPositions[GameConstants::F_NUMBER]; //positions of different pieces of wall //abilities CDefEssential * abils82; //spells @@ -85,7 +84,6 @@ public: void loadHeroAnims(); void loadHeroAnim(const std::string &name, const std::vector > &rotations, std::vector Graphics::*dst); void loadHeroPortraits(); - void loadWallPositions(); void loadErmuToPicture(); SDL_Surface * getPic(int ID, bool fort=true, bool builded=false); //returns small picture of town: ID=-1 - blank; -2 - border; -3 - random void blueToPlayersAdv(SDL_Surface * sur, int player); //replaces blue interface colour with a color of player diff --git a/client/Makefile.in b/client/Makefile.in index 5b5e2a5a7..caccc026e 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -41,7 +41,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -183,7 +182,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/config/buildings.json b/config/buildings.json index 817d53f57..53518dbd9 100644 --- a/config/buildings.json +++ b/config/buildings.json @@ -177,7 +177,58 @@ { "id" : 41, "upgrades" : 34 }, { "id" : 42, "upgrades" : 35 }, { "id" : 43, "upgrades" : 36 } - ] + ], + + "siege" : + { + "shooter" : 2, + "imagePrefix" : "SGCS", + "gate" : + { + "arch" : { "x" : 477, "y" : 238 }, + "gate" : { "x" : 399, "y" : 274 } + }, + "moat" : + { + "bank" : { "x" : 403, "y" : 80 }, + "moat" : { "x" : 410, "y" : 90 } + }, + "shooterHeight" : 231, + "static" : + { + "background" : { "x" : 600, "y" : 49 }, + "bottom" : { "x" : 512, "y" : 347 }, + "top" : { "x" : 489, "y" : 79 } + }, + "towers" : + { + "bottom" : + { + "battlement" : { "x" : 602, "y" : 500 }, + "creature" : { "x" : 394, "y" : 299 }, + "tower" : { "x" : 602, "y" : 500 } + }, + "keep" : + { + "battlement" : { "x" : 720, "y" : 158 }, + "creature" : { "x" : 526, "y" : -29 }, + "tower" : { "x" : 720, "y" : 158 } + }, + "top" : + { + "battlement" : { "x" : 557, "y" : 24 }, + "creature" : { "x" : 342, "y" : -187 }, + "tower" : { "x" : 569, "y" : 35 } + } + }, + "walls" : + { + "bottom" : { "x" : 528, "y" : 350 }, + "bottomMid" : { "x" : 469, "y" : 291 }, + "upper" : { "x" : 524, "y" : 32 }, + "upperMid" : { "x" : 470, "y" : 127 } + } + } } }, "rampart" : @@ -363,7 +414,58 @@ { "id" : 41, "upgrades" : 34 }, { "id" : 42, "upgrades" : 35 }, { "id" : 43, "upgrades" : 36, "requires" : [ 2 ] } - ] + ], + + "siege" : + { + "shooter" : 18, + "imagePrefix" : "SGRM", + "gate" : + { + "arch" : { "x" : 460, "y" : 220 }, + "gate" : { "x" : 403, "y" : 271 } + }, + "moat" : + { + "bank" : { "x" : 410, "y" : 97 }, + "moat" : { "x" : 410, "y" : 77 } + }, + "shooterHeight" : 232, + "static" : + { + "background" : { "x" : 608, "y" : 46 }, + "bottom" : { "x" : 510, "y" : 364 }, + "top" : { "x" : 492, "y" : 103 } + }, + "towers" : + { + "bottom" : + { + "battlement" : { "x" : 594, "y" : 511 }, + "creature" : { "x" : 371, "y" : 296 }, + "tower" : { "x" : 594, "y" : 511 } + }, + "keep" : + { + "battlement" : { "x" : 724, "y" : 189 }, + "creature" : { "x" : 532, "y" : -27 }, + "tower" : { "x" : 724, "y" : 189 } + }, + "top" : + { + "battlement" : { "x" : 566, "y" : 31 }, + "creature" : { "x" : 341, "y" : -186 }, + "tower" : { "x" : 565, "y" : 31 } + } + }, + "walls" : + { + "bottom" : { "x" : 549, "y" : 451 }, + "bottomMid" : { "x" : 469, "y" : 309 }, + "upper" : { "x" : 530, "y" : 57 }, + "upperMid" : { "x" : 469, "y" : 186 } + } + } } }, "tower" : @@ -541,7 +643,58 @@ { "id" : 41, "upgrades" : 34 }, { "id" : 42, "upgrades" : 35 }, { "id" : 43, "upgrades" : 36 } - ] + ], + + "siege" : + { + "shooter" : 34, + "imagePrefix" : "SGTW", + "gate" : + { + "arch" : { "x" : 471, "y" : 187 }, + "gate" : { "x" : 400, "y" : 253 } + }, + "moat" : + { + "bank" : { "x" : 410, "y" : 80 }, + "moat" : { "x" : 410, "y" : 90 } + }, + "shooterHeight" : 231, + "static" : + { + "background" : { "x" : 615, "y" : 57 }, + "bottom" : { "x" : 517, "y" : 365 }, + "top" : { "x" : 514, "y" : 79 } + }, + "towers" : + { + "bottom" : + { + "battlement" : { "x" : 592, "y" : 516 }, + "creature" : { "x" : 355, "y" : 311 }, + "tower" : { "x" : 592, "y" : 516 } + }, + "keep" : + { + "battlement" : { "x" : 726, "y" : 148 }, + "creature" : { "x" : 499, "y" : -16 }, + "tower" : { "x" : 726, "y" : 148 } + }, + "top" : + { + "battlement" : { "x" : 580, "y" : 36 }, + "creature" : { "x" : 346, "y" : -175 }, + "tower" : { "x" : 580, "y" : 36 } + } + }, + "walls" : + { + "bottom" : { "x" : 547, "y" : 452 }, + "bottomMid" : { "x" : 475, "y" : 298 }, + "upper" : { "x" : 547, "y" : 66 }, + "upperMid" : { "x" : 488, "y" : 190 } + } + } } }, "inferno" : @@ -721,7 +874,58 @@ { "id" : 41, "upgrades" : 34, "requires" : [ 1 ] }, { "id" : 42, "upgrades" : 35 }, { "id" : 43, "upgrades" : 36 } - ] + ], + + "siege" : + { + "shooter" : 44, + "imagePrefix" : "SGIN", + "gate" : + { + "arch" : { "x" : 477, "y" : 221 }, + "gate" : { "x" : 408, "y" : 254 } + }, + "moat" : + { + "bank" : { "x" : 403, "y" : 68 }, + "moat" : { "x" : 403, "y" : 68 } + }, + "shooterHeight" : 231, + "static" : + { + "background" : { "x" : 606, "y" : 52 }, + "bottom" : { "x" : 522, "y" : 376 }, + "top" : { "x" : 502, "y" : 92 } + }, + "towers" : + { + "bottom" : + { + "battlement" : { "x" : 595, "y" : 514 }, + "creature" : { "x" : 369, "y" : 298 }, + "tower" : { "x" : 595, "y" : 514 } + }, + "keep" : + { + "battlement" : { "x" : 730, "y" : 179 }, + "creature" : { "x" : 511, "y" : -37 }, + "tower" : { "x" : 730, "y" : 179 } + }, + "top" : + { + "battlement" : { "x" : 569, "y" : 27 }, + "creature" : { "x" : 341, "y" : -187 }, + "tower" : { "x" : 569, "y" : 27 } + } + }, + "walls" : + { + "bottom" : { "x" : 561, "y" : 451 }, + "bottomMid" : { "x" : 485, "y" : 316 }, + "upper" : { "x" : 532, "y" : 71 }, + "upperMid" : { "x" : 480, "y" : 151 } + } + } } }, "necropolis" : @@ -904,7 +1108,58 @@ { "id" : 41, "upgrades" : 34 }, { "id" : 42, "upgrades" : 35 }, { "id" : 43, "upgrades" : 36 } - ] + ], + + "siege" : + { + "shooter" : 64, + "imagePrefix" : "SGNC", + "gate" : + { + "arch" : { "x" : 474, "y" : 240 }, + "gate" : { "x" : 401, "y" : 262 } + }, + "moat" : + { + "bank" : { "x" : -1, "y" : -1 }, + "moat" : { "x" : 406, "y" : 77 } + }, + "shooterHeight" : 231, + "static" : + { + "background" : { "x" : 604, "y" : 58 }, + "bottom" : { "x" : 509, "y" : 372 }, + "top" : { "x" : 504, "y" : 97 } + }, + "towers" : + { + "bottom" : + { + "battlement" : { "x" : 592, "y" : 512 }, + "creature" : { "x" : 371, "y" : 303 }, + "tower" : { "x" : 592, "y" : 512 } + }, + "keep" : + { + "battlement" : { "x" : 730, "y" : 164 }, + "creature" : { "x" : 501, "y" : 98 }, + "tower" : { "x" : 730, "y" : 164 } + }, + "top" : + { + "battlement" : { "x" : 561, "y" : 26 }, + "creature" : { "x" : 339, "y" : -177 }, + "tower" : { "x" : 561, "y" : 26 } + } + }, + "walls" : + { + "bottom" : { "x" : 536, "y" : 445 }, + "bottomMid" : { "x" : 478, "y" : 323 }, + "upper" : { "x" : 543, "y" : 66 }, + "upperMid" : { "x" : 487, "y" : 164 } + } + } } }, "dungeon" : @@ -1081,7 +1336,58 @@ { "id" : 41, "upgrades" : 34 }, { "id" : 42, "upgrades" : 35 }, { "id" : 43, "upgrades" : 36, "requires" : [ 2 ] } - ] + ], + + "siege" : + { + "shooter" : 76, + "imagePrefix" : "SGDN", + "gate" : + { + "arch" : { "x" : 471, "y" : 164 }, + "gate" : { "x" : 395, "y" : 260 } + }, + "moat" : + { + "bank" : { "x" : 283, "y" : 94 }, + "moat" : { "x" : 283, "y" : 94 } + }, + "shooterHeight" : 230, + "static" : + { + "background" : { "x" : 608, "y" : 50 }, + "bottom" : { "x" : 522, "y" : 305 }, + "top" : { "x" : 494, "y" : 53 } + }, + "towers" : + { + "bottom" : + { + "battlement" : { "x" : 600, "y" : 495 }, + "creature" : { "x" : 410, "y" : 293 }, + "tower" : { "x" : 560, "y" : 495 } + }, + "keep" : + { + "battlement" : { "x" : 732, "y" : 162 }, + "creature" : { "x" : 570, "y" : -50 }, + "tower" : { "x" : 732, "y" : 162 } + }, + "top" : + { + "battlement" : { "x" : 565, "y" : 15 }, + "creature" : { "x" : 381, "y" : -187 }, + "tower" : { "x" : 565, "y" : 15 } + } + }, + "walls" : + { + "bottom" : { "x" : 559, "y" : 448 }, + "bottomMid" : { "x" : 471, "y" : 296 }, + "upper" : { "x" : 523, "y" : 56 }, + "upperMid" : { "x" : 477, "y" : 180 } + } + } } }, "stronghold" : @@ -1257,7 +1563,58 @@ { "id" : 41, "upgrades" : 34 }, { "id" : 42, "upgrades" : 35 }, { "id" : 43, "upgrades" : 36 } - ] + ], + + "siege" : + { + "shooter" : 88, + "imagePrefix" : "SGST", + "gate" : + { + "arch" : { "x" : 478, "y" : 235 }, + "gate" : { "x" : 407, "y" : 266 } + }, + "moat" : + { + "bank" : { "x" : 410, "y" : 91 }, + "moat" : { "x" : 410, "y" : 90 } + }, + "shooterHeight" : 231, + "static" : + { + "background" : { "x" : 617, "y" : 62 }, + "bottom" : { "x" : 511, "y" : 380 }, + "top" : { "x" : 499, "y" : 107} + }, + "towers" : + { + "bottom" : + { + "battlement" : { "x" : 586, "y" : 508 }, + "creature" : { "x" : 361, "y" : 290 }, + "tower" : { "x" : 586, "y" : 508 } + }, + "keep" : + { + "battlement" : { "x" : 731, "y" : 168 }, + "creature" : { "x" : 531, "y" : -45 }, + "tower" : { "x" : 731, "y" : 168 } + }, + "top" : + { + "battlement" : { "x" : 568, "y" : 30 }, + "creature" : { "x" : 342, "y" : -187 }, + "tower" : { "x" : 568, "y" : 30 } + } + }, + "walls" : + { + "bottom" : { "x" : 553, "y" : 440 }, + "bottomMid" : { "x" : 483, "y" : 304 }, + "upper" : { "x" : 534, "y" : 69 }, + "upperMid" : { "x" : 476, "y" : 189 } + } + } } }, "fortress" : @@ -1436,7 +1793,58 @@ { "id" : 41, "upgrades" : 34, "requires" : [ 15 ] }, { "id" : 42, "upgrades" : 35 }, { "id" : 43, "upgrades" : 36 } - ] + ], + + "siege" : + { + "shooter" : 100, + "imagePrefix" : "SGFR", + "gate" : + { + "arch" : { "x" : 483, "y" : 236 }, + "gate" : { "x" : 392, "y" : 253 } + }, + "moat" : + { + "bank" : { "x" : 376, "y" : 70 }, + "moat" : { "x" : 383, "y" : 95 } + }, + "shooterHeight" : 231, + "static" : + { + "background" : { "x" : 599, "y" : 62 }, + "bottom" : { "x" : 522, "y" : 382 }, + "top" : { "x" : 508, "y" : 130 } + }, + "towers" : + { + "bottom" : + { + "battlement" : { "x" : 599, "y" : 505 }, + "creature" : { "x" : 372, "y" : 308 }, + "tower" : { "x" : 599, "y" : 505 } + }, + "keep" : + { + "battlement" : { "x" : 721, "y" : 178 }, + "creature" : { "x" : 541, "y" : -37 }, + "tower" : { "x" : 721, "y" : 178 } + }, + "top" : + { + "battlement" : { "x" : 548, "y" : 27 }, + "creature" : { "x" : 326, "y" : -182 }, + "tower" : { "x" : 548, "y" : 27 } + } + }, + "walls" : + { + "bottom" : { "x" : 546, "y" : 441 }, + "bottomMid" : { "x" : 486, "y" : 306 }, + "upper" : { "x" : 526, "y" : 80 }, + "upperMid" : { "x" : 498, "y" : 184 } + } + } } }, "conflux" : @@ -1618,7 +2026,58 @@ { "id" : 41, "upgrades" : 34 }, { "id" : 42, "upgrades" : 35, "requires" : [ 1 ] }, { "id" : 43, "upgrades" : 36 } - ] + ], + + "siege" : + { + "shooter" : 127, + "imagePrefix" : "SGEL", + "gate" : + { + "arch" : { "x" : 486, "y" : 232 }, + "gate" : { "x" : 408, "y" : 254 } + }, + "moat" : + { + "bank" : { "x" : 407, "y" : 80 }, + "moat" : { "x" : 407, "y" : 80 } + }, + "shooterHeight" : 229, + "static" : + { + "background" : { "x" : 600, "y" : 50 }, + "bottom" : { "x" : 509, "y" : 346 }, + "top" : { "x" : 490, "y" : 97 } + }, + "towers" : + { + "bottom" : + { + "battlement" : { "x" : 608, "y" : 505 }, + "creature" : { "x" : 382, "y" : 308 }, + "tower" : { "x" : 608, "y" : 505 } + }, + "keep" : + { + "battlement" : { "x" : 736, "y" : 159 }, + "creature" : { "x" : 529, "y" : -42 }, + "tower" : { "x" : 736, "y" : 159 } + }, + "top" : + { + "battlement" : { "x" : 576, "y" : 28 }, + "creature" : { "x" : 341, "y" : -162 }, + "tower" : { "x" : 576, "y" : 28 } + } + }, + "walls" : + { + "bottom" : { "x" : 509, "y" : 346 }, + "bottomMid" : { "x" : 468, "y" : 299 }, + "upper" : { "x" : 521, "y" : 41 }, + "upperMid" : { "x" : 471, "y" : 147 } + } + } } }, "neutral" : diff --git a/config/creatures.json b/config/creatures.json index 2fe788a1b..13d11bc77 100644 --- a/config/creatures.json +++ b/config/creatures.json @@ -45,8 +45,7 @@ "upgrades": [3], "defname": "CLCBOW.DEF", "projectile_defname": "PLCBOWX.DEF", - "projectile_spin": false, - "turret_shooter": true + "projectile_spin": false }, { @@ -201,8 +200,7 @@ "upgrades": [19], "defname": "CELF.DEF", "projectile_defname": "PELFX.DEF", - "projectile_spin": false, - "turret_shooter": true + "projectile_spin": false }, { @@ -365,8 +363,7 @@ "upgrades": [35], "defname": "CMAGE.DEF", "projectile_defname": "PMAGEX.DEF", - "projectile_spin": false, - "turret_shooter": true + "projectile_spin": false }, { @@ -471,8 +468,7 @@ "upgrades": [45], "defname": "CGOG.DEF", "projectile_defname": "CPRGOGX.DEF", - "projectile_spin": false, - "turret_shooter": true + "projectile_spin": false }, { @@ -590,7 +586,7 @@ "name": [ "ArchDevil" ], "faction": 3, "ability_remove": [ "FLYING" ], //use teleport instead - "ability_add": [ [ "HATE", 50, 13, 0 ], + "ability_add": [ [ "HATE", 50, 13, 0 ], [ "HATE", 50, 12, 0 ], [ "FLYING", 0, 1, 0], [ "ENEMY_LUCK_DECREASING", 1, 0, 0 ], //archdevils //archdevils hate archangles @@ -681,8 +677,7 @@ "upgrades": [65], "defname": "CLICH.DEF", "projectile_defname": "PLICH.DEF", - "projectile_spin": false, - "turret_shooter": true + "projectile_spin": false }, { @@ -805,8 +800,7 @@ "upgrades": [77], "defname": "CMEDUS.DEF", "projectile_defname": "PMEDUSX.DEF", - "projectile_spin": false, - "turret_shooter": true + "projectile_spin": false }, { @@ -925,8 +919,7 @@ "upgrades": [89], "defname": "CORC.DEF", "projectile_defname": "PORCHX.DEF", - "projectile_spin": true, - "turret_shooter": true + "projectile_spin": true }, { @@ -1043,8 +1036,7 @@ "upgrades": [101], "defname": "CPLIZA.DEF", "projectile_defname": "PPLIZAX.DEF", - "projectile_spin": false, - "turret_shooter": true + "projectile_spin": false }, { @@ -1322,8 +1314,7 @@ [ "SPELLCASTER", 2, 30, 0 ]], "defname": "CSTORM.DEF", "projectile_defname": "CPRGTIX.DEF", - "projectile_spin": false, - "turret_shooter": true + "projectile_spin": false }, { @@ -1472,7 +1463,7 @@ "level": 3, "name": [ "Mummy" ], "faction": 9, - "ability_add": [ [ "UNDEAD", 0, 0, 0 ] ], + "ability_add": [ [ "UNDEAD", 0, 0, 0 ] ], "defname": "CMUMMY.DEF" }, @@ -1546,6 +1537,7 @@ "name": [ "ArrowTower" ], "faction": 9, "ability_add": [ [ "SHOOTER", 0, 0, 0 ] ], + "projectile_defname": "SMBALX.DEF", //workaround for crash "defname": "x" }, diff --git a/config/wall_pos.json b/config/wall_pos.json deleted file mode 100644 index ee13009bf..000000000 --- a/config/wall_pos.json +++ /dev/null @@ -1,280 +0,0 @@ -{ - - // Description of positions of wall parts' positions. - // pos is a set of coordinates (x, y): - // 1. background wall - // 2. keep - // 3. bottom tower - // 4. bottom wall - // 5. wall below gate - // 6. wall over gate - // 7. upper wall - // 8. upper tower - // 9. gate - // 10. gate arch - // 11. bottom static wall - // 12. upper static wall - // 13. moat - // 14. mlip - // 15. keep turret cover - // 16. lower turret cover - // 17. upper turret cover - // 18. keep creature - // 19. lower turret creature - // 20. upper turret creature - // 21. y=turret height(from top of def image); x is not used - - "towns": [ - { - "id": 0, - "name": "Castle", - "pos": [ - { "x": 600, "y": 49 }, - { "x": 720, "y": 158 }, - { "x": 602, "y": 500 }, - { "x": 528, "y": 350 }, - { "x": 469, "y": 291 }, - { "x": 470, "y": 127 }, - { "x": 524, "y": 32 }, - { "x": 569, "y": 35 }, - { "x": 399, "y": 274 }, - { "x": 477, "y": 238 }, - { "x": 512, "y": 347 }, - { "x": 489, "y": 79 }, - { "x": 410, "y": 90 }, - { "x": 403, "y": 80 }, - { "x": 720, "y": 158 }, - { "x": 602, "y": 500 }, - { "x": 557, "y": 24 }, - { "x": 526, "y": -29 }, - { "x": 394, "y": 299 }, - { "x": 342, "y": -187 }, - { "x": 0, "y": 231 } - ] - }, - - { - "id": 1, - "name": "Rampart", - "pos": [ - { "x": 608, "y": 46 }, - { "x": 724, "y": 189 }, - { "x": 594, "y": 511 }, - { "x": 549, "y": 451 }, - { "x": 469, "y": 309 }, - { "x": 469, "y": 186 }, - { "x": 530, "y": 57 }, - { "x": 565, "y": 31 }, - { "x": 403, "y": 271 }, - { "x": 460, "y": 220 }, - { "x": 510, "y": 364 }, - { "x": 492, "y": 103 }, - { "x": 410, "y": 77 }, - { "x": 410, "y": 97 }, - { "x": 724, "y": 189 }, - { "x": 594, "y": 511 }, - { "x": 566, "y": 31 }, - { "x": 532, "y": -27 }, - { "x": 371, "y": 296 }, - { "x": 341, "y": -186 }, - { "x": 0, "y": 232 } - ] - }, - - { - "id": 2, - "name": "Tower", - "pos": [ - { "x": 615, "y": 57 }, - { "x": 726, "y": 148 }, - { "x": 592, "y": 516 }, - { "x": 547, "y": 452 }, - { "x": 475, "y": 298 }, - { "x": 488, "y": 190 }, - { "x": 547, "y": 66 }, - { "x": 580, "y": 36 }, - { "x": 400, "y": 253 }, - { "x": 471, "y": 187 }, - { "x": 517, "y": 365 }, - { "x": 514, "y": 79 }, - { "x": 410, "y": 90 }, - { "x": 410, "y": 80 }, - { "x": 726, "y": 148 }, - { "x": 592, "y": 516 }, - { "x": 580, "y": 36 }, - { "x": 499, "y": -16 }, - { "x": 355, "y": 311 }, - { "x": 346, "y": -175 }, - { "x": 0, "y": 231 } - ] - }, - - { - "id": 3, - "name": "Inferno", - "pos": [ - { "x": 606, "y": 52 }, - { "x": 730, "y": 179 }, - { "x": 595, "y": 514 }, - { "x": 561, "y": 451 }, - { "x": 485, "y": 316 }, - { "x": 480, "y": 151 }, - { "x": 532, "y": 71 }, - { "x": 569, "y": 27 }, - { "x": 408, "y": 254 }, - { "x": 477, "y": 221 }, - { "x": 522, "y": 376 }, - { "x": 502, "y": 92 }, - { "x": 403, "y": 68 }, - { "x": 403, "y": 68 }, - { "x": 730, "y": 179 }, - { "x": 595, "y": 514 }, - { "x": 569, "y": 27 }, - { "x": 511, "y": -37 }, - { "x": 369, "y": 298 }, - { "x": 341, "y": -187 }, - { "x": 0, "y": 231 } - ] - }, - - { - "id": 4, - "name": "Necropolis", - "pos": [ - { "x": 604, "y": 58 }, - { "x": 730, "y": 164 }, - { "x": 592, "y": 512 }, - { "x": 536, "y": 445 }, - { "x": 478, "y": 323 }, - { "x": 487, "y": 164 }, - { "x": 543, "y": 66 }, - { "x": 561, "y": 26 }, - { "x": 401, "y": 262 }, - { "x": 474, "y": 240 }, - { "x": 509, "y": 372 }, - { "x": 504, "y": 97 }, - { "x": 406, "y": 77 }, - { "x": -1, "y": -1 }, - { "x": 730, "y": 164 }, - { "x": 592, "y": 512 }, - { "x": 561, "y": 26 }, - { "x": 501, "y": 98 }, - { "x": 371, "y": 303 }, - { "x": 339, "y": -177 }, - { "x": 0, "y": 231 } - ] - }, - - { - "id": 5, - "name": "Dungeon", - "pos": [ - { "x": 608, "y": 50 }, - { "x": 732, "y": 162 }, - { "x": 560, "y": 495 }, - { "x": 559, "y": 448 }, - { "x": 471, "y": 296 }, - { "x": 477, "y": 180 }, - { "x": 523, "y": 56 }, - { "x": 565, "y": 15 }, - { "x": 395, "y": 260 }, - { "x": 471, "y": 164 }, - { "x": 522, "y": 305 }, - { "x": 494, "y": 53 }, - { "x": 283, "y": 94 }, - { "x": 283, "y": 94 }, - { "x": 732, "y": 162 }, - { "x": 600, "y": 495 }, - { "x": 565, "y": 15 }, - { "x": 570, "y": -50 }, - { "x": 410, "y": 293 }, - { "x": 381, "y": -187 }, - { "x": 0, "y": 230 } - ] - }, - - { - "id": 6, - "name": "Stronghold", - "pos": [ - { "x": 617, "y": 62 }, - { "x": 731, "y": 168 }, - { "x": 586, "y": 508 }, - { "x": 553, "y": 440 }, - { "x": 483, "y": 304 }, - { "x": 476, "y": 189 }, - { "x": 534, "y": 69 }, - { "x": 568, "y": 30 }, - { "x": 407, "y": 266 }, - { "x": 478, "y": 235 }, - { "x": 511, "y": 380 }, - { "x": 499, "y": 107 }, - { "x": 410, "y": 90 }, - { "x": 410, "y": 91 }, - { "x": 731, "y": 168 }, - { "x": 586, "y": 508 }, - { "x": 568, "y": 30 }, - { "x": 531, "y": -45 }, - { "x": 361, "y": 290 }, - { "x": 342, "y": -187 }, - { "x": 0, "y": 231 } - ] - }, - - { - "id": 7, - "name": "Fortress", - "pos": [ - { "x": 599, "y": 62 }, - { "x": 721, "y": 178 }, - { "x": 599, "y": 505 }, - { "x": 546, "y": 441 }, - { "x": 486, "y": 306 }, - { "x": 498, "y": 184 }, - { "x": 526, "y": 80 }, - { "x": 548, "y": 27 }, - { "x": 392, "y": 253 }, - { "x": 483, "y": 236 }, - { "x": 522, "y": 382 }, - { "x": 508, "y": 130 }, - { "x": 383, "y": 95 }, - { "x": 376, "y": 70 }, - { "x": 721, "y": 178 }, - { "x": 599, "y": 505 }, - { "x": 548, "y": 27 }, - { "x": 541, "y": -37 }, - { "x": 372, "y": 308 }, - { "x": 326, "y": -182 }, - { "x": 0, "y": 231 } - ] - }, - - { - "id": 8, - "name": "Conflux", - "pos": [ - { "x": 600, "y": 50 }, - { "x": 736, "y": 159 }, - { "x": 608, "y": 505 }, - { "x": 509, "y": 346 }, - { "x": 468, "y": 299 }, - { "x": 471, "y": 147 }, - { "x": 521, "y": 41 }, - { "x": 576, "y": 28 }, - { "x": 408, "y": 254 }, - { "x": 486, "y": 232 }, - { "x": 509, "y": 346 }, - { "x": 490, "y": 97 }, - { "x": 407, "y": 80 }, - { "x": 407, "y": 80 }, - { "x": 736, "y": 159 }, - { "x": 608, "y": 505 }, - { "x": 576, "y": 28 }, - { "x": 529, "y": -42 }, - { "x": 382, "y": 308 }, - { "x": 341, "y": -162 }, - { "x": 0, "y": 229 } - ] - } - ] -} diff --git a/configure b/configure index b9fbbe9be..567cc7e11 100755 --- a/configure +++ b/configure @@ -621,7 +621,6 @@ SDL_LIBS SDL_CFLAGS SDL_CONFIG BOOST_PROGRAM_OPTIONS_LIB -BOOST_IOSTREAMS_LIB BOOST_THREAD_LIB BOOST_FILESYSTEM_LIB BOOST_SYSTEM_LIB @@ -764,7 +763,6 @@ with_boost_libdir with_boost_system with_boost_filesystem with_boost_thread -with_boost_iostreams with_boost_program_options with_sdl_prefix with_sdl_exec_prefix @@ -1444,11 +1442,6 @@ Optional Packages: use the Thread library from boost - it is possible to specify a certain library for the linker e.g. --with-boost-thread=boost_thread-gcc-mt - --with-boost-iostreams[=special-lib] - use the IOStreams library from boost - it is - possible to specify a certain library for the linker - e.g. - --with-boost-iostreams=boost_iostreams-gcc-mt-d-1_33_1 --with-boost-program-options[=special-lib] use the program options library from boost - it is possible to specify a certain library for the linker @@ -16253,239 +16246,6 @@ fi -# Check whether --with-boost-iostreams was given. -if test "${with_boost_iostreams+set}" = set; then : - withval=$with_boost_iostreams; - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_iostreams_lib="" - else - want_boost="yes" - ax_boost_user_iostreams_lib="$withval" - fi - -else - want_boost="yes" - -fi - - - if test "x$want_boost" = "xyes"; then - - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::IOStreams library is available" >&5 -$as_echo_n "checking whether the Boost::IOStreams library is available... " >&6; } -if ${ax_cv_boost_iostreams+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -std::string input = "Hello World!"; - namespace io = boost::iostreams; - io::filtering_istream in(boost::make_iterator_range(input)); - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv_boost_iostreams=yes -else - ax_cv_boost_iostreams=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_iostreams" >&5 -$as_echo "$ax_cv_boost_iostreams" >&6; } - if test "x$ax_cv_boost_iostreams" = "xyes"; then - -$as_echo "#define HAVE_BOOST_IOSTREAMS /**/" >>confdefs.h - - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'` - if test "x$ax_boost_user_iostreams_lib" = "x"; then - for libextension in `ls $BOOSTLIBDIR/libboost_iostreams*.so* $BOOSTLIBDIR/libboost_iostreams*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_iostreams.*\)\.so.*$;\1;' -e 's;^lib\(boost_iostreams.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 -$as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$ax_lib $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char exit (); -int -main () -{ -return exit (); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" -else - eval "$as_ac_Lib=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - BOOST_IOSTREAMS_LIB="-l$ax_lib"; link_iostreams="yes"; break -else - link_iostreams="no" -fi - - done - if test "x$link_iostreams" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_iostreams*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_iostreams.*\)\.dll.*$;\1;' -e 's;^\(boost_iostreams.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5 -$as_echo_n "checking for exit in -l$ax_lib... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$ax_lib $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char exit (); -int -main () -{ -return exit (); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" -else - eval "$as_ac_Lib=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - BOOST_IOSTREAMS_LIB="-l$ax_lib"; link_iostreams="yes"; break -else - link_iostreams="no" -fi - - done - fi - - else - for ax_lib in $ax_boost_user_iostreams_lib boost_iostreams-$ax_boost_user_iostreams_lib; do - as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5 -$as_echo_n "checking for main in -l$ax_lib... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$ax_lib $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int -main () -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" -else - eval "$as_ac_Lib=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - BOOST_IOSTREAMS_LIB="-l$ax_lib"; link_iostreams="yes"; break -else - link_iostreams="no" -fi - - done - - fi - if test "x$ax_lib" = "x"; then - as_fn_error $? "Could not find a version of the library!" "$LINENO" 5 - fi - if test "x$link_iostreams" != "xyes"; then - as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5 - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi - - - # Check whether --with-boost-program-options was given. if test "${with_boost_program_options+set}" = set; then : withval=$with_boost_program_options; diff --git a/configure.ac b/configure.ac index 9960707e9..d03c5bb46 100644 --- a/configure.ac +++ b/configure.ac @@ -51,7 +51,6 @@ AX_BOOST_BASE([1.36]) AX_BOOST_SYSTEM AX_BOOST_FILESYSTEM AX_BOOST_THREAD -AX_BOOST_IOSTREAMS AX_BOOST_PROGRAM_OPTIONS # Check which libs are necessary diff --git a/lib/CCreatureHandler.cpp b/lib/CCreatureHandler.cpp index ec20246c1..818cc839b 100644 --- a/lib/CCreatureHandler.cpp +++ b/lib/CCreatureHandler.cpp @@ -344,10 +344,6 @@ void CCreatureHandler::loadCreatures() c->projectileSpin = value->Bool(); } - value = &creature["turret_shooter"]; - if (!value->isNull() && value->Bool()) - factionToTurretCreature[c->faction] = creatureID; - value = &creature["ability_remove"];//remove first - arch devil if (!value->isNull()) { diff --git a/lib/CCreatureHandler.h b/lib/CCreatureHandler.h index e169434cf..8ff9db44e 100644 --- a/lib/CCreatureHandler.h +++ b/lib/CCreatureHandler.h @@ -132,7 +132,6 @@ public: std::set doubledCreatures; //they get double week std::vector > creatures; //creature ID -> creature info bmap nameToID; - int factionToTurretCreature[GameConstants::F_NUMBER]; //which creature's animation should be used to dispaly creature in turret while siege //stack exp std::map > stackBonuses; // bonus => name, description @@ -165,7 +164,7 @@ public: template void serialize(Handler &h, const int version) { //TODO: should be optimized, not all these informations needs to be serialized (same for ccreature) - h & notUsedMonsters & creatures & nameToID & factionToTurretCreature; + h & notUsedMonsters & creatures & nameToID; h & stackBonuses & expRanks & maxExpPerBattle & expAfterUpgrade; h & factionCommanders & skillLevels & skillRequirements & commanderLevelPremy; h & allCreatures; diff --git a/lib/CTownHandler.cpp b/lib/CTownHandler.cpp index 7acbba46f..c17b943dd 100644 --- a/lib/CTownHandler.cpp +++ b/lib/CTownHandler.cpp @@ -322,6 +322,51 @@ void CTownHandler::loadTownHall(CTown &town, const JsonNode & source) } } +CTown::ClientInfo::Point JsonToPoint(const JsonNode & node) +{ + CTown::ClientInfo::Point ret; + ret.x = node["x"].Float(); + ret.y = node["y"].Float(); + return ret; +} + +void CTownHandler::loadSiegeScreen(CTown &town, const JsonNode & source) +{ + town.clientInfo.siegePrefix = source["imagePrefix"].String(); + town.clientInfo.siegeShooter = source["shooter"].Float(); + town.clientInfo.siegeShooterCropHeight = source["shooterHeight"].Float(); + + auto & pos = town.clientInfo.siegePositions; + pos.resize(21); + + pos[8] = JsonToPoint(source["towers"]["top"]["tower"]); + pos[17] = JsonToPoint(source["towers"]["top"]["battlement"]); + pos[20] = JsonToPoint(source["towers"]["top"]["creature"]); + + pos[2] = JsonToPoint(source["towers"]["keep"]["tower"]); + pos[15] = JsonToPoint(source["towers"]["keep"]["battlement"]); + pos[18] = JsonToPoint(source["towers"]["keep"]["creature"]); + + pos[3] = JsonToPoint(source["towers"]["bottom"]["tower"]); + pos[16] = JsonToPoint(source["towers"]["bottom"]["battlement"]); + pos[19] = JsonToPoint(source["towers"]["bottom"]["creature"]); + + pos[9] = JsonToPoint(source["gate"]["gate"]); + pos[10] = JsonToPoint(source["gate"]["arch"]); + + pos[7] = JsonToPoint(source["walls"]["upper"]); + pos[6] = JsonToPoint(source["walls"]["upperMid"]); + pos[5] = JsonToPoint(source["walls"]["bottomMid"]); + pos[4] = JsonToPoint(source["walls"]["bottom"]); + + pos[13] = JsonToPoint(source["moat"]["moat"]); + pos[14] = JsonToPoint(source["moat"]["bank"]); + + pos[11] = JsonToPoint(source["static"]["bottom"]); + pos[12] = JsonToPoint(source["static"]["top"]); + pos[1] = JsonToPoint(source["static"]["background"]); +} + void CTownHandler::loadClientData(CTown &town, const JsonNode & source) { town.clientInfo.icons[0][0] = source["icons"]["village"]["normal"].Float(); @@ -337,6 +382,7 @@ void CTownHandler::loadClientData(CTown &town, const JsonNode & source) loadTownHall(town, source["hallSlots"]); loadStructures(town, source["structures"]); + loadSiegeScreen(town, source["siege"]); } void CTownHandler::loadTown(CTown &town, const JsonNode & source) diff --git a/lib/CTownHandler.h b/lib/CTownHandler.h index 3492091d1..9287a985a 100644 --- a/lib/CTownHandler.h +++ b/lib/CTownHandler.h @@ -102,6 +102,8 @@ public: // Client-only data. Should be moved away from lib struct ClientInfo { + struct Point { si32 x; si32 y;}; + //icons [fort is present?][build limit reached?] -> index of icon in def files int icons[2][2]; @@ -117,6 +119,11 @@ public: /// NOTE: index in vector is meaningless. Vector used instead of list for a bit faster access std::vector > structures; + std::string siegePrefix; + std::vector siegePositions; + TCreature siegeShooter; // shooter creature ID + si32 siegeShooterCropHeight; //trim height for shooters in turrets + template void serialize(Handler &h, const int version) { h & icons & musicTheme & townBackground & guildWindow & buildingsIcons & hallBackground & hallSlots & structures; @@ -178,6 +185,7 @@ class DLL_LINKAGE CTownHandler /// loads town hall vector (hallSlots) void loadTownHall(CTown &town, const JsonNode & source); + void loadSiegeScreen(CTown &town, const JsonNode & source); void loadClientData(CTown &town, const JsonNode & source); diff --git a/lib/Makefile.in b/lib/Makefile.in index 911b96cd8..aff95580a 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -39,7 +39,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -170,7 +169,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ diff --git a/server/Makefile.in b/server/Makefile.in index 4e0a781d3..239047e6b 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -40,7 +40,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/aclocal/m4/ax_boost_base.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/aclocal/m4/ax_boost_iostreams.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_program_options.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_system.m4 \ $(top_srcdir)/aclocal/m4/ax_boost_thread.m4 \ @@ -126,7 +125,6 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ -BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@