summaryrefslogtreecommitdiffstats
path: root/konquest
diff options
context:
space:
mode:
Diffstat (limited to 'konquest')
-rw-r--r--konquest/AUTHORS12
-rw-r--r--konquest/ChangeLog26
-rw-r--r--konquest/Konquest.cc34
-rw-r--r--konquest/Makefile.am23
-rw-r--r--konquest/README10
-rw-r--r--konquest/TODO1
-rw-r--r--konquest/fleetdlg.cc88
-rw-r--r--konquest/fleetdlg.h29
-rw-r--r--konquest/gameboard.cc991
-rw-r--r--konquest/gameboard.h119
-rw-r--r--konquest/gamecore.cc646
-rw-r--r--konquest/gamecore.h331
-rw-r--r--konquest/gameenddlg.cc76
-rw-r--r--konquest/gameenddlg.h32
-rw-r--r--konquest/hi128-app-konquest.pngbin0 -> 13847 bytes
-rw-r--r--konquest/hi16-app-konquest.pngbin0 -> 628 bytes
-rw-r--r--konquest/hi22-app-konquest.pngbin0 -> 1049 bytes
-rw-r--r--konquest/hi32-app-konquest.pngbin0 -> 1657 bytes
-rw-r--r--konquest/hi48-app-konquest.pngbin0 -> 3185 bytes
-rw-r--r--konquest/hi64-app-konquest.pngbin0 -> 4893 bytes
-rw-r--r--konquest/images.h17
-rw-r--r--konquest/int_validator.cc53
-rw-r--r--konquest/int_validator.h31
-rw-r--r--konquest/konquest.desktop74
-rw-r--r--konquest/konquestui.rc21
-rw-r--r--konquest/mainwin.cc77
-rw-r--r--konquest/mainwin.h33
-rw-r--r--konquest/map_widget.cc243
-rw-r--r--konquest/map_widget.h59
-rw-r--r--konquest/minimap.cc79
-rw-r--r--konquest/minimap.h44
-rw-r--r--konquest/newGameDlg_ui.ui440
-rw-r--r--konquest/newgamedlg.cc325
-rw-r--r--konquest/newgamedlg.h51
-rw-r--r--konquest/pics/Makefile.am7
-rw-r--r--konquest/pics/konquest-splash.pngbin0 -> 207292 bytes
-rw-r--r--konquest/pics/planet1.xpm228
-rw-r--r--konquest/pics/planet2.xpm190
-rw-r--r--konquest/pics/planet3.xpm133
-rw-r--r--konquest/pics/planet4.xpm122
-rw-r--r--konquest/pics/planet5.xpm143
-rw-r--r--konquest/pics/planet6.xpm110
-rw-r--r--konquest/pics/planet7.xpm122
-rw-r--r--konquest/pics/planet8.xpm189
-rw-r--r--konquest/pics/planet9.xpm168
-rw-r--r--konquest/pics/ruler.xpm21
-rw-r--r--konquest/planet_info.cc161
-rw-r--r--konquest/planet_info.h53
-rw-r--r--konquest/scoredlg.cc80
-rw-r--r--konquest/scoredlg.h32
-rw-r--r--konquest/version.h4
51 files changed, 5728 insertions, 0 deletions
diff --git a/konquest/AUTHORS b/konquest/AUTHORS
new file mode 100644
index 00000000..6d46c5fd
--- /dev/null
+++ b/konquest/AUTHORS
@@ -0,0 +1,12 @@
+Galactic Konquest
+-----------------
+
+Contributers are:
+
+- Russell Steffen <rsteffen@bayarea.net>
+
+
+- Computer/AI Player
+Stephan Zehetner <s.zehetner@nevox.org>
+
+
diff --git a/konquest/ChangeLog b/konquest/ChangeLog
new file mode 100644
index 00000000..0601252e
--- /dev/null
+++ b/konquest/ChangeLog
@@ -0,0 +1,26 @@
+2005-02-18 Inge Wallin <ingwa@dhcp-254-182.lkpg.cendio.se>
+
+ * version.h (KONQUEST_VERSION): Bumped version number to 1.1
+ because of the upcoming release of KDE 3.4.
+
+2004-08-22 Inge Wallin <inge@lysator.liu.se>
+
+ * gameboard.cc (nextTurn): Fixed a grammatical error.
+
+0.99.4 --
+ Brought the KDE CVS tree in sync with my own. Changes from previous version
+ include:
+ -- removed dependence on libg++ random integer classes
+ -- fixed a couple of problems with the game state machine.
+
+0.0.4 --
+ Fixed (hopefully) a compiler error. gamecore.cc would compile fine with
+ debug (-g), but not with the optimizer (-O2). Added a destructor
+ and things seem okay.
+
+ Added the distance measuring function of the original game. It appears as a
+ in the toolbar.
+
+0.0.3 --
+ wasn't keeping a changelog prior to 0.0.4
+
diff --git a/konquest/Konquest.cc b/konquest/Konquest.cc
new file mode 100644
index 00000000..90a6b6c6
--- /dev/null
+++ b/konquest/Konquest.cc
@@ -0,0 +1,34 @@
+#include <kapplication.h>
+#include <klocale.h>
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+
+#include "version.h"
+#include "mainwin.h"
+#include "map_widget.h"
+
+static const char description[] = I18N_NOOP("Galactic Strategy KDE Game");
+
+int
+main(int argc, char **argv)
+{
+ KAboutData aboutData( "konquest", I18N_NOOP("Konquest"),
+ KONQUEST_VERSION, description, KAboutData::License_GPL,
+ I18N_NOOP("Copyright (c) 1999-2001, Developers"));
+ aboutData.addAuthor("Russ Steffen",0, "rsteffen@bayarea.net");
+ KCmdLineArgs::init( argc, argv, &aboutData );
+
+ KApplication a;
+ QApplication::setGlobalMouseTracking( true );
+ KGlobal::locale()->insertCatalogue("libkdegames");
+
+ if (a.isRestored())
+ RESTORE(MainWindow)
+ else {
+ MainWindow *w = new MainWindow;
+ a.setMainWidget(w);
+ w->show();
+ }
+ return a.exec();
+}
+
diff --git a/konquest/Makefile.am b/konquest/Makefile.am
new file mode 100644
index 00000000..e6b50150
--- /dev/null
+++ b/konquest/Makefile.am
@@ -0,0 +1,23 @@
+SUBDIRS = pics
+
+INCLUDES= -I$(top_srcdir)/libkdegames $(all_includes)
+KDE_ICON = konquest
+
+bin_PROGRAMS = konquest
+konquest_SOURCES = Konquest.cc gameboard.cc gamecore.cc int_validator.cc \
+ mainwin.cc map_widget.cc minimap.cc newgamedlg.cc planet_info.cc \
+ gameenddlg.cc scoredlg.cc fleetdlg.cc newGameDlg_ui.ui
+konquest_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+konquest_LDADD = $(LIB_KDEGAMES)
+konquest_DEPENDENCIES = $(LIB_KDEGAMES_DEP)
+
+
+METASOURCES = AUTO
+
+xdg_apps_DATA = konquest.desktop
+
+rcdir = $(kde_datadir)/konquest
+rc_DATA = konquestui.rc
+
+messages: rc.cpp
+ $(XGETTEXT) rc.cpp *.cc -o $(podir)/konquest.pot
diff --git a/konquest/README b/konquest/README
new file mode 100644
index 00000000..b8950f43
--- /dev/null
+++ b/konquest/README
@@ -0,0 +1,10 @@
+Konquest
+----------------------------------------
+
+Konquest is a multi-player strategy game. The goal of
+the game is to expand your interstellar empire across the
+ galaxy and, of course, crush your rivals in the process.
+
+Please see the konquest help page for more information.
+
+
diff --git a/konquest/TODO b/konquest/TODO
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/konquest/TODO
@@ -0,0 +1 @@
+
diff --git a/konquest/fleetdlg.cc b/konquest/fleetdlg.cc
new file mode 100644
index 00000000..0117f74d
--- /dev/null
+++ b/konquest/fleetdlg.cc
@@ -0,0 +1,88 @@
+#include <qlayout.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <math.h>
+#include <kglobal.h>
+#include <kpushbutton.h>
+#include <kstdguiitem.h>
+
+#include "fleetdlg.h"
+
+FleetDlgListViewItem::FleetDlgListViewItem(QListView *parent, QString s1, QString s2, QString s3, QString s4, QString s5) : QListViewItem(parent, s1, s2, s3, s4, s5)
+{
+}
+
+int FleetDlgListViewItem::compare(QListViewItem *i, int col, bool) const
+{
+ if (col == 1)
+ {
+ if (text(col) > i -> text(col)) return 1;
+ else if (text(col) < i -> text(col)) return -1;
+ else return compare(i, 0, true);
+ }
+ else if (col == 3)
+ {
+ if (text(col).toDouble() > i -> text(col).toDouble()) return 1;
+ else if (text(col).toDouble() < i -> text(col).toDouble()) return -1;
+ else return compare(i, 0, true);
+ }
+ else
+ {
+ if (text(col).toInt() > i -> text(col).toInt()) return 1;
+ else if (text(col).toInt() < i -> text(col).toInt()) return -1;
+ else return compare(i, 0, true);
+ }
+}
+
+
+FleetDlg::FleetDlg( QWidget *parent, AttackFleetList *fleets )
+ : QDialog(parent, "FleetDlg", true ), fleetList(fleets)
+{
+ setCaption( kapp->makeStdCaption(i18n("Fleet Overview")) );
+
+ fleetTable = new KListView( this, 0 );
+ fleetTable->addColumn(i18n("Fleet No."));
+ fleetTable->addColumn(i18n("Destination"));
+ fleetTable->addColumn(i18n("Ships"));
+ fleetTable->addColumn(i18n("Kill Percentage"));
+ fleetTable->addColumn(i18n("Arrival Turn"));
+ fleetTable->setMinimumSize( fleetTable->sizeHint() );
+
+ KPushButton *okButton = new KPushButton( KStdGuiItem::ok(), this );
+ okButton->setMinimumSize( okButton->sizeHint() );
+ okButton->setDefault(true);
+
+ QVBoxLayout *layout1 = new QVBoxLayout( this );
+ QHBoxLayout *layout2 = new QHBoxLayout;
+
+ layout1->addWidget( fleetTable, 1 );
+ layout1->addLayout( layout2 );
+
+ layout2->addStretch( 2 );
+ layout2->addWidget( okButton );
+ layout2->addStretch( 2 );
+
+ connect( okButton, SIGNAL(clicked()), this, SLOT(accept()) );
+
+ init();
+
+ resize( 580, 140 );
+}
+
+void
+FleetDlg::init()
+{
+ AttackFleet *curFleet;
+ AttackFleetListIterator nextFleet( *fleetList );
+ int fleetNumber = 0;
+
+ while( (curFleet = nextFleet())) {
+ fleetNumber++;
+ new FleetDlgListViewItem(fleetTable,
+ QString("%1").arg(fleetNumber),
+ curFleet->destination->getName(),
+ QString("%1").arg(curFleet->getShipCount()),
+ QString("%1").arg(KGlobal::locale()->formatNumber(curFleet->killPercentage, 3)),
+ QString("%1").arg((int)ceil(curFleet->arrivalTurn)));
+ }
+}
diff --git a/konquest/fleetdlg.h b/konquest/fleetdlg.h
new file mode 100644
index 00000000..abab1957
--- /dev/null
+++ b/konquest/fleetdlg.h
@@ -0,0 +1,29 @@
+#ifndef FLEETDLG_H
+#define FLEETDLG_H
+
+#include <klistview.h>
+
+#include <qdialog.h>
+
+#include "gamecore.h"
+
+class FleetDlgListViewItem : public QListViewItem
+{
+ public:
+ FleetDlgListViewItem(QListView *parent, QString s1, QString s2, QString s3, QString s4, QString s5);
+ int compare(QListViewItem *i, int col, bool) const;
+};
+
+class FleetDlg : public QDialog {
+
+public:
+ FleetDlg( QWidget *parent, AttackFleetList *fleets );
+
+private:
+ void init();
+
+ AttackFleetList *fleetList;
+ QListView *fleetTable;
+};
+
+#endif
diff --git a/konquest/gameboard.cc b/konquest/gameboard.cc
new file mode 100644
index 00000000..75e440d7
--- /dev/null
+++ b/konquest/gameboard.cc
@@ -0,0 +1,991 @@
+#include <qlayout.h>
+#include <qcolor.h>
+#include <qlabel.h>
+#include <qslider.h>
+#include <qevent.h>
+#include <qkeycode.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qvalidator.h>
+#include <qtextedit.h>
+
+#include <kapplication.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+
+#include <ctype.h>
+#include <math.h>
+
+#include "gamecore.h"
+
+#include "int_validator.h"
+#include "newgamedlg.h"
+#include "gameenddlg.h"
+#include "scoredlg.h"
+#include "fleetdlg.h"
+#include "gameboard.h"
+#include "gameboard.moc"
+
+
+/*********************************************************************
+ Game Board
+*********************************************************************/
+GameBoard::GameBoard( QWidget *parent )
+ : QWidget( parent ), gameInProgress( false ), gameState( NONE )
+{
+ QColorGroup cg( white, black, green.light(), green.dark(), green, green.dark(75), green.dark() );
+ QPalette palette( cg, cg, cg );
+
+ neutralPlayer = Player::createNeutralPlayer();
+ map = new Map;
+
+ planets.setAutoDelete(true);
+ players.setAutoDelete(true);
+
+ //********************************************************************
+ // Create the widgets in the main window
+ //********************************************************************
+ mapWidget = new ConquestMap( map, this );
+ msgWidget = new QTextEdit( this );
+ msgWidget->setTextFormat(LogText);
+ msgWidget->setMinimumHeight(100);
+ msgWidget->setHScrollBarMode(QScrollView::AlwaysOff);
+ msgWidget->setPaper(QBrush(Qt::black));
+ planetInfo = new PlanetInfo( this, palette );
+ gameMessage = new QLabel( this );
+ gameMessage->setPalette( palette );
+ turnCounter = new QLabel( this );
+ turnCounter->setPalette( palette );
+ turnCounter->setText( "Turn" );
+ turnCounter->setMaximumHeight( turnCounter->sizeHint().height() );
+
+ endTurn = new QPushButton( i18n("End Turn"), this );
+ endTurn->setFixedSize( endTurn->sizeHint() );
+ endTurn->setPalette( palette );
+
+ shipCountEdit = new QLineEdit( this );
+ IntValidator *v = new IntValidator( 1, 32767, this );
+ shipCountEdit->setValidator( v );
+ shipCountEdit->setMinimumSize( 40, 0 );
+ shipCountEdit->setMaximumSize( 32767, 40 );
+ shipCountEdit->setEnabled(false);
+ shipCountEdit->setPalette( palette );
+ shipCountEdit->setEchoMode( QLineEdit::Password );
+
+ splashScreen = new QLabel( this );
+ splashScreen->setPixmap(QPixmap(IMAGE_SPLASH));
+ splashScreen->setGeometry( 0, 0, 600, 550 );
+
+ setMinimumSize( 600, 600 );
+
+ setMouseTracking( true );
+ setFocusPolicy( StrongFocus );
+ setFocus();
+
+ //********************************************************************
+ // Layout the main window
+ //********************************************************************
+ QHBoxLayout *layout1 = new QHBoxLayout( this );
+ QVBoxLayout *layout2 = new QVBoxLayout;
+ QHBoxLayout *layout3 = new QHBoxLayout;
+ QVBoxLayout *layout4 = new QVBoxLayout;
+
+ layout1->addLayout( layout2 );
+ layout2->addLayout( layout3 );
+
+ layout3->addSpacing( 5 );
+ layout3->addWidget( gameMessage, 10 );
+ layout3->addWidget( shipCountEdit, 1 );
+ layout3->addWidget( endTurn, 1 );
+
+ layout2->addSpacing( 5 );
+ layout2->addWidget( mapWidget, 0, AlignTop );
+ layout2->addWidget( msgWidget );
+ layout2->addStretch( 1 );
+
+ layout1->addSpacing( 5 );
+ layout1->addLayout( layout4, 10 );
+
+ layout4->addWidget( planetInfo, 1 );
+ layout4->addSpacing( 10 );
+ layout4->addWidget( turnCounter, 1 );
+ layout4->addStretch( 1 );
+
+ layout1->addStretch( 1 );
+
+ //**********************************************************************
+ // Set up signal/slot connections
+ //**********************************************************************
+ connect( mapWidget, SIGNAL( planetSelected(Planet *) ), this, SLOT(planetSelected(Planet *)) );
+ connect( shipCountEdit, SIGNAL(returnPressed()), this, SLOT(newShipCount()) );
+ connect( endTurn, SIGNAL( clicked() ), this, SLOT( nextPlayer() ) );
+ connect( mapWidget, SIGNAL( planetHighlighted(Planet *)), planetInfo, SLOT(showPlanet(Planet *)) );
+
+ changeGameBoard( false );
+}
+
+
+//**********************************************************************
+// Destructor
+//**********************************************************************
+GameBoard::~GameBoard()
+{
+ // Nothing much to do yet
+}
+
+#if 0
+QSize GameBoard::sizeHint() const
+{
+ return QSize( 600, 550 );
+}
+#endif
+
+//************************************************************************
+// Keyboard Event handlers
+//************************************************************************
+void
+GameBoard::keyPressEvent( QKeyEvent *e )
+{
+ // Check for the escape key
+ if( e->key() == Key_Escape ) {
+ switch( gameState ) {
+ case DEST_PLANET:
+ case SHIP_COUNT:
+ case RULER_SOURCE:
+ case RULER_DEST:
+ gameState = SOURCE_PLANET;
+ haveSourcePlanet = false;
+ haveDestPlanet = false;
+ turn();
+ break;
+ default:
+ break;
+ }
+ return;
+ }
+
+ if( !isgraph( e->ascii() ) ) {
+ e->ignore();
+ return;
+ }
+
+ PlanetListIterator planetSearch( planets );
+ QString planetName;
+
+ planetName += toupper( e->ascii() );
+
+ for(Planet *p = planetSearch.toFirst();
+ p != NULL;
+ p = ++planetSearch ) {
+
+ if( p->getName() == planetName )
+ planetSelected( p );
+ }
+
+}
+
+QString
+GameBoard::playerString(Player *player)
+{
+ if (!player)
+ player = currentPlayer->current();
+ return player->getColoredName();
+}
+
+//************************************************************************
+// Game engine/state machine
+//************************************************************************
+void
+GameBoard::turn()
+{
+ PlanetListIterator planetAi( planets );
+ PlanetListIterator planetAttack( planets );
+ Planet *target = 0;
+
+ switch( gameState ) {
+ case NONE :
+ // stuff for none
+ gameState = SOURCE_PLANET;
+ haveSourcePlanet = false;
+ haveDestPlanet = false;
+ haveShipCount = false;
+ shipCount = 0;
+ mapWidget->unselectPlanet();
+
+
+ turn();
+ setFocus();
+ break;
+
+ case SOURCE_PLANET :
+
+ if( haveSourcePlanet ) {
+ gameState = DEST_PLANET;
+
+ sourcePlanet->select();
+ turn();
+
+ } else {
+ shipCountEdit->hide();
+ endTurn->setEnabled( true );
+ mapWidget->unselectPlanet();
+
+ gameMessage->setText( "<qt>" + playerString() + ": " +
+ i18n("Select source planet...") + "</qt>" );
+ setFocus();
+ }
+
+ break;
+
+ case DEST_PLANET :
+
+ if( haveDestPlanet ) {
+ mapWidget->unselectPlanet();
+ gameState = SHIP_COUNT;
+ turn();
+
+ } else {
+ shipCountEdit->hide();
+ endTurn->setEnabled( false );
+ sourcePlanet->select();
+ gameMessage->setText( "<qt>" + playerString() + ": " +
+ i18n("Select destination planet...") + "</qt>" );
+ setFocus();
+ }
+
+ break;
+
+ case SHIP_COUNT:
+
+ if( haveShipCount ) {
+ // We now have a complete fleet to send, so send it
+ sendAttackFleet( sourcePlanet, destPlanet, shipCount);
+
+ shipCountEdit->hide();
+ endTurn->setEnabled( true );
+
+ gameState = NONE;
+ turn();
+
+ endTurn->setFocus();
+
+ } else {
+ gameMessage->setText( currentPlayer->current()->getName() +
+ i18n(": How many ships?") );
+
+ shipCountEdit->setText( "" );
+ shipCountEdit->show();
+ shipCountEdit->setEnabled(true);
+ shipCountEdit->setFocus();
+
+ endTurn->setEnabled( false );
+
+ mapWidget->unselectPlanet();
+ }
+
+ break;
+
+ case RULER_SOURCE:
+ if( haveSourcePlanet ) {
+ gameState = RULER_DEST;
+ sourcePlanet->select();
+ turn();
+ } else {
+ shipCountEdit->hide();
+ endTurn->setEnabled( true );
+ mapWidget->unselectPlanet();
+
+ gameMessage->setText( i18n("Ruler: Select starting planet.") );
+ setFocus();
+ }
+
+ break;
+
+ case RULER_DEST:
+ if( haveDestPlanet ) {
+ mapWidget->unselectPlanet();
+
+ // Display the distance between the two planets
+ CoreLogic cl;
+ double dist = cl.distance( sourcePlanet, destPlanet );
+
+ QString msg;
+ msg = i18n("The distance from Planet %1 to Planet %2 is %3 light years.\n"
+ "A ship leaving this turn will arrive on turn %4")
+ .arg(sourcePlanet->getName())
+ .arg(destPlanet->getName())
+ .arg(KGlobal::locale()->formatNumber( dist, 2 ))
+ .arg(KGlobal::locale()->formatNumber( turnNumber + (int)dist, 0 ));
+ KMessageBox::information( this, msg, i18n("Distance"));
+
+ gameState = NONE;
+ turn();
+ } else {
+ gameMessage->setText( i18n("Ruler: Select ending planet.") );
+ shipCountEdit->hide();
+ endTurn->setEnabled( false );
+ sourcePlanet->select();
+
+ setFocus();
+ }
+
+ break;
+
+ case AI_PLAYER:
+ endTurn->setEnabled( false );
+ gameMessage->setText( i18n("Computer Player thinking...") );
+
+ Planet *home;
+
+ int ships;
+ planetAi.toFirst();
+
+ while ((home = planetAi())) {
+ if (home->getPlayer() == currentPlayer->current()) {
+
+ bool hasAttack = false;
+ ships = (int)floor(home->getFleet().getShipCount() * 0.7 );
+
+ if (ships >= 20) {
+
+ Planet *attack;
+ double minDistance = 100;
+ planetAttack.toFirst();
+ while ((attack = planetAttack())) {
+ bool skip = false;
+
+ CoreLogic cl;
+ double dist = cl.distance( home, attack );
+
+ if ((dist < minDistance) && (attack->getPlayer() != currentPlayer->current()) &&
+ (attack->getFleet().getShipCount() < ships )) {
+ AttackFleetListIterator FleetsinFlight( currentPlayer->current()->getAttackList() );
+ AttackFleet *curFleet;
+
+ while ( (curFleet = FleetsinFlight())) {
+ if (curFleet->destination == attack) {
+ skip = true;
+ }
+ }
+ if (skip) continue;
+
+ target = attack;
+ hasAttack = true;
+ minDistance = dist;
+ }
+ }
+
+ if (hasAttack) {
+ sendAttackFleet( home, target, ships );
+ }
+ else {
+ planetAttack.toFirst();
+ minDistance = 100;
+ int shipsToSend = 0;
+ bool hasDestination = false;
+
+ while ((attack = planetAttack())) {
+ bool skip = false;
+ CoreLogic cl;
+ double dist = cl.distance( home, attack );
+ int homeships = (int)floor(home->getFleet().getShipCount() * 0.5 );
+
+ if ((dist < minDistance) && (attack->getPlayer() == currentPlayer->current()) &&
+ (attack->getFleet().getShipCount() < homeships )) {
+ AttackFleetListIterator FleetsinFlight( currentPlayer->current()->getAttackList() );
+ AttackFleet *curFleet;
+
+ while ( (curFleet = FleetsinFlight())) {
+ if (curFleet->destination == attack) {
+ skip = true;
+ }
+ }
+ if (skip) continue;
+
+ shipsToSend = (int)floor((home->getFleet().getShipCount() - attack->getFleet().getShipCount()) / 2) ;
+
+ target = attack;
+ hasDestination = true;
+ minDistance = dist;
+ }
+ }
+
+ if (hasDestination) {
+ sendAttackFleet( home, target, shipsToSend );
+ }
+ }
+ }
+ }
+ }
+
+ endTurn->setEnabled( true );
+ nextPlayer();
+
+ break;
+
+ default:
+ break;
+ }
+
+ QString turnStr;
+ turnStr = i18n("Turn #: %1 of %2").arg(turnNumber).arg(lastTurn);
+
+ turnCounter->setText( turnStr );
+
+ emit newGameState( gameState );
+}
+//************************************************************************
+// To the end turn processing (resolve combat, etc.)
+//************************************************************************
+void
+GameBoard::nextTurn()
+{
+ resolveShipsInFlight();
+
+ scanForSurvivors();
+
+ // advance to first living player
+ while( currentPlayer->current() && !currentPlayer->current()->isInPlay() ) {
+ ++(*currentPlayer);
+ };
+
+ // advance turn counter
+ turnNumber++;
+
+ // update the planets
+ PlanetListIterator nextPlanet( planets );
+ Planet *planet;
+
+ while( (planet = nextPlanet()) )
+ {
+ planet->turn();
+ }
+
+ // Tell the status widget to update itself
+ planetInfo->rescanPlanets();
+
+ Player *winner = findWinner();
+ if (winner)
+ {
+ mapWidget->repaint(true);
+ KMessageBox::information(this,
+ i18n("The mighty %1 has conquered the galaxy!").arg(winner->getName()),
+ i18n("Game Over"));
+ }
+
+ if( (turnNumber == lastTurn) && !winner )
+ {
+ mapWidget->repaint(true);
+ GameEndDlg *dlg = new GameEndDlg( this );
+
+ if( dlg->exec() == KDialogBase::Yes ) {
+ lastTurn += dlg->extraTurns();
+ }
+
+ delete dlg;
+ }
+
+ if( winner || (turnNumber >= lastTurn) )
+ {
+ // Game over, man! Game over.
+
+ mapWidget->repaint(true);
+
+ gameOver();
+ };
+}
+
+//************************************************************************
+// determine the fate of the ships in transit
+//************************************************************************
+void
+GameBoard::resolveShipsInFlight()
+{
+ AttackFleetList arrivingShips;
+ PlayerListIterator nextPlayer( players );
+ Player *plr;
+
+ while( (plr = nextPlayer()) ) {
+ AttackFleetListIterator nextFleet( plr->getAttackList() );
+
+ AttackFleet *fleet;
+
+ while( (fleet = nextFleet()) ) {
+ double fleetArrivalTurn = floor(fleet->arrivalTurn);
+
+ if( turnNumber == int (fleetArrivalTurn) ) {
+ doFleetArrival( fleet );
+ plr->getAttackList().removeRef( fleet );
+ delete fleet;
+ }
+ }
+ }
+
+}
+
+Player *
+GameBoard::findWinner()
+{
+ Player *winner = 0;
+ int activePlayers = 0;
+
+ PlayerListIterator nextPlayer( players );
+ Player *plr;
+
+ while( (plr = nextPlayer()) ) {
+ if (plr->isInPlay())
+ {
+ winner = plr;
+ activePlayers++;
+ }
+ else if (plr->getAttackList().count() != 0)
+ {
+ activePlayers++;
+ }
+ }
+ if (activePlayers == 1)
+ return winner;
+
+ return 0;
+}
+
+void
+GameBoard::gameMsg(const QString &msg, Player *player, Planet *planet, Player *planetPlayer)
+{
+ bool isHumanInvolved = false;
+
+ QString color = "white";
+ QString colorMsg = msg;
+ QString plainMsg = msg;
+
+ if (player)
+ {
+ if (!player->isAiPlayer())
+ isHumanInvolved = true;
+ colorMsg = colorMsg.arg(playerString(player));
+ plainMsg = plainMsg.arg(player->getName());
+ }
+
+ if (planet)
+ {
+ if (!planetPlayer)
+ planetPlayer = planet->getPlayer();
+ if (!planetPlayer->isAiPlayer() && !planetPlayer->isNeutral())
+ isHumanInvolved = true;
+
+ QString color = planetPlayer->getColor().name();
+ colorMsg = colorMsg.arg(QString("<font color=\"%1\">%2</font>").arg(color, planet->getName()));
+ plainMsg = plainMsg.arg(planet->getName());
+ }
+ msgWidget->append(("<qt><font color=\"white\">Turn %1:</font> <font color=\""+color+"\">").arg(turnNumber)+colorMsg+"</font></qt>");
+ msgWidget->scrollToBottom();
+
+ if (isHumanInvolved)
+ {
+ mapWidget->repaint(true);
+ KMessageBox::information(this, plainMsg);
+ }
+}
+
+//************************************************************************
+// check to see any players have been eliminated
+//************************************************************************
+void
+GameBoard::scanForSurvivors()
+{
+ PlayerListIterator nextPlayer( players );
+ PlayerList activePlayers;
+ PlayerList inactivePlayers;
+
+ // insert all of the active players into a special
+ // list, the deactivate them
+ Player *plr;
+ while( (plr = nextPlayer()) ) {
+ if( plr->isInPlay() ) {
+ activePlayers.append( plr );
+ plr->setInPlay( false );
+ } else {
+ inactivePlayers.append( plr );
+ }
+ }
+
+
+ // iterate through the list of planets and
+ // mark their owners in play
+ PlanetListIterator nextPlanet( planets );
+
+ Planet *planet;
+ while( (planet = nextPlanet()) ) {
+ planet->getPlayer()->setInPlay( true );
+ }
+
+
+ PlayerListIterator nextActivePlayer( activePlayers );
+ while( (plr = nextActivePlayer()) ) {
+ if( !plr->isInPlay() ) {
+ // Player has bitten the dust
+ QString msg;
+ msg = i18n("The once mighty empire of %1 has fallen in ruins.");
+ gameMsg(msg, plr);
+ }
+ }
+
+ PlayerListIterator nextInactivePlayer( inactivePlayers );
+ while( (plr = nextInactivePlayer()) ) {
+ if( plr->isInPlay() ) {
+ // Player has bitten the dust
+ QString msg;
+ msg = i18n("The fallen empire of %1 has staggered back to life.");
+ gameMsg(msg, plr);
+ }
+ }
+}
+
+//************************************************************************
+// handle the arrival of a fleet at a planet
+//************************************************************************
+void
+GameBoard::doFleetArrival( AttackFleet *arrivingFleet )
+{
+ // Check to see of (fleet owner) == (planet owner)
+ // if the planet and fleet owner are the same, then merge the fleets
+ // otherwise attack.
+
+ if( (*arrivingFleet->owner) == (*arrivingFleet->destination->getPlayer())) {
+ if (!arrivingFleet->owner->isAiPlayer()) {
+ arrivingFleet->destination->getFleet().absorb(arrivingFleet);
+
+ QString msg;
+ msg = i18n("Reinforcements (%1 ships) have arrived for planet %2.")
+ .arg(arrivingFleet->getShipCount());
+ gameMsg(msg, 0, arrivingFleet->destination);
+ }
+ } else {
+
+ // let's get ready to rumble...
+
+ CoreLogic cl;
+ AttackFleet &attacker = *arrivingFleet;
+ DefenseFleet &defender = arrivingFleet->destination->getFleet();
+ Planet &prizePlanet = *(arrivingFleet->destination);
+
+ bool haveVictor = false;
+ bool planetHolds = true;
+
+ while( !haveVictor ) {
+ double attackerRoll = cl.roll();
+ double defenderRoll = cl.roll();
+
+ if( defenderRoll < prizePlanet.getKillPercentage() ) {
+ attacker.removeShips( 1 );
+ }
+
+ if( attacker.getShipCount() <= 0 ) {
+ haveVictor = true;
+ planetHolds = true;
+ continue;
+ }
+
+ if( attackerRoll < attacker.killPercentage ) {
+ defender.removeShips( 1 );
+ attacker.owner->statEnemyShipsDestroyed( 1 );
+ }
+
+ if( defender.getShipCount() <= 0 ) {
+ haveVictor = true;
+ planetHolds = false;
+ }
+ }
+
+ if( planetHolds ) {
+ prizePlanet.getPlayer()->statEnemyFleetsDestroyed(1);
+ QString msg;
+ msg = i18n("Planet %2 has held against an attack from %1.");
+ gameMsg(msg, attacker.owner, &prizePlanet);
+ } else {
+ Player *defender = prizePlanet.getPlayer();
+ attacker.owner->statEnemyFleetsDestroyed( 1 );
+
+ arrivingFleet->destination->conquer( arrivingFleet );
+
+ QString msg;
+ msg = i18n("Planet %2 has fallen to %1.");
+ gameMsg(msg, attacker.owner, &prizePlanet, defender);
+ }
+ }
+
+ mapWidget->repaint(true);
+}
+
+//************************************************************************
+// Set up the game board for a new game
+//************************************************************************
+void
+GameBoard::startNewGame()
+{
+ shutdownGame();
+
+ if( gameInProgress )
+ return;
+
+ NewGameDlg *newGame = new NewGameDlg( this, map, &players, neutralPlayer, &planets );
+
+ if( !newGame->exec() )
+ {
+ delete newGame;
+ return;
+ }
+ newGame->save(); // Save settings for next time
+
+ msgWidget->clear();
+
+ changeGameBoard( true );
+
+ planetInfo->setPlanetList(planets);
+
+ shipCountEdit->hide();
+ endTurn->setEnabled( true );
+
+ currentPlayer = new PlayerListIterator( players );
+ currentPlayer->toFirst();
+
+ endTurn->show();
+ gameMessage->show();
+
+ lastTurn = newGame->turns();
+
+ turnNumber = 1;
+ turn();
+
+ delete newGame;
+}
+
+//************************************************************************
+// Shut down the current game
+//************************************************************************
+void
+GameBoard::shutdownGame()
+{
+ if( !gameInProgress )
+ return;
+
+ int choice = KMessageBox::warningContinueCancel
+ ( this,
+ i18n("Do you wish to retire this game?"),
+ i18n("End Game"),
+ KStdGuiItem::ok() );
+
+ if( choice == KMessageBox::Cancel )
+ return;
+
+ gameOver();
+}
+
+void
+GameBoard::gameOver()
+{
+ ScoreDlg *scoreDlg = new ScoreDlg( this, i18n("Final Standings"), &players );
+ scoreDlg->exec();
+
+ cleanupGame();
+}
+
+void
+GameBoard::cleanupGame()
+{
+ map->clearMap();
+
+ planets.clear();
+ players.clear();
+
+ delete currentPlayer;
+ currentPlayer = NULL;
+
+ shipCountEdit->hide();
+ endTurn->setEnabled( false );
+
+ gameMessage->hide();
+ endTurn->hide();
+
+ changeGameBoard( false );
+ gameState = NONE;
+ emit newGameState(gameState);
+}
+
+
+//************************************************************************
+// Player selected a planet
+//************************************************************************
+void
+GameBoard::planetSelected( Planet *planet )
+{
+ switch( gameState ) {
+ case SOURCE_PLANET:
+ if( (*planet->getPlayer()) == (*currentPlayer->current()) ) {
+ // got a match
+ haveSourcePlanet = true;
+ sourcePlanet = planet;
+
+ turn();
+ }
+
+ break;
+
+ case RULER_SOURCE:
+ haveSourcePlanet = true;
+ sourcePlanet = planet;
+ turn();
+ break;
+
+ case DEST_PLANET:
+ case RULER_DEST:
+ if( planet != sourcePlanet ) {
+ // got a match
+ haveDestPlanet = true;
+ destPlanet = planet;
+
+ turn();
+ }
+
+ break;
+
+ default:
+ case NONE :
+ break;
+ }
+
+}
+
+//************************************************************************
+// Player hit return in the ship count edit box
+//************************************************************************
+void
+GameBoard::newShipCount()
+{
+ QString temp( shipCountEdit->text() );
+ bool ok;
+
+ switch( gameState ) {
+ case SHIP_COUNT:
+ shipCount = temp.toInt(&ok);
+
+ if( ok )
+ haveShipCount = true;
+
+ shipCountEdit->setText( "" );
+
+ turn();
+ break;
+
+ default:
+ break;
+ };
+
+}
+
+//**********************************************************************
+// transition board from play to non-play
+//**********************************************************************
+void
+GameBoard::changeGameBoard( bool inPlay )
+{
+ gameInProgress = inPlay;
+
+ if( gameInProgress ) {
+ mapWidget->show();
+ planetInfo->show();
+ gameMessage->show();
+ endTurn->show();
+ shipCountEdit->show();
+ splashScreen->hide();
+ setBackgroundColor( black );
+ } else {
+ mapWidget->hide();
+ planetInfo->hide();
+ gameMessage->hide();
+ endTurn->hide();
+ shipCountEdit->hide();
+ splashScreen->show();
+ setBackgroundColor( black );
+ }
+
+}
+
+//************************************************************************
+// Player clicked the 'End Turn' button
+//************************************************************************
+void
+GameBoard::nextPlayer()
+{
+ // end turn and advance to next player
+ Player *plr;
+
+ while( (plr = ++(*currentPlayer)) && !(plr->isInPlay()) ) {}
+
+ if( !plr ) {
+ // end of player list, new turn
+ currentPlayer->toFirst();
+ nextTurn();
+ }
+
+ if( gameInProgress ) {
+ if (currentPlayer->current()->isAiPlayer()) {
+ gameState = AI_PLAYER;
+ }
+ else {
+ gameState = SOURCE_PLANET;
+
+ }
+ turn();
+ }
+}
+
+//************************************************************************
+// A complete set of source, destination planets and ship count has been
+// entered, so do something about it
+//************************************************************************
+void
+GameBoard::sendAttackFleet( Planet *source, Planet *dest, int ship )
+{
+ bool ok;
+
+ ok = currentPlayer->current()->NewAttack( source, dest,
+ ship, turnNumber );
+
+ if( !ok ) {
+ KMessageBox::error( this,
+ i18n("Not enough ships to send.") );
+ }
+}
+
+//************************************************************************
+// Toolbar items
+//************************************************************************
+void
+GameBoard::measureDistance()
+{
+ switch( gameState ) {
+ case SOURCE_PLANET:
+ gameState = RULER_SOURCE;
+ turn();
+ default:
+ break;
+ }
+}
+
+void
+GameBoard::showScores()
+{
+ ScoreDlg *scoreDlg = new ScoreDlg( this, i18n("Current Standings"), &players );
+ scoreDlg->show();
+}
+
+void
+GameBoard::showFleets()
+{
+ FleetDlg *fleetDlg = new FleetDlg( this, &(currentPlayer->current()->getAttackList()) );
+ fleetDlg->show();
+}
diff --git a/konquest/gameboard.h b/konquest/gameboard.h
new file mode 100644
index 00000000..5e3cddfa
--- /dev/null
+++ b/konquest/gameboard.h
@@ -0,0 +1,119 @@
+#ifndef _GAMEBOARD_H_
+#define _GAMEBOARD_H_
+
+#include <qwidget.h>
+
+#include "planet_info.h"
+#include "map_widget.h"
+
+//************************************************************************
+// forward declarations
+//************************************************************************
+class QSlider;
+class QLabel;
+class QListBox;
+class QPushButton;
+class QLineEdit;
+class QTextEdit;
+
+enum GameState { NONE, SOURCE_PLANET, DEST_PLANET, SHIP_COUNT, RULER_SOURCE, RULER_DEST, AI_PLAYER };
+
+//************************************************************************
+// GameBoard Widget
+//************************************************************************
+class GameBoard : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GameBoard( QWidget *parent );
+ virtual ~GameBoard();
+
+ bool isGameInProgress(void) const { return gameInProgress; }
+
+// virtual QSize sizeHint() const;
+
+protected slots:
+ void startNewGame();
+ void shutdownGame();
+ void planetSelected( Planet * );
+ void newShipCount();
+ void nextPlayer();
+
+ //***************************************************************
+ // Toolbar items
+ //***************************************************************
+ void measureDistance();
+ void showScores();
+ void showFleets();
+
+signals:
+ void newGameState( GameState newState );
+
+ //***************************************************************
+ // Event Handlers
+ //***************************************************************
+protected:
+ virtual void keyPressEvent( QKeyEvent * );
+
+private:
+ void turn();
+ void nextTurn();
+ void gameOver();
+
+ void resolveShipsInFlight();
+ void sendAttackFleet( Planet *source, Planet *dest, int ships );
+ void doFleetArrival( AttackFleet *arrivingFleet );
+ void scanForSurvivors();
+
+ void gameMsg(const QString &msg, Player *player = 0, Planet *planet = 0, Player *planetPlayer = 0);
+
+ void changeGameBoard( bool inPlay );
+ void cleanupGame();
+ Player *findWinner();
+
+ QString playerString(Player *player = 0);
+
+ //***************************************************************
+ // Game State information
+ //***************************************************************
+ bool gameInProgress;
+ GameState gameState;
+ PlayerListIterator *currentPlayer;
+
+ //***************************************************************
+ // Display Widgets
+ //***************************************************************
+ ConquestMap *mapWidget;
+ PlanetInfo *planetInfo;
+ QLabel *gameMessage;
+ QLabel *turnCounter;
+ QPushButton *endTurn;
+ QLineEdit *shipCountEdit;
+ QLabel *splashScreen;
+ QTextEdit *msgWidget;
+
+
+ //***************************************************************
+ // Game objects
+ //***************************************************************
+ int turnNumber;
+ int lastTurn;
+
+ PlayerList players;
+ PlanetList planets;
+ Player *neutralPlayer;
+ Map *map;
+
+ bool haveSourcePlanet;
+ Planet *sourcePlanet;
+
+ bool haveDestPlanet;
+ Planet *destPlanet;
+
+ bool haveShipCount;
+ int shipCount;
+
+};
+
+#endif
diff --git a/konquest/gamecore.cc b/konquest/gamecore.cc
new file mode 100644
index 00000000..843c1a92
--- /dev/null
+++ b/konquest/gamecore.cc
@@ -0,0 +1,646 @@
+#include "gamecore.h"
+#include "gamecore.moc"
+
+#include <stddef.h>
+#include <math.h>
+
+#include <config.h>
+
+//*******************************************************************
+// Game Core Logic
+//*******************************************************************
+
+bool CoreLogic::class_init = false;
+
+CoreLogic::CoreLogic()
+{
+ random.setSeed(0);
+}
+
+void
+CoreLogic::generatePlanetCoordinates( int &x, int &y )
+{
+ // 0 - 15
+ x = random.getLong(16);
+ y = random.getLong(16);
+}
+
+double
+CoreLogic::generateKillPercentage()
+{
+ // 0.30 - 0.90
+ return 0.30 + random.getDouble()*0.60;
+}
+
+int
+CoreLogic::generatePlanetProduction()
+{
+ // 5 - 15
+ return 5 + random.getLong(10);
+}
+
+double
+CoreLogic::generateMorale()
+{
+ // constant
+ return 0.50;
+}
+
+double
+CoreLogic::distance( Planet *p1, Planet *p2 )
+{
+ int k = (p1->getSector().getRow() - p2->getSector().getRow()) / 2;
+ int l = (p1->getSector().getColumn() - p2->getSector().getColumn()) / 2;
+
+ return sqrt(double((k*k) + (l*l)));
+}
+
+double
+CoreLogic::roll()
+{
+ // 0.00 - 1.00
+ return random.getDouble();
+}
+
+//---------------------------------------------------------------------------
+// class Map
+//---------------------------------------------------------------------------
+
+
+Map::Map()
+ : QObject( 0, 0 ), freezeUpdates( false ),
+ rows( BOARD_ROWS ), columns( BOARD_COLS ),
+ hasSelectedSector( false )
+{
+ // initialize the grid of Sectors
+ for( int x = 0; x < rows; x++ )
+ {
+ for( int y = 0; y < columns; y++ )
+ {
+ grid[x][y] = Sector( this, x, y );
+ connect( &grid[x][y], SIGNAL( update() ), this, SLOT( childSectorUpdate() ));
+ }
+ }
+}
+
+Map::~Map()
+{
+}
+
+void
+Map::populateMap( PlayerList &players, Player *neutral,
+ int numNeutralPlanets, PlanetList &thePlanets )
+{
+ Freeze();
+
+ int index = 0;
+ QString names( "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(),.<>;:[]{}/?-+\\|" );
+
+ // Create a planet for each player
+ Player *plr;
+ for( plr = players.first(); plr != 0; plr = players.next() )
+ {
+ QString newName( names.mid( index++, 1 ) );
+ Sector &sect = findRandomFreeSector();
+ Planet *plrPlanet = Planet::createPlayerPlanet( sect, plr, newName );
+
+ thePlanets.append( plrPlanet );
+ }
+
+ for( int x = 0; x < numNeutralPlanets; x++ )
+ {
+ QString newName( names.mid( index++, 1 ) );
+ Sector &sect = findRandomFreeSector();
+ Planet *neutralPlanet = Planet::createNeutralPlanet( sect, neutral, newName );
+
+ thePlanets.append( neutralPlanet );
+ }
+
+ Thaw();
+
+ emit update();
+}
+
+void
+Map::clearMap()
+{
+ Freeze();
+
+ int x,y;
+
+ for( x = 0; x < rows; x++ )
+ for( y = 0; y < columns; y++ )
+ {
+ grid[x][y].removePlanet();
+ }
+
+
+ Thaw();
+
+ emit update();
+}
+
+Sector &
+Map::findRandomFreeSector()
+{
+ CoreLogic cl;
+
+ bool found = false;
+
+ while( !found )
+ {
+ int x,y;
+
+ cl.generatePlanetCoordinates( x,y );
+
+ if( !grid[x][y].hasPlanet() )
+ {
+ return grid[x][y];
+ }
+ }
+
+ // TODO: get rid of this
+ return grid[0][0];
+
+}
+
+bool
+Map::selectedSector( int &x, int &y ) const
+{
+ if( hasSelectedSector)
+ {
+ x = sel_x;
+ y = sel_y;
+ }
+
+ return hasSelectedSector;
+
+}
+
+void
+Map::setSelectedSector( int x, int y )
+{
+ hasSelectedSector = true;
+ sel_x = x;
+ sel_y = y;
+
+ emit update();
+}
+
+void
+Map::setSelectedSector( const Planet &planet )
+{
+ hasSelectedSector = true;
+ sel_x = planet.getSector().getRow();
+ sel_y = planet.getSector().getColumn();
+
+ emit update();
+}
+
+void
+Map::setSelectedSector()
+{
+ hasSelectedSector = false;
+
+ emit update();
+}
+
+
+void Map::childSectorUpdate()
+{
+ if( !freezeUpdates )
+ emit update();
+}
+
+void Map::Freeze()
+{
+ freezeUpdates = true;
+}
+
+void Map::Thaw()
+{
+ freezeUpdates = false;
+}
+
+Sector &Map::getSector( int x, int y )
+{
+ return grid[x][y];
+}
+
+const int Map::getRows() const
+{
+ return rows;
+}
+
+const int Map::getColumns() const
+{
+ return columns;
+}
+
+//---------------------------------------------------------------------------
+// class Sector
+//---------------------------------------------------------------------------
+
+Sector::Sector()
+: QObject(0,0), planet( NULL ), parentMap(NULL ), x(0), y(0)
+{}
+
+Sector::Sector( Map *newParentMap, int xPos, int yPos )
+: QObject(0,0), planet(NULL), parentMap( newParentMap ), x(xPos), y(yPos)
+{
+}
+
+Sector::Sector( const Sector & other )
+: QObject(0,0), planet(other.planet), parentMap(other.parentMap), x(other.x), y(other.y)
+{
+}
+
+bool Sector::hasPlanet() const
+{
+ return (planet != NULL);
+}
+
+
+void Sector::setPlanet( Planet *newPlanet )
+{
+ planet = newPlanet;
+
+ connect( planet, SIGNAL( update() ), this, SLOT( childPlanetUpdate() ) );
+
+ emit update();
+}
+
+Planet *Sector::getPlanet()
+{
+ return planet;
+}
+
+void Sector::removePlanet()
+{
+ planet = NULL;
+
+ emit update();
+}
+
+
+void Sector::childPlanetUpdate()
+{
+ emit update();
+}
+
+Sector &
+Sector::operator=( const Sector &other )
+{
+ x = other.x;
+ y = other.y;
+ planet = other.planet;
+ parentMap = other.parentMap;
+
+ return *this;
+}
+
+void
+Sector::select()
+{
+ parentMap->setSelectedSector( x, y );
+ emit selected();
+}
+
+int Sector::getRow()
+{
+ return x;
+}
+
+int Sector::getColumn()
+{
+ return y;
+}
+
+//---------------------------------------------------------------------------
+// class Planet
+//---------------------------------------------------------------------------
+
+Planet::Planet( QString planetName, Sector &newParentSector, Player *initialOwner,
+ int newProd, double newKillP, double newMorale )
+ : QObject(0,0), name(planetName), owner(initialOwner), parentSector(newParentSector),
+ homeFleet( this, newProd ), killPercentage(newKillP), morale( newMorale ), productionRate(newProd)
+
+
+{
+ parentSector.setPlanet( this );
+}
+
+Planet::~Planet() {}
+
+Planet *
+Planet::createPlayerPlanet( Sector &parentSector, Player *initialOwner, QString planetName )
+{
+ CoreLogic clogic;
+
+ double morale = clogic.generateMorale();
+
+ return new Planet( planetName, parentSector, initialOwner,
+ 10, 0.400, morale );
+}
+
+Planet *
+Planet::createNeutralPlanet( Sector &parentSector, Player *initialOwner, QString planetName )
+{
+ CoreLogic clogic;
+ double morale = clogic.generateMorale();
+
+ double killP = clogic.generateKillPercentage();
+
+ int productionRate = (int)clogic.generatePlanetProduction();
+
+ return new Planet( planetName, parentSector,
+ initialOwner, productionRate, killP, morale );
+}
+
+double
+Planet::getKillPercentage()
+{
+ return killPercentage;
+}
+
+void
+Planet::setKillPercentage( double newValue )
+{
+ killPercentage = newValue;
+
+ emit update();
+}
+
+double
+Planet::getMorale()
+{
+ return morale;
+}
+
+void
+Planet::setMorale( double newMorale )
+{
+ morale = newMorale;
+}
+
+int
+Planet::getProduction()
+{
+ return productionRate;
+}
+
+void
+Planet::setProduction( int newProduction )
+{
+ productionRate = newProduction;
+}
+
+void
+Planet::select()
+{
+ parentSector.select();
+
+ emit selected();
+}
+
+DefenseFleet &Planet::getFleet()
+{
+ return homeFleet;
+}
+
+Player *
+Planet::getPlayer() const
+{
+ return owner;
+}
+
+const QString &
+Planet::getName() const
+{
+ return name;
+}
+
+Sector &
+Planet::getSector() const
+{
+ return parentSector;
+}
+
+void
+Planet::conquer( AttackFleet *conqueringFleet )
+{
+ owner = conqueringFleet->owner;
+ owner->statPlanetsConquered(1);
+ homeFleet.become( conqueringFleet );
+}
+
+void
+Planet::coup( Player *luckyPlayer )
+{
+ owner = luckyPlayer;
+}
+
+void
+Planet::turn()
+{
+ if( !(owner->isNeutral()) ) {
+ homeFleet.addShips( productionRate );
+ owner->statShipsBuilt( productionRate );
+ } else {
+ homeFleet.addShips( 1 );
+ }
+}
+
+//---------------------------------------------------------------------------
+// class Player
+//---------------------------------------------------------------------------
+Player::Player( QString newName, QColor newColor, int newPlrNum, bool isAi ) : name( newName ), color( newColor ),
+playerNum( newPlrNum ), inPlay( true ), aiPlayer( isAi ), shipsBuilt(0), planetsConquered(0), fleetsLaunched(0),
+enemyFleetsDestroyed(0), enemyShipsDestroyed(0)
+{
+}
+
+Player::~Player()
+{
+}
+
+bool
+Player::operator==( const Player &otherPlayer ) const
+{
+ if( playerNum == otherPlayer.playerNum )
+ return true;
+ else
+ return false;
+}
+
+QString &
+Player::getName()
+{
+ return name;
+}
+
+QString
+Player::getColoredName()
+{
+ return QString("<font color=\"%1\">%2</font>").arg(color.name(), name);
+}
+
+Player *Player::createPlayer( QString newName, QColor color, int playerNum, bool isAi )
+{
+ return new Player( newName, color, playerNum, isAi );
+}
+
+Player *Player::createNeutralPlayer()
+{
+ return new Player( QString::null, gray, NEUTRAL_PLAYER_NUMBER, false );
+}
+
+QColor &Player::getColor()
+{
+ return color;
+}
+
+bool
+Player::isNeutral()
+{
+ if( playerNum == NEUTRAL_PLAYER_NUMBER ) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool Player::isInPlay()
+{
+ return inPlay;
+}
+
+void Player::setInPlay( bool status )
+{
+ inPlay = status;
+}
+
+AttackFleetList &
+Player::getAttackList()
+{
+ return attackList;
+}
+
+bool
+Player::NewAttack( Planet *sourcePlanet, Planet *destPlanet, int shipCount, int turn )
+{
+ CoreLogic cl;
+
+ double arrival = cl.distance( sourcePlanet, destPlanet ) + turn;
+
+ AttackFleet *fleet = sourcePlanet->getFleet().spawnAttackFleet( destPlanet, shipCount, arrival );
+
+
+ if( fleet ) {
+ attackList.append(fleet);
+
+ statFleetsLaunched( 1 );
+
+ return true;
+ }
+
+ return false;
+}
+
+// Player Statistics collection
+void Player::statShipsBuilt( int x )
+{
+ shipsBuilt += x;
+}
+
+void Player::statPlanetsConquered( int x )
+{
+ planetsConquered += x;
+}
+
+void Player::statFleetsLaunched( int x )
+{
+ fleetsLaunched += x;
+}
+
+void Player::statEnemyFleetsDestroyed( int x )
+{
+ enemyFleetsDestroyed += x;
+}
+
+void Player::statEnemyShipsDestroyed( int x )
+{
+ enemyShipsDestroyed += x;
+}
+
+bool Player::isAiPlayer() {
+ return aiPlayer;
+}
+
+//---------------------------------------------------------------------------
+// class Fleet
+// \---class AttackFleet
+// \---class DefenseFleet
+//---------------------------------------------------------------------------
+
+
+Fleet::Fleet( int initialShipCount )
+: shipCount( initialShipCount )
+{
+}
+
+int
+Fleet::getShipCount()
+{
+ return shipCount;
+}
+
+void
+Fleet::removeShips( int lostShips )
+{
+ shipCount -= lostShips;
+}
+
+AttackFleet::AttackFleet( Planet *source, Planet *dest, int initialCount, double arrival )
+: Fleet( initialCount ), owner( source->getPlayer() ), destination( dest ), arrivalTurn( arrival ),
+killPercentage( source->getKillPercentage() )
+{
+}
+
+DefenseFleet::DefenseFleet( Planet *newHome, int initialCount ) : Fleet( initialCount ), home( newHome )
+{
+}
+
+void
+DefenseFleet::absorb( AttackFleet *fleet )
+{
+ shipCount += fleet->getShipCount();
+}
+
+void
+DefenseFleet::become( AttackFleet *fleet )
+{
+ shipCount = fleet->getShipCount();
+}
+
+
+AttackFleet *
+DefenseFleet::spawnAttackFleet( Planet *dest, int count, double arrivalTurn )
+{
+ if( shipCount < count ) {
+ return NULL;
+ }
+
+ AttackFleet *newFleet = new AttackFleet( home, dest, count, arrivalTurn );
+
+ removeShips( count );
+
+ return newFleet;
+}
+
+void
+DefenseFleet::addShips( int newShips )
+{
+ shipCount += newShips;
+}
+
diff --git a/konquest/gamecore.h b/konquest/gamecore.h
new file mode 100644
index 00000000..c8c7c39a
--- /dev/null
+++ b/konquest/gamecore.h
@@ -0,0 +1,331 @@
+#ifndef _GAMECORE_H_
+#define _GAMECORE_H_
+
+#include <krandomsequence.h>
+
+#include <qobject.h>
+#include <qstring.h>
+#include <qcolor.h>
+#include <qptrlist.h>
+
+// Board Size Constants
+#define BOARD_ROWS 16
+#define BOARD_COLS 16
+
+// Maximum Number of Players
+#define MAX_PLAYERS 10
+
+
+//**********************************************************
+// Forward declarations for classes in this file
+//**********************************************************
+class Player;
+class Planet;
+class Sector;
+class Map;
+class Fleet;
+
+
+//**********************************************************
+// Core Logic routines
+//**********************************************************
+
+class CoreLogic
+{
+public:
+ CoreLogic();
+
+ void generatePlanetCoordinates( int &x, int &y );
+ double generateKillPercentage();
+ int generatePlanetProduction();
+ double generateMorale();
+
+ double distance( Planet *p1, Planet *p2 );
+
+ double roll();
+
+private:
+ KRandomSequence random;
+ static bool class_init;
+};
+
+
+//**********************************************************
+// class Fleet
+// \--- class AttackFleet
+// \--- class DefenseFleet
+//**********************************************************
+
+class Fleet : public QObject
+{
+
+public:
+
+ Fleet( int initialShipCount );
+ virtual ~Fleet() {}
+
+ int getShipCount();
+ void removeShips( int lostShips );
+
+protected:
+ int shipCount;
+};
+
+class AttackFleet : public Fleet
+{
+
+public:
+ AttackFleet( Planet *source, Planet *dest, int initialCount, double arrivalTurn );
+
+ Player *owner;
+ Planet *destination;
+ double arrivalTurn;
+ double killPercentage;
+
+};
+
+
+class DefenseFleet : public Fleet
+{
+
+public:
+ DefenseFleet( Planet *newHome, int initialCount );
+
+ void absorb( AttackFleet *fleet );
+ void become( AttackFleet *fleet );
+
+ void addShips( int newShips );
+
+ AttackFleet *spawnAttackFleet( Planet *destination, int shipCount, double arrivalTurn );
+
+ Planet *home;
+
+};
+
+
+//**************************************************************
+// class Player
+//**************************************************************
+
+class Player : public QObject
+{
+
+public:
+ Player( QString newName, QColor color, int number, bool isAi );
+ virtual ~Player();
+
+ enum { NEUTRAL_PLAYER_NUMBER = -1 };
+
+public:
+ QString &getName();
+ QString getColoredName();
+ QColor &getColor();
+ bool isNeutral();
+ QPtrList<AttackFleet> &getAttackList();
+
+ // factory functions
+ static Player *createPlayer( QString newName, QColor newColor, int playerNum, bool isAi );
+ static Player *createNeutralPlayer();
+
+ bool NewAttack( Planet *sourcePlanet, Planet *destPlanet, int shipCount, int departureTurn );
+
+ bool operator==( const Player &otherPlayer ) const;
+
+ bool isInPlay();
+ void setInPlay( bool );
+
+private:
+ QString name;
+ QColor color;
+ int playerNum;
+ bool inPlay;
+ bool aiPlayer;
+
+ QPtrList<AttackFleet> attackList;
+
+ // statistics counters
+ int shipsBuilt;
+ int planetsConquered;
+ int fleetsLaunched;
+ int enemyFleetsDestroyed;
+ int enemyShipsDestroyed;
+
+public:
+ void statShipsBuilt( int );
+ void statPlanetsConquered( int );
+ void statFleetsLaunched( int );
+ void statEnemyFleetsDestroyed( int );
+ void statEnemyShipsDestroyed( int );
+
+ int getShipsBuilt() { return shipsBuilt; }
+ int getPlanetsConquered() { return planetsConquered; }
+ int getFleetsLaunched() { return fleetsLaunched; }
+ int getEnemyFleetsDestroyed() { return enemyFleetsDestroyed; }
+ int getEnemyShipsDestroyed() { return enemyShipsDestroyed; }
+ bool isAiPlayer();
+
+};
+
+
+//**************************************************************
+// class Planet
+//**************************************************************
+
+class Planet : public QObject
+{
+ Q_OBJECT
+
+private:
+
+ Planet( QString planetName, Sector &newParentSector,
+ Player *initialOwner, int newProd,
+ double newKillP, double newMorale );
+
+public:
+ virtual ~Planet();
+
+ static Planet *createPlayerPlanet( Sector &parentSector,
+ Player *initialOwner, QString planetName );
+ static Planet *createNeutralPlanet( Sector &parentSector,
+ Player *initialOwner, QString planetName );
+
+ Sector &getSector() const;
+ Player *getPlayer() const;
+ const QString &getName() const;
+ DefenseFleet &getFleet();
+
+ double getKillPercentage();
+ void setKillPercentage( double newValue );
+ double getMorale();
+ void setMorale( double );
+ int getProduction();
+ void setProduction( int );
+
+ void select();
+ void conquer( AttackFleet *conqueringFleet );
+ void coup( Player *luckyPlayer );
+ void turn();
+
+signals:
+ void update();
+ void selected();
+
+private:
+ QString name;
+ Player *owner;
+ Sector &parentSector;
+ DefenseFleet homeFleet;
+
+ double killPercentage;
+ double morale;
+ int productionRate;
+};
+
+//***************************************************************
+// class Sector
+//***************************************************************
+
+class Sector : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ // constructors
+ Sector();
+ Sector( Map *parentMap, int xpos, int ypos );
+ Sector( const Sector & );
+
+ // assignment operator (makes initialization easy)
+ Sector &operator=( const Sector & );
+
+ bool hasPlanet() const;
+ void setPlanet( Planet *newPlanet );
+ Planet *getPlanet();
+ void removePlanet();
+
+ void select();
+
+ int getRow();
+ int getColumn();
+
+signals:
+ void update();
+ void selected();
+
+protected slots:
+ void childPlanetUpdate( );
+
+
+protected:
+ Planet *planet; // a sector has 0 or 1 planets
+ Map *parentMap;
+ int x, y;
+
+};
+
+//*****************************************************************
+// class Map
+//*****************************************************************
+
+class Map : public QObject
+{
+ Q_OBJECT
+
+public:
+ Map();
+ virtual ~Map();
+
+ const int getRows() const;
+ const int getColumns() const;
+
+ void populateMap( QPtrList<Player> &players, Player *neutral,
+ int numNeutralPlanets, QPtrList<Planet> &thePlanets );
+ void clearMap();
+
+ bool selectedSector( int &x, int &y ) const;
+ void setSelectedSector( int x, int y );
+ void setSelectedSector( const Planet & );
+ void setSelectedSector();
+
+ Sector &getSector( int x, int y );
+
+protected slots:
+ void childSectorUpdate();
+
+signals:
+ void update();
+
+protected:
+ void Freeze();
+ void Thaw();
+ bool freezeUpdates;
+
+private:
+ Sector &findRandomFreeSector();
+
+protected:
+ Sector grid[BOARD_ROWS][BOARD_COLS]; // a map is a 2-D array of sectors;
+ const int rows; // size of grid in sectors
+ const int columns;
+
+ // This is used to implement a selected sector,
+ // one who's boarder flashes.
+ bool hasSelectedSector;
+ int sel_x, sel_y;
+};
+
+//---------------------------------------------------------------------------------
+// Typedefs
+//---------------------------------------------------------------------------------
+typedef QPoint Coordinate; // Gotta start using this instead of int x,y crap
+typedef QPtrList<AttackFleet> AttackFleetList;
+typedef QPtrListIterator<AttackFleet> AttackFleetListIterator;
+typedef QPtrList<Player> PlayerList;
+typedef QPtrList<Planet> PlanetList;
+typedef QPtrListIterator<Player> PlayerListIterator;
+typedef QPtrListIterator<Planet> PlanetListIterator;
+
+#endif // _GAMECORE_H_
+
+
diff --git a/konquest/gameenddlg.cc b/konquest/gameenddlg.cc
new file mode 100644
index 00000000..080a8477
--- /dev/null
+++ b/konquest/gameenddlg.cc
@@ -0,0 +1,76 @@
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qslider.h>
+#include <qvbox.h>
+
+#include <kapplication.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+
+#include "gameenddlg.h"
+#include "gameenddlg.moc"
+
+GameEndDlg::GameEndDlg( QWidget *parent )
+ : KDialogBase( i18n("Out of Turns"),
+ KDialogBase::Yes|KDialogBase::No, KDialogBase::Yes, KDialogBase::No,
+ parent, "end_game_dialog", true, true )
+{
+ QVBox *page = makeVBoxMainWidget();
+
+ // Create controls
+ QLabel *label1 = new QLabel( i18n("This is the last turn.\nDo you wish to add extra turns?")+"\n\n", page );
+ label1->setAlignment( AlignCenter );
+
+ turnCountLbl = new QLabel( page );
+ turnCount = new QSlider( 1, 40, 1, 5, Qt::Horizontal, page );
+
+ KGuiItem addTurns(i18n("&Add Turns"), QString::null, QString::null,
+ i18n("Add the specified number of turns to the game and continue playing."));
+ KGuiItem gameOver(i18n("&Game Over"), QString::null, QString::null,
+ i18n("Terminate the current game."));
+
+ setButtonGuiItem(KDialogBase::Yes, addTurns);
+ setButtonGuiItem(KDialogBase::No, gameOver);
+
+ init();
+
+ connect( turnCount, SIGNAL(valueChanged( int )), this, SLOT(turnCountChange( int )) );
+}
+
+GameEndDlg::~GameEndDlg()
+{
+}
+
+void
+GameEndDlg::init()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Game");
+ int turns = config->readNumEntry("ExtraTurns", 10);
+ turnCount->setValue(turns);
+ turnCountChange(turns);
+}
+
+void
+GameEndDlg::slotYes()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Game");
+ config->writeEntry("ExtraTurns", extraTurns());
+ config->sync();
+ KDialogBase::slotYes();
+}
+
+int
+GameEndDlg::extraTurns()
+{
+ return turnCount->value();
+}
+
+void
+GameEndDlg::turnCountChange( int newTurnCount )
+{
+ QString newLbl = i18n("Extra turns: %1").arg( newTurnCount );
+ turnCountLbl->setText( newLbl);
+}
diff --git a/konquest/gameenddlg.h b/konquest/gameenddlg.h
new file mode 100644
index 00000000..d1c982e3
--- /dev/null
+++ b/konquest/gameenddlg.h
@@ -0,0 +1,32 @@
+#ifndef _GAMEENDDLG_H_
+#define _GAMEENDDLG_H_
+
+#include <kdialogbase.h>
+
+class QSlider;
+class QPushButton;
+
+class GameEndDlg : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ GameEndDlg( QWidget *parent );
+ virtual ~GameEndDlg();
+
+ int extraTurns();
+
+private:
+ void init();
+
+private slots:
+ void turnCountChange( int );
+ void slotYes();
+
+private:
+ QSlider *turnCount;
+ QLabel *turnCountLbl;
+};
+
+#endif // _GAMEENDDLG_H_
+
diff --git a/konquest/hi128-app-konquest.png b/konquest/hi128-app-konquest.png
new file mode 100644
index 00000000..3d980350
--- /dev/null
+++ b/konquest/hi128-app-konquest.png
Binary files differ
diff --git a/konquest/hi16-app-konquest.png b/konquest/hi16-app-konquest.png
new file mode 100644
index 00000000..87f6a2d5
--- /dev/null
+++ b/konquest/hi16-app-konquest.png
Binary files differ
diff --git a/konquest/hi22-app-konquest.png b/konquest/hi22-app-konquest.png
new file mode 100644
index 00000000..c9165e2f
--- /dev/null
+++ b/konquest/hi22-app-konquest.png
Binary files differ
diff --git a/konquest/hi32-app-konquest.png b/konquest/hi32-app-konquest.png
new file mode 100644
index 00000000..fc252dfe
--- /dev/null
+++ b/konquest/hi32-app-konquest.png
Binary files differ
diff --git a/konquest/hi48-app-konquest.png b/konquest/hi48-app-konquest.png
new file mode 100644
index 00000000..bd67b1b9
--- /dev/null
+++ b/konquest/hi48-app-konquest.png
Binary files differ
diff --git a/konquest/hi64-app-konquest.png b/konquest/hi64-app-konquest.png
new file mode 100644
index 00000000..7014729e
--- /dev/null
+++ b/konquest/hi64-app-konquest.png
Binary files differ
diff --git a/konquest/images.h b/konquest/images.h
new file mode 100644
index 00000000..4c436a18
--- /dev/null
+++ b/konquest/images.h
@@ -0,0 +1,17 @@
+#ifndef _IMAGES_H
+#include <kstandarddirs.h>
+#define _IMAGES_H
+
+#define IMAGE_SPLASH locate("appdata", "pics/konquest-splash.png")
+#define IMAGE_PLANET_1 locate("appdata", "pics/planet1.xpm")
+#define IMAGE_PLANET_2 locate("appdata", "pics/planet2.xpm")
+#define IMAGE_PLANET_3 locate("appdata", "pics/planet3.xpm")
+#define IMAGE_PLANET_4 locate("appdata", "pics/planet4.xpm")
+#define IMAGE_PLANET_5 locate("appdata", "pics/planet5.xpm")
+#define IMAGE_PLANET_6 locate("appdata", "pics/planet6.xpm")
+#define IMAGE_PLANET_7 locate("appdata", "pics/planet7.xpm")
+#define IMAGE_PLANET_8 locate("appdata", "pics/planet8.xpm")
+#define IMAGE_PLANET_9 locate("appdata", "pics/planet9.xpm")
+
+#endif // _IMAGES_H
+
diff --git a/konquest/int_validator.cc b/konquest/int_validator.cc
new file mode 100644
index 00000000..85fd1779
--- /dev/null
+++ b/konquest/int_validator.cc
@@ -0,0 +1,53 @@
+#include <limits.h>
+
+#include "int_validator.h"
+#include "int_validator.moc"
+
+IntValidator::IntValidator( QWidget *parent, const char *name ) :
+ QValidator( parent, name )
+{
+#ifdef INT_MIN
+ v_bottom = INT_MIN;
+#else
+ v_bottom = ~INT_MAX;
+#endif
+ v_top = INT_MIN;
+}
+
+IntValidator::IntValidator( int bottom, int top, QWidget *parent, const char *name ) :
+QValidator( parent, name )
+{
+ v_bottom = bottom;
+ v_top = top;
+}
+
+IntValidator::~IntValidator() {}
+
+QValidator::State
+IntValidator::validate( QString &input, int & ) const
+{
+ if( input.isEmpty() ) {
+ return QValidator::Valid;
+ } else {
+ bool ok;
+
+ int value = input.toInt( &ok );
+
+ if( !ok )
+ return QValidator::Invalid;
+
+ if( value < v_bottom || value > v_top )
+ return QValidator::Valid;
+
+ return QValidator::Acceptable;
+ }
+}
+
+void
+IntValidator::setRange( int b, int t )
+{
+ v_bottom = b;
+ v_top = t;
+}
+
+
diff --git a/konquest/int_validator.h b/konquest/int_validator.h
new file mode 100644
index 00000000..e5973fee
--- /dev/null
+++ b/konquest/int_validator.h
@@ -0,0 +1,31 @@
+#ifndef _INT_VALIDATOR_H_
+#define _INT_VALIDATOR_H_
+
+#include <qvalidator.h>
+
+
+class IntValidator : public QValidator
+{
+ Q_OBJECT
+
+public:
+ IntValidator( QWidget *parent, const char *name = 0 );
+ IntValidator( int bottom, int top, QWidget *parent, const char *name = 0 );
+
+ virtual ~IntValidator();
+
+ virtual QValidator::State validate( QString &, int & ) const;
+
+ virtual void setRange( int bottom, int top );
+
+ int bottom() const { return v_bottom; }
+ int top() const { return v_top; }
+
+private:
+ int v_bottom, v_top;
+};
+
+
+
+#endif /* _INT_VALIDATOR_H_ */
+
diff --git a/konquest/konquest.desktop b/konquest/konquest.desktop
new file mode 100644
index 00000000..e300059d
--- /dev/null
+++ b/konquest/konquest.desktop
@@ -0,0 +1,74 @@
+[Desktop Entry]
+Icon=konquest
+Name=Konquest
+Name[ar]=لعبة الإحتلال (Konquest)
+Name[be]=Заваёва
+Name[bn]=কনকোয়েস্ট
+Name[br]=KAloubadur
+Name[da]=Erobring
+Name[eo]=Konkero
+Name[et]=Vallutus
+Name[hi]=कॉन्क्वेस्ट
+Name[hu]=Hódítás
+Name[is]=Geimstyrjöld
+Name[lt]=Užkariautojas
+Name[ne]=कनक्वेष्ट
+Name[pt]=Conquista
+Name[ta]=கான்க்குவெஸ்ட்
+Name[tg]=Истило
+Name[zh_TW]=Konquest 征服
+Exec=konquest %i %m -caption %c
+Type=Application
+GenericName=Galactic Strategy Game
+GenericName[be]=Стратэгічная галактычная гульня
+GenericName[bg]=Галактическа игра
+GenericName[bn]=গ্যালাকটিক কৌশলের খেলা
+GenericName[bs]=Galaktička strateška igra
+GenericName[ca]=Joc d'estratègia galàctica
+GenericName[cs]=Strategická galaktická hra
+GenericName[cy]=Gêm Strategaeth Galaethol
+GenericName[da]=Galaktisk strategispil
+GenericName[de]=Galaktisches Strategiespiel
+GenericName[el]=Γαλαξιακό παιχνίδι στρατηγικής
+GenericName[eo]=Galaksia Strategiludo
+GenericName[es]=Juego de estrategia espacial
+GenericName[et]=Galaktiline strateegiamäng
+GenericName[eu]=Estrategia galaktikoaren jokoa
+GenericName[fa]=بازی Galactic Strategy
+GenericName[fi]=Galaktinen avaruuspeli
+GenericName[fr]=Jeu de stratégie galactique
+GenericName[he]=משחק אסטרטגיה גלקטי
+GenericName[hr]=Galaktička igra strategije
+GenericName[hu]=Stratégiai
+GenericName[is]=Herkænskuleikur
+GenericName[it]=Gioco galattico di strategia
+GenericName[ja]=宇宙戦略ゲーム
+GenericName[km]=ល្បែង​យុទ្ធសាស្ត្រ​ផ្កាយ
+GenericName[ko]=우주 전략 게임
+GenericName[lt]=Galaktikos strateginis žaidimas
+GenericName[lv]=Stratēģiska kosmiskā spēle
+GenericName[mk]=Игра на галактичка стратегија
+GenericName[nb]=Strategispillet Galactic
+GenericName[nds]= Galaktsch Strategiespeel
+GenericName[ne]=ग्यालाक्टिक रणनीति खेल
+GenericName[nl]=Strategisch ruimtespel
+GenericName[nn]=Strategispelet Galactic
+GenericName[pl]=Gra strategiczna w kosmosie
+GenericName[pt]=Jogo de Estratégia Galáctica
+GenericName[pt_BR]=Jogo de Estratégia galáctico
+GenericName[ru]=Завоевание
+GenericName[se]=Strategiijaspeallu Galactic
+GenericName[sk]=Galaktická strategická hra
+GenericName[sl]=Galaktična strateška igra
+GenericName[sr]=Галактичка стратешка игра
+GenericName[sr@Latn]=Galaktička strateška igra
+GenericName[sv]=Galaktiskt strategispel
+GenericName[ta]=கலாட்டிக் தந்திர விளையாட்டு
+GenericName[uk]=Галактична гра на стратегію
+GenericName[wa]=Djeu di stratedjeye galactike
+GenericName[zh_TW]=銀河戰略遊戲
+Terminal=false
+DocPath=konquest/index.html
+X-KDE-StartupNotify=true
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;Game;StrategyGame;
diff --git a/konquest/konquestui.rc b/konquest/konquestui.rc
new file mode 100644
index 00000000..aff9e71a
--- /dev/null
+++ b/konquest/konquestui.rc
@@ -0,0 +1,21 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="konquest" version="1">
+
+<MenuBar>
+ <Menu name="game"><text>&amp;Game</text>
+ <Action name="game_measure"/>
+ <Action name="game_scores"/>
+ <Action name="game_fleets"/>
+ </Menu>
+</MenuBar>
+
+<ToolBar name="mainToolBar"><text>Main Toolbar</text>
+ <Action name="game_new"/>
+ <Action name="game_end"/>
+ <Separator/>
+ <Action name="game_measure"/>
+ <Action name="game_scores"/>
+ <Action name="game_fleets"/>
+</ToolBar>
+
+</kpartgui>
diff --git a/konquest/mainwin.cc b/konquest/mainwin.cc
new file mode 100644
index 00000000..496d3ac0
--- /dev/null
+++ b/konquest/mainwin.cc
@@ -0,0 +1,77 @@
+#include <config.h>
+
+#include <qpushbutton.h>
+
+#include <kapplication.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <kmenubar.h>
+#include <ktoolbar.h>
+#include <kiconloader.h>
+#include <kaction.h>
+#include <kstdaction.h>
+#include <kstdgameaction.h>
+
+#include "version.h"
+#include "gamecore.h"
+#include "mainwin.h"
+#include "mainwin.moc"
+#include "gameboard.h"
+
+// KonquestMainWindow
+
+
+MainWindow::MainWindow()
+{
+ setCaption( i18n("Galactic Conquest") );
+
+ setupGameBoard();
+ setupKAction();
+ setupGUI();
+}
+
+MainWindow::~MainWindow()
+{
+}
+
+void
+MainWindow::setupKAction()
+{
+ KStdGameAction::gameNew( gameBoard, SLOT( startNewGame() ), actionCollection() );
+ KStdGameAction::quit( this, SLOT( close() ), actionCollection() );
+ endAction = KStdGameAction::end( gameBoard, SLOT( shutdownGame() ), actionCollection() );
+ endAction->setEnabled(false);
+
+ //AB: there is no icon for disabled - KToolBar::insertButton shows the
+ //different state - KAction not :-(
+ measureAction = new KAction( i18n("&Measure Distance"), "ruler", 0, gameBoard, SLOT( measureDistance() ), actionCollection(), "game_measure" );
+ measureAction->setEnabled(false);
+ standingAction = new KAction( i18n("&Show Standings"), "help", 0, gameBoard, SLOT( showScores() ), actionCollection(), "game_scores" );
+ standingAction->setEnabled(false);
+ fleetAction = new KAction( i18n("&Fleet Overview"), "launch", 0, gameBoard, SLOT( showFleets() ), actionCollection(), "game_fleets" );
+ fleetAction->setEnabled(false);
+ toolBar()->setBarPos( KToolBar::Left );
+ toolBar()->setMovingEnabled( false );
+}
+
+void
+MainWindow::setupGameBoard()
+{
+ gameBoard = new GameBoard( this );
+ setCentralWidget(gameBoard);
+
+ connect( gameBoard, SIGNAL( newGameState( GameState )), this, SLOT( gameStateChange( GameState ) ) );
+}
+
+
+void
+MainWindow::gameStateChange( GameState newState )
+{
+ endAction->setEnabled( gameBoard->isGameInProgress() );
+ measureAction->setEnabled( newState==SOURCE_PLANET );
+ standingAction->setEnabled( newState==SOURCE_PLANET );
+ fleetAction->setEnabled( newState==SOURCE_PLANET );
+}
+
+
+
diff --git a/konquest/mainwin.h b/konquest/mainwin.h
new file mode 100644
index 00000000..2954039c
--- /dev/null
+++ b/konquest/mainwin.h
@@ -0,0 +1,33 @@
+#ifndef _MAIN_WIN_H
+#define _MAIN_WIN_H
+
+#include <kmainwindow.h>
+
+#include "gameboard.h"
+
+class ConquestMap;
+class PlanetStatusTable;
+
+class MainWindow : public KMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+ ~MainWindow();
+
+protected:
+ void setupKAction();
+ void setupGameBoard();
+
+private:
+ GameBoard *gameBoard;
+ KAction *endAction, *measureAction, *standingAction, *fleetAction;
+
+private slots:
+ void gameStateChange( GameState );
+
+};
+
+#endif
+
diff --git a/konquest/map_widget.cc b/konquest/map_widget.cc
new file mode 100644
index 00000000..9bb1a632
--- /dev/null
+++ b/konquest/map_widget.cc
@@ -0,0 +1,243 @@
+#include <qpixmap.h>
+#include <qpainter.h>
+#include <qcolor.h>
+
+#include <kapplication.h>
+#include <kiconloader.h>
+#include <kglobalsettings.h>
+
+#include <kglobal.h>
+#include "map_widget.moc"
+
+ConquestMap::ConquestMap( Map *newMap, QWidget *parent )
+ : QGridView( parent ),
+ SECTOR_HEIGHT( 28 ), SECTOR_WIDTH( 28 ),
+ BOARD_HEIGHT( newMap->getRows() * SECTOR_HEIGHT ),
+ BOARD_WIDTH( newMap->getColumns() * SECTOR_WIDTH ),
+ map( newMap ), gridColor( 50, 80, 50 ),
+ hiLiteRow( -1 ), hiLiteCol( -1 )
+{
+ labelFont = KGlobalSettings::generalFont();
+ labelFont.setPointSize( 8 );
+
+ setFrameStyle( NoFrame );
+ setPaletteBackgroundColor( black );
+ setMinimumSize( BOARD_HEIGHT, BOARD_WIDTH );
+
+ setCellWidth( SECTOR_WIDTH );
+ setCellHeight( SECTOR_HEIGHT );
+ setNumRows( map->getRows() );
+ setNumCols( map->getColumns() );
+
+ setMinimumSize( BOARD_HEIGHT, BOARD_WIDTH );
+ setMaximumSize( BOARD_HEIGHT, BOARD_WIDTH );
+
+ connect( map, SIGNAL( update() ), this, SLOT( mapUpdate() ) );
+
+ QTimer *timer = new QTimer( this );
+ connect( timer, SIGNAL(timeout()), this, SLOT(squareBlink()) );
+ timer->start( 500, false );
+
+ viewport()->setMouseTracking( true );
+ setMouseTracking( true );
+
+ show();
+
+
+}
+
+ConquestMap::~ConquestMap()
+{
+}
+
+
+void
+ConquestMap::contentsMousePressEvent( QMouseEvent *e )
+{
+ int row, col;
+
+ row = rowAt( e->y() );
+ col = columnAt( e->x() );
+
+ if( map->getSector( row, col ).hasPlanet() ) {
+ emit planetSelected( map->getSector( row, col ).getPlanet() );
+ }
+
+}
+
+void
+ConquestMap::contentsMouseMoveEvent( QMouseEvent *e )
+{
+ // highlight the square under the mouse
+ int row, col;
+
+ row = rowAt( e->y() );
+ col = columnAt( e->x() );
+
+ // Check to make sure the mouse is in a valid grid location
+ if( (row < 0 || col < 0) ||
+ (row >= BOARD_ROWS || col >= BOARD_COLS) ) {
+ return;
+ }
+
+
+ if( (hiLiteRow != -1) && (hiLiteCol != -1) ) {
+ QPainter p( viewport() );
+
+ p.translate( hiLiteCol * cellWidth(), hiLiteRow * cellHeight() );
+
+ drawSector( &p, map->getSector(hiLiteRow,hiLiteCol) );
+
+ hiLiteRow = -1;
+ hiLiteCol = -1;
+
+ }
+
+ if( map->getSector( row, col ).hasPlanet() ) {
+ QPainter p( viewport() );
+
+ p.translate( col * cellWidth(),row * cellHeight() );
+
+ drawSector( &p, map->getSector(row,col), false, true );
+ emit planetHighlighted(map->getSector( row, col ).getPlanet() );
+
+ hiLiteRow = row;
+ hiLiteCol = col;
+
+ }
+
+}
+
+void
+ConquestMap::unselectPlanet()
+{
+ map->setSelectedSector();
+}
+
+
+void
+ConquestMap::paintCell( QPainter *p, int row, int col )
+{
+ drawSector( p, map->getSector( row, col ) );
+}
+
+void
+ConquestMap::squareBlink()
+{
+ static bool blinkState = true;
+
+ int row, col;
+ if( map->selectedSector( row, col ) ) {
+ QPainter p( this, true );
+
+ p.translate( col * cellWidth(), row * cellHeight() );
+
+ if( blinkState ) {
+ drawSector( &p, map->getSector(row,col), true );
+ } else {
+ drawSector( &p, map->getSector(row,col), false );
+ }
+ }
+
+ if( blinkState )
+ blinkState = false;
+ else
+ blinkState = true;
+}
+
+
+void
+ConquestMap::mapUpdate()
+{
+ viewport()->repaint(false);
+}
+
+
+void
+ConquestMap::drawSector( QPainter *p, Sector &sector, bool borderStrobe, bool highlight )
+{
+ QColor labelColor( white );
+ QPoint labelCorner;
+
+ if( sector.hasPlanet() ) {
+ QPixmap pm;
+
+ // simple (pathetic) way to "randomize"
+ // the planet graphic
+ // and also a really dirty hack to make the planet
+ // name more visible (hard coded pixel offsets)
+ switch( ((sector.getRow()+sector.getColumn()) % 9) + 1 ) {
+ case 1 :
+ pm = QPixmap( IMAGE_PLANET_1 );
+ labelCorner = QPoint( 18, 14 );
+ break;
+ case 2 :
+ pm = QPixmap( IMAGE_PLANET_2 );
+ labelCorner = QPoint( 2, 14 );
+ break;
+ case 3 :
+ pm = QPixmap( IMAGE_PLANET_3 );
+ labelCorner = QPoint( 2, 26 );
+ break;
+ case 4 :
+ pm = QPixmap( IMAGE_PLANET_4 );
+ labelCorner = QPoint( 18, 26 );
+ break;
+ case 5 :
+ pm = QPixmap( IMAGE_PLANET_5 );
+ labelCorner = QPoint( 18, 26 );
+ break;
+ case 6 :
+ pm = QPixmap( IMAGE_PLANET_6 );
+ labelCorner = QPoint( 18, 26 );
+ break;
+ case 7 :
+ pm = QPixmap( IMAGE_PLANET_7 );
+ labelCorner = QPoint( 18, 26 );
+ break;
+ case 8 :
+ pm = QPixmap( IMAGE_PLANET_8 );
+ labelCorner = QPoint( 18, 26 );
+ break;
+ case 9 :
+ pm = QPixmap( IMAGE_PLANET_9 );
+ labelCorner = QPoint( 18, 26 );
+ break;
+ }
+
+ QPoint pos;
+
+ pos.setX( ( SECTOR_HEIGHT / 2 ) - ( pm.height() / 2 ) );
+ pos.setY( ( SECTOR_WIDTH / 2 ) - ( pm.width() / 2 ) );
+
+ p->drawPixmap( pos, pm, QRect(0, 0, pm.height(), pm.width() ) );
+
+ p->setFont( labelFont );
+ p->setPen( labelColor );
+
+ p->drawText( labelCorner, sector.getPlanet()->getName() );
+
+ if( borderStrobe ) {
+ QPen gridPen( sector.getPlanet()->getPlayer()->getColor() );
+ p->setPen( gridPen );
+ } else if( highlight ) {
+ QPen gridPen( white );
+ p->setPen( gridPen );
+ } else {
+ QPen gridPen( gridColor );
+ p->setPen( gridPen );
+ }
+
+ } else {
+ p->eraseRect( 0, 0, SECTOR_WIDTH, SECTOR_HEIGHT );
+
+ QPen gridPen( gridColor );
+
+ p->setPen( gridPen );
+ }
+
+ p->drawRect( 0, 0, SECTOR_HEIGHT, SECTOR_WIDTH );
+
+}
+
+
diff --git a/konquest/map_widget.h b/konquest/map_widget.h
new file mode 100644
index 00000000..052d6e9d
--- /dev/null
+++ b/konquest/map_widget.h
@@ -0,0 +1,59 @@
+#ifndef _MAP_WIDGET_H
+#define _MAP_WIDGET_H
+
+
+#include <qwidget.h>
+#include <qframe.h>
+#include <qpixmap.h>
+
+#include <qgridview.h>
+
+#include <qtimer.h>
+
+#include "gamecore.h"
+#include "images.h"
+
+class ConquestMap : public QGridView
+{
+ Q_OBJECT
+
+ // Constructors
+public:
+ ConquestMap( Map *newMap, QWidget *parent = 0 );
+ virtual ~ConquestMap();
+
+ // Interface
+public:
+ void unselectPlanet();
+
+protected:
+ virtual void contentsMousePressEvent( QMouseEvent *e );
+ virtual void contentsMouseMoveEvent( QMouseEvent *e );
+ virtual void paintCell( QPainter *p, int row, int col );
+
+private slots:
+ void mapUpdate();
+ void squareBlink();
+
+signals:
+ void planetSelected( Planet * );
+ void planetHighlighted( Planet * );
+
+private:
+ const int SECTOR_HEIGHT;
+ const int SECTOR_WIDTH;
+
+ const int BOARD_HEIGHT;
+ const int BOARD_WIDTH;
+
+ void drawSector( QPainter *, Sector &, bool borderStrobe = true, bool highlight = false );
+
+ Map *map;
+ QColor gridColor;
+ QFont labelFont;
+
+ int hiLiteRow, hiLiteCol;
+};
+
+
+#endif
diff --git a/konquest/minimap.cc b/konquest/minimap.cc
new file mode 100644
index 00000000..eee1237b
--- /dev/null
+++ b/konquest/minimap.cc
@@ -0,0 +1,79 @@
+#include <qpixmap.h>
+#include <qpainter.h>
+
+#include <kapplication.h>
+#include <kiconloader.h>
+
+#include "minimap.h"
+#include "minimap.moc"
+
+MiniMap::MiniMap( QWidget *parent, const char *name )
+ : QGridView( parent, name ),
+ SECTOR_HEIGHT( 12 ), SECTOR_WIDTH( 12 ),
+ BOARD_HEIGHT( 10 * SECTOR_HEIGHT ),
+ BOARD_WIDTH( 10 * SECTOR_WIDTH ),
+ map( 0 )
+{
+ setFrameStyle( NoFrame );
+ setPaletteBackgroundColor( black );
+ setMinimumSize( BOARD_HEIGHT, BOARD_WIDTH );
+
+ setCellWidth( SECTOR_WIDTH );
+ setCellHeight( SECTOR_HEIGHT );
+ setNumRows( 10 );
+ setNumCols( 10 );
+
+ setMinimumSize( BOARD_HEIGHT, BOARD_WIDTH );
+ setMaximumSize( BOARD_HEIGHT, BOARD_WIDTH );
+}
+
+void
+MiniMap::setMap(Map *newMap)
+{
+ map = newMap;
+ BOARD_HEIGHT = map->getRows() * SECTOR_HEIGHT;
+ BOARD_WIDTH = map->getColumns() * SECTOR_WIDTH;
+ setNumRows( map->getRows() );
+ setNumCols( map->getColumns() );
+
+ setMinimumSize( BOARD_HEIGHT, BOARD_WIDTH );
+ setMaximumSize( BOARD_HEIGHT, BOARD_WIDTH );
+
+ connect( map, SIGNAL( update() ), this, SLOT( mapUpdate() ) );
+}
+
+MiniMap::~MiniMap()
+{
+}
+
+
+void
+MiniMap::paintCell( QPainter *p, int row, int col )
+{
+ drawSector( p, map->getSector( row, col ) );
+}
+
+void
+MiniMap::mapUpdate()
+{
+ updateContents();
+}
+
+
+void
+MiniMap::drawSector( QPainter *p, Sector &sector )
+{
+ QRect r( 0, 0, SECTOR_WIDTH, SECTOR_HEIGHT );
+
+ p->setPen( black );
+ p->setBrush( black );
+ p->drawRect( r );
+
+ if( sector.hasPlanet() ) {
+ p->setPen( sector.getPlanet()->getPlayer()->getColor() );
+ p->setBrush( sector.getPlanet()->getPlayer()->getColor() );
+
+ p->drawPie( r, 0, (360 * 16)-1 );
+ }
+}
+
diff --git a/konquest/minimap.h b/konquest/minimap.h
new file mode 100644
index 00000000..9d205abb
--- /dev/null
+++ b/konquest/minimap.h
@@ -0,0 +1,44 @@
+#ifndef _MINIMAP_H
+#define _MINIMAP_H
+
+#include <qwidget.h>
+#include <qframe.h>
+#include <qpixmap.h>
+#include <qgridview.h>
+#include <qtimer.h>
+
+#include "gamecore.h"
+#include "images.h"
+
+
+class MiniMap : public QGridView
+{
+ Q_OBJECT
+
+ // Constructors
+public:
+ MiniMap( QWidget *parent = 0, const char* name = 0 );
+ virtual ~MiniMap();
+
+ void setMap( Map *newMap );
+
+protected:
+ void paintCell( QPainter *p, int row, int col );
+
+private slots:
+ void mapUpdate();
+
+private:
+ int SECTOR_HEIGHT;
+ int SECTOR_WIDTH;
+
+ int BOARD_HEIGHT;
+ int BOARD_WIDTH;
+
+ void drawSector( QPainter *, Sector & );
+
+ Map *map;
+};
+
+
+#endif // _MINIMAP_H_
diff --git a/konquest/newGameDlg_ui.ui b/konquest/newGameDlg_ui.ui
new file mode 100644
index 00000000..2768e5f8
--- /dev/null
+++ b/konquest/newGameDlg_ui.ui
@@ -0,0 +1,440 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>NewGameDlgUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>NewGameDlgUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>661</width>
+ <height>461</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>labelPlayers</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>sliderPlayers</cstring>
+ </property>
+ </widget>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>sliderPlayers</cstring>
+ </property>
+ <property name="minValue">
+ <number>2</number>
+ </property>
+ <property name="maxValue">
+ <number>9</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>labelPlayerList</cstring>
+ </property>
+ <property name="text">
+ <string>Player list:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>listPlayers</cstring>
+ </property>
+ </widget>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>listPlayers</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>labelNewPlayer</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Human player:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>newPlayer</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>newPlayer</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addPlayer</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add Human Player</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>labelPlanets</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>sliderPlanets</cstring>
+ </property>
+ </widget>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>sliderPlanets</cstring>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>35</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>labelMap</cstring>
+ </property>
+ <property name="text">
+ <string>Preview map:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="MiniMap">
+ <property name="name">
+ <cstring>map</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>rejectMap</cstring>
+ </property>
+ <property name="text">
+ <string>Reject &amp;Map</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>labelTurns</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>sliderTurns</cstring>
+ </property>
+ </widget>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>sliderTurns</cstring>
+ </property>
+ <property name="minValue">
+ <number>5</number>
+ </property>
+ <property name="maxValue">
+ <number>40</number>
+ </property>
+ <property name="pageStep">
+ <number>5</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>MiniMap</class>
+ <header location="local">minimap.h</header>
+ <sizehint>
+ <width>250</width>
+ <height>250</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>0</hordata>
+ <verdata>0</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154789cad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e0582c261e95f8bfc04f1a1e8bc5c4dfe0a19017a725d8c60000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>minimap.h</includehint>
+</includehints>
+</UI>
diff --git a/konquest/newgamedlg.cc b/konquest/newgamedlg.cc
new file mode 100644
index 00000000..c1beae4f
--- /dev/null
+++ b/konquest/newgamedlg.cc
@@ -0,0 +1,325 @@
+#include <qheader.h>
+#include <qlayout.h>
+#include <qcolor.h>
+#include <qlabel.h>
+#include <qslider.h>
+#include <qevent.h>
+#include <qkeycode.h>
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+
+#include <kapplication.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+#include <kstdguiitem.h>
+
+#include "newgamedlg.h"
+#include "newgamedlg.moc"
+
+#include "newGameDlg_ui.h"
+
+/*************************************************************************
+ New Game Dialog Members
+ ************************************************************************/
+
+NewGameDlg::NewGameDlg( QWidget *parent, Map *pmap, PlayerList *players,
+ Player *neutralPlayer, PlanetList *planets )
+ : KDialogBase( parent, "new_game_dialog", true, i18n("Start New Game"),
+ KDialogBase::Ok|KDialogBase::Default|KDialogBase::Cancel, KDialogBase::NoDefault, true ),
+ plrList(players), plnetList(planets), neutral(neutralPlayer),
+ map(pmap)
+{
+ w = new NewGameDlgUI(this);
+ w->map->setMap(map);
+ w->listPlayers->header()->hide();
+// w->listPlayers->setMinimumSize( 100, 150 );
+ w->listPlayers->setSortColumn(-1);
+ w->listPlayers->setHScrollBarMode(QScrollView::AlwaysOff);
+ w->sliderPlayers->setMinimumWidth(270);
+ w->sliderPlanets->setMinimumWidth(270);
+
+ w->newPlayer->setMaxLength( 8 );
+
+ connect(w->sliderPlayers, SIGNAL(valueChanged(int)), this, SLOT(slotPlayerCount(int)));
+ connect(w->sliderPlanets, SIGNAL(valueChanged(int)), this, SLOT(slotNewMap()));
+ connect(w->sliderTurns, SIGNAL(valueChanged(int)), this, SLOT(slotTurns()));
+ connect(w->rejectMap, SIGNAL(clicked()), this, SLOT(slotNewMap()));
+ connect(w->newPlayer, SIGNAL(textChanged(const QString &)), this, SLOT(slotNewPlayer()));
+ connect(w->newPlayer, SIGNAL(returnPressed()), this, SLOT(slotAddPlayer()));
+ connect(w->addPlayer, SIGNAL(clicked()), this, SLOT(slotAddPlayer()));
+
+ init();
+
+ setMainWidget(w);
+}
+
+void
+NewGameDlg::slotDefault()
+{
+ w->sliderPlayers->setValue(2);
+ w->sliderPlanets->setValue(3);
+ w->sliderTurns->setValue(15);
+
+ w->listPlayers->clear();
+
+ setPlayerCount(2);
+
+ updateMiniMap();
+ updateLabels();
+}
+
+void
+NewGameDlg::init()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Game");
+ int nrOfPlayers = config->readNumEntry("NrOfPlayers");
+ if (nrOfPlayers < 2)
+ nrOfPlayers = 2;
+ if (nrOfPlayers > MAX_PLAYERS)
+ nrOfPlayers = MAX_PLAYERS;
+
+ int nrOfPlanets = config->readNumEntry("NrOfPlanets", 3);
+ int nrOfTurns = config->readNumEntry("NrOfTurns", 15);
+
+ w->sliderPlayers->setValue(nrOfPlayers);
+ w->sliderPlanets->setValue(nrOfPlanets);
+ w->sliderTurns->setValue(nrOfTurns);
+ setPlayerCount(nrOfPlayers);
+ slotNewPlayer();
+
+ // Restore player names
+ int plrNum = 0;
+ for( QListViewItem *item = w->listPlayers->firstChild();
+ item; item = item->nextSibling(), plrNum++ )
+ {
+ QString key = QString("Player_%1").arg(plrNum);
+
+ QString playerName = config->readEntry(key);
+ if (playerName.isEmpty())
+ continue;
+
+ item->setText(2, "H"); // Human
+ item->setText(1, i18n("Human Player"));
+ item->setText(0, playerName);
+ }
+
+ updateMiniMap();
+ updateLabels();
+}
+
+void
+NewGameDlg::slotNewPlayer()
+{
+ w->addPlayer->setEnabled(!w->newPlayer->text().isEmpty());
+}
+
+void
+NewGameDlg::slotAddPlayer()
+{
+ QString playerName = w->newPlayer->text();
+ if (playerName.isEmpty())
+ return;
+
+ QListViewItem *item;
+ do
+ {
+ item = w->listPlayers->firstChild();
+ while( item )
+ {
+ if (item->text(2) == "A")
+ break;
+
+ item = item->nextSibling();
+ }
+ if (!item)
+ {
+ int nrPlayers = w->listPlayers->childCount();
+ if (nrPlayers >= MAX_PLAYERS)
+ return; // Too bad
+ nrPlayers++;
+ w->sliderPlayers->setValue(nrPlayers);
+ setPlayerCount(nrPlayers);
+ }
+ }
+ while(!item);
+
+ item->setText(2, "H"); // Human
+ item->setText(1, i18n("Human Player"));
+ item->setText(0, playerName);
+
+ w->newPlayer->setText(QString::null);
+
+ updateMiniMap();
+ updateLabels();
+}
+
+void
+NewGameDlg::setPlayerCount(int playerCount)
+{
+ QColor PlayerColors[MAX_PLAYERS] = { QColor( 130, 130, 255 ), yellow, red, green,
+ white, cyan, magenta, QColor( 235, 153, 46 ),
+ QColor( 106, 157, 104 ), QColor( 131, 153, 128) };
+
+ int i = 0;
+ QListViewItem *lastItem = 0;
+ QListViewItem *item = 0;
+ QListViewItem *nextItem = w->listPlayers->firstChild();
+ while( (item = nextItem) )
+ {
+ nextItem = item->nextSibling();
+ if (i >= playerCount)
+ {
+ delete item;
+ }
+ else
+ {
+ lastItem = item;
+ }
+ i++;
+ }
+
+ while(w->listPlayers->childCount() < playerCount)
+ {
+ QString playerName = i18n("Generated AI player name", "Comp%1").arg(i+1);
+ QPixmap pm(16,16);
+ QColor color(PlayerColors[i]);
+ pm.fill(color);
+ QListViewItem *item = new QListViewItem(w->listPlayers, lastItem, playerName, i18n("Computer Player"), "A", color.name());
+ item->setPixmap(0, pm);
+ lastItem = item;
+ i++;
+ }
+}
+
+void
+NewGameDlg::slotPlayerCount(int playerCount)
+{
+ if (w->listPlayers->childCount() == playerCount)
+ return;
+
+ setPlayerCount(playerCount);
+
+ updateMiniMap();
+ updateLabels();
+}
+
+void
+NewGameDlg::slotTurns()
+{
+ updateLabels();
+}
+
+void
+NewGameDlg::slotNewMap()
+{
+ updateMiniMap();
+ updateLabels();
+}
+
+int
+NewGameDlg::turns()
+{
+ return w->sliderTurns->value();
+}
+
+void
+NewGameDlg::updateLabels()
+{
+ w->labelPlayers->setText(i18n("Number of &players: %1").arg(w->sliderPlayers->value()));
+ w->labelPlanets->setText(i18n("Number of neutral p&lanets: %1").arg(w->sliderPlanets->value()));
+ w->labelTurns->setText(i18n("Number of &turns: %1").arg(w->sliderTurns->value()));
+}
+
+void
+NewGameDlg::slotOk()
+{
+ bool hasHumans = false;
+ for( QListViewItem *item = w->listPlayers->firstChild();
+ item; item = item->nextSibling() )
+ {
+ bool ai = (item->text(2) == "A");
+ if (!ai)
+ hasHumans = true;
+ }
+
+ if (!hasHumans)
+ {
+ KMessageBox::information(this, i18n("The game is much more fun when you add a human player!"));
+ w->newPlayer->setFocus();
+ return;
+ }
+ KDialogBase::slotOk();
+}
+
+void
+NewGameDlg::save()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Game");
+
+ config->writeEntry("NrOfPlayers", w->sliderPlayers->value());
+ config->writeEntry("NrOfPlanets", w->sliderPlanets->value());
+ config->writeEntry("NrOfTurns", w->sliderTurns->value());
+
+ int plrNum = 0;
+ for( QListViewItem *item = w->listPlayers->firstChild();
+ item; item = item->nextSibling() )
+ {
+ QString key = QString("Player_%1").arg(plrNum);
+ QString playerName = item->text(0);
+ bool ai = (item->text(2) == "A");
+ if (ai)
+ {
+ if (config->hasKey(key))
+ config->deleteEntry(key);
+ }
+ else
+ {
+ config->writeEntry(key, playerName);
+ }
+ plrNum++;
+ }
+ config->sync();
+}
+
+void
+NewGameDlg::updateMiniMap()
+{
+ // Clear map,, player and planet lists
+ map->clearMap();
+
+ Planet *planet;
+ planet = plnetList->first();
+ for( planet = plnetList->take(); planet != 0; planet = plnetList->take() ) {
+ delete planet;
+ }
+
+ Player *player;
+ player = plrList->first();
+ for( player = plrList->take(); player != 0; player = plrList->take() ) {
+ delete player;
+ }
+
+ // Make player list
+ // Does the name already exist in the list
+ int plrNum = 0;
+ for( QListViewItem *item = w->listPlayers->firstChild();
+ item; item = item->nextSibling() )
+ {
+ QString playerName = item->text(0);
+ bool ai = (item->text(2) == "A");
+ QColor color(item->text(3));
+ plrList->append( Player::createPlayer( playerName, color, plrNum, ai ));
+ plrNum++;
+ }
+
+ // make the planets
+ map->populateMap( *plrList, neutral,
+ w->sliderPlanets->value(),
+ *plnetList );
+}
+
diff --git a/konquest/newgamedlg.h b/konquest/newgamedlg.h
new file mode 100644
index 00000000..ed2d48d6
--- /dev/null
+++ b/konquest/newgamedlg.h
@@ -0,0 +1,51 @@
+#ifndef _NEWGAMEDLG_H_
+#define _NEWGAMEDLG_H_
+
+#include <kdialogbase.h>
+
+#include "gamecore.h"
+#include "minimap.h"
+
+class NewGameDlgUI;
+
+/*************************************************************************
+ New Game Dialog
+ ************************************************************************/
+
+class NewGameDlg : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ NewGameDlg( QWidget *parent, Map *map, PlayerList *playerList,
+ Player *neutralPlayer, PlanetList *planetList );
+
+ int turns( void );
+
+ void save();
+
+protected slots:
+ void slotPlayerCount(int playerCount);
+ void slotNewMap();
+ void slotTurns();
+ void slotNewPlayer();
+ void slotAddPlayer();
+ void slotDefault();
+ void slotOk();
+
+private:
+ void init();
+ void updateMiniMap();
+ void updateLabels();
+ void setPlayerCount(int playerCount);
+
+private:
+ PlayerList *plrList;
+ PlanetList *plnetList;
+ Player *neutral;
+ Map *map;
+
+ NewGameDlgUI *w;
+};
+
+#endif
diff --git a/konquest/pics/Makefile.am b/konquest/pics/Makefile.am
new file mode 100644
index 00000000..6c702a0e
--- /dev/null
+++ b/konquest/pics/Makefile.am
@@ -0,0 +1,7 @@
+
+# add here all files
+pics_DATA = konquest-splash.png planet1.xpm planet2.xpm planet3.xpm planet4.xpm \
+ planet5.xpm planet6.xpm planet7.xpm planet8.xpm planet9.xpm ruler.xpm
+
+picsdir = $(kde_datadir)/konquest/pics
+
diff --git a/konquest/pics/konquest-splash.png b/konquest/pics/konquest-splash.png
new file mode 100644
index 00000000..6640b1a4
--- /dev/null
+++ b/konquest/pics/konquest-splash.png
Binary files differ
diff --git a/konquest/pics/planet1.xpm b/konquest/pics/planet1.xpm
new file mode 100644
index 00000000..fc867ba3
--- /dev/null
+++ b/konquest/pics/planet1.xpm
@@ -0,0 +1,228 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 201 2",
+/* colors */
+" c #12222C",
+" . c #121A2C",
+" X c #96B2B4",
+" o c #5E6E5C",
+" O c #0A1E24",
+" + c #161A1C",
+" @ c #5E665C",
+" # c #0A1A24",
+" $ c #16161C",
+" % c #0A1624",
+" & c #A6AA9C",
+" * c #8EA6AC",
+" = c #3E6664",
+" - c #4A625C",
+" ; c #0E0E14",
+" : c #AAA28C",
+" > c #425E54",
+" , c #7E969C",
+" < c #3A524C",
+" 1 c #2E5254",
+" 2 c #9A927C",
+" 3 c #324E44",
+" 4 c #BEDAD4",
+" 5 c #324A44",
+" 6 c #264A4C",
+" 7 c #324644",
+" 8 c #7A8E84",
+" 9 c #C2D2C4",
+" 0 c #1E3E44",
+" q c #8A866C",
+" w c #7E8274",
+" e c #BACABC",
+" r c #AECAC4",
+" t c #AEC6C4",
+" y c #BAC2BC",
+" u c #16363C",
+" i c #5E827C",
+" p c #222E34",
+" a c #62766C",
+" s c #0E2A34",
+" d c #6E7264",
+" f c #426E74",
+" g c #121E24",
+" h c #121A24",
+" j c #52665C",
+" k c #466664",
+" l c #0A161C",
+" z c #0A121C",
+" x c #9AAA9C",
+" c c #0A0E1C",
+" v c #9AA69C",
+" b c #92A294",
+" n c #9E9E8C",
+" m c #42564C",
+" M c #365654",
+" N c #2A565C",
+" B c #365254",
+" V c #729E9C",
+" C c #8A968C",
+" Z c #2E524C",
+" A c #DEDAC4",
+" S c #D2DACC",
+" D c #829284",
+" F c #1A464C",
+" G c #32423C",
+" H c #BECECC",
+" J c #868A74",
+" K c #2A3E34",
+" L c #C2CABC",
+" P c #B6CAC4",
+" I c #2A3A34",
+" U c #C2C6BC",
+" Y c #1E3A3C",
+" T c #1E363C",
+" R c #BAC2B4",
+" E c #22322C",
+" W c #BABEB4",
+" Q c #A2BEC4",
+" ! c #162E34",
+" ~ c #467A84",
+" ^ c #B2B6AC",
+" / c #3E767C",
+" ( c #627264",
+" ) c #1A2224",
+" _ c #0E222C",
+" ` c #92BAB4",
+" ' c #1A1E24",
+" ] c #0E1E2C",
+" [ c #5A6A5C",
+" { c #12161C",
+" } c #12121C",
+" | c #061224",
+". c #526254",
+".. c #DEEEE4",
+".X c #3A6264",
+".o c #0A0E14",
+".O c #82A6A4",
+".+ c #0A0A14",
+".@ c #0A0614",
+".# c #325A5C",
+".$ c #32565C",
+".% c #9E9A84",
+".& c #929A8C",
+".* c #869A94",
+".= c #3E4A54",
+".- c #2A5254",
+".; c #3A4A3C",
+".: c #D2D6C4",
+".> c #2E4A44",
+"., c #2E4644",
+".< c #2E4244",
+".1 c #22424C",
+".2 c #26423C",
+".3 c #BECEC4",
+".4 c #1A4244",
+".5 c #1A3E44",
+".6 c #263A3C",
+".7 c #6E867C",
+".8 c #56828C",
+".9 c #1E2E34",
+".0 c #5A727C",
+".q c #162A2C",
+".w c #46767C",
+".e c #566664",
+".r c #0E1624",
+".t c #AAAE9C",
+".y c #566264",
+".u c #0E1224",
+".i c #426664",
+".p c #2E6264",
+".a c #9A9E8C",
+".s c #325654",
+".d c #D6DED4",
+".f c #869E8C",
+".g c #325254",
+".h c #3E4E4C",
+".j c #26465C",
+".k c #7A8E94",
+".l c #2A4A4C",
+".z c #2A464C",
+".x c #669294",
+".c c #728E8C",
+".v c #D2D2BC",
+".b c #224644",
+".n c #D2CEBC",
+".m c #224244",
+".M c #16424C",
+".N c #5E828C",
+".B c #BEC6BC",
+".V c #1A3A3C",
+".C c #6E8274",
+".Z c #1A363C",
+".A c #0E3644",
+".S c #1A323C",
+".D c #C2C2AC",
+".F c #123234",
+".G c #122E34",
+".H c #66766C",
+".J c #122A34",
+".K c #5E7664",
+".L c #A2B6B4",
+".P c #5E7264",
+".I c #467274",
+".U c #0A222C",
+".Y c #6A6A5C",
+".T c #0A1E2C",
+".R c #161A24",
+".E c #A6AEA4",
+".W c #3E6A6C",
+".Q c #4A6664",
+".! c #0E161C",
+".~ c #0E121C",
+".^ c #0E0E1C",
+"./ c #AAA694",
+".( c #9EA69C",
+".) c #0E0A1C",
+"._ c #E6EADC",
+".` c #7EA6A4",
+".' c #96A294",
+".] c #42565C",
+".[ c #7EA2A4",
+".{ c #060614",
+".} c #3A5E54",
+".| c #D2EADC",
+"X c #2E5A5C",
+"X. c #3A5654",
+"XX c #2E565C",
+"Xo c #32524C",
+"XO c #C2DACC",
+"X+ c #CED6C4",
+"X@ c #1E424C",
+"X# c #728A84",
+"X$ c #668A8C",
+"X% c #2E3A34",
+"X& c #B2C6BC",
+"X* c #1A3234",
+"X= c #6E7A6C",
+"X- c #6E766C",
+"X; c #B6BAAC",
+"X: c #AABAB4",
+"X> c #9EBABC",
+/* pixels */
+" ).R {.~.~.^.^.^.^.).o.+.+ c ; ;.o ;.~ +",
+" '.~.^.^.+.o c.+.+ %.r c.).+.+.+.).+ ; }",
+" +.~ c.^.^ ..0 *X> Q X.[.N B ..+.+.+.o }",
+" +.~.^.^.e HX+ yX&.L.c.W = f ~.j c.+.).~",
+" }.o.u ,.B.E x C.tX& i.XX N.I.8 f z ;.~",
+" {.^.k W./ C bX: eX+ H t.` XX>.x.p.A.+ }",
+" }.] U.(.t L.n._.:.B.3.d.. r.x.4.A.M.T.~",
+" +X: 9X;.a n & J q.D A S.3.. 4 V / F.5.^",
+".=.v AX; w ( o aX#.B P.f C R S.| ` f.p g",
+".y n & : 8.& v ^.a w DX=.H D.' vXO.O.w.S",
+".yX- @. 2.%.% @ I E E.q K.K.C.>.C.*X$ ",
+".y [.;X%X% d m.q g.r.! l ] I o.}.2 ZXo h",
+".h. G.9.q.Y < _.q # # # O.G 7.7.i 6.5.~",
+" p > K.9X* w., ! O O.U.U.FX* T >.W.G ;",
+" { - 5.6 T.H TX* !.S s.F u u.V 0.bX | ;",
+" } p j.,.h [.ZX* T.V.S.Z.m 3.#.l.V.U.+ c",
+" $.o.h.P -.H < 3 5 M MX. -.#XXX@.U.{.@ ;",
+" h.^.+.< k.Q M.g.sX..gXX 1 6 Y _.{.{.@.^",
+" $ ;.+.@ g.1XX.$.#.-.z.b.4 s |.@.{.{.{ ;",
+" + c.+.@.@.@ c ].J.J.U %.+.{.{.{.@.+.o.^"
+};
diff --git a/konquest/pics/planet2.xpm b/konquest/pics/planet2.xpm
new file mode 100644
index 00000000..f77d9ddb
--- /dev/null
+++ b/konquest/pics/planet2.xpm
@@ -0,0 +1,190 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 163 2",
+/* colors */
+" c #3E161C",
+" . c #CEAE9C",
+" X c #7A5A64",
+" o c #EAAE7C",
+" O c #7A5664",
+" + c #361214",
+" @ c #360E14",
+" # c #F6EEE4",
+" $ c #72525C",
+" % c #2E0E0C",
+" & c #724E5C",
+" * c #A292AC",
+" = c #EEE6DC",
+" - c #FEEEC4",
+" ; c #F2EACC",
+" : c #AA968C",
+" > c #C2927C",
+" , c #E6DED4",
+" < c #FADEAC",
+" 1 c #A28684",
+" 2 c #DECECC",
+" 3 c #A27E84",
+" 4 c #F2CEA4",
+" 5 c #8E7684",
+" 6 c #927674",
+" 7 c #927274",
+" 8 c #DABEB4",
+" 9 c #CEBEBC",
+" 0 c #766694",
+" q c #DEC6A4",
+" w c #D2C2AC",
+" e c #A26E5C",
+" r c #D2BAAC",
+" t c #DEB6A4",
+" y c #8A6A6C",
+" u c #7E5E74",
+" i c #CAB2A4",
+" p c #FAFAF4",
+" a c #DAB28C",
+" s c #765A6C",
+" d c #B6A6A4",
+" f c #C2A29C",
+" g c #360E0C",
+" h c #6E4E64",
+" j c #F6EEDC",
+" k c #664A5C",
+" l c #D69A74",
+" z c #66425C",
+" x c #B29A8C",
+" c c #6A4A4C",
+" v c #5E4654",
+" b c #A69294",
+" n c #5E3A54",
+" m c #9E828C",
+" M c #56324C",
+" N c #927E94",
+" B c #5A3A3C",
+" V c #967E84",
+" C c #DECAC4",
+" Z c #D2CACC",
+" A c #4E2A44",
+" S c #8A768C",
+" D c #523234",
+" F c #522A34",
+" G c #4A222C",
+" H c #CEBAB4",
+" J c #DEBE9C",
+" K c #866674",
+" L c #96625C",
+" P c #7E626C",
+" I c #3A1A1C",
+" U c #CAB29C",
+" Y c #CAAE9C",
+" T c #3A121C",
+" R c #320E14",
+" E c #CEA68C",
+" W c #B6A29C",
+" Q c #F2EAE4",
+" ! c #AA9AA4",
+" ~ c #D2967C",
+" ^ c #664A54",
+" / c #AE9694",
+" ( c #664654",
+" ) c #663E54",
+" _ c #EEE2CC",
+" ` c #9E8284",
+" ' c #F6D6AC",
+" ] c #DECEBC",
+" [ c #967A7C",
+" { c #D2C6C4",
+" } c #C6BACC",
+" | c #A67264",
+". c #8E7274",
+".. c #CABEBC",
+".X c #8E6E74",
+".o c #BEB6C4",
+".O c #4A2224",
+".+ c #4A1E24",
+".@ c #86666C",
+".# c #C2B2B4",
+".$ c #FEFEFC",
+".% c #86626C",
+".& c #7A5E74",
+".* c #C6B2A4",
+".= c #7E5E64",
+".- c #3A1214",
+".; c #FAF6E4",
+".: c #765A5C",
+".> c #BEA69C",
+"., c #825254",
+".< c #BE9E9C",
+".1 c #320E0C",
+".2 c #6A4E64",
+".3 c #320A0C",
+".4 c #6A4A64",
+".5 c #E69E74",
+".6 c #6A4664",
+".7 c #B69E94",
+".8 c #B69A94",
+".9 c #6E4A54",
+".0 c #E6DEE4",
+".q c #664A4C",
+".w c #EAE2D4",
+".e c #EEDEC4",
+".r c #B28E7C",
+".t c #A68A84",
+".y c #A68684",
+".u c #E2D2CC",
+".i c #D6CED4",
+".p c #9E7A7C",
+".a c #EACAAC",
+".s c #DECAB4",
+".d c #967674",
+".f c #D2C2BC",
+".g c #D2BEBC",
+".h c #CABAB4",
+".j c #8E666C",
+".k c #CEB6A4",
+".l c #E6B294",
+".z c #866264",
+".x c #C2AAAC",
+".c c #B6AAB4",
+".v c #DEAE8C",
+".b c #F6F2EC",
+".n c #725664",
+".m c #725264",
+".M c #6A465C",
+".N c #AA9294",
+".B c #624254",
+".V c #BA927C",
+".C c #664244",
+".Z c #AE8E84",
+".A c #968694",
+".S c #5A364C",
+".D c #E2D6C4",
+".F c #D6CECC",
+".G c #927A7C",
+".H c #DAC6BC",
+".J c #4A263C",
+".K c #FACE8C",
+".L c #4E222C",
+".P c #D6C2A4",
+".I c #BEAEB4",
+/* pixels */
+".1.3.1.1.1.1.1.1.1.1.1.1.1.1 g g g g g @",
+".3.1.3.3.3.1.1.q.j.d 7.C.-.3.3.3.3.3.3.3",
+".3 % % %.3.: Z ; t.l 4.a Y ( R R @ @ @ @",
+" %.3.3 @.Z - <.K l > E.j.& u.= @ R.3 @.3",
+" % %.1 ` ' a | L.V.v ~ (.m.2.k c R.3 @ @",
+".3.3.S r f Y.* / q J X [ :.h m K.L R.3 R",
+" % % N :.#.u _ w = ].7.N.m.@.t 1.9 R.3 @",
+".3 I.o S 6 x.P _ _ U.7 1.B.B.@.<.d T R.1",
+".3.C.c.I b V a 4 Y.z., y X.S z.@.p.O.3 @",
+" % v *.# 5 H.5 o e.9.S A n h ( z.m F R R",
+" % ^ 0.G s.B.N '.r O M.J A.n.G ).4 F.3 R",
+" % B } N...h.@.. #.w 9 $.= X P k & G R g",
+" % I.0 !.# / $ i W.$.b. .< Y. b.6 +.3 @",
+" g.1.A Z.x.f d , p.e.>.X 1.F.D r ) @ R.1",
+".3.3 D.w {.g #.D j.s ..8.y & 3 O.+ R.3 @",
+".1 R.3 P.# 2.f = Q.w =.H Y 8.<.M.3.3 @.3",
+".3.1 R @ m.;.$.$.$.$.$ p.; C.% + @.3 @ @",
+".1.3.3 @ @ $.i.$.$.$.$ p.u O @.3.3 @.3.3",
+".3.1.1.1.1.3 @ ^ V b V.9 R @ @.3 @ @ @",
+" %.3.3.3.3 R.1.1 %.3.3 % %.3.3.3 @.3.3 g"
+};
diff --git a/konquest/pics/planet3.xpm b/konquest/pics/planet3.xpm
new file mode 100644
index 00000000..6375bfd1
--- /dev/null
+++ b/konquest/pics/planet3.xpm
@@ -0,0 +1,133 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 106 2",
+/* colors */
+" c #BA6A2C",
+" . c #EAB27C",
+" X c #8E623C",
+" o c #76624C",
+" O c #825644",
+" + c #120604",
+" @ c #D29664",
+" # c #5E3A34",
+" $ c #DA8A44",
+" % c #CE8A4C",
+" & c #B6865C",
+" * c #9E866C",
+" = c #D2823C",
+" - c #BA824C",
+" ; c #CA7A34",
+" : c #BE7A3C",
+" > c #CA7634",
+" , c #BE763C",
+" < c #B27644",
+" 1 c #3A2A24",
+" 2 c #C2722C",
+" 3 c #926E4C",
+" 4 c #AE6A2C",
+" 5 c #BA6624",
+" 6 c #7E664C",
+" 7 c #2A1A14",
+" 8 c #B2661C",
+" 9 c #965A3C",
+" 0 c #8E6234",
+" q c #7E564C",
+" w c #82623C",
+" e c #EEA664",
+" r c #E69A5C",
+" t c #DA9A64",
+" y c #CE9A6C",
+" u c #060204",
+" i c #DE9254",
+" p c #C68E64",
+" a c #CA8A54",
+" s c #763E1C",
+" d c #B28A64",
+" f c #4A3E2C",
+" g c #4A3A2C",
+" h c #C67E3C",
+" j c #423224",
+" k c #BA7644",
+" l c #9A6E4C",
+" z c #3A221C",
+" x c #B66E2C",
+" c c #EAA66C",
+" v c #965634",
+" b c #765A3C",
+" n c #6A5A44",
+" m c #CAA274",
+" M c #E29E64",
+" N c #924E1C",
+" B c #C29A6C",
+" V c #CE9664",
+" C c #DE8E4C",
+" Z c #CE823C",
+" A c #B67E4C",
+" S c #9E765C",
+" D c #8A725C",
+" F c #BE722C",
+" G c #9A6E44",
+" H c #F2AE6C",
+" J c #32120C",
+" K c #1E160C",
+" L c #1E120C",
+" P c #1E0E0C",
+" I c #DEA26C",
+" U c #725644",
+" Y c #C69E7C",
+" T c #160A04",
+" R c #E2965C",
+" E c #BE9674",
+" W c #6A463C",
+" Q c #020204",
+" ! c #C29264",
+" ~ c #663E24",
+" ^ c #7E3A14",
+" / c #AE8664",
+" ( c #D6863C",
+" ) c #CA8244",
+" _ c #6A3214",
+" ` c #C27E3C",
+" ' c #4A321C",
+" ] c #C27A3C",
+" [ c #92765C",
+" { c #BA7634",
+" } c #C6722C",
+" | c #AE723C",
+". c #BE6E24",
+".. c #8E6A44",
+".X c #EEB274",
+".o c #E6A66C",
+".O c #DAA674",
+".+ c #120E0C",
+".@ c #C69A74",
+".# c #0A0204",
+".$ c #62422C",
+".% c #D28244",
+".& c #C6824C",
+".* c #CA7E3C",
+".= c #AA7644",
+".- c #86725C",
+/* pixels */
+" Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q",
+" Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q",
+" Q Q Q Q Q Q Q Q Q 7 W O q # T Q Q Q Q Q",
+" Q Q Q Q Q Q Q P X y @ @ @ t k s.# Q Q Q",
+" Q Q Q Q Q Q L S p t $ ) ) F 8 N + Q Q",
+" Q Q Q Q Q Q U Y.O ! % ` ]. . ) 5 ^ Q Q",
+" Q Q Q Q Q L *.@ ! A : { , 2 > Z ; 5 J Q",
+" Q Q Q Q Q 1 * d & - : ].* Z = } ; > _ Q",
+" Q Q Q Q Q z [ l G A.& ` h R $ >.% R v Q",
+" Q Q Q Q Q 7 6.. 0 | | 4 4 % ( = C H 9 Q",
+" Q Q Q Q Q +.$ w X.= < x ,.* = $ r i ~ Q",
+" Q Q Q Q Q Q z b 3 & & !.o c e M t.& + Q",
+" Q Q Q Q Q Q u g D / V I ..X c I a ' Q Q",
+" Q Q Q Q Q Q Q.# g.- / E Y m B d j Q Q Q",
+" Q Q Q Q Q Q Q Q Q K g n o n f.+ Q Q Q Q",
+" Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q",
+" Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q",
+" Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q",
+" Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q",
+" Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q"
+};
diff --git a/konquest/pics/planet4.xpm b/konquest/pics/planet4.xpm
new file mode 100644
index 00000000..5d34f2df
--- /dev/null
+++ b/konquest/pics/planet4.xpm
@@ -0,0 +1,122 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 95 2",
+/* colors */
+" c #2A221C",
+" . c #7E5E54",
+" X c #221A14",
+" o c #765A4C",
+" O c #1A120C",
+" + c #6E5644",
+" @ c #6E5244",
+" # c #E2AA4C",
+" $ c #D6A654",
+" % c #664E3C",
+" & c #D6A254",
+" * c #CE9E4C",
+" = c #BE9264",
+" - c #CE9A4C",
+" ; c #B68E5C",
+" : c #4A3A34",
+" > c #AA8264",
+" , c #42362C",
+" < c #A27A5C",
+" 1 c #9A7654",
+" 2 c #3A2A24",
+" 3 c #32261C",
+" 4 c #866A54",
+" 5 c #866654",
+" 6 c #2A2214",
+" 7 c #8A6A44",
+" 8 c #8A6644",
+" 9 c #7E624C",
+" 0 c #F2B654",
+" q c #765A44",
+" w c #0E0A0C",
+" e c #624E44",
+" r c #060604",
+" t c #C69A64",
+" y c #060204",
+" u c #D6A24C",
+" i c #5A463C",
+" p c #CA9A54",
+" a c #BA8E44",
+" s c #A27E54",
+" d c #8E6E54",
+" f c #866A4C",
+" g c #261E1C",
+" h c #FABE54",
+" j c #7E6244",
+" k c #725A4C",
+" l c #16120C",
+" z c #6A5644",
+" x c #DEA64C",
+" c c #624E3C",
+" v c #D2A254",
+" b c #624A3C",
+" n c #BE9254",
+" m c #B2865C",
+" M c #B68A4C",
+" N c #AA8254",
+" B c #A27A4C",
+" V c #362A24",
+" C c #8A6E5C",
+" Z c #2E261C",
+" A c #261E14",
+" S c #866644",
+" D c #7A624C",
+" F c #7A5E4C",
+" G c #725644",
+" H c #E6AE4C",
+" J c #D69E64",
+" K c #DAAA54",
+" L c #DAA654",
+" P c #020204",
+" I c #D29E4C",
+" U c #C69654",
+" Y c #4E3E34",
+" T c #B28654",
+" R c #463A2C",
+" E c #A6825C",
+" W c #9E7A54",
+" Q c #3E2E24",
+" ! c #8A6A54",
+" ~ c #8E6A44",
+" ^ c #F6BA54",
+" / c #1A1614",
+" ( c #120E0C",
+" ) c #665244",
+" _ c #D6A25C",
+" ` c #0A0A04",
+" ' c #0A0604",
+" ] c #5E4A3C",
+" [ c #564234",
+" { c #B68A64",
+" } c #C6924C",
+" | c #BA8E54",
+". c #BE8E44",
+".. c #927254",
+".X c #322624",
+/* pixels */
+" P P y P P P P P P P P P P P P P P y ' P",
+" P y P y y y y y y y y y y y y y 3 c k l",
+" P r r r r P r r r r r P r r / b 4 . ] r",
+" P P P P P r P P P w ( ` P / . F 5 9 3 y",
+" P P P y P r r l R q 9 @ 3 l Q A 9 [ r P",
+" P y y r y y l ) 1 N T B j 2 y , o ( P r",
+" P r P r r r e < | U } M N S F X y P y",
+" P P P P P V W n _ u * } - ~ G 3 r r y r",
+" P P y y y ) ; $ K L I #. j b P P P P P",
+" P r P r r.. p & x u 0 u 8 < i r y r y r",
+" P r P P r 1 p v # h # 7 T m : r P r P y",
+" P P P P O.. | L ^ u 7 { U > 3 P P P y r",
+" P y r ( + 5 p H a f | J = ! ` y y r P P",
+" P r r ] Y Z M f ! | J t E.X y r r P P r",
+" P y , F / w [ d { t = s , r P P P y P y",
+" P X D % : k c Q D C z g r P y P y r P r",
+" r [ d ! 9 , r P P y r y y P r r P r P P",
+" X z D ] X y r y y r y r r r r P P P P r",
+" / : 6 r P P P r P P P P P P y y y P P P",
+" P P P P y y r P P r y P y P r r P r P r"
+};
diff --git a/konquest/pics/planet5.xpm b/konquest/pics/planet5.xpm
new file mode 100644
index 00000000..339e086e
--- /dev/null
+++ b/konquest/pics/planet5.xpm
@@ -0,0 +1,143 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 116 2",
+/* colors */
+" c #321624",
+" . c #D2AE8C",
+" X c #72625C",
+" o c #D2AA8C",
+" O c #2A121C",
+" + c #2A0E1C",
+" @ c #6A5A54",
+" # c #CAA284",
+" $ c #220A14",
+" % c #6A5654",
+" & c #220614",
+" * c #62524C",
+" = c #1A020C",
+" - c #120204",
+" ; c #BA9274",
+" : c #FAD2AC",
+" > c #523A3C",
+" , c #B2826C",
+" < c #927E74",
+" 1 c #F2C6A4",
+" 2 c #DEC6A4",
+" 3 c #EABE9C",
+" 4 c #42222C",
+" 5 c #E2BA94",
+" 6 c #E2B694",
+" 7 c #8E6A5C",
+" 8 c #CEB694",
+" 9 c #DAB28C",
+" 0 c #32161C",
+" q c #725E54",
+" w c #C6A68C",
+" e c #725A54",
+" r c #725654",
+" t c #22060C",
+" y c #22020C",
+" u c #BE9A84",
+" i c #6A4E4C",
+" p c #1A0204",
+" a c #B6927C",
+" s c #F6DAB4",
+" d c #FACEA4",
+" f c #523634",
+" g c #FACAA4",
+" h c #462E3C",
+" j c #F2C69C",
+" k c #9E7A64",
+" l c #F2C29C",
+" z c #4A262C",
+" x c #966E5C",
+" c c #DEBA9C",
+" v c #8E6A54",
+" b c #D6B294",
+" n c #82665C",
+" m c #CEAA8C",
+" M c #6E5E5C",
+" N c #C6A684",
+" B c #C69E84",
+" V c #16020C",
+" C c #FEE2B4",
+" Z c #B69274",
+" A c #FEDEB4",
+" S c #564644",
+" D c #B68E74",
+" F c #AE866C",
+" G c #EAD2B4",
+" H c #AE826C",
+" J c #4E363C",
+" K c #4E323C",
+" L c #EECAA4",
+" P c #927264",
+" I c #765E5C",
+" U c #2E0E1C",
+" Y c #765A5C",
+" T c #C2A68C",
+" R c #260A14",
+" E c #6E5654",
+" W c #260614",
+" Q c #C69E7C",
+" ! c #1E020C",
+" ~ c #160204",
+" ^ c #A69284",
+" / c #5E4244",
+" ( c #FED6AC",
+" ) c #F2D6B4",
+" _ c #AE8264",
+" ` c #968274",
+" ' c #462E2C",
+" ] c #9A7664",
+" [ c #E2C2A4",
+" { c #9A7264",
+" } c #DABE9C",
+" | c #867264",
+". c #E6BA94",
+".. c #361A1C",
+".X c #CAAA8C",
+".o c #765E54",
+".O c #26060C",
+".+ c #C29E84",
+".@ c #26020C",
+".# c #C29A84",
+".$ c #1E0204",
+".% c #12020C",
+".& c #B28A74",
+".* c #FAD6B4",
+".= c #523E44",
+".- c #4A363C",
+".; c #AA7E6C",
+".: c #F6C69C",
+".> c #422A34",
+"., c #8E7664",
+".< c #9A725C",
+".1 c #E2BE9C",
+".2 c #8E7264",
+".3 c #E2BA9C",
+".4 c #DAB694",
+".5 c #321A24",
+/* pixels */
+".@ y y y.$.$ !.$.$.$ ! p.$ = p p p ! ! !",
+" y y.$ p.$ !.$ ! !.O p p = p = = = p p p",
+" y.$ ! ! p.$ f v.< r z y p ~ p p = = = =",
+" y !.$.$ 0 a 9 Q , n / U V = V V ~ p p.$",
+" ! ! =.. 8 l 6 # , n i...$ ~ ~ = = V V =",
+" y.$ y N g l 9.# , x r 4 & V = ~ ~ p p p",
+" !.$.o ( d l 9.# _ n e 4 t ~ V = = = V =",
+" ! y 2 :.: 3 . Q F P X z U V p ~ ~ ~ ~ ~",
+" y J C d.: 3 ..+ F P * f U V.% V V V V =",
+" ! Y ( : j. N u H x e K W V - - - ~ ~ ~",
+" ! ` A : l 5 o.+.; x E K R p - -.% - V V",
+" ! < A : 1.3 m u F 7 r.- +.% - - - V ~ ~",
+" ! % A.* L. b B ; { e K R V.% - -.% V ~",
+" ! 0 s A : 1 9 m.& k I.= &.% -.%.% ~ - V",
+" ! ! ^ C : 1.4 w D k q h & - - - - V ~ =",
+" ! =.5 G.* L c w D ] M.> & V V ~ V ~ V ~",
+" y.$.$ / ) L.1.X.&.2 @.> ~ -.% - - ~ V V",
+" ! = V ~ > } [.X Z., * V V - V V V ~ =",
+" ! ! = p V O | T D | S & ~ V ~ p ~ V ~ V",
+" ! !.$ !.$ p = $ '.- O p V ~ V V = ~ ~ ="
+};
diff --git a/konquest/pics/planet6.xpm b/konquest/pics/planet6.xpm
new file mode 100644
index 00000000..196b5ed7
--- /dev/null
+++ b/konquest/pics/planet6.xpm
@@ -0,0 +1,110 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 83 1",
+/* colors */
+" c #2E0E0C",
+". c #CE5A04",
+"X c #CE5604",
+"o c #1A0E0C",
+"O c #CE5204",
+"+ c #1A0A0C",
+"@ c #1A060C",
+"# c #06020C",
+"$ c #BA4604",
+"% c #BA3E04",
+"& c #A64A04",
+"* c #BA3A04",
+"= c #A63E04",
+"- c #A63A04",
+"; c #A63604",
+": c #923A04",
+"> c #923204",
+", c #7E2604",
+"< c #6A2E04",
+"1 c #6A2A04",
+"2 c #561A04",
+"3 c #4A1A0C",
+"4 c #36160C",
+"5 c #D65E04",
+"6 c #D65A04",
+"7 c #220A0C",
+"8 c #C24E04",
+"9 c #0E060C",
+"0 c #C24A04",
+"q c #0E020C",
+"w c #C24604",
+"e c #C24204",
+"r c #060204",
+"t c #AE4604",
+"y c #9A3E04",
+"u c #722E04",
+"i c #722204",
+"p c #4A1604",
+"a c #3E120C",
+"s c #2A0E0C",
+"d c #CA5604",
+"f c #CA5204",
+"g c #CA4E04",
+"h c #16060C",
+"j c #CA4A04",
+"k c #B64E04",
+"l c #B64604",
+"z c #B64204",
+"x c #B63A04",
+"c c #A24604",
+"v c #A24204",
+"b c #A23604",
+"n c #8E3204",
+"m c #7A2A04",
+"M c #7A2604",
+"N c #662A04",
+"B c #662204",
+"V c #5A220C",
+"C c #521A04",
+"Z c #32160C",
+"A c #D25A04",
+"S c #D25604",
+"D c #1E0A0C",
+"F c #BE4A04",
+"G c #0A020C",
+"H c #BE4204",
+"J c #AA3E04",
+"K c #AA3604",
+"L c #963A04",
+"P c #963204",
+"I c #6E2204",
+"U c #3A1A0C",
+"Y c #3A120C",
+"T c #260A0C",
+"R c #C65604",
+"E c #12060C",
+"W c #C64A04",
+"Q c #C64604",
+"! c #B24E04",
+"~ c #8A3204",
+"^ c #763204",
+"/ c #762604",
+"( c #621E04",
+/* pixels */
+"#r#r#r#r#rr#r#r#r#r#",
+"r#r#r#GhD+qr#r#r#r#r",
+"r#r#GUum/(aTqr#r#r##",
+"#rrqNLb-b>,CsGr#r#rr",
+"##rN=z%%x-P,C7Grr###",
+"rrZ=zwweHxbnIY9###rr",
+"#r^lWgjQ%*;>m3Drr##r",
+"r9y8fffWwxKP,CT##rr#",
+"r+JROOOjw*KP,2TG##r#",
+"ro&XAXOfw%;P,CTrrr#r",
+"r9cd66Sf0%;>Mp@##r##",
+"#r^R556Sgz;~ia@rr#rr",
+"rrZ!XAA.f$-~B q#r##r",
+"##rNkRd8FJ:mp+rr#rr#",
+"r#r9<vttv:m3D##r##r#",
+"#r#rr41^uVYhrrr##r#r",
+"#r#rrrrEE9r###r##r##",
+"r#r####rrrrrr##rr#rr",
+"r#rrrrr#####rr##r###",
+"#r##r##r##r####r#rrr"
+};
diff --git a/konquest/pics/planet7.xpm b/konquest/pics/planet7.xpm
new file mode 100644
index 00000000..7d7fda20
--- /dev/null
+++ b/konquest/pics/planet7.xpm
@@ -0,0 +1,122 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 95 2",
+/* colors */
+" c #765674",
+" . c #7A5264",
+" X c #BE8EB4",
+" o c #724A5C",
+" O c #B686AC",
+" + c #664664",
+" @ c #6A3E54",
+" # c #563E54",
+" $ c #563A54",
+" % c #4E3A4C",
+" & c #4E364C",
+" * c #9E7294",
+" = c #9E6E94",
+" - c #522E3C",
+" ; c #3E2A3C",
+" : c #D2A6D4",
+" > c #362234",
+" , c #CA9ECC",
+" < c #925A74",
+" 1 c #2E1E2C",
+" 2 c #1E121C",
+" 3 c #6E4A64",
+" 4 c #B28AB4",
+" 5 c #0E0A0C",
+" 6 c #C27A9C",
+" 7 c #0E060C",
+" 8 c #A27AA4",
+" 9 c #060604",
+" 0 c #060204",
+" q c #56364C",
+" w c #F6AEDC",
+" e c #E2AEDC",
+" r c #4E2E44",
+" t c #826284",
+" y c #D29ECC",
+" u c #7A5A7C",
+" i c #D696BC",
+" p c #865674",
+" a c #2E1A24",
+" s c #725A74",
+" d c #725274",
+" f c #26161C",
+" g c #BA8AB4",
+" h c #624A64",
+" j c #160A0C",
+" k c #5E3A4C",
+" l c #A27A9C",
+" z c #523A54",
+" x c #F2B6E4",
+" c c #5E364C",
+" v c #AE7294",
+" b c #E2AAD4",
+" n c #926A8C",
+" m c #462634",
+" M c #CEA2D4",
+" N c #322634",
+" B c #322234",
+" V c #825E7C",
+" C c #8E5A74",
+" Z c #2A222C",
+" A c #2A1A2C",
+" S c #CA92BC",
+" D c #1A121C",
+" F c #C682A4",
+" G c #62465C",
+" H c #0A0A0C",
+" J c #0A060C",
+" K c #EEBAEC",
+" L c #9E7AA4",
+" P c #020204",
+" I c #E6B6E4",
+" U c #F2B2DC",
+" Y c #E6B2E4",
+" T c #DEAEDC",
+" R c #4A2E44",
+" E c #EE9EC4",
+" W c #8A5E7C",
+" Q c #C696C4",
+" ! c #7A526C",
+" ~ c #BE92BC",
+" ^ c #22121C",
+" / c #7E4A5C",
+" ( c #1A0E14",
+" ) c #AE82AC",
+" _ c #120A0C",
+" ` c #56425C",
+" ' c #B27A9C",
+" ] c #0A0604",
+" [ c #AA7694",
+" { c #9E769C",
+" } c #967294",
+" | c #D6A2CC",
+". c #3A1E2C",
+".. c #DA96BC",
+".X c #8A5674",
+/* pixels */
+" P P P P P P P P P P P P ( a ( P P P P P",
+" P P P P P P P P P P 1 o / - j P P P P P",
+" P P P P P P P P 5 W v.X @ m 7 P P P P P",
+" P P P P P P P _ O.. [ p k. 5 P P P P P",
+" P P P P P P 9 l b X n 3 R ^ P P P P P P",
+" P P P P P P % M y O n + ; D P P P P P P",
+" P P P P P 9 4 : ~ 8 t G m _ P P P P P P",
+" P P P P P N T Y Q L u # B 5 P P P P P P",
+" P P P P P h K I y ) V $ 1 J P P P P P P",
+" P P P P P K e Q { z 1 9 P P P P P P",
+" P P P P P s T | g = d & f P P P P P P P",
+" P P P P P ` , , X } d & A 0 P P P P P P",
+" P P P P P Z M : X { # B J P P P P P P",
+" P P P P P 0 4 Y | O n + > ] P P P P P P",
+" P P P P P P % x U S = 3 ; _ P P P P P P",
+" P P P P P P P * w i v ! r ^ P P P P P P",
+" P P P P P P P H ' E F C q ^ P P P P P P",
+" P P P P P P P P 0 . 6 < c f P P P P P P",
+" P P P P P P P P P P 2 c @. 0 P P P P P",
+" P P P P P P P P P P P P 0 ( ] P P P P P"
+};
diff --git a/konquest/pics/planet8.xpm b/konquest/pics/planet8.xpm
new file mode 100644
index 00000000..f1fbe368
--- /dev/null
+++ b/konquest/pics/planet8.xpm
@@ -0,0 +1,189 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 162 2",
+/* colors */
+" c #362214",
+" . c #A2623C",
+" X c #8E5A3C",
+" o c #8E563C",
+" O c #825644",
+" + c #76564C",
+" @ c #1A120C",
+" # c #865234",
+" $ c #7A523C",
+" % c #7A4E3C",
+" & c #6E4E44",
+" * c #6E4A44",
+" = c #EA9E54",
+" - c #7E522C",
+" ; c #66463C",
+" : c #5A4644",
+" > c #5A4244",
+" , c #E2964C",
+" < c #523E3C",
+" 1 c #523A3C",
+" 2 c #DA8644",
+" 3 c #CE824C",
+" 4 c #3E363C",
+" 5 c #D27E3C",
+" 6 c #C67E44",
+" 7 c #C67A44",
+" 8 c #2A2A3C",
+" 9 c #BE723C",
+" 0 c #32221C",
+" q c #321E1C",
+" w c #AA663C",
+" e c #9E6244",
+" r c #92624C",
+" t c #A26234",
+" y c #965E3C",
+" u c #8A5A44",
+" i c #825A3C",
+" p c #82563C",
+" a c #82523C",
+" s c #765244",
+" d c #764E44",
+" f c #6A4E4C",
+" g c #6E4E3C",
+" h c #6E4A3C",
+" j c #624644",
+" k c #724E2C",
+" l c #D28E5C",
+" z c #5A423C",
+" x c #4E4244",
+" c c #D68A4C",
+" v c #D6864C",
+" b c #CA8654",
+" n c #523A34",
+" m c #46363C",
+" M c #CE8244",
+" N c #CE7E44",
+" B c #C27A4C",
+" V c #322E3C",
+" C c #C6763C",
+" Z c #A27254",
+" A c #A26E54",
+" S c #3A2A1C",
+" D c #BE7234",
+" F c #B26E3C",
+" G c #B26A3C",
+" H c #A66A44",
+" J c #321E14",
+" K c #9E623C",
+" L c #925E44",
+" P c #1E1614",
+" I c #8A5A3C",
+" U c #8A563C",
+" Y c #16120C",
+" T c #825234",
+" R c #764E3C",
+" E c #764A3C",
+" W c #5E4A4C",
+" Q c #E69A54",
+" ! c #6E4634",
+" ~ c #62463C",
+" ^ c #62423C",
+" / c #564244",
+" ( c #DE924C",
+" ) c #DE8E4C",
+" _ c #423A44",
+" ` c #D68644",
+" ' c #CA824C",
+" ] c #52362C",
+" [ c #3A323C",
+" { c #C67634",
+" } c #362A24",
+" | c #BA723C",
+". c #1E2634",
+".. c #A26A4C",
+".X c #966654",
+".o c #3A2614",
+".O c #9A6244",
+".+ c #925E3C",
+".@ c #865A44",
+".# c #7A564C",
+".$ c #1E120C",
+".% c #120E14",
+".& c #7E523C",
+".* c #724E44",
+".= c #6A4A3C",
+".- c #6A463C",
+".; c #5E4644",
+".: c #E6964C",
+".> c #020204",
+"., c #DA9254",
+".< c #563E3C",
+".1 c #4A3E44",
+".2 c #664224",
+".3 c #DE8A44",
+".4 c #D2864C",
+".5 c #C68254",
+".6 c #CA7E44",
+".7 c #BE7A4C",
+".8 c #2E2E3C",
+".9 c #3E2E24",
+".0 c #C2763C",
+".q c #C2723C",
+".w c #1A263C",
+".e c #9E6E54",
+".r c #BA6E34",
+".t c #AE6E3C",
+".y c #AE6A3C",
+".u c #A26A44",
+".i c #AE663C",
+".p c #A26644",
+".a c #A66634",
+".s c #9A5E3C",
+".d c #8E5E44",
+".f c #925A34",
+".g c #86563C",
+".h c #7A5244",
+".j c #6E524C",
+".k c #6E4E4C",
+".l c #7E4E34",
+".z c #724A3C",
+".x c #664A44",
+".c c #664644",
+".v c #5A464C",
+".b c #E29654",
+".n c #5E463C",
+".m c #524244",
+".M c #523E44",
+".N c #6E4224",
+".B c #DA8A4C",
+".V c #4A3A3C",
+".C c #5A3A24",
+".Z c #D28244",
+".A c #BA7E54",
+".S c #423234",
+".D c #36323C",
+".F c #CA7A3C",
+".G c #B2764C",
+".H c #B2724C",
+".J c #B66E3C",
+".K c #AA6E44",
+".L c #322224",
+".P c #9E6A4C",
+/* pixels */
+".>.>.>.>.>.>.o -.a F.a.f.N .>.>.>.>.>.>",
+".>.>.>.> J.t ).3.Z G M.B.G.y K J.>.>.>.>",
+".>.>.>.C.F.B ) , ).4., b f.n.# H.2.>.>.>",
+".>.>.C 7 v.b Q = c.4 B.e.;.D.w.V.P k.>.>",
+".> J '.4 2 (.b.b.:.Z c.A.V. .w.w & l.o.>",
+".>.p c 3 M.: Q =.b.0 B b < V. 4.m.X.G.>",
+" 0.7 3.F.4.B ) Q c ` ' g ^ 4 8 4 W W.5 S",
+" ! 9 3 N 5.Z v ) ) c.p s / [ 8.D : + A i",
+" X 6 ' 3 M.4 ) `.Z.K u z j.1.8.8 x.j...u",
+" e | N C t 7 `.6 F.d ; O.M.;.V _.1 f.H.7",
+" u.J.6.0.J.F 5 | ..&.< $.<.M >.;.v f.P.G",
+" ] X 9 {.0 C C G e e.p.@.c ; <.x : f.k R",
+".L 1 a.i {.F.q |.O p h.h.h d *.<.V / > }",
+" P R ! E w.r D.r w e a p.@.* ~.= m.< /.%",
+".> !.g T U.s.i.y.y.y L.d.@ z ~ < / ;.S.>",
+".>.$ # #.g X.+ y . I n.- a % R n ; ; @.>",
+".>.> .l T # o.f.s y I.+.+ a d R $ q.>.>",
+".>.>.> q.N E h R O u o U O.& h h 0.>.>.>",
+".>.>.>.> Y ] ;.- E $.z.h +.#.<.%.>.>.>.>",
+".>.>.>.>.>.> @.9.n r Z.e h 0.>.>.>.>.>.>"
+};
diff --git a/konquest/pics/planet9.xpm b/konquest/pics/planet9.xpm
new file mode 100644
index 00000000..a8a96c17
--- /dev/null
+++ b/konquest/pics/planet9.xpm
@@ -0,0 +1,168 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 141 2",
+/* colors */
+" c #760604",
+" . c #620604",
+" X c #4E0A04",
+" o c #4E0604",
+" O c #3A0604",
+" + c #260604",
+" @ c #E23204",
+" # c #120604",
+" $ c #E22E04",
+" % c #E21E04",
+" & c #CE2604",
+" * c #CE1604",
+" = c #CE1204",
+" - c #F2AA0C",
+" ; c #CE0A04",
+" : c #F2A20C",
+" > c #BA1204",
+" , c #BA0E04",
+" < c #F2960C",
+" 1 c #BA0A04",
+" 2 c #A60A04",
+" 3 c #F2820C",
+" 4 c #920E04",
+" 5 c #920A04",
+" 6 c #920604",
+" 7 c #7E0A04",
+" 8 c #6A0A04",
+" 9 c #6A0604",
+" 0 c #560604",
+" q c #EA5204",
+" w c #420604",
+" e c #EA4604",
+" r c #EA4204",
+" t c #EA3A04",
+" y c #EA3604",
+" u c #D63E04",
+" i c #1A0604",
+" p c #060604",
+" a c #D61A04",
+" s c #C22604",
+" d c #D60E04",
+" f c #AE1E04",
+" g c #C20E04",
+" h c #AE1A04",
+" j c #C20A04",
+" k c #AE1604",
+" l c #AE0E04",
+" z c #AE0A04",
+" x c #9A0E04",
+" c c #9A0A04",
+" v c #860A04",
+" b c #860604",
+" n c #F27204",
+" m c #720A04",
+" M c #720604",
+" N c #5E0A04",
+" B c #F25A04",
+" V c #5E0604",
+" C c #4A0604",
+" Z c #F24604",
+" A c #360604",
+" S c #DE4604",
+" D c #220604",
+" F c #0E0604",
+" G c #DE2604",
+" H c #F6BA14",
+" J c #DE1A04",
+" K c #CA1204",
+" L c #CA0E04",
+" P c #B60E04",
+" I c #8E2604",
+" U c #B60A04",
+" Y c #A20A04",
+" T c #A20604",
+" R c #8E0A04",
+" E c #8E0604",
+" W c #7A0E04",
+" Q c #7A0A04",
+" ! c #7A0604",
+" ~ c #660A04",
+" ^ c #660604",
+" / c #520A04",
+" ( c #520604",
+" ) c #3E0604",
+" _ c #2A0A04",
+" ` c #2A0604",
+" ' c #D24604",
+" ] c #160604",
+" [ c #E62A04",
+" { c #F2C21C",
+" } c #E62204",
+" | c #020604",
+". c #020204",
+".. c #D21E04",
+".X c #D21A04",
+".o c #D21604",
+".O c #BE1E04",
+".+ c #D20E04",
+".@ c #BE1604",
+".# c #BE1204",
+".$ c #BE0E04",
+".% c #BE0A04",
+".& c #AA0E04",
+".* c #AA0A04",
+".= c #AA0604",
+".- c #960A04",
+".; c #820A04",
+".: c #6E0A04",
+".> c #6E0604",
+"., c #EE6604",
+".< c #E2660C",
+".1 c #EE6204",
+".2 c #5A0A04",
+".3 c #EE5A04",
+".4 c #5A0604",
+".5 c #EE5604",
+".6 c #460A04",
+".7 c #460604",
+".8 c #EE3E04",
+".9 c #320604",
+".0 c #EE3604",
+".q c #EE3204",
+".w c #1E0604",
+".e c #0A0604",
+".r c #DA1E04",
+".t c #DA1A04",
+".y c #DA1204",
+".u c #C61604",
+".i c #F2A214",
+".p c #C61204",
+".a c #C60E04",
+".s c #C60A04",
+".d c #B21604",
+".f c #B20E04",
+".g c #B20A04",
+".h c #9E0A04",
+".j c #9E0604",
+".k c #F27614",
+".l c #8A0A04",
+".z c #8A0604",
+".x c #760E04",
+/* pixels */
+" p p p | | p p p ] ` D F p p p | | | p p",
+". . . . . _ m 5 c.-.; M o.w. . . . . . ",
+" | | p p.2 l , 5.f l.- ! w . ( + p | | |",
+". . . C v.l M R ,.p 1 v M.4 o 0 (. . . ",
+" p p.9.> O ` (.d.t a , , 5 ~ E z X p |",
+". # C ~ 0.4.2.p Y 7 / 9 2 l ..7 z i. ",
+". (.:.9.2 9.7.9 O ) w.4 D.2 8 m.w v N |",
+" i .l.4 C 0 D.7.x.; E.z V 2 x z b.; 6. ",
+" O.2 m.- ( M.6 w h.l > 1.h 4 % * * =.+ D",
+" X b c.l R.u.. f.d s.<.<.X a.q Z.q.a g O",
+" ).> Y 2 K P.* G.1 - { : r a.8 <.k G.h O",
+" `.g E.- J.r.r t 3.i - H n t 3 < H.3.@ D",
+" # , 8.6 l W P.$ = = $ q ' u.5.i., n S p",
+". Q.z.z.= N U L.s T ! & k } B.5 e [ I. ",
+" p _.4.$.* x.g 1.s b V.& y.q.t.0 @.O i. ",
+". . N g U L.% j U.* 5.$.a > J.t.#.7. p",
+" p. .e.-.a L.s d.+ ; U U.= ,.o.g 0. . . ",
+". |. .e Q.s d.y d.s 1.=.% j.j ). p. p",
+". . . . . A 5 j ; ;.%.% U ^ #. . p. |",
+" p p p p p | |.e.9 ) O +.e p. p p. p. "
+};
diff --git a/konquest/pics/ruler.xpm b/konquest/pics/ruler.xpm
new file mode 100644
index 00000000..6e60655c
--- /dev/null
+++ b/konquest/pics/ruler.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char * ruler_xpm[] = {
+"16 16 2 1",
+" c None",
+". c #000000000000",
+" ",
+"................",
+"................",
+" . . . ",
+" . . . ",
+" . . . ",
+" . . ",
+" . . ",
+" . ... ",
+" . ..... ",
+" . .. .. ",
+" . ... ",
+" ... ",
+" .. ",
+" ..... ",
+" ..... "};
diff --git a/konquest/planet_info.cc b/konquest/planet_info.cc
new file mode 100644
index 00000000..4c1d4be1
--- /dev/null
+++ b/konquest/planet_info.cc
@@ -0,0 +1,161 @@
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpalette.h>
+#include <qcolor.h>
+#include <kapplication.h>
+#include <klocale.h>
+
+#include "planet_info.h"
+#include <kglobal.h>
+#include "planet_info.moc"
+
+PlanetInfo::PlanetInfo( QWidget *parent, QPalette palette )
+ : QFrame( parent )
+{
+ setPalette( palette );
+
+ name = new QLabel( this );
+ name->setMinimumWidth( 100 );
+ owner = new QLabel( this );
+ owner->setMinimumWidth( 100 );
+ ships = new QLabel( this );
+ ships->setMinimumWidth( 100 );
+ production = new QLabel( this );
+ production->setMinimumWidth( 100 );
+ kill_percent = new QLabel( this );
+ kill_percent->setMinimumWidth( 100 );
+
+ clearDisplay();
+
+ QVBoxLayout *layout1 = new QVBoxLayout( this );
+
+ layout1->addWidget( name );
+ layout1->addWidget( owner );
+ layout1->addWidget( ships );
+ layout1->addWidget( production );
+ layout1->addWidget( kill_percent );
+ layout1->addStretch(1);
+
+ setMouseTracking( true );
+
+ setMinimumSize( sizeHint() );
+ setMaximumHeight( sizeHint().height() );
+}
+
+PlanetInfo::~PlanetInfo()
+{
+ emptyPlanetInfoList();
+}
+
+QSize PlanetInfo::sizeHint() const
+{
+ int height;
+
+ height = name->sizeHint().height() +
+ owner->sizeHint().height() +
+ ships->sizeHint().height() +
+ production->sizeHint().height()+
+ kill_percent->sizeHint().height();
+
+ return QSize( 100, height );
+}
+
+void PlanetInfo::setPlanetList( PlanetList &newPlanets )
+{
+ emptyPlanetInfoList();
+
+ PlanetListIterator itr( newPlanets );
+
+ Planet *p;
+ while( (p = itr()) ) {
+ planet_info_buffer *stats = new planet_info_buffer;
+ stats->planet = p;
+ planet_stats.append( stats );
+ }
+
+ rescanPlanets();
+}
+
+void PlanetInfo::rescanPlanets()
+{
+ PlanetInfoListIterator itr( planet_stats );
+ planet_info_buffer *p;
+
+ while( (p = itr()) ) {
+ p->production = p->planet->getProduction();
+ p->ships = p->planet->getFleet().getShipCount();
+ p->killRate = p->planet->getKillPercentage();
+ }
+}
+
+void PlanetInfo::clearDisplay()
+{
+ QString temp;
+
+ temp = "<qt>" + i18n("Planet name: ");
+ name->setText( temp );
+
+ temp = "<qt>" + i18n("Owner: ");
+ owner->setText( temp );
+
+ temp = "<qt>" + i18n("Ships: ");
+ ships->setText( temp );
+
+ temp = "<qt>" + i18n("Production: ");
+ production->setText( temp );
+
+ temp = "<qt>" + i18n("Kill percent: ");
+ kill_percent->setText( temp );
+}
+
+void PlanetInfo::emptyPlanetInfoList()
+{
+ planet_stats.first();
+
+ planet_info_buffer *p;
+ while( (p = planet_stats.take()) ) {
+ delete p;
+ }
+
+}
+
+void PlanetInfo::showPlanet( Planet *planet )
+{
+ if( planet->getPlayer()->isNeutral() ) {
+ clearDisplay();
+
+ QString temp;
+
+ temp = "<qt>" + i18n("Planet name: %1").arg(planet->getName());
+ name->setText( temp );
+ return;
+ }
+
+ QString nameToShow = planet->getName();
+
+ PlanetInfoListIterator itr( planet_stats );
+ planet_info_buffer *p;
+
+ while( (p = itr()) ) {
+ if( p->planet == planet ) {
+
+ QString temp;
+
+ temp = "<qt>" + i18n("Planet name: %1").arg(p->planet->getName());
+ name->setText( temp );
+
+ temp = "<qt>" + i18n("Owner: %1").arg(p->planet->getPlayer()->getColoredName());
+ owner->setText( temp );
+
+ temp = "<qt>" + i18n("Ships: %1").arg( KGlobal::locale()->formatNumber(p->ships, 0) );
+ ships->setText( temp );
+
+ temp = "<qt>" + i18n("Production: %1").arg( KGlobal::locale()->formatNumber(p->production, 0) );
+ production->setText( temp );
+
+ temp = "<qt>" + i18n("Kill percent: %1").arg( KGlobal::locale()->formatNumber(p->killRate, 3) );
+ kill_percent->setText( temp );
+ }
+ }
+}
+
diff --git a/konquest/planet_info.h b/konquest/planet_info.h
new file mode 100644
index 00000000..4080f6b9
--- /dev/null
+++ b/konquest/planet_info.h
@@ -0,0 +1,53 @@
+#ifndef _PLANET_INFO_H_
+#define _PLANET_INFO_H_
+
+#include <qframe.h>
+#include <qstring.h>
+#include <qptrlist.h>
+#include <qpalette.h>
+
+#include "gamecore.h"
+
+class QLabel;
+
+struct planet_info_buffer {
+ Planet *planet;
+ int production;
+ int ships;
+ float killRate;
+};
+
+typedef QPtrList<planet_info_buffer> PlanetInfoList;
+typedef QPtrListIterator<planet_info_buffer> PlanetInfoListIterator;
+
+class PlanetInfo : public QFrame
+{
+ Q_OBJECT
+
+public:
+ PlanetInfo( QWidget *parent, QPalette palette );
+ virtual ~PlanetInfo();
+
+ void setPlanetList( PlanetList &newPlanets );
+ void rescanPlanets();
+ QSize sizeHint() const;
+
+public slots:
+ void showPlanet( Planet * );
+
+private:
+ void emptyPlanetInfoList();
+ void clearDisplay();
+
+ PlanetList *planets;
+ PlanetInfoList planet_stats;
+
+ QLabel *name;
+ QLabel *owner;
+ QLabel *ships;
+ QLabel *production;
+ QLabel *kill_percent;
+};
+
+#endif // _PLANET_INFO_H_
+
diff --git a/konquest/scoredlg.cc b/konquest/scoredlg.cc
new file mode 100644
index 00000000..685ba9c5
--- /dev/null
+++ b/konquest/scoredlg.cc
@@ -0,0 +1,80 @@
+#include <qlayout.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <kpushbutton.h>
+#include <kstdguiitem.h>
+
+#include "scoredlg.h"
+
+ScoreDlgListViewItem::ScoreDlgListViewItem(QListView *parent, QString s1, QString s2, QString s3, QString s4, QString s5, QString s6) : QListViewItem(parent, s1, s2, s3, s4, s5, s6)
+{
+}
+
+int ScoreDlgListViewItem::compare(QListViewItem *i, int col, bool) const
+{
+ if (col == 0)
+ {
+ if (text(col) > i -> text(col)) return 1;
+ else if (text(col) < i -> text(col)) return -1;
+ else return 0;
+ }
+ else
+ {
+ if (text(col).toInt() > i -> text(col).toInt()) return 1;
+ else if (text(col).toInt() < i -> text(col).toInt()) return -1;
+ else return compare(i, 0, true);
+ }
+}
+
+
+ScoreDlg::ScoreDlg( QWidget *parent, const QString& title, PlayerList *players )
+ : QDialog(parent, "ScoreDlg", true ), plrList(players)
+{
+ setCaption( kapp->makeStdCaption(title) );
+
+ scoreTable = new KListView( this, 0 );
+ scoreTable->addColumn(i18n("Player"));
+ scoreTable->addColumn(i18n("Ships Built"));
+ scoreTable->addColumn(i18n("Planets Conquered"));
+ scoreTable->addColumn(i18n("Fleets Launched"));
+ scoreTable->addColumn(i18n("Fleets Destroyed"));
+ scoreTable->addColumn(i18n("Ships Destroyed"));
+ scoreTable->setMinimumSize( scoreTable->sizeHint() );
+
+ KPushButton *okButton = new KPushButton( KStdGuiItem::ok(), this );
+ okButton->setMinimumSize( okButton->sizeHint() );
+ okButton->setDefault(true);
+
+ QVBoxLayout *layout1 = new QVBoxLayout( this );
+ QHBoxLayout *layout2 = new QHBoxLayout;
+
+ layout1->addWidget( scoreTable, 1 );
+ layout1->addLayout( layout2 );
+
+ layout2->addStretch( 2 );
+ layout2->addWidget( okButton );
+ layout2->addStretch( 2 );
+
+ connect( okButton, SIGNAL(clicked()), this, SLOT(accept()) );
+
+ init();
+
+ resize( 580, 140 );
+}
+
+void
+ScoreDlg::init()
+{
+ Player *curPlayer;
+ PlayerListIterator itr( *plrList );
+
+ for( ;(curPlayer = itr()); )
+ new ScoreDlgListViewItem(scoreTable,
+ curPlayer->getName(),
+ QString("%1").arg(curPlayer->getShipsBuilt()),
+ QString("%1").arg(curPlayer->getPlanetsConquered()),
+ QString("%1").arg(curPlayer->getFleetsLaunched()),
+ QString("%1").arg(curPlayer->getEnemyFleetsDestroyed()),
+ QString("%1").arg(curPlayer->getEnemyShipsDestroyed()));
+}
+
diff --git a/konquest/scoredlg.h b/konquest/scoredlg.h
new file mode 100644
index 00000000..570a3b36
--- /dev/null
+++ b/konquest/scoredlg.h
@@ -0,0 +1,32 @@
+#ifndef _SCOREDLG_H_
+#define _SCOREDLG_H_
+
+#include <klistview.h>
+
+#include <qdialog.h>
+
+#include "gamecore.h"
+
+class ScoreDlgListViewItem : public QListViewItem
+{
+ public:
+ ScoreDlgListViewItem(QListView *parent, QString s1, QString s2, QString s3, QString s4, QString s5, QString s6);
+ int compare(QListViewItem *i, int col, bool) const;
+};
+
+class ScoreDlg : public QDialog
+{
+
+public:
+ ScoreDlg( QWidget *parent, const QString& title, PlayerList *players );
+
+private:
+ void init();
+
+ PlayerList *plrList;
+ QListView *scoreTable;
+
+};
+
+#endif // _SCOREDLG_H_
+
diff --git a/konquest/version.h b/konquest/version.h
new file mode 100644
index 00000000..df59820a
--- /dev/null
+++ b/konquest/version.h
@@ -0,0 +1,4 @@
+#ifndef KONQUEST_VERSION
+#define KONQUEST_VERSION "1.1"
+#endif
+