mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-29 03:04:42 +00:00
fix build
This commit is contained in:
parent
dcb21225cf
commit
b743977167
@ -84,6 +84,14 @@ bool IItem::isActive(int item) {
|
|||||||
return _childs.contains(item) && _activeItems.contains(item);
|
return _childs.contains(item) && _activeItems.contains(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Store *IItem::store() const {
|
||||||
|
return _store;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IItem::setStore(const Store *newStore) {
|
||||||
|
_store = newStore;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int IItem::itemType() {
|
unsigned int IItem::itemType() {
|
||||||
if (_typeItem) {
|
if (_typeItem) {
|
||||||
return _typeItem;
|
return _typeItem;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief IITEM_OBJECT This macross init the item id for child IItem classes.
|
* @brief IITEM_OBJECT This macross init the item id for child IItem classes.
|
||||||
* For each items with this macross automaticly added two method:
|
* For each items with this macross automaticly added two method:
|
||||||
@ -29,6 +30,8 @@
|
|||||||
|
|
||||||
namespace CRAWL {
|
namespace CRAWL {
|
||||||
|
|
||||||
|
class Store;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The ChildIteAction struct contains two lambda function with actions for remove and add item to a parent item.
|
* @brief The ChildIteAction struct contains two lambda function with actions for remove and add item to a parent item.
|
||||||
* The parent can be run any actions when item added or dropped.
|
* The parent can be run any actions when item added or dropped.
|
||||||
@ -227,11 +230,28 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool isActive(int item);
|
bool isActive(int item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief store This mrthod sets pointer value of the global store object.
|
||||||
|
* Usualy this method invoked in the Store::addLevel method. (when item adding into store).
|
||||||
|
* @param newStore This is new pinter value of the store object.
|
||||||
|
*/
|
||||||
|
void setStore(const Store *newStore);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief store This method return pointer to the store object.
|
||||||
|
* @return pointer to curent store object. If object is not initialized on the global store then return nullptr
|
||||||
|
*/
|
||||||
|
const Store *store() const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int _id = 0;
|
unsigned int _id = 0;
|
||||||
unsigned int _typeItem = 0;
|
unsigned int _typeItem = 0;
|
||||||
QHash<int, ChildItemAction> _childs;
|
QHash<int, ChildItemAction> _childs;
|
||||||
QSet<int> _activeItems;
|
QSet<int> _activeItems;
|
||||||
|
const Store *_store = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,9 +10,7 @@
|
|||||||
|
|
||||||
namespace CRAWL {
|
namespace CRAWL {
|
||||||
|
|
||||||
IPreviewScaneWorld::IPreviewScaneWorld(const IWorld* mainWorld) {
|
IPreviewScaneWorld::IPreviewScaneWorld() {
|
||||||
debug_assert(mainWorld, "The mainWorld world option should be initialized.");
|
|
||||||
_mainWorld = mainWorld;
|
|
||||||
|
|
||||||
setCameraReleativePosition({0, 100, 100});
|
setCameraReleativePosition({0, 100, 100});
|
||||||
setCameraRotation(QQuaternion::fromEulerAngles(-40,0,0));
|
setCameraRotation(QQuaternion::fromEulerAngles(-40,0,0));
|
||||||
@ -42,14 +40,12 @@ int IPreviewScaneWorld::requiredTier() const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayableObject *IPreviewScaneWorld::initPlayer(int objectType) const {
|
|
||||||
return _mainWorld->initPlayer(objectType);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IPreviewScaneWorld::start(const StartData& config) {
|
bool IPreviewScaneWorld::start(const StartData& config) {
|
||||||
_configuration = config;
|
_configuration = config;
|
||||||
|
|
||||||
setPlayer(initPlayer(config.snakeType()));
|
if (!setPlayer(config.snakeType())) {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
worldChanged(worldRules()->cbegin());
|
worldChanged(worldRules()->cbegin());
|
||||||
setTargetFps(60);
|
setTargetFps(60);
|
||||||
|
@ -23,7 +23,7 @@ public:
|
|||||||
* @brief IPreviewScaneWorld This is main constructo of the preview world model.
|
* @brief IPreviewScaneWorld This is main constructo of the preview world model.
|
||||||
* @param mainWorld This pointer to the main world. This is needed for correctly working initPalayer methods. The implementation of the some methods should be identy with the main world.
|
* @param mainWorld This pointer to the main world. This is needed for correctly working initPalayer methods. The implementation of the some methods should be identy with the main world.
|
||||||
*/
|
*/
|
||||||
IPreviewScaneWorld(const IWorld* mainWorld);
|
IPreviewScaneWorld();
|
||||||
|
|
||||||
// IItem interface
|
// IItem interface
|
||||||
public:
|
public:
|
||||||
@ -33,7 +33,6 @@ public:
|
|||||||
QString image() const override final;
|
QString image() const override final;
|
||||||
int cost() const override final;
|
int cost() const override final;
|
||||||
int requiredTier() const override final;
|
int requiredTier() const override final;
|
||||||
PlayableObject *initPlayer(int objectType) const override final;
|
|
||||||
void initControl(IControl *control) override;
|
void initControl(IControl *control) override;
|
||||||
IControl* initUserInterface() const override;
|
IControl* initUserInterface() const override;
|
||||||
bool start(const StartData &config) override;
|
bool start(const StartData &config) override;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "eventserver.h"
|
#include "eventserver.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
#include "store.h"
|
||||||
|
|
||||||
namespace CRAWL {
|
namespace CRAWL {
|
||||||
|
|
||||||
@ -39,7 +40,11 @@ IWorld::IWorld() {
|
|||||||
|
|
||||||
IWorld::~IWorld() {
|
IWorld::~IWorld() {
|
||||||
disconnect();
|
disconnect();
|
||||||
reset();
|
|
||||||
|
IWorld::stop();
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
delete _eventServer;
|
delete _eventServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,15 +107,18 @@ bool IWorld::start(const StartData& config) {
|
|||||||
|
|
||||||
auto player = dynamic_cast<Player*>(userInterface());
|
auto player = dynamic_cast<Player*>(userInterface());
|
||||||
if (!player) {
|
if (!player) {
|
||||||
QuasarAppUtils::Params::log("Failed to start world. T userIterface control should be children class of the Palyer class",
|
QuasarAppUtils::Params::log("Failed to start world. The userIterface control should be children class of the Palyer class",
|
||||||
QuasarAppUtils::Error);
|
QuasarAppUtils::Error);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setWorldStatus(WorldStatus::Game);
|
|
||||||
backgroundAI()->stopAI();
|
backgroundAI()->stopAI();
|
||||||
setPlayer(initPlayer(config.snakeType()));
|
setWorldStatus(WorldStatus::Game);
|
||||||
|
|
||||||
|
if (!setPlayer(config.snakeType())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
player->setUserData(config.player());
|
player->setUserData(config.player());
|
||||||
|
|
||||||
@ -151,6 +159,21 @@ void IWorld::setPlayer(QObject *newPlayer) {
|
|||||||
emit playerChanged();
|
emit playerChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IWorld::setPlayer(int snakeId) {
|
||||||
|
auto snake = dynamic_cast<PlayableObject*>(store()->getItemById(snakeId));
|
||||||
|
|
||||||
|
if (!snake) {
|
||||||
|
QuasarAppUtils::Params::log("Failed to start world. The snake should be not null",
|
||||||
|
QuasarAppUtils::Error);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setPlayer(snake);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
IWorldItem *IWorld::generate(const QString &objectType) const {
|
IWorldItem *IWorld::generate(const QString &objectType) const {
|
||||||
return _registeredTypes.value(objectType, [](){return nullptr;}).operator()();
|
return _registeredTypes.value(objectType, [](){return nullptr;}).operator()();
|
||||||
}
|
}
|
||||||
@ -248,14 +271,7 @@ void IWorld::removeItem(IWorldItem* item, QList<int> *removedObjectsList) {
|
|||||||
emit sigOBjctsListChanged(diff);
|
emit sigOBjctsListChanged(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IWorld::reset() {
|
void CRAWL::IWorld::clear() {
|
||||||
|
|
||||||
stop();
|
|
||||||
|
|
||||||
if (_player) {
|
|
||||||
_player = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_worldRules) {
|
if (_worldRules) {
|
||||||
delete _worldRules;
|
delete _worldRules;
|
||||||
_worldRules = nullptr;
|
_worldRules = nullptr;
|
||||||
@ -270,9 +286,18 @@ void IWorld::reset() {
|
|||||||
delete _backgroundAI;
|
delete _backgroundAI;
|
||||||
_backgroundAI = nullptr;
|
_backgroundAI = nullptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IWorld::reset() {
|
||||||
|
|
||||||
|
stop();
|
||||||
|
|
||||||
|
if (_player) {
|
||||||
|
_player = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
clear();
|
||||||
setHdr("");
|
setHdr("");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,15 +84,6 @@ public:
|
|||||||
IWorld();
|
IWorld();
|
||||||
~IWorld() override;
|
~IWorld() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief initPlayer The implementation of This interface must be return playerObject by type. This method should be generate new object of the player by type.
|
|
||||||
* @param objectType This is type of requried snake object. See the IItem::itemId method.
|
|
||||||
* @return raw pointer to the player object.
|
|
||||||
* @note The Palyer object will be deleted when wold distroed.
|
|
||||||
* So do not delete your created player pbject yuorself.
|
|
||||||
*/
|
|
||||||
virtual PlayableObject* initPlayer(int objectType) const = 0;
|
|
||||||
|
|
||||||
QString itemTextType() const override;
|
QString itemTextType() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -334,6 +325,12 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void setPlayer(QObject *newPlayer);
|
void setPlayer(QObject *newPlayer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setPlayer This method sets new player object by snake id.
|
||||||
|
* @param snakeId This is snake object id that user will be control.
|
||||||
|
*/
|
||||||
|
bool setPlayer(int snakeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief generate This method shold be generate object from the @a objectType.
|
* @brief generate This method shold be generate object from the @a objectType.
|
||||||
* Override this method for add support yourown objects.
|
* Override this method for add support yourown objects.
|
||||||
@ -546,6 +543,9 @@ private:
|
|||||||
QList<int>* removedObjectsList = nullptr);
|
QList<int>* removedObjectsList = nullptr);
|
||||||
|
|
||||||
void renderLoop();
|
void renderLoop();
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
QFuture<void> _renderLoopFuture;
|
QFuture<void> _renderLoopFuture;
|
||||||
|
|
||||||
EventServer * _eventServer = nullptr;
|
EventServer * _eventServer = nullptr;
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
#include "Crawl/icontrol.h"
|
#include "Crawl/icontrol.h"
|
||||||
#include "QDateTime"
|
#include "QDateTime"
|
||||||
#include "QtConcurrent"
|
#include "QtConcurrent"
|
||||||
#include "store.h"
|
#include "offlinestore.h"
|
||||||
|
|
||||||
namespace CRAWL {
|
namespace CRAWL {
|
||||||
|
|
||||||
Engine::Engine(QObject *parent): QObject(parent) {
|
Engine::Engine(QObject *parent): QObject(parent) {
|
||||||
_store = new Store();
|
_store = new OfflineStore();
|
||||||
_menu = new MainMenuModel();
|
_menu = new MainMenuModel();
|
||||||
|
|
||||||
setNewUser(new User());
|
setNewUser(new User());
|
||||||
@ -223,24 +223,20 @@ User *Engine::currentUser() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Engine::init() {
|
void Engine::init() {
|
||||||
QMultiHash<int, const IItem *> availabelItems;
|
QList<int> availableWorlds;
|
||||||
|
|
||||||
for (const auto &data : qAsConst(_availableLvls)) {
|
for (const auto &data : qAsConst(_availableLvls)) {
|
||||||
if (data && data->world())
|
if (data && data->world()) {
|
||||||
availabelItems.unite(data->world()->childItemsRecursive());
|
if (data->world()->itemType() == IWorld::type() && _currentUser->isUnlocked(data->world()->itemId())) {
|
||||||
|
availableWorlds.push_back(data->world()->itemId());
|
||||||
|
}
|
||||||
|
|
||||||
|
_store->addLevel(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_store->init(availabelItems);
|
|
||||||
static_cast<StoreViewModel*>(_menu->storeView())->init(_store, _currentUser);
|
static_cast<StoreViewModel*>(_menu->storeView())->init(_store, _currentUser);
|
||||||
|
|
||||||
QList<int> availableWorlds;
|
|
||||||
for (int id : _currentUser->unlockedItems()) {
|
|
||||||
auto item = availabelItems.value(id);
|
|
||||||
if (item->itemType() == IWorld::type()) {
|
|
||||||
availableWorlds.push_back(item->itemId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define selectedLevelModel static_cast<AvailableLevelsModel*>(_menu->selectLevelModle())
|
#define selectedLevelModel static_cast<AvailableLevelsModel*>(_menu->selectLevelModle())
|
||||||
selectedLevelModel->setStore(_store);
|
selectedLevelModel->setStore(_store);
|
||||||
selectedLevelModel->setKeys(availableWorlds);
|
selectedLevelModel->setKeys(availableWorlds);
|
||||||
|
@ -16,9 +16,15 @@ OfflineStore::OfflineStore() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OfflineStore::init(const ILevel *level) {
|
void OfflineStore::addLevel(const ILevel *level) {
|
||||||
store().unite(level->availableItems());
|
|
||||||
|
for (auto item : qAsConst(level->availableItems())) {
|
||||||
|
item->setStore(this);
|
||||||
|
store().insert(item->itemId(), item);
|
||||||
|
}
|
||||||
|
|
||||||
store().insert(level->world()->itemId(), level->world());
|
store().insert(level->world()->itemId(), level->world());
|
||||||
|
level->world()->setStore(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class OfflineStore : public Store
|
|||||||
public:
|
public:
|
||||||
OfflineStore();
|
OfflineStore();
|
||||||
|
|
||||||
void init(const ILevel *level) override;
|
void addLevel(const ILevel *level) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ bool Store::buy(User &buyer, int itemId) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const IItem *Store::getItemById(int id) const {
|
IItem *Store::getItemById(int id) const {
|
||||||
return _store.value(id, nullptr);
|
return _store.value(id, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,17 +33,17 @@ public:
|
|||||||
bool buy(User& buyer, int itemId);
|
bool buy(User& buyer, int itemId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief init This method initialise store of the game.
|
* @brief addLevel This method add level objects to store.
|
||||||
* @return true if the items inited successfuly else false.
|
* @return true if the items inited successfuly else false.
|
||||||
*/
|
*/
|
||||||
virtual void init(const ILevel* level) = 0;
|
virtual void addLevel(const ILevel* level) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getItemById This method return item by id.
|
* @brief getItemById This method return item by id.
|
||||||
* @param id This is id of the required item.
|
* @param id This is id of the required item.
|
||||||
* @return pointer to item. if The item with @a id not found then return nullptr.
|
* @return pointer to item. if The item with @a id not found then return nullptr.
|
||||||
*/
|
*/
|
||||||
const IItem* getItemById(int id) const;
|
IItem* getItemById(int id) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief size This method return count of the available items in store.
|
* @brief size This method return count of the available items in store.
|
||||||
|
@ -8,13 +8,15 @@
|
|||||||
#include "abstractlevel.h"
|
#include "abstractlevel.h"
|
||||||
#include "abslvlworld.h"
|
#include "abslvlworld.h"
|
||||||
|
|
||||||
|
#include <abslvlsnake.h>
|
||||||
#include <absnest.h>
|
#include <absnest.h>
|
||||||
|
|
||||||
AbstractLevel::AbstractLevel() {
|
AbstractLevel::AbstractLevel() {
|
||||||
initAbstractLvlResources();
|
initAbstractLvlResources();
|
||||||
|
|
||||||
auto world = new AbstractLvl::AbsLvlWorld();
|
setWorld(new AbstractLvl::AbsLvlWorld());
|
||||||
setWorld(world);
|
setPreviewScane(new AbstractLvl::AbsNest());
|
||||||
setPreviewScane(new AbstractLvl::AbsNest(world));
|
|
||||||
|
addItem(new AbstractLvl::AbsLvlSnake);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,10 +23,6 @@ AbsLvlWorld::AbsLvlWorld() {
|
|||||||
setCameraRotation(QQuaternion::fromEulerAngles({0,0,0}));
|
setCameraRotation(QQuaternion::fromEulerAngles({0,0,0}));
|
||||||
}
|
}
|
||||||
|
|
||||||
CRAWL::PlayableObject *AbsLvlWorld::initPlayer(int) const {
|
|
||||||
return new AbsLvlSnake();
|
|
||||||
}
|
|
||||||
|
|
||||||
CRAWL::WorldRule *AbsLvlWorld::initWorldRules() {
|
CRAWL::WorldRule *AbsLvlWorld::initWorldRules() {
|
||||||
|
|
||||||
return new CRAWL::WorldRule {
|
return new CRAWL::WorldRule {
|
||||||
|
@ -19,7 +19,6 @@ public:
|
|||||||
|
|
||||||
AbsLvlWorld();
|
AbsLvlWorld();
|
||||||
|
|
||||||
CRAWL::PlayableObject *initPlayer(int type) const override;
|
|
||||||
CRAWL::WorldRule *initWorldRules() override;
|
CRAWL::WorldRule *initWorldRules() override;
|
||||||
QString initHdrBackGround() const override;
|
QString initHdrBackGround() const override;
|
||||||
QString description() const override;
|
QString description() const override;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace AbstractLvl {
|
namespace AbstractLvl {
|
||||||
|
|
||||||
AbsNest::AbsNest(IWorld * mainWorld): CRAWL::IPreviewScaneWorld(mainWorld) {
|
AbsNest::AbsNest(): CRAWL::IPreviewScaneWorld() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace AbstractLvl {
|
|||||||
class AbsNest: public CRAWL::IPreviewScaneWorld
|
class AbsNest: public CRAWL::IPreviewScaneWorld
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AbsNest(IWorld *mainWorld);
|
AbsNest();
|
||||||
|
|
||||||
// IWorld interface
|
// IWorld interface
|
||||||
public:
|
public:
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
namespace TestLvl {
|
namespace TestLvl {
|
||||||
|
|
||||||
Nest::Nest(IWorld *mainWorld): CRAWL::IPreviewScaneWorld(mainWorld) {
|
Nest::Nest(): CRAWL::IPreviewScaneWorld() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace TestLvl {
|
|||||||
class Nest: public CRAWL::IPreviewScaneWorld
|
class Nest: public CRAWL::IPreviewScaneWorld
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Nest(IWorld* mainWorld);
|
Nest();
|
||||||
|
|
||||||
// IWorld interface
|
// IWorld interface
|
||||||
public:
|
public:
|
||||||
|
@ -25,8 +25,6 @@ namespace TestLvl {
|
|||||||
World::World() {
|
World::World() {
|
||||||
setCameraReleativePosition({50,0,100});
|
setCameraReleativePosition({50,0,100});
|
||||||
setCameraRotation(QQuaternion::fromEulerAngles({0,0,0}));
|
setCameraRotation(QQuaternion::fromEulerAngles({0,0,0}));
|
||||||
|
|
||||||
addChildItem();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CRAWL::WorldRule *World::initWorldRules() {
|
CRAWL::WorldRule *World::initWorldRules() {
|
||||||
@ -75,10 +73,6 @@ void World::initControl(CRAWL::IControl *control) {
|
|||||||
return IWorld::initControl(control);
|
return IWorld::initControl(control);
|
||||||
}
|
}
|
||||||
|
|
||||||
CRAWL::PlayableObject *World::initPlayer(int) const {
|
|
||||||
return new TestSnake();
|
|
||||||
}
|
|
||||||
|
|
||||||
CRAWL::IAI *World::initBackGroundAI() const {
|
CRAWL::IAI *World::initBackGroundAI() const {
|
||||||
return IWorld::initBackGroundAI();
|
return IWorld::initBackGroundAI();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ public:
|
|||||||
int cost() const override;
|
int cost() const override;
|
||||||
CRAWL::IControl *initUserInterface() const override;
|
CRAWL::IControl *initUserInterface() const override;
|
||||||
void initControl(CRAWL::IControl *control) override;
|
void initControl(CRAWL::IControl *control) override;
|
||||||
CRAWL::PlayableObject *initPlayer(int type) const override;
|
|
||||||
CRAWL::IAI *initBackGroundAI() const override;
|
CRAWL::IAI *initBackGroundAI() const override;
|
||||||
QString itemTextId() const override;
|
QString itemTextId() const override;
|
||||||
int requiredTier() const override;
|
int requiredTier() const override;
|
||||||
|
@ -8,10 +8,13 @@
|
|||||||
#include "testlevel.h"
|
#include "testlevel.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "nest.h"
|
#include "nest.h"
|
||||||
|
#include "testsnake.h"
|
||||||
|
|
||||||
TestLevel::TestLevel() {
|
TestLevel::TestLevel() {
|
||||||
initTestLvlResources();
|
initTestLvlResources();
|
||||||
auto world = new TestLvl::World();
|
setWorld(new TestLvl::World());
|
||||||
setWorld(world);
|
setPreviewScane(new TestLvl::Nest());
|
||||||
setPreviewScane(new TestLvl::Nest(world));
|
|
||||||
|
addItem(new TestLvl::TestSnake());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,13 @@
|
|||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "nest.h"
|
#include "nest.h"
|
||||||
|
|
||||||
|
#include "snake.h"
|
||||||
|
|
||||||
Jungle::Jungle() {
|
Jungle::Jungle() {
|
||||||
initJungleLvlResources();
|
initJungleLvlResources();
|
||||||
|
setWorld(new JungleLvl::World());
|
||||||
|
|
||||||
auto world = new JungleLvl::World();
|
setPreviewScane(new JungleLvl::Nest());
|
||||||
|
|
||||||
setWorld(world);
|
addItem(new JungleLvl::Snake());
|
||||||
|
|
||||||
setPreviewScane(new JungleLvl::Nest(world));
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
namespace JungleLvl {
|
namespace JungleLvl {
|
||||||
|
|
||||||
Nest::Nest(IWorld *mainWorld): CRAWL::IPreviewScaneWorld(mainWorld) {
|
Nest::Nest(): CRAWL::IPreviewScaneWorld() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace JungleLvl {
|
|||||||
class Nest: public CRAWL::IPreviewScaneWorld
|
class Nest: public CRAWL::IPreviewScaneWorld
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Nest(IWorld *mainWorld);
|
Nest();
|
||||||
|
|
||||||
// IWorld interface
|
// IWorld interface
|
||||||
public:
|
public:
|
||||||
|
@ -108,10 +108,6 @@ void World::initControl(CRAWL::IControl *control) {
|
|||||||
return IWorld::initControl(control);
|
return IWorld::initControl(control);
|
||||||
}
|
}
|
||||||
|
|
||||||
CRAWL::PlayableObject *World::initPlayer(int) const {
|
|
||||||
return new Snake();
|
|
||||||
}
|
|
||||||
|
|
||||||
CRAWL::IAI *World::initBackGroundAI() const {
|
CRAWL::IAI *World::initBackGroundAI() const {
|
||||||
return IWorld::initBackGroundAI();
|
return IWorld::initBackGroundAI();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ public:
|
|||||||
int cost() const override;
|
int cost() const override;
|
||||||
CRAWL::IControl *initUserInterface() const override;
|
CRAWL::IControl *initUserInterface() const override;
|
||||||
void initControl(CRAWL::IControl *control) override;
|
void initControl(CRAWL::IControl *control) override;
|
||||||
CRAWL::PlayableObject *initPlayer(int) const override;
|
|
||||||
CRAWL::IAI *initBackGroundAI() const override;
|
CRAWL::IAI *initBackGroundAI() const override;
|
||||||
QString itemTextId() const override;
|
QString itemTextId() const override;
|
||||||
int requiredTier() const override;
|
int requiredTier() const override;
|
||||||
|
@ -45,7 +45,6 @@ public:
|
|||||||
|
|
||||||
// IWorld interface
|
// IWorld interface
|
||||||
public:
|
public:
|
||||||
CRAWL::PlayableObject *initPlayer(int) const override {return nullptr;};
|
|
||||||
CRAWL::WorldRule *initWorldRules() override {return nullptr;};
|
CRAWL::WorldRule *initWorldRules() override {return nullptr;};
|
||||||
QString initHdrBackGround() const override {return "";};
|
QString initHdrBackGround() const override {return "";};
|
||||||
QString description() const override {return "";};
|
QString description() const override {return "";};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user