some bugfix in ADeditor

memory optimization in AD
This commit is contained in:
2010-09-18 00:00:32 +04:00
parent 97c8725091
commit 0a9679fd99
14 changed files with 399 additions and 133 deletions

View File

@@ -16,7 +16,8 @@ SOURCES += main.cpp \
../game_data.cpp \ ../game_data.cpp \
triggermodel.cpp \ triggermodel.cpp \
mapmodel.cpp \ mapmodel.cpp \
animationmodel.cpp animationmodel.cpp \
animlabel.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
../loader.h \ ../loader.h \
alienmodel.h \ alienmodel.h \
@@ -28,7 +29,8 @@ HEADERS += mainwindow.h \
../game_data.h \ ../game_data.h \
triggermodel.h \ triggermodel.h \
mapmodel.h \ mapmodel.h \
animationmodel.h animationmodel.h \
animlabel.h
FORMS += mainwindow.ui FORMS += mainwindow.ui
TRANSLATIONS += adeditor_ru.ts TRANSLATIONS += adeditor_ru.ts
RESOURCES += ADeditor.qrc RESOURCES += ADeditor.qrc

View File

@@ -76,7 +76,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-wExeabp7q4,guid=18815993df3603fdc64a3f6d4c7b5822</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-2HAd2azpnh,guid=fd81c6d6610b4c57717ec20c4c90d3de</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@@ -84,7 +84,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value> <value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value> <value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-4vN5uf</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-vNW3fv</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value> <value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value> <value type="QString">LANG=ru_RU.UTF-8</value>
@@ -95,17 +95,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value> <value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205</value> <value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1158,unix/buull-eeePC:/tmp/.ICE-unix/1158</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value> <value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1239</value> <value type="QString">SSH_AGENT_PID=1195</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-4vN5uf/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-vNW3fv/ssh</value>
<value type="QString">USER=andrey</value> <value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value> <value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-x9URui/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-Len9P0/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1283151906.338331-318132279</value> <value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1284559837.801731-819619931</value>
</valuelist> </valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">/home/andrey/AD/aliendefender/ADeditor/ADeditor.pro</value> <value type="QString">/home/andrey/AD/aliendefender/ADeditor/ADeditor.pro</value>
@@ -124,7 +124,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-wExeabp7q4,guid=18815993df3603fdc64a3f6d4c7b5822</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-2HAd2azpnh,guid=fd81c6d6610b4c57717ec20c4c90d3de</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@@ -132,7 +132,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value> <value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value> <value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-4vN5uf</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-vNW3fv</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value> <value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value> <value type="QString">LANG=ru_RU.UTF-8</value>
@@ -143,17 +143,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value> <value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205</value> <value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1158,unix/buull-eeePC:/tmp/.ICE-unix/1158</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value> <value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1239</value> <value type="QString">SSH_AGENT_PID=1195</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-4vN5uf/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-vNW3fv/ssh</value>
<value type="QString">USER=andrey</value> <value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value> <value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-x9URui/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-Len9P0/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1283151906.338331-318132279</value> <value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1284559837.801731-819619931</value>
</valuelist> </valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value> <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">

View File

@@ -8,5 +8,6 @@
<file>icons/list-add.png</file> <file>icons/list-add.png</file>
<file>icons/list-remove.png</file> <file>icons/list-remove.png</file>
<file>icons/view-refresh.png</file> <file>icons/view-refresh.png</file>
<file>icons/edit.png</file>
</qresource> </qresource>
</RCC> </RCC>

27
ADeditor/animlabel.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include "animlabel.h"
AnimLabel::AnimLabel(QWidget *parent) :
QLabel(parent)
{
startTimer(50);
}
void AnimLabel::setAnimation(const QStringList &anim)
{
for (int i=0; i<images.size(); ++i)
delete images[i];
images.clear();
for (int i=0; i<anim.size(); ++i)
images.append(new QPixmap(anim.at(i)));
imgIndex = 0;
}
void AnimLabel::timerEvent(QTimerEvent *)
{
if (images.isEmpty()) return;
if (imgIndex >= images.size()) imgIndex = 0;
this->setPixmap(*images.at(imgIndex));
imgIndex++;
}

22
ADeditor/animlabel.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef ANIMLABEL_H
#define ANIMLABEL_H
#include <QLabel>
class AnimLabel : public QLabel
{
Q_OBJECT
public:
explicit AnimLabel(QWidget *parent = 0);
void setAnimation(const QStringList &anim);
signals:
public slots:
private:
QList<QPixmap *> images;
int imgIndex;
void timerEvent(QTimerEvent *);
};
#endif // ANIMLABEL_H

View File

