# HG changeset patch # User smaxx # Date 1284806158 -7200 # Node ID 3dd031a8b395c56d7f4ded13d87a467ed8b2a3f3 # Parent 7d7c16ed5056f51a0eb84e96bc5eb766a2dc664f Frontend: * Changed team color handling to use red as first color and make it easier to add more colors in the future diff -r 7d7c16ed5056 -r 3dd031a8b395 QTfrontend/frameTeam.cpp --- a/QTfrontend/frameTeam.cpp Sat Sep 18 01:50:29 2010 +0200 +++ b/QTfrontend/frameTeam.cpp Sat Sep 18 12:35:58 2010 +0200 @@ -35,12 +35,9 @@ mainLayout.setSpacing(1); mainLayout.setContentsMargins(4, 4, 4, 4); - availableColors.push_back(*color1); - availableColors.push_back(*color2); - availableColors.push_back(*color3); - availableColors.push_back(*color4); - availableColors.push_back(*color5); - availableColors.push_back(*color6); + int i = 0; + while(colors[i]) + availableColors.push_back(*colors[i++]); resetColors(); } @@ -57,7 +54,7 @@ void FrameTeams::resetColors() { - currentColor=availableColors.begin(); + currentColor=availableColors.end() - 1; // ensure next color is the first one } QColor FrameTeams::getNextColor() const diff -r 7d7c16ed5056 -r 3dd031a8b395 QTfrontend/game.cpp --- a/QTfrontend/game.cpp Sat Sep 18 01:50:29 2010 +0200 +++ b/QTfrontend/game.cpp Sat Sep 18 12:35:58 2010 +0200 @@ -115,7 +115,7 @@ HWTeam * team1; team1 = new HWTeam; team1->difficulty = 0; - team1->teamColor = *color1; + team1->teamColor = *colors[0]; team1->numHedgehogs = 4; namegen.TeamRandomNames(team1,TRUE); HWProto::addStringListToBuffer(teamscfg, @@ -124,7 +124,7 @@ HWTeam * team2; team2 = new HWTeam; team2->difficulty = 4; - team2->teamColor = *color2; + team2->teamColor = *colors[1]; team2->numHedgehogs = 4; do namegen.TeamRandomNames(team2,TRUE); diff -r 7d7c16ed5056 -r 3dd031a8b395 QTfrontend/hwconsts.cpp.in --- a/QTfrontend/hwconsts.cpp.in Sat Sep 18 01:50:29 2010 +0200 +++ b/QTfrontend/hwconsts.cpp.in Sat Sep 18 12:35:58 2010 +0200 @@ -70,12 +70,17 @@ "111111111111111111111111111111111111111111110111")) ; -QColor * color1 = new QColor(221, 0, 0); -QColor * color2 = new QColor( 67, 118, 233); -QColor * color3 = new QColor( 62, 147, 33); -QColor * color4 = new QColor(162, 61, 187); -QColor * color5 = new QColor(255, 147, 41); -QColor * color6 = new QColor(115, 115, 115); +QColor *colors[] = { + new QColor(221, 0, 0), // classic red + new QColor( 67, 118, 233), // classic blue + new QColor( 62, 147, 33), // classic green + new QColor(162, 61, 187), // classic purple + new QColor(255, 147, 41), // classic orange + new QColor(115, 115, 115), // classic gray + new QColor(187, 162, 61), // gold + new QColor( 61, 162, 187), // cyan + // add new colors here + 0}; QString * netHost = new QString(); quint16 netPort = 46631; diff -r 7d7c16ed5056 -r 3dd031a8b395 QTfrontend/hwconsts.h --- a/QTfrontend/hwconsts.h Sat Sep 18 01:50:29 2010 +0200 +++ b/QTfrontend/hwconsts.h Sat Sep 18 12:35:58 2010 +0200 @@ -40,12 +40,7 @@ extern int cAmmoNumber; extern QList< QPair > cDefaultAmmos; -extern QColor * color1; -extern QColor * color2; -extern QColor * color3; -extern QColor * color4; -extern QColor * color5; -extern QColor * color6; +extern QColor *colors[]; extern QString * netHost; extern quint16 netPort;