File indexing completed on 2024-04-21 04:04:45

0001 /***************************************************************************
0002                           cannonsprite.cpp  -  description
0003                              -------------------
0004     begin                : 
0005     copyright            : (C) 2003-2007 by Gael de Chalendar
0006     email                : kleag@free.fr
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either either version 2
0014    of the License, or (at your option) any later version.of the License, or     *
0015  *   (at your option) any later version.                                   *
0016  *                                                                         *
0017  *   You should have received a copy of the GNU General Public License
0018  *   along with this program; if not, write to the Free Software
0019  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0020  *   02110-1301, USA
0021  ***************************************************************************/
0022 
0023 #include "cannonsprite.h"
0024 #include "skinSpritesData.h"
0025 
0026 #include "GameLogic/country.h"
0027 
0028 namespace Ksirk {
0029 
0030 CannonSprite::CannonSprite(double zoom,
0031                               BackGnd* aBackGnd,
0032                               unsigned int visibility) :
0033                               ArmySprite(
0034         "cannon",
0035         Sprites::SkinSpritesData::single().intData("cannon-width"),
0036         Sprites::SkinSpritesData::single().intData("cannon-height"),
0037         Sprites::SkinSpritesData::single().intData("cannon-frames"),
0038         Sprites::SkinSpritesData::single().intData("cannon-versions"), zoom, aBackGnd, visibility)
0039 {
0040 }
0041 
0042 
0043 
0044 CannonSprite::CannonSprite(const QString &svgid,
0045                               unsigned int width,
0046                               unsigned int height,
0047                               unsigned int nbFrames,
0048                               unsigned int nbDirs,
0049                               double zoom,
0050                               BackGnd* aBackGnd,
0051                               unsigned int visibility) :
0052                               ArmySprite(svgid, width, height, nbFrames, nbDirs, zoom, aBackGnd, visibility)
0053 {
0054 }
0055 
0056 void CannonSprite::setupTravel(
0057   GameLogic::Country* src, 
0058   GameLogic::Country* dest, 
0059   const QPointF* dpi)
0060 {
0061   qCDebug(KSIRK_LOG) << src->name() << dest->name() << (void*)dpi << (dpi==nullptr?QPointF():*dpi);
0062   if (dpi == nullptr) 
0063   {
0064     AnimSprite::setupTravel(src, dest, 
0065                              src->pointCannon()*m_zoom, dest-> pointCannon()*m_zoom);
0066   }
0067   else 
0068   {
0069     AnimSprite::setupTravel(src, dest, src->pointCannon()*m_zoom, *dpi);
0070   }
0071 }
0072 
0073 }