@@ -10,8 +10,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui(new Ui::MainWindow) ui(new Ui::MainWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->pbSave->setIcon(/*QIcon::fromTheme("documment-save",*/ ui->pbSave->setIcon(QIcon::fromTheme("document-save", QIcon(":/icons/icons/document-save.png")));
QIcon(":/icons/icons/documment-save.png"));
ui->pbReload->setIcon(QIcon::fromTheme("edit-undo", QIcon(":/icons/icons/edit-undo.png"))); ui->pbReload->setIcon(QIcon::fromTheme("edit-undo", QIcon(":/icons/icons/edit-undo.png")));
ui->pbAlAdd->setIcon(QIcon::fromTheme("list-add", QIcon(":/icons/icons/list-add.png"))); ui->pbAlAdd->setIcon(QIcon::fromTheme("list-add", QIcon(":/icons/icons/list-add.png")));
ui->pbAlDel->setIcon(QIcon::fromTheme("list-remove", QIcon(":/icons/icons/list-remove.png"))); ui->pbAlDel->setIcon(QIcon::fromTheme("list-remove", QIcon(":/icons/icons/list-remove.png")));
@@ -87,6 +86,9 @@ MainWindow::MainWindow(QWidget *parent) :
ui->splitter_5->restoreState(sett.value("session/split5").toByteArray()); ui->splitter_5->restoreState(sett.value("session/split5").toByteArray());
ui->splitter_6->restoreState(sett.value("session/split6").toByteArray()); ui->splitter_6->restoreState(sett.value("session/split6").toByteArray());
ui->tabWidget->setCurrentIndex(sett.value("session/tab").toInt()); ui->tabWidget->setCurrentIndex(sett.value("session/tab").toInt());
//alb = new AnimLabel();
//ui->verticalLayout->addWidget(alb);
//alb->setAnimation(adloader->animations.value(1).pathes);
} }
@@ -112,20 +114,22 @@ void MainWindow::changeEvent(QEvent *e)
void MainWindow::on_cbAlArmor_toggled(bool checked) void MainWindow::on_cbAlArmor_toggled(bool checked)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
float lval = adloader->aliens[id].armor;
ui->sbAlArmor->setEnabled(checked); ui->sbAlArmor->setEnabled(checked);
if (checked) adloader->aliens[id].armor = ui->sbAlArmor->value(); if (checked) adloader->aliens[id].armor = ui->sbAlArmor->value();
else adloader->aliens[id].armor = 0; else adloader->aliens[id].armor = 0;
isSaved = false; if (lval != adloader->aliens[id].armor) isSaved = false;
} }
void MainWindow::on_cbAlRegeneration_toggled(bool checked) void MainWindow::on_cbAlRegeneration_toggled(bool checked)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
float lval = adloader->aliens[id].regeneration;
ui->sbAlregeneration->setEnabled(checked); ui->sbAlregeneration->setEnabled(checked);
if (checked) adloader->aliens[id].regeneration = ui->sbAlregeneration->value(); if (checked) adloader->aliens[id].regeneration = ui->sbAlregeneration->value();
else adloader->aliens[id].regeneration = 0; else adloader->aliens[id].regeneration = 0;
isSaved = false; if (lval != adloader->aliens[id].regeneration) isSaved = false;
} }
@@ -156,6 +160,8 @@ void MainWindow::lvAliens_select(QModelIndex index, QModelIndex)
else ui->cbAlRegeneration->setChecked(false); else ui->cbAlRegeneration->setChecked(false);
ui->sbAlScore->setValue(al.score); ui->sbAlScore->setValue(al.score);
ui->cbAlIsFly->setChecked(al.isFlying); ui->cbAlIsFly->setChecked(al.isFlying);
ui->cbAlImage->setCurrentIndex(adloader->animations.keys().indexOf(al.imgType));
ui->lbAlAnim->setAnimation(adloader->animations.value(al.imgType).pathes);
} }
} }
@@ -222,6 +228,8 @@ void MainWindow::lvTowers_select(QModelIndex index, QModelIndex)
ui->sbTwRadius->setValue(tw.radius); ui->sbTwRadius->setValue(tw.radius);
ui->sbTwReload->setValue(tw.reload); ui->sbTwReload->setValue(tw.reload);
ui->cbTwSplash->setCurrentIndex(adloader->splashes.keys().indexOf(tw.splashId)); ui->cbTwSplash->setCurrentIndex(adloader->splashes.keys().indexOf(tw.splashId));
ui->cbTwImage->setCurrentIndex(adloader->animations.keys().indexOf(tw.imgType));
ui->lbTwAnim->setAnimation(adloader->animations.value(tw.imgType).pathes);
} }
} }
@@ -235,6 +243,8 @@ void MainWindow::lvSplashes_select(QModelIndex index, QModelIndex)
ui->sbSplSpeed->setValue(spl.speed); ui->sbSplSpeed->setValue(spl.speed);
ui->cbSplAutoControl->setChecked(spl.autoControl); ui->cbSplAutoControl->setChecked(spl.autoControl);
ui->leSplName->setText(spl.name); ui->leSplName->setText(spl.name);
ui->cbSplImage->setCurrentIndex(adloader->animations.keys().indexOf(spl.imgType));
ui->lbSplAnim->setAnimation(adloader->animations.value(spl.imgType).pathes);
} }
} }
@@ -374,23 +384,16 @@ void MainWindow::on_pbReload_clicked()
trigModel->refresh(adloader->triggers.values()); trigModel->refresh(adloader->triggers.values());
animModel->refresh(adloader->animations.values()); animModel->refresh(adloader->animations.values());
mapModel->refresh(adloader->maps.values()); mapModel->refresh(adloader->maps.values());
ui->lvAnimations->setModel((QAbstractItemModel * )animModel);
ui->lvAnimations->reset(); ui->lvAnimations->reset();
ui->lvAnimations->selectionModel()->setCurrentIndex(ui->lvAnimations->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvAnimations->selectionModel()->setCurrentIndex(ui->lvAnimations->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->lvMaps->setModel((QAbstractItemModel * )mapModel);
ui->lvMaps->reset(); ui->lvMaps->reset();
ui->lvMaps->selectionModel()->setCurrentIndex(ui->lvMaps->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvMaps->selectionModel()->setCurrentIndex(ui->lvMaps->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->lvAliens->setModel(alModel);
ui->lvAliens->reset(); ui->lvAliens->reset();
ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->lvSplashes->setModel(splModel);
ui->lvSplashes->reset(); ui->lvSplashes->reset();
ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->lvTowers->setModel(twModel);
ui->cbTwSplash->setModel(splModel);
ui->lvTowers->reset(); ui->lvTowers->reset();
ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->lvTriggers->setModel(trigModel);
ui->lvTriggers->reset(); ui->lvTriggers->reset();
ui->lvTriggers->selectionModel()->setCurrentIndex(ui->lvTriggers->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvTriggers->selectionModel()->setCurrentIndex(ui->lvTriggers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
isSaved = true; isSaved = true;
@@ -401,66 +404,76 @@ void MainWindow::on_pbReload_clicked()
void MainWindow::on_sbAlHealth_valueChanged(double value) void MainWindow::on_sbAlHealth_valueChanged(double value)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
float lval = adloader->aliens[id].health;
adloader->aliens[id].health = value; adloader->aliens[id].health = value;
isSaved = false; if (lval != adloader->aliens[id].health) isSaved = false;
} }
void MainWindow::on_sbAlArmor_valueChanged(double value) void MainWindow::on_sbAlArmor_valueChanged(double value)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
float lval = adloader->aliens[id].armor;
adloader->aliens[id].armor = value; adloader->aliens[id].armor = value;
isSaved = false; if (lval != adloader->aliens[id].armor) isSaved = false;
} }
void MainWindow::on_sbAlregeneration_valueChanged(double value) void MainWindow::on_sbAlregeneration_valueChanged(double value)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
float lval = adloader->aliens[id].regeneration;
adloader->aliens[id].regeneration = value; adloader->aliens[id].regeneration = value;
isSaved = false; if (lval != adloader->aliens[id].regeneration) isSaved = false;
} }
void MainWindow::on_sbAlSpeed_valueChanged(double value) void MainWindow::on_sbAlSpeed_valueChanged(double value)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
float lval = adloader->aliens[id].speed;
adloader->aliens[id].speed = value; adloader->aliens[id].speed = value;
isSaved = false; if (lval != adloader->aliens[id].speed) isSaved = false;
} }
void MainWindow::on_sbAlPrise_valueChanged(int val) void MainWindow::on_sbAlPrise_valueChanged(int val)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
unsigned int lval = adloader->aliens[id].prise;
adloader->aliens[id].prise = val; adloader->aliens[id].prise = val;
isSaved = false; if (lval != adloader->aliens[id].prise) isSaved = false;
} }
void MainWindow::on_sbAlScore_valueChanged(int val) void MainWindow::on_sbAlScore_valueChanged(int val)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
unsigned int lval = adloader->aliens[id].score;
adloader->aliens[id].score = val; adloader->aliens[id].score = val;
isSaved = false; if (lval != adloader->aliens[id].score) isSaved = false;
} }
void MainWindow::on_cbAlIsFly_toggled(bool checked) void MainWindow::on_cbAlIsFly_toggled(bool checked)
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
bool lval = adloader->aliens[id].isFlying;
adloader->aliens[id].isFlying = checked; adloader->aliens[id].isFlying = checked;
isSaved = false; if (lval != adloader->aliens[id].isFlying) isSaved = false;
} }
void MainWindow::on_leAlName_editingFinished() void MainWindow::on_leAlName_editingFinished()
{ {
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
QString lval = adloader->aliens[id].name;
adloader->aliens[id].name = ui->leAlName->text(); adloader->aliens[id].name = ui->leAlName->text();
alModel->refresh(adloader->aliens.values()); alModel->refresh(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel); QModelIndex mindex = ui->lvAliens->currentIndex();
isSaved = false; ui->lvAliens->reset();
ui->lvAliens->setCurrentIndex(mindex);
if (lval != adloader->aliens[id].name) isSaved = false;
} }
@@ -478,7 +491,6 @@ void MainWindow::on_pbAlAdd_clicked()
adloader->aliens.insert(al.id,al); adloader->aliens.insert(al.id,al);
int index = adloader->aliens.keys().indexOf(i); int index = adloader->aliens.keys().indexOf(i);
alModel->refresh(adloader->aliens.values()); alModel->refresh(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel);
ui->lvAliens->reset(); ui->lvAliens->reset();
ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(index,0),QItemSelectionModel::ClearAndSelect); ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
isSaved = false; isSaved = false;
@@ -510,7 +522,6 @@ void MainWindow::on_pbAlDel_clicked()
{ {
adloader->aliens.remove(id); adloader->aliens.remove(id);
alModel->refresh(adloader->aliens.values()); alModel->refresh(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel);
ui->lvAliens->reset(); ui->lvAliens->reset();
ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
isSaved = false; isSaved = false;
@@ -521,106 +532,121 @@ void MainWindow::on_pbAlDel_clicked()
void MainWindow::on_leTwName_editingFinished() void MainWindow::on_leTwName_editingFinished()
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
QString lval = adloader->towers[id].name;
adloader->towers[id].name = ui->leTwName->text(); adloader->towers[id].name = ui->leTwName->text();
twModel->refresh(adloader->towers.values()); twModel->refresh(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel); QModelIndex mindex = ui->lvTowers->currentIndex();
isSaved = false; ui->lvTowers->reset();
ui->lvTowers->setCurrentIndex(mindex);
if (lval != adloader->towers[id].name) isSaved = false;
} }
void MainWindow::on_sbTwBuildTime_valueChanged(int val) void MainWindow::on_sbTwBuildTime_valueChanged(int val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
unsigned int lval = adloader->towers[id].buildTime;
adloader->towers[id].buildTime = val; adloader->towers[id].buildTime = val;
isSaved = false; if (lval != adloader->towers[id].buildTime) isSaved = false;
} }
void MainWindow::on_sbTwCost_valueChanged(int val) void MainWindow::on_sbTwCost_valueChanged(int val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
unsigned int lval = adloader->towers[id].cost;
adloader->towers[id].cost = val; adloader->towers[id].cost = val;
isSaved = false; if (lval != adloader->towers[id].cost) isSaved = false;
} }
void MainWindow::on_cbTwSplash_currentIndexChanged(int index) void MainWindow::on_cbTwSplash_currentIndexChanged(int index)
{ {
if (index > 0) if (!ui->lvTowers->currentIndex().isValid()) return;
if (index >= 0)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
int lval = adloader->towers[id].splashId;
adloader->towers[id].splashId = adloader->splashes.values().at(index).id; adloader->towers[id].splashId = adloader->splashes.values().at(index).id;
isSaved = false; if (lval != adloader->towers[id].splashId) isSaved = false;
} }
} }
void MainWindow::on_sbTwReload_valueChanged(int val) void MainWindow::on_sbTwReload_valueChanged(int val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
unsigned int lval = adloader->towers[id].reload;
adloader->towers[id].reload = val; adloader->towers[id].reload = val;
isSaved = false; if (lval != adloader->towers[id].reload) isSaved = false;
} }
void MainWindow::on_sbTwRadius_valueChanged(double val) void MainWindow::on_sbTwRadius_valueChanged(double val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
float lval = adloader->towers[id].radius;
adloader->towers[id].radius = val; adloader->towers[id].radius = val;
isSaved = false; if (lval != adloader->towers[id].radius) isSaved = false;
} }
void MainWindow::on_sbTwExpByShot_valueChanged(double val) void MainWindow::on_sbTwExpByShot_valueChanged(double val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
float lval = adloader->towers[id].expByShot;
adloader->towers[id].expByShot = val; adloader->towers[id].expByShot = val;
isSaved = false; if (lval != adloader->towers[id].expByShot) isSaved = false;
} }
void MainWindow::on_cbTwExpByShot_toggled(bool checked) void MainWindow::on_cbTwExpByShot_toggled(bool checked)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
float lval = adloader->towers[id].expByShot;
ui->sbTwExpByShot->setEnabled(checked); ui->sbTwExpByShot->setEnabled(checked);
if (checked) adloader->towers[id].expByShot = ui->sbTwExpByShot->value(); if (checked) adloader->towers[id].expByShot = ui->sbTwExpByShot->value();
else adloader->towers[id].expByShot = 0; else adloader->towers[id].expByShot = 0;
isSaved = false; if (lval != adloader->towers[id].expByShot) isSaved = false;
} }
void MainWindow::on_sbTwExpByDam_valueChanged(double val) void MainWindow::on_sbTwExpByDam_valueChanged(double val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
float lval = adloader->towers[id].expByDamage;
adloader->towers[id].expByDamage = val; adloader->towers[id].expByDamage = val;
isSaved = false; if (lval != adloader->towers[id].expByDamage) isSaved = false;
} }
void MainWindow::on_cbTwExpByDam_toggled(bool checked) void MainWindow::on_cbTwExpByDam_toggled(bool checked)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
float lval = adloader->towers[id].expByDamage;
ui->sbTwExpByDam->setEnabled(checked); ui->sbTwExpByDam->setEnabled(checked);
if (checked) adloader->towers[id].expByDamage = ui->sbTwExpByDam->value(); if (checked) adloader->towers[id].expByDamage = ui->sbTwExpByDam->value();
else adloader->towers[id].expByDamage = 0; else adloader->towers[id].expByDamage = 0;
isSaved = false; if (lval != adloader->towers[id].expByDamage) isSaved = false;
} }
void MainWindow::on_sbTwExpByKill_valueChanged(double val) void MainWindow::on_sbTwExpByKill_valueChanged(double val)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
float lval = adloader->towers[id].expByKill;
adloader->towers[id].expByKill = val; adloader->towers[id].expByKill = val;
isSaved = false; if (lval != adloader->towers[id].expByKill) isSaved = false;
} }
void MainWindow::on_cbTwExpByKill_toggled(bool checked) void MainWindow::on_cbTwExpByKill_toggled(bool checked)
{ {
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
float lval = adloader->towers[id].expByKill;
ui->sbTwExpByKill->setEnabled(checked); ui->sbTwExpByKill->setEnabled(checked);
if (checked) adloader->towers[id].expByKill = ui->sbTwExpByKill->value(); if (checked) adloader->towers[id].expByKill = ui->sbTwExpByKill->value();
else adloader->towers[id].expByKill = 0; else adloader->towers[id].expByKill = 0;
isSaved = false; if (lval != adloader->towers[id].expByKill) isSaved = false;
} }
@@ -639,7 +665,6 @@ void MainWindow::on_pbTwAdd_clicked()
adloader->towers.insert(tw.id,tw); adloader->towers.insert(tw.id,tw);
int index = adloader->towers.keys().indexOf(i); int index = adloader->towers.keys().indexOf(i);
twModel->refresh(adloader->towers.values()); twModel->refresh(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel);
ui->lvTowers->reset(); ui->lvTowers->reset();
ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(index,0),QItemSelectionModel::ClearAndSelect); ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
isSaved = false; isSaved = false;
@@ -671,7 +696,6 @@ void MainWindow::on_pbTwDel_clicked()
{ {
adloader->towers.remove(id); adloader->towers.remove(id);
twModel->refresh(adloader->towers.values()); twModel->refresh(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel);
ui->lvTowers->reset(); ui->lvTowers->reset();
ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
isSaved = false; isSaved = false;
@@ -681,35 +705,42 @@ void MainWindow::on_pbTwDel_clicked()
void MainWindow::on_leSplName_editingFinished() void MainWindow::on_leSplName_editingFinished()
{ {
int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id;
QString lval = adloader->splashes[id].name;
adloader->splashes[id].name = ui->leSplName->text(); adloader->splashes[id].name = ui->leSplName->text();
splModel->refresh(adloader->splashes.values()); splModel->refresh(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel); //ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel); //ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
isSaved = false; QModelIndex mindex = ui->lvSplashes->currentIndex();
ui->lvSplashes->reset();
ui->lvSplashes->setCurrentIndex(mindex);
if (lval != adloader->splashes[id].name) isSaved = false;
} }
void MainWindow::on_sbSplSpeed_valueChanged(double val) void MainWindow::on_sbSplSpeed_valueChanged(double val)
{ {
int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id;
float lval = adloader->splashes[id].speed;
adloader->splashes[id].speed = val; adloader->splashes[id].speed = val;
isSaved = false; if (lval != adloader->splashes[id].speed) isSaved = false;
} }
void MainWindow::on_cbSplAutoControl_toggled(bool checked) void MainWindow::on_cbSplAutoControl_toggled(bool checked)
{ {
int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id;
bool lval = adloader->splashes[id].autoControl;
adloader->splashes[id].autoControl = checked; adloader->splashes[id].autoControl = checked;
isSaved = false; if (lval != adloader->splashes[id].autoControl) isSaved = false;
} }
void MainWindow::on_sbSplLifeTime_valueChanged(int val) void MainWindow::on_sbSplLifeTime_valueChanged(int val)
{ {
int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id;
unsigned int lval = adloader->splashes[id].lifetime;
adloader->splashes[id].lifetime = val; adloader->splashes[id].lifetime = val;
isSaved = false; if (lval != adloader->splashes[id].lifetime) isSaved = false;
} }
@@ -725,10 +756,8 @@ void MainWindow::on_pbSplAdd_clicked()
adloader->splashes.insert(spl.id,spl); adloader->splashes.insert(spl.id,spl);
int index = adloader->splashes.keys().indexOf(i); int index = adloader->splashes.keys().indexOf(i);
splModel->refresh(adloader->splashes.values()); splModel->refresh(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
ui->lvSplashes->reset(); ui->lvSplashes->reset();
ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(index,0),QItemSelectionModel::ClearAndSelect); ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
isSaved = false; isSaved = false;
} }
@@ -771,10 +800,8 @@ void MainWindow::on_pbSlpDel_clicked()
{ {
adloader->splashes.remove(id); adloader->splashes.remove(id);
splModel->refresh(adloader->splashes.values()); splModel->refresh(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
ui->lvSplashes->reset(); ui->lvSplashes->reset();
ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
isSaved = false; isSaved = false;
} }
} }
@@ -791,116 +818,131 @@ void MainWindow::on_pbTwSplashEdit_clicked()
void MainWindow::on_cbTrigChance_toggled(bool checked) void MainWindow::on_cbTrigChance_toggled(bool checked)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
int lval = adloader->triggers[id].chance;
ui->sbTrigChance->setEnabled(checked); ui->sbTrigChance->setEnabled(checked);
if (checked) adloader->triggers[id].chance = ui->sbTrigChance->value(); if (checked) adloader->triggers[id].chance = ui->sbTrigChance->value();
else adloader->triggers[id].chance = 100; else adloader->triggers[id].chance = 100;
isSaved = false; if (lval != adloader->triggers[id].chance) isSaved = false;
} }
void MainWindow::on_sbTrigChance_valueChanged(int val) void MainWindow::on_sbTrigChance_valueChanged(int val)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
int lval = adloader->triggers[id].chance;
adloader->triggers[id].chance = val; adloader->triggers[id].chance = val;
isSaved = false; if (lval != adloader->triggers[id].chance) isSaved = false;
} }
void MainWindow::on_leTrigName_editingFinished() void MainWindow::on_leTrigName_editingFinished()
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
QString lval = adloader->triggers[id].name;
adloader->triggers[id].name = ui->leTrigName->text(); adloader->triggers[id].name = ui->leTrigName->text();
trigModel->refresh(adloader->triggers.values()); trigModel->refresh(adloader->triggers.values());
ui->lvTriggers->setModel((QAbstractItemModel * )trigModel); QModelIndex mindex = ui->lvTriggers->currentIndex();
isSaved = false; ui->lvTriggers->reset();
ui->lvTriggers->setCurrentIndex(mindex);
if (lval != adloader->triggers[id].name) isSaved = false;
} }
void MainWindow::on_sbTrigCount_valueChanged(int val) void MainWindow::on_sbTrigCount_valueChanged(int val)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
int lval = adloader->triggers[id].count;
adloader->triggers[id].count = val; adloader->triggers[id].count = val;
isSaved = false; if (lval != adloader->triggers[id].count) isSaved = false;
} }
void MainWindow::on_sbTrigRandomRadius_valueChanged(double value) void MainWindow::on_sbTrigRandomRadius_valueChanged(double value)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
float lval = adloader->triggers[id].randomPosRadius;
adloader->triggers[id].randomPosRadius = value; adloader->triggers[id].randomPosRadius = value;
isSaved = false; if (lval != adloader->triggers[id].randomPosRadius) isSaved = false;
} }
void MainWindow::on_cbTrigDelPar_toggled(bool checked) void MainWindow::on_cbTrigDelPar_toggled(bool checked)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
bool lval = adloader->triggers[id].delParent;
adloader->triggers[id].delParent = checked; adloader->triggers[id].delParent = checked;
isSaved = false; if (lval != adloader->triggers[id].delParent) isSaved = false;
} }
void MainWindow::on_sbTrigTimer_valueChanged(int val) void MainWindow::on_sbTrigTimer_valueChanged(int val)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
unsigned int lval = adloader->triggers[id].timer;
adloader->triggers[id].timer = val; adloader->triggers[id].timer = val;
isSaved = false; if (lval != adloader->triggers[id].timer) isSaved = false;
} }
void MainWindow::on_sbTrigDamage_valueChanged(double value) void MainWindow::on_sbTrigDamage_valueChanged(double value)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
float lval = adloader->triggers[id].damage;
adloader->triggers[id].damage = value; adloader->triggers[id].damage = value;
isSaved = false; if (lval != adloader->triggers[id].damage) isSaved = false;
} }
void MainWindow::on_sbTrigDamRadius_valueChanged(double value) void MainWindow::on_sbTrigDamRadius_valueChanged(double value)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
float lval = adloader->triggers[id].radius;
adloader->triggers[id].radius = value; adloader->triggers[id].radius = value;
isSaved = false; if (lval != adloader->triggers[id].radius) isSaved = false;
} }
void MainWindow::on_cbTrigDamRad_toggled(bool checked) void MainWindow::on_cbTrigDamRad_toggled(bool checked)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
float lval = adloader->triggers[id].radius;
ui->sbTrigDamRadius->setEnabled(checked); ui->sbTrigDamRadius->setEnabled(checked);
if (checked) adloader->triggers[id].radius = ui->sbTrigDamRadius->value(); if (checked) adloader->triggers[id].radius = ui->sbTrigDamRadius->value();
else adloader->triggers[id].radius = 0; else adloader->triggers[id].radius = 0;
isSaved = false; if (lval != adloader->triggers[id].radius) isSaved = false;
} }
void MainWindow::on_cbTrigDamage_toggled(bool checked) void MainWindow::on_cbTrigDamage_toggled(bool checked)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
float lval = adloader->triggers[id].damage;
ui->sbTrigDamage->setEnabled(checked); ui->sbTrigDamage->setEnabled(checked);
if (checked) adloader->triggers[id].damage = ui->sbTrigDamage->value(); if (checked) adloader->triggers[id].damage = ui->sbTrigDamage->value();
else adloader->triggers[id].damage = 0; else adloader->triggers[id].damage = 0;
isSaved = false; if (lval != adloader->triggers[id].damage) isSaved = false;
} }
void MainWindow::on_cbTrigRandRadius_toggled(bool checked) void MainWindow::on_cbTrigRandRadius_toggled(bool checked)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
float lval = adloader->triggers[id].randomPosRadius;
ui->sbTrigRandomRadius->setEnabled(checked); ui->sbTrigRandomRadius->setEnabled(checked);
if (checked) adloader->triggers[id].randomPosRadius = ui->sbTrigRandomRadius->value(); if (checked) adloader->triggers[id].randomPosRadius = ui->sbTrigRandomRadius->value();
else adloader->triggers[id].randomPosRadius = 0; else adloader->triggers[id].randomPosRadius = 0;
isSaved = false; if (lval != adloader->triggers[id].randomPosRadius) isSaved = false;
} }
void MainWindow::on_cbTrigCount_toggled(bool checked) void MainWindow::on_cbTrigCount_toggled(bool checked)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
int lval = adloader->triggers[id].count;
ui->sbTrigCount->setEnabled(checked); ui->sbTrigCount->setEnabled(checked);
if (checked) adloader->triggers[id].count = ui->sbTrigCount->value(); if (checked) adloader->triggers[id].count = ui->sbTrigCount->value();
else adloader->triggers[id].count = 0; else adloader->triggers[id].count = 0;
isSaved = false; if (lval != adloader->triggers[id].count) isSaved = false;
} }
@@ -923,7 +965,6 @@ void MainWindow::on_pbTrigAdd_clicked()
adloader->triggers.insert(trig.id,trig); adloader->triggers.insert(trig.id,trig);
int index = adloader->triggers.keys().indexOf(i); int index = adloader->triggers.keys().indexOf(i);
trigModel->refresh(adloader->triggers.values()); trigModel->refresh(adloader->triggers.values());
ui->lvTriggers->setModel((QAbstractItemModel * )trigModel);
ui->lvTriggers->reset(); ui->lvTriggers->reset();
ui->lvTriggers->selectionModel()->setCurrentIndex(ui->lvTriggers->model()->index(index,0),QItemSelectionModel::ClearAndSelect); ui->lvTriggers->selectionModel()->setCurrentIndex(ui->lvTriggers->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
isSaved = false; isSaved = false;
@@ -955,7 +996,6 @@ void MainWindow::on_pbTrigDel_clicked()
{ {
adloader->triggers.remove(id); adloader->triggers.remove(id);
trigModel->refresh(adloader->triggers.values()); trigModel->refresh(adloader->triggers.values());
ui->lvTriggers->setModel((QAbstractItemModel * )trigModel);
ui->lvTriggers->reset(); ui->lvTriggers->reset();
ui->lvTriggers->selectionModel()->setCurrentIndex(ui->lvTriggers->model()->index(0,0),QItemSelectionModel::ClearAndSelect); ui->lvTriggers->selectionModel()->setCurrentIndex(ui->lvTriggers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
isSaved = false; isSaved = false;
@@ -966,6 +1006,7 @@ void MainWindow::on_pbTrigDel_clicked()
void MainWindow::on_cbTrigType_currentIndexChanged(int index) void MainWindow::on_cbTrigType_currentIndexChanged(int index)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
srcTriggerType::triggerType lval = adloader->triggers[id].type;
adloader->triggers[id].type = (srcTriggerType::triggerType)ui->cbTrigType->itemData(index).toInt(); adloader->triggers[id].type = (srcTriggerType::triggerType)ui->cbTrigType->itemData(index).toInt();
if (adloader->triggers[id].type != srcTriggerType::onTimer) if (adloader->triggers[id].type != srcTriggerType::onTimer)
{ {
@@ -976,15 +1017,16 @@ void MainWindow::on_cbTrigType_currentIndexChanged(int index)
ui->sbTrigTimer->setVisible(true); ui->sbTrigTimer->setVisible(true);
ui->sbTrigTimer->setValue(adloader->triggers[id].timer); ui->sbTrigTimer->setValue(adloader->triggers[id].timer);
} }
isSaved = false; if (lval != adloader->triggers[id].type) isSaved = false;
} }
void MainWindow::on_cbTrigChildAim_currentIndexChanged(int index) void MainWindow::on_cbTrigChildAim_currentIndexChanged(int index)
{ {
int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id; int id = adloader->triggers.values().at(ui->lvTriggers->currentIndex().row()).id;
srcTriggerType::aimType lval = adloader->triggers[id].childAim;
adloader->triggers[id].childAim = (srcTriggerType::aimType)ui->cbTrigChildAim->itemData(index).toInt(); adloader->triggers[id].childAim = (srcTriggerType::aimType)ui->cbTrigChildAim->itemData(index).toInt();
isSaved = false; if (lval != adloader->triggers[id].childAim)isSaved = false;
} }
@@ -1022,8 +1064,122 @@ void MainWindow::refresh_lwImages(QStringList pathes)
void MainWindow::on_pbImgDel_clicked() void MainWindow::on_pbImgDel_clicked()
{ {
int id = adloader->animations.values().at(ui->lvAnimations->currentIndex().row()).id; if (!ui->lwImages->selectedItems().isEmpty())
for (int i=0; i<ui->lwImages->selectedItems().size(); ++i) {
adloader->animations[id].pathes.removeOne(ui->lwImages->selectedItems().at(i)->text()); int id = adloader->animations.values().at(ui->lvAnimations->currentIndex().row()).id;
refresh_lwImages(adloader->animations.value(id).pathes); for (int i=0; i<ui->lwImages->selectedItems().size(); ++i)
adloader->animations[id].pathes.removeOne(ui->lwImages->selectedItems().at(i)->text());
refresh_lwImages(adloader->animations.value(id).pathes);
isSaved = false;
}
}
void MainWindow::on_pbAnimAdd_clicked()
{
int i = 1;
while (adloader->animations.contains(i)) i++;
tbAnimation anim;
anim.id = i;
adloader->animations.insert(anim.id,anim);
int index = adloader->animations.keys().indexOf(i);
animModel->refresh(adloader->animations.values());
ui->lvAnimations->reset();
ui->lvAnimations->selectionModel()->setCurrentIndex(ui->lvAnimations->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
isSaved = false;
}
void MainWindow::on_cbAlImage_currentIndexChanged(int index)
{
if (!ui->lvAliens->currentIndex().isValid()) return;
if (index >= 0)
{
int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id;
int lval = adloader->aliens[id].imgType;
adloader->aliens[id].imgType = adloader->animations.values().at(index).id;
ui->lbAlAnim->setAnimation(adloader->animations.value(adloader->aliens[id].imgType).pathes);
if (lval != adloader->aliens[id].imgType) isSaved = false;
}
}
void MainWindow::on_cbTwImage_currentIndexChanged(int index)
{
if (!ui->lvTowers->currentIndex().isValid()) return;
if (index >= 0)
{
int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id;
int lval = adloader->towers[id].imgType;
adloader->towers[id].imgType = adloader->animations.values().at(index).id;
ui->lbTwAnim->setAnimation(adloader->animations.value(adloader->towers[id].imgType).pathes);
if (lval != adloader->towers[id].imgType) isSaved = false;
}
}
void MainWindow::on_cbSplImage_currentIndexChanged(int index)
{
if (!ui->lvSplashes->currentIndex().isValid()) return;
if (index >= 0)
{
int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id;
int lval = adloader->splashes[id].imgType;
adloader->splashes[id].imgType = adloader->animations.values().at(index).id;
ui->lbSplAnim->setAnimation(adloader->animations.value(adloader->splashes[id].imgType).pathes);
if (lval != adloader->splashes[id].imgType) isSaved = false;
}
}
void MainWindow::on_pbAnimDel_clicked()
{
if (adloader->animations.size() < 2) return;
QMessageBox msgBox;
int id = adloader->animations.keys().at(ui->lvAnimations->currentIndex().row());
for (int i=0; i<adloader->towers.size(); i++)
{
if (adloader->towers.values().at(i).imgType == id)
{
msgBox.setText(tr("You can not delete anim %1").arg(id));
msgBox.setInformativeText(tr("It used by tower %1 id=%2").arg(adloader->towers.values().at(i).name).arg(adloader->towers.values().at(i).id));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return;
}
}
for (int i=0; i<adloader->aliens.size(); i++)
{
if (adloader->aliens.values().at(i).imgType == id)
{
msgBox.setText(tr("You can not delete anim %1").arg(id));
msgBox.setInformativeText(tr("It used by alien %1 id=%2").arg(adloader->aliens.values().at(i).name).arg(adloader->aliens.values().at(i).id));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return;
}
}
for (int i=0; i<adloader->splashes.size(); i++)
{
if (adloader->splashes.values().at(i).imgType == id)
{
msgBox.setText(tr("You can not delete anim %1").arg(id));
msgBox.setInformativeText(tr("It used by splash %1 id=%2").arg(adloader->splashes.values().at(i).name).arg(adloader->splashes.values().at(i).id));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return;
}
}
msgBox.setText(tr("Delete anim %1").arg(id));
msgBox.setInformativeText(tr("Are you sure?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
if (ret == QMessageBox::Ok)
{
adloader->animations.remove(id);
animModel->refresh(adloader->animations.values());
ui->lvAnimations->reset();
ui->lvAnimations->selectionModel()->setCurrentIndex(ui->lvAnimations->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
isSaved = false;
}
} }

View File

@@ -13,6 +13,7 @@
#include "triggermodel.h" #include "triggermodel.h"
#include "mapmodel.h" #include "mapmodel.h"
#include "animationmodel.h" #include "animationmodel.h"
#include "animlabel.h"
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
@@ -38,12 +39,19 @@ private:
AnimationModel * animModel; AnimationModel * animModel;
QGraphicsScene * mapScene; QGraphicsScene * mapScene;
//AnimLabel * alb;
bool isSaved; bool isSaved;
void refresh_lwImages(QStringList pathes); void refresh_lwImages(QStringList pathes);
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);
private slots: private slots:
void on_pbImgDel_clicked(); void on_pbAnimDel_clicked();
void on_cbSplImage_currentIndexChanged(int index);
void on_cbTwImage_currentIndexChanged(int index);
void on_cbAlImage_currentIndexChanged(int index);
void on_pbAnimAdd_clicked();
void on_pbImgDel_clicked();
void on_pbImgAdd_clicked(); void on_pbImgAdd_clicked();
void on_cbTrigChildAim_currentIndexChanged(int index); void on_cbTrigChildAim_currentIndexChanged(int index);
void on_cbTrigType_currentIndexChanged(int index); void on_cbTrigType_currentIndexChanged(int index);

View File

@@ -24,10 +24,33 @@
<property name="spacing"> <property name="spacing">
<number>2</number> <number>2</number>
</property> </property>
<item row="4" column="0">
<widget class="QPushButton" name="pbReload">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="pbSave">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>5</number>
</property>
<property name="movable">
<bool>true</bool>
</property> </property>
<widget class="QWidget" name="tabAliens"> <widget class="QWidget" name="tabAliens">
<attribute name="title"> <attribute name="title">
@@ -356,6 +379,13 @@
<item> <item>
<widget class="QComboBox" name="cbAlImage"/> <widget class="QComboBox" name="cbAlImage"/>
</item> </item>
<item>
<widget class="AnimLabel" name="lbAlAnim">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@@ -387,7 +417,7 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QWidget" name=""> <widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_11"> <layout class="QVBoxLayout" name="verticalLayout_11">
<item> <item>
<widget class="QListView" name="lvTowers"/> <widget class="QListView" name="lvTowers"/>
@@ -747,6 +777,13 @@
<item> <item>
<widget class="QComboBox" name="cbTwImage"/> <widget class="QComboBox" name="cbTwImage"/>
</item> </item>
<item>
<widget class="AnimLabel" name="lbTwAnim">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@@ -778,7 +815,7 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QWidget" name=""> <widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_13"> <layout class="QVBoxLayout" name="verticalLayout_13">
<item> <item>
<widget class="QListView" name="lvSplashes"> <widget class="QListView" name="lvSplashes">
@@ -1003,6 +1040,13 @@
<item> <item>
<widget class="QComboBox" name="cbSplImage"/> <widget class="QComboBox" name="cbSplImage"/>
</item> </item>
<item>
<widget class="AnimLabel" name="lbSplAnim">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@@ -1034,7 +1078,7 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QWidget" name=""> <widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_15"> <layout class="QVBoxLayout" name="verticalLayout_15">
<item> <item>
<widget class="QListView" name="lvTriggers"/> <widget class="QListView" name="lvTriggers"/>
@@ -1390,7 +1434,7 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QWidget" name=""> <widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_17"> <layout class="QVBoxLayout" name="verticalLayout_17">
<item> <item>
<widget class="QListView" name="lvMaps"/> <widget class="QListView" name="lvMaps"/>
@@ -1675,24 +1719,17 @@
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QPushButton" name="pbReload">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="pbSave">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>AnimLabel</class>
<extends>QLabel</extends>
<header>animlabel.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@@ -6,15 +6,16 @@ AD_Core::AD_Core(QObject *parent) :
step = 0; step = 0;
//admap = new Map(1); //admap = new Map(1);
//addata = new Game_Data(admap); //addata = new Game_Data(admap);
adloader = new Loader(); Loader * adloader = new Loader();
adloader->load("data2.xml"); adloader->load("data2.xml");
//adloader->save("data2.xml"); //adloader->save("data2.xml");
addata = adloader->loadlevel(1); addata = adloader->loadlevel(1);
delete adloader;
if (addata != 0) qDebug("Sucsess"); if (addata != 0) qDebug("Sucsess");
else qFatal("Error"); else qFatal("Error");
Player * pl1 = new Player(0); //Player * pl1 = new Player(0);
// Player * pl2 = new Player(0); // Player * pl2 = new Player(0);
addata->players.push_back(pl1); //addata->players.push_back(pl1);
// addata->players.push_back(pl2); // addata->players.push_back(pl2);
adaliens = new Aliens(addata); adaliens = new Aliens(addata);
adtowers = new Towers(addata); adtowers = new Towers(addata);

View File

@@ -17,7 +17,7 @@ public:
Aliens * adaliens; Aliens * adaliens;
Towers * adtowers; Towers * adtowers;
Splashes * adsplashes; Splashes * adsplashes;
Loader * adloader; //Loader * adloader;
unsigned int step; unsigned int step;
private: private:

View File

@@ -76,7 +76,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-wExeabp7q4,guid=18815993df3603fdc64a3f6d4c7b5822</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-2HAd2azpnh,guid=fd81c6d6610b4c57717ec20c4c90d3de</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@@ -84,7 +84,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value> <value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value> <value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-4vN5uf</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-vNW3fv</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value> <value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value> <value type="QString">LANG=ru_RU.UTF-8</value>
@@ -95,17 +95,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value> <value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205</value> <value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1158,unix/buull-eeePC:/tmp/.ICE-unix/1158</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value> <value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1239</value> <value type="QString">SSH_AGENT_PID=1195</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-4vN5uf/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-vNW3fv/ssh</value>
<value type="QString">USER=andrey</value> <value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value> <value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-x9URui/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-Len9P0/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1283151906.338331-318132279</value> <value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1284559837.801731-819619931</value>
</valuelist> </valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">/home/andrey/AD/aliendefender/aliendefender.pro</value> <value type="QString">/home/andrey/AD/aliendefender/aliendefender.pro</value>
@@ -124,7 +124,7 @@
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList"> <valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-wExeabp7q4,guid=18815993df3603fdc64a3f6d4c7b5822</value> <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-2HAd2azpnh,guid=fd81c6d6610b4c57717ec20c4c90d3de</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value> <value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value> <value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value> <value type="QString">DISPLAY=:0.0</value>
@@ -132,7 +132,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value> <value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value> <value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value> <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-4vN5uf</value> <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-vNW3fv</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value> <value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value> <value type="QString">LANG=ru_RU.UTF-8</value>
@@ -143,17 +143,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value> <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value> <value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205</value> <value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1158,unix/buull-eeePC:/tmp/.ICE-unix/1158</value>
<value type="QString">SHELL=/bin/bash</value> <value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value> <value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1239</value> <value type="QString">SSH_AGENT_PID=1195</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-4vN5uf/ssh</value> <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-vNW3fv/ssh</value>
<value type="QString">USER=andrey</value> <value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value> <value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-x9URui/database</value> <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-Len9P0/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value> <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value> <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1283151906.338331-318132279</value> <value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1284559837.801731-819619931</value>
</valuelist> </valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value> <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
<valuelist key="abstractProcess.arguments" type="QVariantList"> <valuelist key="abstractProcess.arguments" type="QVariantList">

View File

@@ -25,7 +25,7 @@
<wave prise="220" timeout="5" id="11"/> <wave prise="220" timeout="5" id="11"/>
</waves> </waves>
<levels> <levels>
<level map="2" id="1" score="168114848" name="First Level"/> <level map="2" id="1" score="138887032" name="First Level"/>
</levels> </levels>
<waveParts> <waveParts>
<wavePart alien="10" count="10" wave="1"/> <wavePart alien="10" count="10" wave="1"/>
@@ -81,7 +81,7 @@
<splash speed="0.1" imageType="5" lifetime="50" autoControl="true" id="6" name="Снаряд"/> <splash speed="0.1" imageType="5" lifetime="50" autoControl="true" id="6" name="Снаряд"/>
</splashes> </splashes>
<towers> <towers>
<tower imageType="3" radius="12" expByKill="0.1" expByShot="0.15" buildTime="150" splash="2" reload="15" id="1" name="rocket launcher 2" cost="50" expByDamage="0.04"/> <tower imageType="8" radius="12" expByKill="0.1" expByShot="0.15" buildTime="150" splash="2" reload="15" id="1" name="rocket launcher 2" cost="50" expByDamage="0.04"/>
<tower imageType="2" radius="3" expByKill="0.2" expByShot="0.1" buildTime="100" splash="3" reload="5" id="2" name="gun" cost="10" expByDamage="0.1"/> <tower imageType="2" radius="3" expByKill="0.2" expByShot="0.1" buildTime="100" splash="3" reload="5" id="2" name="gun" cost="10" expByDamage="0.1"/>
<tower imageType="3" radius="5" expByKill="0.1" expByShot="0.15" buildTime="200" splash="1" reload="50" id="3" name="rocket launcher" cost="30" expByDamage="0.04"/> <tower imageType="3" radius="5" expByKill="0.1" expByShot="0.15" buildTime="200" splash="1" reload="50" id="3" name="rocket launcher" cost="30" expByDamage="0.04"/>
</towers> </towers>
@@ -110,5 +110,6 @@
<animation pathes="images/Splashes/Rocket.png" id="5"/> <animation pathes="images/Splashes/Rocket.png" id="5"/>
<animation pathes="images/Splashes/Smoke_00.png;images/Splashes/Smoke_01.png;images/Splashes/Smoke_02.png;images/Splashes/Smoke_03.png;images/Splashes/Smoke_04.png;images/Splashes/Smoke_05.png;images/Splashes/Smoke_06.png;images/Splashes/Smoke_07.png;images/Splashes/Smoke_08.png;images/Splashes/Smoke_09.png;images/Splashes/Smoke_10.png" id="6"/> <animation pathes="images/Splashes/Smoke_00.png;images/Splashes/Smoke_01.png;images/Splashes/Smoke_02.png;images/Splashes/Smoke_03.png;images/Splashes/Smoke_04.png;images/Splashes/Smoke_05.png;images/Splashes/Smoke_06.png;images/Splashes/Smoke_07.png;images/Splashes/Smoke_08.png;images/Splashes/Smoke_09.png;images/Splashes/Smoke_10.png" id="6"/>
<animation pathes="images/Splashes/Shot_0.png;images/Splashes/Shot_1.png;images/Splashes/Shot_2.png;images/Splashes/Shot_3.png" id="7"/> <animation pathes="images/Splashes/Shot_0.png;images/Splashes/Shot_1.png;images/Splashes/Shot_2.png;images/Splashes/Shot_3.png" id="7"/>
<animation pathes="images/Towers/01_6.png" id="8"/>
</animations> </animations>
</ADdata> </ADdata>

View File

@@ -268,6 +268,12 @@ Game_Data * Loader::loadlevel(int id)
Map * map = new Map(tbm.data,tbm.size,tbm.name,tbm.maxPlayers,tbm.imgType); Map * map = new Map(tbm.data,tbm.size,tbm.name,tbm.maxPlayers,tbm.imgType);
//int maxPlayers = map->maxPlayers(); //int maxPlayers = map->maxPlayers();
Game_Data * gd = new Game_Data(map); Game_Data * gd = new Game_Data(map);
for (int i=0; i<map->maxPlayers(); i++)
{
Player * pl = new Player(0);
gd->players.append(pl);
}
qDebug() << gd->players.size();
for (int i=0; i<map->maxPlayers(); ++i) for (int i=0; i<map->maxPlayers(); ++i)
gd->players.push_back(new Player(i)); gd->players.push_back(new Player(i));
QList <tbWaveOnLevel> wollist = levWaves.values(id); QList <tbWaveOnLevel> wollist = levWaves.values(id);

19
map.h
View File

@@ -11,7 +11,8 @@ Q_OBJECT
public: public:
enum CellType enum CellType
{ {
Free = 0, Free = 0, // FIXME: not worked yet!!
// FIXME: must add Free cell to all functions
Player = 1, // use Player + playerId for multiplayer Player = 1, // use Player + playerId for multiplayer
AlienPath = 1000, // use AlienPath + Player and + playerId AlienPath = 1000, // use AlienPath + Player and + playerId
PlayerTower = -1, // use PlayerTower - Player - playerId PlayerTower = -1, // use PlayerTower - Player - playerId
@@ -19,16 +20,20 @@ public:
Start = 9999, Start = 9999,
Finish = 8888 Finish = 8888
}; };
// 0 - free for any player
// 1 - free for player 1 // 1 - free for player 1
// 2 - free for player 2 // 2 - free for player 2
// 3 - -/- // 3 - -/-
// 1001 - player 1, free, but it is alien path (for optimization) // 1001 - player 1, free, but it is alien path (for optimization)
// 1002 - -/- // 1001 - player 2, free, but it is alien path (for optimization)
// 99999 - start field or finish field // 1003 - -/-
// -1 - player 1 tower // 9999 - start field
// -2 - player 2 tower // 8888 - finish field
// -3 - -/- // -1 - tower on free cell
// -1000 - it is wall or some place where you can't build // -2 - player 1 tower
// -3 - player 2 tower
// -4 - -/-
// -1000 - it is wall or some place where you can't build any towers
explicit Map(QByteArray data, QSize size, QString name, int maxPlayers, int image, QObject *parent = 0); explicit Map(QByteArray data, QSize size, QString name, int maxPlayers, int image, QObject *parent = 0);