1 /***************************************************************************
2 cannonsprite.cpp - description
3 -------------------
4 begin :
5 copyright : (C) 2003-2007 by Gael de Chalendar
6 email : kleag@free.fr
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either either version 2
14 of the License, or (at your option) any later version.of the License, or *
15 * (at your option) any later version. *
16 * *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA
21 ***************************************************************************/
22
23 #include "cannonsprite.h"
24 #include "skinSpritesData.h"
25
26 #include "GameLogic/country.h"
27
28 namespace Ksirk {
29
CannonSprite(double zoom,BackGnd * aBackGnd,unsigned int visibility)30 CannonSprite::CannonSprite(double zoom,
31 BackGnd* aBackGnd,
32 unsigned int visibility) :
33 ArmySprite(
34 "cannon",
35 Sprites::SkinSpritesData::single().intData("cannon-width"),
36 Sprites::SkinSpritesData::single().intData("cannon-height"),
37 Sprites::SkinSpritesData::single().intData("cannon-frames"),
38 Sprites::SkinSpritesData::single().intData("cannon-versions"), zoom, aBackGnd, visibility)
39 {
40 }
41
42
43
CannonSprite(const QString & svgid,unsigned int width,unsigned int height,unsigned int nbFrames,unsigned int nbDirs,double zoom,BackGnd * aBackGnd,unsigned int visibility)44 CannonSprite::CannonSprite(const QString &svgid,
45 unsigned int width,
46 unsigned int height,
47 unsigned int nbFrames,
48 unsigned int nbDirs,
49 double zoom,
50 BackGnd* aBackGnd,
51 unsigned int visibility) :
52 ArmySprite(svgid, width, height, nbFrames, nbDirs, zoom, aBackGnd, visibility)
53 {
54 }
55
setupTravel(GameLogic::Country * src,GameLogic::Country * dest,const QPointF * dpi)56 void CannonSprite::setupTravel(
57 GameLogic::Country* src,
58 GameLogic::Country* dest,
59 const QPointF* dpi)
60 {
61 qCDebug(KSIRK_LOG) << src->name() << dest->name() << (void*)dpi << (dpi==0?QPointF():*dpi);
62 if (dpi == 0)
63 {
64 AnimSprite::setupTravel(src, dest,
65 src->pointCannon()*m_zoom, dest-> pointCannon()*m_zoom);
66 }
67 else
68 {
69 AnimSprite::setupTravel(src, dest, src->pointCannon()*m_zoom, *dpi);
70 }
71 }
72
73 }
74