diff --git a/ADeditor/ADeditor b/ADeditor/ADeditor
new file mode 100755
index 0000000..a982a76
Binary files /dev/null and b/ADeditor/ADeditor differ
diff --git a/ADeditor/ADeditor.pro b/ADeditor/ADeditor.pro
new file mode 100644
index 0000000..5f9c048
--- /dev/null
+++ b/ADeditor/ADeditor.pro
@@ -0,0 +1,15 @@
+# -------------------------------------------------
+# Project created by QtCreator 2010-08-22T13:42:02
+# -------------------------------------------------
+QT += xml \
+ xmlpatterns
+TARGET = ADeditor
+TEMPLATE = app
+SOURCES += main.cpp \
+ mainwindow.cpp \
+ ../loader.cpp \
+ alienmodel.cpp
+HEADERS += mainwindow.h \
+ ../loader.h \
+ alienmodel.h
+FORMS += mainwindow.ui
diff --git a/ADeditor/ADeditor.pro.user b/ADeditor/ADeditor.pro.user
new file mode 100644
index 0000000..833beb4
--- /dev/null
+++ b/ADeditor/ADeditor.pro.user
@@ -0,0 +1,283 @@
+
+
+
+ RunConfiguration0-BaseEnvironmentBase
+ 2
+
+
+ RunConfiguration0-CommandLineArguments
+
+
+
+ RunConfiguration0-ProFile
+ ADeditor.pro
+
+
+ RunConfiguration0-RunConfiguration.name
+ ADeditor
+
+
+ RunConfiguration0-UseDyldImageSuffix
+ false
+
+
+ RunConfiguration0-UseTerminal
+ false
+
+
+ RunConfiguration0-UserEnvironmentChanges
+
+
+
+ RunConfiguration0-UserSetName
+ false
+
+
+ RunConfiguration0-UserSetWorkingDirectory
+ false
+
+
+ RunConfiguration0-UserWorkingDirectory
+
+
+
+ RunConfiguration0-type
+ Qt4ProjectManager.Qt4RunConfiguration
+
+
+ activeRunConfiguration
+ 0
+
+
+ activebuildconfiguration
+ Debug
+
+
+ buildConfiguration-Debug
+
+ Debug
+ 0
+ 0
+
+ 2
+
+
+
+ buildConfiguration-Release
+
+ Release
+ 0
+
+ 0
+
+
+
+ buildconfiguration-Debug-buildstep0
+
+ Debug
+
+ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd
+ DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
+ DESKTOP_SESSION=gnome
+ DISPLAY=:0.0
+ GDMSESSION=gnome
+ GDM_KEYBOARD_LAYOUT=us
+ GDM_LANG=ru_RU.UTF-8
+ GNOME_DESKTOP_SESSION_ID=this-is-deprecated
+ GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW
+ GTK_MODULES=canberra-gtk-module
+ HOME=/home/andrey
+ LANG=ru_RU.UTF-8
+ LD_LIBRARY_PATH=/usr/lib/qtcreator:
+ LOGNAME=andrey
+ MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
+ ORBIT_SOCKETDIR=/tmp/orbit-andrey
+ PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ PWD=/home/andrey
+ QTDIR=/usr/share/qt4
+ SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124
+ SHELL=/bin/bash
+ SPEECHD_PORT=6561
+ SSH_AGENT_PID=1158
+ SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh
+ USER=andrey
+ USERNAME=andrey
+ XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database
+ XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
+ XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
+ XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736
+
+
+ /home/andrey/AD/aliendefender/ADeditor/ADeditor.pro
+ -spec
+ linux-g++
+ -r
+ CONFIG+=debug
+
+ /usr/bin/qmake-qt4
+ false
+ /home/andrey/AD/aliendefender/ADeditor
+
+
+
+ buildconfiguration-Debug-buildstep1
+
+ Debug
+
+ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd
+ DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
+ DESKTOP_SESSION=gnome
+ DISPLAY=:0.0
+ GDMSESSION=gnome
+ GDM_KEYBOARD_LAYOUT=us
+ GDM_LANG=ru_RU.UTF-8
+ GNOME_DESKTOP_SESSION_ID=this-is-deprecated
+ GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW
+ GTK_MODULES=canberra-gtk-module
+ HOME=/home/andrey
+ LANG=ru_RU.UTF-8
+ LD_LIBRARY_PATH=/usr/lib/qtcreator:
+ LOGNAME=andrey
+ MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
+ ORBIT_SOCKETDIR=/tmp/orbit-andrey
+ PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ PWD=/home/andrey
+ QTDIR=/usr/share/qt4
+ SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124
+ SHELL=/bin/bash
+ SPEECHD_PORT=6561
+ SSH_AGENT_PID=1158
+ SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh
+ USER=andrey
+ USERNAME=andrey
+ XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database
+ XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
+ XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
+ XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736
+
+ false
+
+ -w
+
+ /usr/bin/make
+ true
+ /home/andrey/AD/aliendefender/ADeditor
+
+
+
+ buildconfiguration-Debug-cleanstep0
+
+ Debug
+
+ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd
+ DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
+ DESKTOP_SESSION=gnome
+ DISPLAY=:0.0
+ GDMSESSION=gnome
+ GDM_KEYBOARD_LAYOUT=us
+ GDM_LANG=ru_RU.UTF-8
+ GNOME_DESKTOP_SESSION_ID=this-is-deprecated
+ GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW
+ GTK_MODULES=canberra-gtk-module
+ HOME=/home/andrey
+ LANG=ru_RU.UTF-8
+ LD_LIBRARY_PATH=/usr/lib/qtcreator:
+ LOGNAME=andrey
+ MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
+ ORBIT_SOCKETDIR=/tmp/orbit-andrey
+ PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ PWD=/home/andrey
+ QTDIR=/usr/share/qt4
+ SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124
+ SHELL=/bin/bash
+ SPEECHD_PORT=6561
+ SSH_AGENT_PID=1158
+ SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh
+ USER=andrey
+ USERNAME=andrey
+ XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database
+ XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
+ XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
+ XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736
+
+ true
+
+ clean
+ -w
+
+ /usr/bin/make
+ true
+ /home/andrey/AD/aliendefender/ADeditor
+ true
+
+ clean
+
+
+
+
+ buildconfiguration-Release-buildstep0
+
+ Release
+
+
+
+ buildconfiguration-Release-buildstep1
+
+ Release
+
+
+
+ buildconfiguration-Release-cleanstep0
+
+ Release
+
+
+
+ buildconfigurations
+
+ Debug
+ Release
+
+
+
+ buildstep0
+
+
+
+
+
+
+ buildstep1
+
+
+
+
+
+ buildsteps
+
+ trolltech.qt4projectmanager.qmake
+ trolltech.qt4projectmanager.make
+
+
+
+ cleanstep0
+
+
+ true
+
+
+
+ cleansteps
+
+ trolltech.qt4projectmanager.make
+
+
+
+ defaultFileEncoding
+ System
+
+
+ project
+
+
+
diff --git a/ADeditor/Makefile b/ADeditor/Makefile
new file mode 100644
index 0000000..78a005d
--- /dev/null
+++ b/ADeditor/Makefile
@@ -0,0 +1,279 @@
+#############################################################################
+# Makefile for building: ADeditor
+# Generated by qmake (2.01a) (Qt 4.6.2) on: ?? ???. 24 15:25:17 2010
+# Project: ADeditor.pro
+# Template: app
+# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ADeditor.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+DEFINES = -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtXmlPatterns -I/usr/include/qt4 -I. -I.
+LINK = g++
+LFLAGS =
+LIBS = $(SUBLIBS) -L/usr/lib -lQtXmlPatterns -lQtXml -lQtGui -lQtCore -lpthread
+AR = ar cqs
+RANLIB =
+QMAKE = /usr/bin/qmake-qt4
+TAR = tar -cf
+COMPRESS = gzip -9f
+COPY = cp -f
+SED = sed
+COPY_FILE = $(COPY)
+COPY_DIR = $(COPY) -r
+STRIP = strip
+INSTALL_FILE = install -m 644 -p
+INSTALL_DIR = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE = rm -f
+SYMLINK = ln -f -s
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = main.cpp \
+ mainwindow.cpp \
+ ../loader.cpp \
+ alienmodel.cpp moc_mainwindow.cpp \
+ moc_loader.cpp \
+ moc_alienmodel.cpp
+OBJECTS = main.o \
+ mainwindow.o \
+ loader.o \
+ alienmodel.o \
+ moc_mainwindow.o \
+ moc_loader.o \
+ moc_alienmodel.o
+DIST = /usr/share/qt4/mkspecs/common/g++.conf \
+ /usr/share/qt4/mkspecs/common/unix.conf \
+ /usr/share/qt4/mkspecs/common/linux.conf \
+ /usr/share/qt4/mkspecs/qconfig.pri \
+ /usr/share/qt4/mkspecs/features/qt_functions.prf \
+ /usr/share/qt4/mkspecs/features/qt_config.prf \
+ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+ /usr/share/qt4/mkspecs/features/default_pre.prf \
+ /usr/share/qt4/mkspecs/features/debug.prf \
+ /usr/share/qt4/mkspecs/features/default_post.prf \
+ /usr/share/qt4/mkspecs/features/warn_on.prf \
+ /usr/share/qt4/mkspecs/features/qt.prf \
+ /usr/share/qt4/mkspecs/features/unix/thread.prf \
+ /usr/share/qt4/mkspecs/features/moc.prf \
+ /usr/share/qt4/mkspecs/features/resources.prf \
+ /usr/share/qt4/mkspecs/features/uic.prf \
+ /usr/share/qt4/mkspecs/features/yacc.prf \
+ /usr/share/qt4/mkspecs/features/lex.prf \
+ /usr/share/qt4/mkspecs/features/include_source_dir.prf \
+ ADeditor.pro
+QMAKE_TARGET = ADeditor
+DESTDIR =
+TARGET = ADeditor
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): ui_mainwindow.h $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: ADeditor.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
+ /usr/share/qt4/mkspecs/common/unix.conf \
+ /usr/share/qt4/mkspecs/common/linux.conf \
+ /usr/share/qt4/mkspecs/qconfig.pri \
+ /usr/share/qt4/mkspecs/features/qt_functions.prf \
+ /usr/share/qt4/mkspecs/features/qt_config.prf \
+ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+ /usr/share/qt4/mkspecs/features/default_pre.prf \
+ /usr/share/qt4/mkspecs/features/debug.prf \
+ /usr/share/qt4/mkspecs/features/default_post.prf \
+ /usr/share/qt4/mkspecs/features/warn_on.prf \
+ /usr/share/qt4/mkspecs/features/qt.prf \
+ /usr/share/qt4/mkspecs/features/unix/thread.prf \
+ /usr/share/qt4/mkspecs/features/moc.prf \
+ /usr/share/qt4/mkspecs/features/resources.prf \
+ /usr/share/qt4/mkspecs/features/uic.prf \
+ /usr/share/qt4/mkspecs/features/yacc.prf \
+ /usr/share/qt4/mkspecs/features/lex.prf \
+ /usr/share/qt4/mkspecs/features/include_source_dir.prf \
+ /usr/lib/libQtXmlPatterns.prl \
+ /usr/lib/libQtXml.prl \
+ /usr/lib/libQtGui.prl \
+ /usr/lib/libQtCore.prl
+ $(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ADeditor.pro
+/usr/share/qt4/mkspecs/common/g++.conf:
+/usr/share/qt4/mkspecs/common/unix.conf:
+/usr/share/qt4/mkspecs/common/linux.conf:
+/usr/share/qt4/mkspecs/qconfig.pri:
+/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/usr/share/qt4/mkspecs/features/qt_config.prf:
+/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/usr/share/qt4/mkspecs/features/default_pre.prf:
+/usr/share/qt4/mkspecs/features/debug.prf:
+/usr/share/qt4/mkspecs/features/default_post.prf:
+/usr/share/qt4/mkspecs/features/warn_on.prf:
+/usr/share/qt4/mkspecs/features/qt.prf:
+/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/usr/share/qt4/mkspecs/features/moc.prf:
+/usr/share/qt4/mkspecs/features/resources.prf:
+/usr/share/qt4/mkspecs/features/uic.prf:
+/usr/share/qt4/mkspecs/features/yacc.prf:
+/usr/share/qt4/mkspecs/features/lex.prf:
+/usr/share/qt4/mkspecs/features/include_source_dir.prf:
+/usr/lib/libQtXmlPatterns.prl:
+/usr/lib/libQtXml.prl:
+/usr/lib/libQtGui.prl:
+/usr/lib/libQtCore.prl:
+qmake: FORCE
+ @$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ADeditor.pro
+
+dist:
+ @$(CHK_DIR_EXISTS) .tmp/ADeditor1.0.0 || $(MKDIR) .tmp/ADeditor1.0.0
+ $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents mainwindow.h ../loader.h alienmodel.h .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp ../loader.cpp alienmodel.cpp .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents mainwindow.ui .tmp/ADeditor1.0.0/ && (cd `dirname .tmp/ADeditor1.0.0` && $(TAR) ADeditor1.0.0.tar ADeditor1.0.0 && $(COMPRESS) ADeditor1.0.0.tar) && $(MOVE) `dirname .tmp/ADeditor1.0.0`/ADeditor1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/ADeditor1.0.0
+
+
+clean:compiler_clean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(TARGET)
+ -$(DEL_FILE) Makefile
+
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_mainwindow.cpp moc_loader.cpp moc_alienmodel.cpp
+compiler_moc_header_clean:
+ -$(DEL_FILE) moc_mainwindow.cpp moc_loader.cpp moc_alienmodel.cpp
+moc_mainwindow.cpp: ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h \
+ mainwindow.h
+ /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
+
+moc_loader.cpp: ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h \
+ ../loader.h
+ /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) ../loader.h -o moc_loader.cpp
+
+moc_alienmodel.cpp: ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h \
+ alienmodel.h
+ /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) alienmodel.h -o moc_alienmodel.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+ -$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all: ui_mainwindow.h
+compiler_uic_clean:
+ -$(DEL_FILE) ui_mainwindow.h
+ui_mainwindow.h: mainwindow.ui
+ /usr/bin/uic-qt4 mainwindow.ui -o ui_mainwindow.h
+
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean compiler_uic_clean
+
+####### Compile
+
+main.o: main.cpp mainwindow.h \
+ ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+
+mainwindow.o: mainwindow.cpp mainwindow.h \
+ ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h \
+ ui_mainwindow.h \
+ alienmodel.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
+
+loader.o: ../loader.cpp ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o loader.o ../loader.cpp
+
+alienmodel.o: alienmodel.cpp alienmodel.h \
+ ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o alienmodel.o alienmodel.cpp
+
+moc_mainwindow.o: moc_mainwindow.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
+
+moc_loader.o: moc_loader.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_loader.o moc_loader.cpp
+
+moc_alienmodel.o: moc_alienmodel.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_alienmodel.o moc_alienmodel.cpp
+
+####### Install
+
+install: FORCE
+
+uninstall: FORCE
+
+FORCE:
+
diff --git a/ADeditor/alienmodel.cpp b/ADeditor/alienmodel.cpp
new file mode 100644
index 0000000..efcde06
--- /dev/null
+++ b/ADeditor/alienmodel.cpp
@@ -0,0 +1,29 @@
+#include "alienmodel.h"
+
+AlienModel::AlienModel(QListmaliens, QObject *parent) :
+ QAbstractListModel(parent)
+{
+ aliens = maliens;
+}
+
+
+int AlienModel::rowCount(const QModelIndex &) const
+{
+ return aliens.count();
+}
+
+
+QVariant AlienModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ if (index.row() >= aliens.size())
+ return QVariant();
+
+ if (role == Qt::DisplayRole)
+ {
+ return aliens.at(index.row()).name;
+ }
+ return QVariant();
+}
diff --git a/ADeditor/alienmodel.h b/ADeditor/alienmodel.h
new file mode 100644
index 0000000..2098248
--- /dev/null
+++ b/ADeditor/alienmodel.h
@@ -0,0 +1,23 @@
+#ifndef ALIENMODEL_H
+#define ALIENMODEL_H
+
+#include
+#include "../loader.h"
+
+class AlienModel : public QAbstractListModel
+{
+Q_OBJECT
+public:
+ explicit AlienModel(QList aliens, QObject *parent = 0);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role) const;
+
+signals:
+
+public slots:
+
+private:
+ QList aliens;
+};
+
+#endif // ALIENMODEL_H
diff --git a/ADeditor/alientablemodel.o b/ADeditor/alientablemodel.o
new file mode 100644
index 0000000..72756f8
Binary files /dev/null and b/ADeditor/alientablemodel.o differ
diff --git a/ADeditor/data.xml b/ADeditor/data.xml
new file mode 100644
index 0000000..6283cd1
--- /dev/null
+++ b/ADeditor/data.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ADeditor/data2.xml b/ADeditor/data2.xml
new file mode 100644
index 0000000..764b336
--- /dev/null
+++ b/ADeditor/data2.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ADeditor/main.cpp b/ADeditor/main.cpp
new file mode 100644
index 0000000..6e7efd9
--- /dev/null
+++ b/ADeditor/main.cpp
@@ -0,0 +1,10 @@
+#include
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+ return a.exec();
+}
diff --git a/ADeditor/mainwindow.cpp b/ADeditor/mainwindow.cpp
new file mode 100644
index 0000000..96b7456
--- /dev/null
+++ b/ADeditor/mainwindow.cpp
@@ -0,0 +1,76 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include "alienmodel.h"
+
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+ adloader = new Loader(this);
+ adloader->load("data2.xml");
+ QAbstractItemModel * model = new AlienModel(adloader->aliens.values());
+ ui->lvAliens->setModel(model);
+ connect(ui->lvAliens->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvAliens_select(QModelIndex, QModelIndex)));
+ ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::Select);
+}
+
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+
+void MainWindow::changeEvent(QEvent *e)
+{
+ QMainWindow::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+
+
+void MainWindow::on_cbAlArmor_toggled(bool checked)
+{
+ ui->sbAlArmor->setEnabled(checked);
+}
+
+
+void MainWindow::on_cbAlRegeneration_toggled(bool checked)
+{
+ ui->sbAlregeneration->setEnabled(checked);
+}
+
+
+void MainWindow::lvAliens_select(QModelIndex index, QModelIndex)
+{
+ tbAlien al = adloader->aliens.values().at(index.row());
+ ui->leAlName->setText(al.name);
+ ui->sbAlHealth->setValue(al.health);
+ ui->sbAlArmor->setValue(al.armor);
+ if (al.armor > 0) ui->cbAlArmor->setChecked(true);
+ else ui->cbAlArmor->setChecked(false);
+ ui->sbAlSpeed->setValue(al.speed);
+ ui->sbAlPrise->setValue(al.prise);
+ ui->sbAlregeneration->setValue(al.regeneration);
+ if (al.regeneration > 0) ui->cbAlRegeneration->setChecked(true);
+ else ui->cbAlRegeneration->setChecked(false);
+ ui->sbAlScore->setValue(al.score);
+ ui->cbAlIsFly->setChecked(al.isFlying);
+}
+
+
+void MainWindow::on_pbSave_clicked()
+{
+ adloader->save("data2.xml");
+ adloader->load("data2.xml");
+ QAbstractItemModel * model = new AlienModel(adloader->aliens.values());
+ ui->lvAliens->setModel(model);
+ ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::Select);
+}
diff --git a/ADeditor/mainwindow.h b/ADeditor/mainwindow.h
new file mode 100644
index 0000000..5365225
--- /dev/null
+++ b/ADeditor/mainwindow.h
@@ -0,0 +1,34 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+#include
+#include
+
+#include "../loader.h"
+
+namespace Ui {
+ class MainWindow;
+}
+
+class MainWindow : public QMainWindow {
+ Q_OBJECT
+public:
+ MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+protected:
+ void changeEvent(QEvent *e);
+
+private:
+ Ui::MainWindow *ui;
+ Loader * adloader;
+
+private slots:
+ void on_pbSave_clicked();
+ void lvAliens_select(QModelIndex, QModelIndex);
+ void on_cbAlRegeneration_toggled(bool checked);
+ void on_cbAlArmor_toggled(bool checked);
+};
+
+#endif // MAINWINDOW_H
diff --git a/ADeditor/mainwindow.ui b/ADeditor/mainwindow.ui
new file mode 100644
index 0000000..f02f9c1
--- /dev/null
+++ b/ADeditor/mainwindow.ui
@@ -0,0 +1,664 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 516
+ 435
+
+
+
+ MainWindow
+
+
+
+ -
+
+
+ 0
+
+
+
+ Aliens
+
+
+
-
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Name
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Health
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Armor
+
+
+
+ -
+
+
+ false
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Regeneration
+
+
+
+ -
+
+
+ false
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Speed
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Prise
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Score
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Qt::LeftToRight
+
+
+ Is Flying
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Image
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 40
+ 40
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 48
+ 32
+
+
+
+ ...
+
+
+
+
+
+
+
+
+ -
+
+
+ 20
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Add
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Delete
+
+
+
+
+
+ -
+
+
+ QAbstractItemView::AllEditTriggers
+
+
+
+
+
+
+
+ Towers
+
+
+ -
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Name
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Build time
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Cost
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ splash
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Reload
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Radius
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ ExpbyShot
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ ExpbyDam
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ ExpbyKill
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Image
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 40
+ 40
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 48
+ 32
+
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Save
+
+
+
+
+
+
+
+
+
+
diff --git a/ADeditor/moc_alientablemodel.cpp b/ADeditor/moc_alientablemodel.cpp
new file mode 100644
index 0000000..bb04aa0
--- /dev/null
+++ b/ADeditor/moc_alientablemodel.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'alientablemodel.h'
+**
+** Created: Tue Aug 24 14:03:38 2010
+** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "alientablemodel.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'alientablemodel.h' doesn't include ."
+#elif Q_MOC_OUTPUT_REVISION != 62
+#error "This file was generated using the moc from 4.6.2. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_AlienTableModel[] = {
+
+ // content:
+ 4, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 0, 0, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+ 0, 0, // constructors
+ 0, // flags
+ 0, // signalCount
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_AlienTableModel[] = {
+ "AlienTableModel\0"
+};
+
+const QMetaObject AlienTableModel::staticMetaObject = {
+ { &QAbstractTableModel::staticMetaObject, qt_meta_stringdata_AlienTableModel,
+ qt_meta_data_AlienTableModel, 0 }
+};
+
+#ifdef Q_NO_DATA_RELOCATION
+const QMetaObject &AlienTableModel::getStaticMetaObject() { return staticMetaObject; }
+#endif //Q_NO_DATA_RELOCATION
+
+const QMetaObject *AlienTableModel::metaObject() const
+{
+ return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
+}
+
+void *AlienTableModel::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_AlienTableModel))
+ return static_cast(const_cast< AlienTableModel*>(this));
+ return QAbstractTableModel::qt_metacast(_clname);
+}
+
+int AlienTableModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QAbstractTableModel::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ return _id;
+}
+QT_END_MOC_NAMESPACE
diff --git a/ADeditor/moc_alientablemodel.o b/ADeditor/moc_alientablemodel.o
new file mode 100644
index 0000000..80bfec7
Binary files /dev/null and b/ADeditor/moc_alientablemodel.o differ
diff --git a/ADeditor/schema.xml b/ADeditor/schema.xml
new file mode 100644
index 0000000..5611a66
--- /dev/null
+++ b/ADeditor/schema.xml
@@ -0,0 +1,221 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/adcore.cpp b/adcore.cpp
index f13ea13..95b0996 100644
--- a/adcore.cpp
+++ b/adcore.cpp
@@ -7,6 +7,9 @@ adCore::adCore(QObject *parent) :
//admap = new Map(1);
//addata = new Game_Data(admap);
adloader = new Loader();
+ addata = adloader->loadlevel(1);
+ if (addata != 0) qDebug("Sucsess");
+ else qDebug("Error");
//admap->load();
//adload->create();
//adload->readAliens();
diff --git a/aliendefender b/aliendefender
new file mode 100755
index 0000000..866784b
Binary files /dev/null and b/aliendefender differ
diff --git a/aliendefender.pro.user b/aliendefender.pro.user
index e497b48..d841b83 100644
--- a/aliendefender.pro.user
+++ b/aliendefender.pro.user
@@ -160,7 +160,7 @@
Debug
- DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-oJVJLhEuxX,guid=dd326939f06256af8e013dce4c50f54e
+ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd
DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
DESKTOP_SESSION=gnome
DISPLAY=:0.0
@@ -168,7 +168,7 @@
GDM_KEYBOARD_LAYOUT=us
GDM_LANG=ru_RU.UTF-8
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
- GNOME_KEYRING_CONTROL=/tmp/keyring-UECX54
+ GNOME_KEYRING_CONTROL=/tmp/keyring-7vXnOW
GTK_MODULES=canberra-gtk-module
HOME=/home/andrey
LANG=ru_RU.UTF-8
@@ -179,17 +179,17 @@
PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
PWD=/home/andrey
QTDIR=/usr/share/qt4
- SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1144,unix/buull-eeePC:/tmp/.ICE-unix/1144
+ SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124
SHELL=/bin/bash
SPEECHD_PORT=6561
- SSH_AGENT_PID=1178
- SSH_AUTH_SOCK=/tmp/keyring-UECX54/ssh
+ SSH_AGENT_PID=1158
+ SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh
USER=andrey
USERNAME=andrey
- XAUTHORITY=/var/run/gdm/auth-for-andrey-SArBRZ/database
+ XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/database
XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
- XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1280374094.93008-1317282182
+ XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1281338556.676663-803309736
true
diff --git a/base_types.h b/base_types.h
index 4ebebf4..cb13bc0 100644
--- a/base_types.h
+++ b/base_types.h
@@ -128,9 +128,8 @@ struct SplashType
struct WaveType
{
- int Id;
QList types; // some types of aliens (e.g. 2 fly and 3 grount in one wave)
- QList counts; // count aliens of each type
+ QList counts; // count aliens of each type
unsigned int timeout; // time in ticks
unsigned int prise;
};
diff --git a/data.xml b/data.xml
index 021672b..6283cd1 100644
--- a/data.xml
+++ b/data.xml
@@ -2,6 +2,7 @@
+
@@ -11,6 +12,7 @@
+
@@ -20,10 +22,15 @@
+
+
+
+
+
diff --git a/loader.cpp b/loader.cpp
index 40d037c..a43598e 100644
--- a/loader.cpp
+++ b/loader.cpp
@@ -5,14 +5,14 @@ Loader::Loader(QObject *parent) :
{
doc = new QDomDocument("data");
//create();
- load();
+ //load();
}
-void Loader::load()
+void Loader::load(QString filename)
{
- validate();
- file = new QFile("data.xml");
+ validate(filename);
+ file = new QFile(filename);
if (!file->open(QIODevice::ReadOnly))
qFatal("No file data.xml found!");
if (!doc->setContent(file))
@@ -38,80 +38,289 @@ void Loader::load()
}
-void Loader::create()
+void Loader::save(QString filename)
{
- QFile cfile("data.xml");
+ QDomDocument data("data");
+ QFile cfile(filename);
if (!cfile.open(QIODevice::WriteOnly))
return;
cfile.resize(0);
QDomElement elem;
- QDomElement root = doc->createElement("ADdata");
- doc->appendChild(root);
- QDomElement child = doc->createElement("aliens");
+ QDomElement root = data.createElement("ADdata");
+ data.appendChild(root);
+ QDomElement child = data.createElement("aliens");
root.appendChild(child);
- elem = doc->createElement("alien");
- child.appendChild(elem);
- elem.setAttribute("name","my alien");
- elem.setAttribute("speed",0.012);
- elem.setAttribute("health",100);
- elem.setAttribute("prise",0);
- elem.setAttribute("id",10);
- elem.setAttribute("imageType",1);
- elem = doc->createElement("alien");
- child.appendChild(elem);
- elem.setAttribute("name","MONSTR");
- elem.setAttribute("speed",0.0099);
- elem.setAttribute("health",200);
- elem.setAttribute("prise",1);
- elem.setAttribute("id",12);
- elem.setAttribute("imageType",1);
- child = doc->createElement("towers");
+ for (int i=0; i 0)
+ elem.setAttribute("armor",al.armor);
+ if (al.isFlying)
+ elem.setAttribute("flying","true");
+ elem.setAttribute("prise",al.prise);
+ if (al.regeneration > 0)
+ elem.setAttribute("regeneration",al.regeneration);
+ elem.setAttribute("score",al.score);
+ elem.setAttribute("speed",al.speed);
+ elem.setAttribute("imageType",al.imgType);
+ }
+ child = data.createElement("maps");
root.appendChild(child);
- elem = doc->createElement("tower");
- child.appendChild(elem);
- elem.setAttribute("name","my tower");
- elem.setAttribute("imageType",1);
- elem.setAttribute("reload",20);
- elem.setAttribute("buildTime",100);
- elem.setAttribute("price",10);
- elem.setAttribute("radius",1.2);
- elem.setAttribute("splashType",0);
- elem.setAttribute("id",0);
- elem = doc->createElement("tower");
- child.appendChild(elem);
- elem.setAttribute("name","Wall");
- elem.setAttribute("imageType",1);
- elem.setAttribute("buildTime",300);
- elem.setAttribute("reload",0);
- elem.setAttribute("price",9);
- elem.setAttribute("radius",0);
- elem.setAttribute("splashType",0);
- elem.setAttribute("id",1);
- child = doc->createElement("maps");
+ for (int i=0; icreateElement("map");
- child.appendChild(elem);
- elem.setAttribute("name","Map 16x16");
- elem.setAttribute("maxPlayers","2");
- elem.setAttribute("id",1);
- elem.setAttribute("imageType",1);
- elem.setAttribute("data",CreateMapExample());
- child = doc->createElement("splashes");
+ for (int i=0; icreateElement("splash");
- child.appendChild(elem);
- elem.setAttribute("name","shot");
- elem.setAttribute("imageType",1);
- elem.setAttribute("damage",2.5);
- elem.setAttribute("speed",100);
- elem.setAttribute("autoControl","true");
- elem.setAttribute("radius",1.2);
- elem.setAttribute("id",0);
- cfile.write(doc->toByteArray());
+ for (int i=0; i 0)
+ elem.setAttribute("expByDamage",tw.expByDamage);
+ if (tw.expByKill > 0)
+ elem.setAttribute("expByKill",tw.expByKill);
+ if (tw.expByShot > 0)
+ elem.setAttribute("expByShot",tw.expByShot);
+ }
+ child = data.createElement("triggers");
+ root.appendChild(child);
+ for (int i=0; i 0)
+ elem.setAttribute("count",trig.count);
+ if (trig.damage > 0)
+ elem.setAttribute("damage",trig.damage);
+ if (trig.radius > 0)
+ elem.setAttribute("radius",trig.radius);
+ if (trig.delParent)
+ elem.setAttribute("delParent","true");
+ if (trig.randomPosRadius > 0)
+ elem.setAttribute("randomPosRadius",trig.randomPosRadius);
+ switch (trig.childAim)
+ {
+ case tbTrigger::allSide :
+ elem.setAttribute("childAim","allSide");
+ break;
+ case tbTrigger::nearlestAlien :
+ elem.setAttribute("childAim","nearlestAlien");
+ break;
+ case tbTrigger::parentAim :
+ elem.setAttribute("childAim","parentAim");
+ break;
+ default:
+ elem.setAttribute("childAim","noAim");
+ break;
+ }
+ switch (trig.type)
+ {
+ case tbTrigger::onTimer :
+ elem.setAttribute("type","onTimer");
+ break;
+ case tbTrigger::onDestination :
+ elem.setAttribute("type","onDestination");
+ break;
+ case tbTrigger::onAlienInRadius :
+ elem.setAttribute("type","onAlienInRadius");
+ break;
+ }
+ }
+ child = data.createElement("chains");
+ root.appendChild(child);
+ for (int i=0; i 0)
+ elem.setAttribute("child",ch.childSplashId);
+ }
+ child = data.createElement("towersOnLevels");
+ root.appendChild(child);
+ for (int i=0; i wollist = levWaves.values(id);
+// if (wollist.isEmpty())
+// {
+// qCritical() << tr("Error no waves on level!");
+// return 0;
+// }
+// tbWave tbw;
+// tbWavePart tbwpt;
+// QList wplist;
+// QList alienIds;
+// for (int i=0; iwaves.prepend(wt);
+// wplist.clear();
+// }
+// for (int i=0; iwaves.size(); i++)
+// qDebug() << tr("load wave #%1 prise=%2 timeout=%3").arg(i+1).arg(gd->waves.at(i).prise).arg(gd->waves.at(i).timeout) << gd->waves.at(i).types << gd->waves.at(i).counts;
+// wollist.clear();
+// for (int i=0; isrcAliens.append(salt);
+// qDebug() << tr("Alien %1 #%2 ").arg(salt.name).arg(i);
+// }
+// QList tollist = levTowers.values(id);
+// tbTower tbt;
+// for (int i=0; i > Cells;
@@ -154,6 +363,7 @@ QString Loader::CreateMapExample()
void Loader::readAliens()
{
+ aliens.clear();
QDomNodeList alelems = doc->elementsByTagName("alien");
for (int i=0; ielementsByTagName("wave");
for (int i=0; ielementsByTagName("wavePart");
for (int i=0; ielementsByTagName("chain");
for (int i=0; ielementsByTagName("waveOnLevel");
for (int i=0; ielementsByTagName("towerOnLevel");
for (int i=0; ielementsByTagName("level");
for (int i=0; ielementsByTagName("trigger");
for (int i=0; i1)) trig.chance = 100;
+ if (!(trig.chance>0)) trig.chance = 100;
str = nm.namedItem("delParent").nodeValue();
trig.delParent = (str == "true");
str = nm.namedItem("type").nodeValue();
@@ -418,6 +636,7 @@ void Loader::readTriggers()
void Loader::readSplashes()
{
+ splashes.clear();
QString str;
QDomNodeList selems = doc->elementsByTagName("splash");
for (int i=0; ielementsByTagName("tower");
for (int i=0; ielementsByTagName("map");
for (int i=0; i aliens;
QHash maps;
@@ -181,6 +175,14 @@ private:
QMultiHash levTowers;
QMultiHash upgrades;
+signals:
+
+public slots:
+
+private:
+ QDomDocument * doc;
+ QFile * file;
+
void readAliens();
void readMaps();
void readLevels();
@@ -195,8 +197,7 @@ private:
void readWaveParts();
void readUpgrades();
- void validate();
- void load();
+ void validate(QString filename);
QString CreateMapExample();
};
diff --git a/schema.xml b/schema.xml
index a65f70e..5611a66 100644
--- a/schema.xml
+++ b/schema.xml
@@ -95,6 +95,7 @@
+
@@ -168,6 +169,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -203,6 +214,7 @@
+
diff --git a/settreader.cpp b/settreader.cpp
deleted file mode 100644
index e647e7a..0000000
--- a/settreader.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-#include
-
-using namespace std;
-
-
-SettingsReader::SettingsReader(const QString & fname) {
- isFile = true;
- file = new QFile(fname);
- file->open(QIODevice::ReadWrite);
- stream = new QTextStream(file);
- parse();
-}
-
-
-SettingsReader::SettingsReader(QString * string) {
- isFile = false;
- str = string;
- stream = new QTextStream(string);
- parse();
-}
-
-
-SettingsReader::~SettingsReader() {
- settname.clear();
- settval.clear();
- settcom.clear();
- setttab.clear();
- settlines.clear();
- setttype.clear();
- all.clear();
- stream->setDevice(0);
- delete stream;
- if (isFile) {
- file->close();
- delete file;
- }
-}
-
-
-QString SettingsReader::getValue(QString vname, QString def, bool * exist) {
- for (int i = 0; i < settname.size(); i++) {
- if (settname.at(i) == vname) {
- if (exist != 0) *exist = true;
- return settval.at(i);
- }
- }
- if (exist != 0) *exist = false;
- return def;
-}
-
-
-void SettingsReader::addLine(const QString & name, const QString & value, const QString & type) {
- if (setttab.size() > 0 && all.size() > 0) *stream << setttab.at(setttab.size() - 1) << name << " = " << value << " #" << type << endl;
- else *stream << name << " = " << value << " #" << type << endl;
- settname.append(name);
- settval.append(value);
- settcom.append("");
- setttype.append(type);
- if (setttab.size() > 0) setttab.append(setttab.at(setttab.size() - 1));
- else setttab.append(" ");
- settlines.push_back(all.size());
- all.append(name + " = " + value + " #" + type);
- stream->flush();
- if (isFile) file->flush();
-}
-
-
-void SettingsReader::insertLine(int number, const QString & name, const QString & value, const QString & type) {
- if (number >= settname.size()) {
- addLine(name, value, type);
- return;
- }
- settname.insert(number, name);
- settval.insert(number, value);
- settcom.insert(number, "");
- setttab.insert(number, setttab.at(number));
- setttype.insert(number, type);
- settlines.insert(number, settlines.at(number));
- for (int i = number + 1; i < settlines.size(); i++) settlines[i]++;
- all.insert(settlines.at(number), name + " = " + value + " #" + type);
- stream->flush();
- if (isFile) file->flush();
- writeAll();
-}
-
-
-int SettingsReader::numValues() {
- return settval.size();
-}
-
-
-QString SettingsReader::getValue(int number) {
- return settval.at(number);
-}
-
-
-QString SettingsReader::getName(int number) {
- return settname.at(number);
-}
-
-
-QString SettingsReader::getComment(int number) {
- return settcom.at(number);
-}
-
-
-char SettingsReader::getType(int number) {
- return setttype.at(number)[0].cell();
-}
-
-
-int SettingsReader::getNumber(const QString & name) {
- for (int i = 0; i < settname.size(); i++) {
- if (settname.at(i) == name) {
- return i;
- }
- }
- return -1;
-}
-
-
-void SettingsReader::setValue(int number, const QString & value, bool write) {
- QString tmp = settname.at(number) + " = " + value + " #" + setttype.at(number) + " " + settcom.at(number);
- settval.replace(number, value);
- all.replace(settlines[number], tmp);
- if (write) writeAll();
-}
-
-
-void SettingsReader::setValue(const QString & name, const QString & value, bool write) {
- int number = getNumber(name);
- if (number == -1) return;
- QString tmp = settname.at(number) + " = " + value + " #" + setttype.at(number) + " " + settcom.at(number);
- settval.replace(number, value);
- all.replace(settlines[number], tmp);
- if (write) writeAll();
-}
-
-
-void SettingsReader::setName(int number, const QString & name) {
- QString tmp = name + " = " + settval.at(number) + " #" + setttype.at(number) + " " + settcom.at(number);
- settname.replace(number, name);
- all.replace(settlines[number], tmp);
- writeAll();
-}
-
-
-void SettingsReader::setType(int number, const QString & type) {
- QString tmp = settname.at(number) + " = " + settval.at(number) + " #" + type + " " + settcom.at(number);
- setttype.replace(number, type);
- all.replace(settlines[number], tmp);
- writeAll();
-}
-
-
-void SettingsReader::setComment(int number, const QString & comment) {
- QString tmp = settname.at(number) + " = " + settval.at(number) + " #" + setttype.at(number) + " " + comment;
- settcom.replace(number, comment);
- all.replace(settlines[number], tmp);
- writeAll();
-}
-
-
-void SettingsReader::deleteLine(const QString & name) {
- bool exist = false;
- int i;
- for (i = 0; i < settname.size(); i++) {
- if (settname.at(i) == name) {
- exist = true;
- break;
- }
- }
- if (!exist) return;
- deleteLine(i);
-}
-
-
-void SettingsReader::deleteLine(int number) {
- settname.remove(number);
- settval.remove(number);
- settcom.remove(number);
- setttab.remove(number);
- setttype.remove(number);
- all.remove(settlines[number]);
- for (int i = number; i < settlines.size(); i++) settlines[i]--;
- settlines.remove(number);
- writeAll();
-}
-
-
-void SettingsReader::writeAll() {
- if (isFile) file->resize(0);
- else *str = "";
- stream->seek(0);
- int c = 0;
- for (int i = 0; i < all.size(); i++) {
- if (c < settlines.size() && c < setttab.size()) {
- if (settlines[c] == i) {
- *stream << setttab.at(c);
- c++;
- }
- }
- *stream << all.at(i) << endl;
- }
- if (isFile) file->flush();
- readAll();
-}
-
-
-void SettingsReader::readAll() {
- settname.clear();
- settval.clear();
- settcom.clear();
- setttab.clear();
- settlines.clear();
- setttype.clear();
- all.clear();
- if (isFile) file->flush();
- parse();
-}
-
-
-void SettingsReader::parse() {
- QString str, tab, comm;
- int ind, sind;
- stream->seek(0);
- lines = 0;
- if (isFile) if (!file->exists()) return;
- while (!stream->atEnd()) {
- str = stream->readLine();
- tab = str.left(str.indexOf(str.trimmed().left(1)));
- str = str.trimmed();
- all.append(str);
- ind = str.indexOf('=');
- if ((ind > 0) && !(str.left(1) == "#")) {
- sind = str.indexOf('#');
- if (sind > 0) {
- comm = str.right(str.length() - sind - 1).trimmed();
- setttype.append(comm.left(1));
- comm = comm.right(comm.length() - 1).trimmed();
- settcom.append(comm);
- str.truncate(sind);
- } else {
- setttype.append("s");
- settcom.append("");
- }
- settname.append((str.left(ind)).trimmed());
- settval.append((str.right(str.length() - ind - 1)).trimmed());
- setttab.append(tab);
- settlines.push_back(lines);
- }
- lines++;
- }
-}
diff --git a/settreader.h b/settreader.h
deleted file mode 100644
index 953bbcb..0000000
--- a/settreader.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef __SETT_READER_H__
-#define __SETT_READER_H__
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-class SettingsReader
-{
-public:
- SettingsReader(const QString & fname);
- SettingsReader(QString * string);
- ~SettingsReader();
-
- QString getValue(QString vname, QString def = "", bool * exist = 0);
- QString getValue(int number);
- QString getName(int number);
- QString getComment(int number);
- char getType(int number);
- int getNumber(const QString & name);
- void setValue(int number, const QString & value, bool write = true);
- void setValue(const QString & name, const QString & value, bool write = true);
- void setName(int number, const QString & name);
- void setType(int number, const QString & type);
- void setComment(int number, const QString & comment);
- int numValues();
- void addLine(const QString & name, const QString & value, const QString & type = "s");
- void insertLine(int number, const QString & name, const QString & value, const QString & type = "s");
- void deleteLine(const QString & name);
- void deleteLine(int number);
- void readAll();
- void writeAll();
-
-private:
- void parse();
-
- bool isFile;
- int lines;
- QFile * file;
- QString * str;
- QTextStream * stream;
- QVector settname;
- QVector settval;
- QVector settcom;
- QVector setttab;
- QVector setttype;
- QVector all;
- QVector settlines;
-};
-
-#endif
diff --git a/settreader.o b/settreader.o
new file mode 100644
index 0000000..c4df5ff
Binary files /dev/null and b/settreader.o differ