QTfrontend/hwconsts.cpp.in
author nemo
Sun, 03 Jun 2012 23:04:21 -0400
changeset 7174 80480d21e6ed
parent 7130 fcab1fd02bc6
child 7258 722e8a0d89dc
permissions -rw-r--r--
Workaround for bug #144. This workaround had occurred to me a while ago, but wasn't sure if placing them unfairly was better than not placing them at all. Argument for not placing at all is people should probably abort the game when they notice it. Argument for placing unfairly is people can still abort, and if we really wanted them to abort, we should probably just have halted launch if all hogs failed to spawn. This way at least play can continue.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 1021
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6937
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     4
 *
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     8
 *
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    13
 *
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    17
 */
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    18
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    19
#include <QStandardItemModel>
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    20
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    21
#include "hwconsts.h"
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    22
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    23
QString * cProtoVer = new QString("${HEDGEWARS_PROTO_VER}");
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    24
QString * cDataDir = new QString("${HEDGEWARS_DATADIR}");
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2370
diff changeset
    25
QString * cConfigDir = new QString("");
4903
21dd1def5aaf if source has uncommitted changes:
sheepluva
parents: 4883
diff changeset
    26
QString * cVersionString = new QString("${HEDGEWARS_VERSION}${HGCHANGED}");
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    27
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    28
QDir * bindir = new QDir("${HEDGEWARS_BINDIR}");
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    29
QDir * cfgdir = new QDir();
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    30
QDir * datadir = new QDir();
94db15de0392 - Some changes to make build process clear
unc0rr
parents:
diff changeset
    31
3932
2fc211f60015 Engine:
smaxx
parents: 3876
diff changeset
    32
bool custom_config = false;
2fc211f60015 Engine:
smaxx
parents: 3876
diff changeset
    33
bool custom_data = false;
2fc211f60015 Engine:
smaxx
parents: 3876
diff changeset
    34
5200
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    35
int cMaxTeams = 8;
6737
ce5fbd98370f - Increase server version number due to rooms list protocol changes
unc0rr
parents: 6579
diff changeset
    36
int cMinServerVersion = 1;
3865
0b1c426b035f Frontend:
smaxx
parents: 3836
diff changeset
    37
5200
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    38
QString * cDefaultAmmoStore = new QString( AMMOLINE_DEFAULT_QT AMMOLINE_DEFAULT_PROB
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    39
                                           AMMOLINE_DEFAULT_DELAY AMMOLINE_DEFAULT_CRATE );
2860
13a53315ae18 Awesome patch from TheException - adds editing of weapon delay and crate count. Tiy might want to tweak the crate graphic, could make be smaller or less overlappy.
nemo
parents: 2473
diff changeset
    40
int cAmmoNumber = cDefaultAmmoStore->size() / 4;
2369
c3eb11f1ab3a Implement probability editor for weapon schemes (engine doesn't support that yet)
unc0rr
parents: 2177
diff changeset
    41
1967
213d368a002f Predefine some ammo schemes
unc0rr
parents: 1966
diff changeset
    42
QList< QPair<QString, QString> > cDefaultAmmos =
3971
5c82ee165ed5 minor stuff
koda
parents: 3963
diff changeset
    43
        QList< QPair<QString, QString> >()
5c82ee165ed5 minor stuff
koda
parents: 3963
diff changeset
    44
        << qMakePair(QString("Default"), *cDefaultAmmoStore)
5200
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    45
        << qMakePair(QString("Crazy"),       QString(
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    46
            AMMOLINE_CRAZY_QT AMMOLINE_CRAZY_PROB
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    47
            AMMOLINE_CRAZY_DELAY AMMOLINE_CRAZY_CRATE ))
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    48
        << qMakePair(QString("Pro Mode"),    QString(
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    49
            AMMOLINE_PROMODE_QT AMMOLINE_PROMODE_PROB
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    50
            AMMOLINE_PROMODE_DELAY AMMOLINE_PROMODE_CRATE ))
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    51
        << qMakePair(QString("Shoppa"),      QString(
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    52
            AMMOLINE_SHOPPA_QT AMMOLINE_SHOPPA_PROB
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    53
            AMMOLINE_SHOPPA_DELAY AMMOLINE_SHOPPA_CRATE ))
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    54
        << qMakePair(QString("Clean Slate"), QString(
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    55
            AMMOLINE_CLEAN_QT AMMOLINE_CLEAN_PROB
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    56
            AMMOLINE_CLEAN_DELAY AMMOLINE_CLEAN_CRATE ))
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    57
        << qMakePair(QString("Minefield"),   QString(
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    58
            AMMOLINE_MINES_QT AMMOLINE_MINES_PROB
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    59
            AMMOLINE_MINES_DELAY AMMOLINE_MINES_CRATE ))
4231
f2eb9ac629e4 added two games modes and one weaponset
koda
parents: 4212
diff changeset
    60
        << qMakePair(QString("Thinking with Portals"), QString(
5200
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    61
            AMMOLINE_PORTALS_QT AMMOLINE_PORTALS_PROB
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    62
            AMMOLINE_PORTALS_DELAY AMMOLINE_PORTALS_CRATE ))
7440fe992e73 * move ammo lines from .cpp.in to .h so that it is readable from the ios frontend (and who knows, maybe from other frontends as well)
koda
parents: 5049
diff changeset
    63
        ;
616
00928b3cf505 Use same team colors everywhere
unc0rr
parents: 608
diff changeset
    64
5201
7b9aa7aac336 * moved colours and default port from .cpp.in to .h
koda
parents: 5200
diff changeset
    65
unsigned int colors[] = HW_TEAMCOLOR_ARRAY;
654
1019b8fa8638 Finish asking host/port dialog implementation
unc0rr
parents: 616
diff changeset
    66
1019b8fa8638 Finish asking host/port dialog implementation
unc0rr
parents: 616
diff changeset
    67
QString * netHost = new QString();
5201
7b9aa7aac336 * moved colours and default port from .cpp.in to .h
koda
parents: 5200
diff changeset
    68
quint16 netPort = NETGAME_DEFAULT_PORT;
1415
6fbfee0e113a Allow build without net game server: introduce -DWITH_SERVER configuration parameter
unc0rr
parents: 1263
diff changeset
    69
6fbfee0e113a Allow build without net game server: introduce -DWITH_SERVER configuration parameter
unc0rr
parents: 1263
diff changeset
    70
bool haveServer = ${HAVE_NETSERVER};
3074
271cfcb2bcda Frontend:
smxx
parents: 3070
diff changeset
    71
bool isDevBuild = ${HW_DEV};
6579
fc52f7c22c9b GCI task: season greetings
valnut
parents: 5289
diff changeset
    72
fc52f7c22c9b GCI task: season greetings
valnut
parents: 5289
diff changeset
    73
int season = SEASON_NONE;
fc52f7c22c9b GCI task: season greetings
valnut
parents: 5289
diff changeset
    74
int years_since_foundation = 0;
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    75
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    76
QStandardItemModel * colorsModel;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    77
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    78
void hwConstsInit()
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    79
{
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    80
    colorsModel = new QStandardItemModel();
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    81
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    82
    int i = 0;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    83
    while(colors[i])
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    84
    {
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    85
        QStandardItem * item = new QStandardItem();
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    86
        item->setData(QColor(colors[i]));
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    87
        colorsModel->appendRow(item);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    88
        ++i;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    89
    }
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents: 6958
diff changeset
    90
}