[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/games/magazynier
From: Tadeusz Andrzej Kadłubowski <yess () hell ! org ! pl>
Date: 2009-12-26 18:11:11
Message-ID: 1261851071.010908.25051.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1066318 by tkadlubo:
Orientation QPoints are static class members.
M +11 -9 levelModel.cpp
M +4 -4 levelModel.h
--- trunk/playground/games/magazynier/levelModel.cpp #1066317:1066318
@@ -29,6 +29,11 @@
#include "item.h"
#include "renderer.h"
+QPoint *LevelModel::m_moveDirUp = 0;
+QPoint *LevelModel::m_moveDirRight = 0;
+QPoint *LevelModel::m_moveDirDown = 0;
+QPoint *LevelModel::m_moveDirLeft = 0;
+
LevelModel::LevelModel(QObject *parent) : //{{{
QGraphicsScene(parent),
m_goalsLeft(0),
@@ -37,11 +42,12 @@
m_moveCount(0)
{
- //Fixme those should be statis. How can I make static QPoint in C++?
- m_moveDirUp = new QPoint(0, -1);
- m_moveDirLeft = new QPoint(-1, 0);
- m_moveDirDown = new QPoint(0, 1);
- m_moveDirRight = new QPoint(1, 0);
+ if (m_moveDirUp == 0) {
+ m_moveDirUp = new QPoint(0, -1);
+ m_moveDirLeft = new QPoint(-1, 0);
+ m_moveDirDown = new QPoint(0, 1);
+ m_moveDirRight = new QPoint(1, 0);
+ }
}//}}}
LevelModel::~LevelModel() //{{{
@@ -56,10 +62,6 @@
delete m_playerPos;
- delete m_moveDirUp;
- delete m_moveDirLeft;
- delete m_moveDirDown;
- delete m_moveDirRight;
}//}}}
void LevelModel::initLevelData(QString &data) //{{{
--- trunk/playground/games/magazynier/levelModel.h #1066317:1066318
@@ -47,10 +47,10 @@
Q_OBJECT
public:
- QPoint *m_moveDirUp;
- QPoint *m_moveDirLeft;
- QPoint *m_moveDirDown;
- QPoint *m_moveDirRight;
+ static QPoint *m_moveDirUp;
+ static QPoint *m_moveDirLeft;
+ static QPoint *m_moveDirDown;
+ static QPoint *m_moveDirRight;
LevelModel(QObject *Parent=0);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic