# HG changeset patch # User koda # Date 1359241233 -3600 # Node ID 535a00ca0d353a57381203510f07ae1a3a8a9d4d # Parent a00b0fa0dbd7ca5514f2b1c65b54094e6377be8a whitespaces and tabs again diff -r a00b0fa0dbd7 -r 535a00ca0d35 ChangeLog.txt --- a/ChangeLog.txt Sat Jan 26 23:57:37 2013 +0100 +++ b/ChangeLog.txt Sun Jan 27 00:00:33 2013 +0100 @@ -28,7 +28,7 @@ * Fix all knowns bugs which caused network game hang when players close engine or quit * Fix drill strike bug when drill's timer gets ridiculously high value instead of explosion * Fix some crashes, freezes and memory leaks in frontend and engine - + 0.9.16 -> 0.9.17: + New theme, Cave + New voicepack, Hillbilly @@ -401,7 +401,7 @@ + AI updates + Teams now work in fort mode, i.e. 2v2 + Ability to attack whilst jumping/rope swinging - + Some weapons can only be used after a certain number of turns + + Some weapons can only be used after a certain number of turns + Lots of new graphics * Many network/gameplay bug fixes diff -r a00b0fa0dbd7 -r 535a00ca0d35 bin/CMakeLists.txt --- a/bin/CMakeLists.txt Sat Jan 26 23:57:37 2013 +0100 +++ b/bin/CMakeLists.txt Sun Jan 27 00:00:33 2013 +0100 @@ -1,9 +1,9 @@ if(WIN32 AND NOT UNIX) - file(GLOB DLLs *.dll) - file(GLOB ICOs *.ico) - - install(FILES - ${DLLs} - ${ICOs} - DESTINATION ${target_library_install_dir}) + file(GLOB DLLs *.dll) + file(GLOB ICOs *.ico) + + install(FILES + ${DLLs} + ${ICOs} + DESTINATION ${target_library_install_dir}) endif(WIN32 AND NOT UNIX) diff -r a00b0fa0dbd7 -r 535a00ca0d35 cmake_modules/FindLibraryWithDebug.cmake --- a/cmake_modules/FindLibraryWithDebug.cmake Sat Jan 26 23:57:37 2013 +0100 +++ b/cmake_modules/FindLibraryWithDebug.cmake Sun Jan 27 00:00:33 2013 +0100 @@ -100,7 +100,7 @@ SET(${var_name} ${${var_name}_DEBUG}) ENDIF(${var_name}_RELEASE) - + ENDIF(${var_name}_RELEASE AND ${var_name}_DEBUG) MARK_AS_ADVANCED(${var_name}_RELEASE) diff -r a00b0fa0dbd7 -r 535a00ca0d35 tools/PascalParser.hs --- a/tools/PascalParser.hs Sat Jan 26 23:57:37 2013 +0100 +++ b/tools/PascalParser.hs Sun Jan 27 00:00:33 2013 +0100 @@ -45,7 +45,7 @@ parens pas (liftM RefExpression expression >>= postfixes) >>= postfixes , try $ typeCast >>= postfixes , char '@' >> liftM Address reference >>= postfixes - , liftM SimpleReference iD >>= postfixes + , liftM SimpleReference iD >>= postfixes ] "simple reference" table = [ @@ -149,7 +149,7 @@ if null r then return $ ArrayDecl Nothing t else - return $ foldr (\a b -> ArrayDecl (Just a) b) (ArrayDecl (Just $ head r) t) (tail r) + return $ foldr (\a b -> ArrayDecl (Just a) b) (ArrayDecl (Just $ head r) t) (tail r) recordDecl = do try $ do optional $ (try $ string "packed") >> comments @@ -401,7 +401,7 @@ {-, [ Infix (try $ string "shl" >> return (BinOp "shl")) AssocNone , Infix (try $ string "shr" >> return (BinOp "shr")) AssocNone ] - , [ + , [ Infix (try $ string "or" >> return (BinOp "or")) AssocLeft , Infix (try $ string "xor" >> return (BinOp "xor")) AssocLeft ]-} @@ -497,7 +497,7 @@ optionMaybe $ choice [ try $ string "to" , try $ string "downto" - ] + ] --choice [string "to", string "downto"] comments e2 <- expression @@ -563,7 +563,7 @@ initExpression = buildExpressionParser table term "initialization expression" where term = comments >> choice [ - liftM (uncurry BuiltInFunction) $ builtInFunction initExpression + liftM (uncurry BuiltInFunction) $ builtInFunction initExpression , try $ brackets pas (commaSep pas $ initExpression) >>= return . InitSet , try $ parens pas (commaSep pas $ initExpression) >>= \ia -> when (null $ tail ia) mzero >> return (InitArray ia) , try $ parens pas (sepEndBy recField (char ';' >> comments)) >>= return . InitRecord diff -r a00b0fa0dbd7 -r 535a00ca0d35 tools/pas2c.hs --- a/tools/pas2c.hs Sat Jan 26 23:57:37 2013 +0100 +++ b/tools/pas2c.hs Sun Jan 27 00:00:33 2013 +0100 @@ -502,7 +502,7 @@ liftM (map(\i -> t' i)) $ mapM (id2CTyped2 (Just $ t' empty) (VarParamType t)) ids tvar2C _ externVar includeType ignoreInit (VarDeclaration _ isConst (ids, t) mInitExpr) = do - t' <- liftM (((if isConst then text "static const" else if externVar + t' <- liftM (((if isConst then text "static const" else if externVar then text "extern" else empty) <+>) . ) $ type2C t @@ -522,18 +522,18 @@ ie' <- return $ case (r, mInitExpr, ignoreInit) of (RangeInfinite, Nothing, False) -> text "= NULL" -- force dynamic array to be initialized as NULL if not initialized at all (_, _, _) -> ie - result <- liftM (map(\i -> varDeclDecision isConst includeType (t' i) ie')) $ mapM (id2CTyped t) ids + result <- liftM (map(\i -> varDeclDecision isConst includeType (t' i) ie')) $ mapM (id2CTyped t) ids case (r, ignoreInit) of - (RangeInfinite, False) -> + (RangeInfinite, False) -> -- if the array is dynamic, add dimension info to it return $ [dimDecl] ++ result - where + where arrayDimStr = show $ arrayDimension t arrayDimInitExp = text ("={" ++ ".dim = " ++ arrayDimStr ++ ", .a = {0, 0, 0, 0}}") dimDecl = varDeclDecision isConst includeType (text "fpcrtl_dimension_t" <+> i' <> text "_dimension_info") arrayDimInitExp - + (_, _) -> return result - + _ -> liftM (map(\i -> varDeclDecision isConst includeType (t' i) ie)) $ mapM (id2CTyped2 (Just $ t' empty) t) ids where initExpr Nothing = return $ empty @@ -815,7 +815,7 @@ i <+> text "=" <+> e1 <> semi $$ iType <+> iEnd <+> text "=" <+> e2 <> semi - $$ + $$ text "if" <+> (parens $ i <+> text "<=" <+> iEnd) <+> text "do" <+> ph <+> text "while" <> parens (i <+> text "!=" <+> iEnd <+> text add) <> semi where diff -r a00b0fa0dbd7 -r 535a00ca0d35 tools/templates/mainform.cpp --- a/tools/templates/mainform.cpp Sat Jan 26 23:57:37 2013 +0100 +++ b/tools/templates/mainform.cpp Sun Jan 27 00:00:33 2013 +0100 @@ -9,102 +9,102 @@ #include "mainform.h" MyWindow::MyWindow(QWidget * parent, Qt::WFlags flags) - : QMainWindow(parent, flags) + : QMainWindow(parent, flags) { - QWidget * centralWidget = new QWidget(this); - QGridLayout * mainlayout = new QGridLayout(centralWidget); - mainlayout->setMargin(1); - mainlayout->setSpacing(1); + QWidget * centralWidget = new QWidget(this); + QGridLayout * mainlayout = new QGridLayout(centralWidget); + mainlayout->setMargin(1); + mainlayout->setSpacing(1); - sa_xy = new QScrollArea(centralWidget); - xy = new PixLabel(); - xy->setFixedSize(1024, 512); - sa_xy->setWidget(xy); + sa_xy = new QScrollArea(centralWidget); + xy = new PixLabel(); + xy->setFixedSize(1024, 512); + sa_xy->setWidget(xy); - mainlayout->addWidget(sa_xy, 0, 0, 1, 4); + mainlayout->addWidget(sa_xy, 0, 0, 1, 4); - setCentralWidget(centralWidget); + setCentralWidget(centralWidget); - buttAdd = new QPushButton(centralWidget); - buttAdd->setText(tr("Add")); - mainlayout->addWidget(buttAdd, 1, 0); + buttAdd = new QPushButton(centralWidget); + buttAdd->setText(tr("Add")); + mainlayout->addWidget(buttAdd, 1, 0); - buttCode = new QPushButton(centralWidget); - buttCode->setText(tr("Code")); - mainlayout->addWidget(buttCode, 1, 1); + buttCode = new QPushButton(centralWidget); + buttCode->setText(tr("Code")); + mainlayout->addWidget(buttCode, 1, 1); - buttSave = new QPushButton(centralWidget); - buttSave->setText(tr("Save")); - mainlayout->addWidget(buttSave, 1, 3); + buttSave = new QPushButton(centralWidget); + buttSave->setText(tr("Save")); + mainlayout->addWidget(buttSave, 1, 3); - buttLoad = new QPushButton(centralWidget); - buttLoad->setText(tr("Load")); - mainlayout->addWidget(buttLoad, 1, 2); + buttLoad = new QPushButton(centralWidget); + buttLoad->setText(tr("Load")); + mainlayout->addWidget(buttLoad, 1, 2); - connect(buttAdd, SIGNAL(clicked()), xy, SLOT(AddRect())); - connect(buttCode, SIGNAL(clicked()), this, SLOT(Code())); - connect(buttSave, SIGNAL(clicked()), this, SLOT(Save())); - connect(buttLoad, SIGNAL(clicked()), this, SLOT(Load())); + connect(buttAdd, SIGNAL(clicked()), xy, SLOT(AddRect())); + connect(buttCode, SIGNAL(clicked()), this, SLOT(Code())); + connect(buttSave, SIGNAL(clicked()), this, SLOT(Save())); + connect(buttLoad, SIGNAL(clicked()), this, SLOT(Load())); } void MyWindow::Code() { - if (xy->rects.size()) - { - QFile f("template.pas"); - if (!f.open(QIODevice::WriteOnly)) - { - QMessageBox::information(this, tr("Error"), - tr("Cannot save")); - return ; - } + if (xy->rects.size()) + { + QFile f("template.pas"); + if (!f.open(QIODevice::WriteOnly)) + { + QMessageBox::information(this, tr("Error"), + tr("Cannot save")); + return ; + } - QTextStream stream(&f); - stream << QString("const Template0Points: array[0..%1] of TSDL_Rect =").arg(xy->rects.size() - 1) << endl; - stream << " (" << endl; - for(int i = 0; i < xy->rects.size(); i++) - { - QRect r = xy->rects[i].normalized(); - stream << QString(" (x: %1; y: %2; w: %3; h: %4),"). - arg(r.x() * 4, 4).arg(r.y() * 4, 4).arg(r.width() * 4, 4).arg(r.height() * 4, 4) << endl; - } - stream << " );" << endl; - f.close(); - } + QTextStream stream(&f); + stream << QString("const Template0Points: array[0..%1] of TSDL_Rect =").arg(xy->rects.size() - 1) << endl; + stream << " (" << endl; + for(int i = 0; i < xy->rects.size(); i++) + { + QRect r = xy->rects[i].normalized(); + stream << QString(" (x: %1; y: %2; w: %3; h: %4),"). + arg(r.x() * 4, 4).arg(r.y() * 4, 4).arg(r.width() * 4, 4).arg(r.height() * 4, 4) << endl; + } + stream << " );" << endl; + f.close(); + } } void MyWindow::Save() { - Code(); + Code(); } void MyWindow::Load() { - QFile f("template.pas"); - if (!f.open(QIODevice::ReadOnly)) - { - QMessageBox::information(this, tr("Error"), - tr("Cannot open file")); - return ; - } + QFile f("template.pas"); + if (!f.open(QIODevice::ReadOnly)) + { + QMessageBox::information(this, tr("Error"), + tr("Cannot open file")); + return ; + } - QTextStream stream(&f); - QStringList sl; - while (!stream.atEnd()) - { - sl << stream.readLine(); - } - xy->rects.clear(); - for (int i = 0; i < sl.size(); ++i) - { - QRegExp re("x:\\s+(\\d+);\\sy:\\s+(\\d+);\\sw:\\s+(\\d+);\\sh:\\s+(\\d+)"); - re.indexIn(sl.at(i)); - QStringList coords = re.capturedTexts(); - qDebug() << sl.at(i) << coords; - if ((coords.size() == 5) && (coords[0].size())) - xy->rects.push_back(QRect(coords[1].toInt() / 4, coords[2].toInt() / 4, coords[3].toInt() / 4, coords[4].toInt() / 4)); - } - f.close(); - xy->repaint(); + QTextStream stream(&f); + QStringList sl; + while (!stream.atEnd()) + { + sl << stream.readLine(); + } + xy->rects.clear(); + for (int i = 0; i < sl.size(); ++i) + { + QRegExp re("x:\\s+(\\d+);\\sy:\\s+(\\d+);\\sw:\\s+(\\d+);\\sh:\\s+(\\d+)"); + re.indexIn(sl.at(i)); + QStringList coords = re.capturedTexts(); + qDebug() << sl.at(i) << coords; + if ((coords.size() == 5) && (coords[0].size())) + xy->rects.push_back(QRect(coords[1].toInt() / 4, coords[2].toInt() / 4, coords[3].toInt() / 4, coords[4].toInt() / 4)); + } + f.close(); + xy->repaint(); } diff -r a00b0fa0dbd7 -r 535a00ca0d35 tools/templates/mainform.h --- a/tools/templates/mainform.h Sat Jan 26 23:57:37 2013 +0100 +++ b/tools/templates/mainform.h Sun Jan 27 00:00:33 2013 +0100 @@ -7,23 +7,23 @@ class MyWindow : public QMainWindow { - Q_OBJECT + Q_OBJECT public: - MyWindow(QWidget * parent = 0, Qt::WFlags flags = 0); + MyWindow(QWidget * parent = 0, Qt::WFlags flags = 0); private: - QScrollArea * sa_xy; - PixLabel * xy; - QPushButton * buttAdd; - QPushButton * buttCode; - QPushButton * buttSave; - QPushButton * buttLoad; + QScrollArea * sa_xy; + PixLabel * xy; + QPushButton * buttAdd; + QPushButton * buttCode; + QPushButton * buttSave; + QPushButton * buttLoad; private slots: - void Code(); - void Save(); - void Load(); + void Code(); + void Save(); + void Load(); }; diff -r a00b0fa0dbd7 -r 535a00ca0d35 tools/templates/pixlabel.cpp --- a/tools/templates/pixlabel.cpp Sat Jan 26 23:57:37 2013 +0100 +++ b/tools/templates/pixlabel.cpp Sun Jan 27 00:00:33 2013 +0100 @@ -3,49 +3,49 @@ #include "pixlabel.h" PixLabel::PixLabel() - : QLabel(0) + : QLabel(0) { } void PixLabel::paintEvent(QPaintEvent * event) { - QLabel::paintEvent(event); - QPainter p(this); + QLabel::paintEvent(event); + QPainter p(this); - p.fillRect(QRect(0, 0, 1024, 512), QBrush(Qt::black)); + p.fillRect(QRect(0, 0, 1024, 512), QBrush(Qt::black)); - if (rects.size()) - { - p.setPen(QPen(Qt::lightGray)); - QVector centers; - for(QList::const_iterator it = rects.begin(); it != rects.end(); ++it) - centers.push_back((*it).center()); - p.drawPolyline(QPolygon(centers)); + if (rects.size()) + { + p.setPen(QPen(Qt::lightGray)); + QVector centers; + for(QList::const_iterator it = rects.begin(); it != rects.end(); ++it) + centers.push_back((*it).center()); + p.drawPolyline(QPolygon(centers)); - p.setPen(QPen(Qt::white)); - p.drawRects(rects.toVector()); + p.setPen(QPen(Qt::white)); + p.drawRects(rects.toVector()); - p.setPen(QPen(Qt::yellow)); - p.drawRect(rects.last()); - } + p.setPen(QPen(Qt::yellow)); + p.drawRect(rects.last()); + } } void PixLabel::mousePressEvent(QMouseEvent * e) { - if (!rects.empty()) - { - if (e->button() == Qt::LeftButton) - rects[rects.size() - 1].moveTopLeft(QPoint(e->x(), e->y())); - else - if (e->button() == Qt::RightButton) - rects[rects.size() - 1].setBottomRight(QPoint(e->x(), e->y())); - repaint(); - } + if (!rects.empty()) + { + if (e->button() == Qt::LeftButton) + rects[rects.size() - 1].moveTopLeft(QPoint(e->x(), e->y())); + else + if (e->button() == Qt::RightButton) + rects[rects.size() - 1].setBottomRight(QPoint(e->x(), e->y())); + repaint(); + } } void PixLabel::AddRect() { - rects.push_back(QRect(0, 0, 1, 1)); - repaint(); + rects.push_back(QRect(0, 0, 1, 1)); + repaint(); } diff -r a00b0fa0dbd7 -r 535a00ca0d35 tools/templates/pixlabel.h --- a/tools/templates/pixlabel.h Sat Jan 26 23:57:37 2013 +0100 +++ b/tools/templates/pixlabel.h Sun Jan 27 00:00:33 2013 +0100 @@ -5,17 +5,17 @@ class PixLabel : public QLabel { - Q_OBJECT + Q_OBJECT public: - PixLabel(); - QList rects; + PixLabel(); + QList rects; public slots: - void AddRect(); + void AddRect(); private: - void paintEvent(QPaintEvent * event); - void mousePressEvent(QMouseEvent * e); + void paintEvent(QPaintEvent * event); + void mousePressEvent(QMouseEvent * e); };