Proto change: set color in addteam command
authorunc0rr
Mon, 02 Jul 2007 18:35:31 +0000
changeset 546 0e7cc3fb05cd
parent 545 f527450337c1
child 547 b81a055f2d06
Proto change: set color in addteam command
CMakeLists.txt
QTfrontend/team.cpp
hedgewars/CCHandlers.inc
hedgewars/uConsole.pas
--- a/CMakeLists.txt	Mon Jul 02 16:21:07 2007 +0000
+++ b/CMakeLists.txt	Mon Jul 02 18:35:31 2007 +0000
@@ -9,7 +9,7 @@
 endif(DEFINED DATA_INSTALL_DIR)
 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
 
-set(HEDGEWARS_PROTO_VER 5)
+set(HEDGEWARS_PROTO_VER 6)
 
 add_subdirectory(bin)
 add_subdirectory(QTfrontend)
--- a/QTfrontend/team.cpp	Mon Jul 02 16:21:07 2007 +0000
+++ b/QTfrontend/team.cpp	Mon Jul 02 18:35:31 2007 +0000
@@ -212,10 +212,9 @@
 QStringList HWTeam::TeamGameConfig(quint32 InitHealth) const
 {
 	QStringList sl;
-	sl.push_back("eaddteam");
+	sl.push_back(QString("eaddteam %1").arg(teamColor.rgb() & 0xffffff));
 	if (m_netID)
 		sl.push_back("erdriven");
-	sl.push_back(QString("ecolor %1").arg(teamColor.rgb() & 0xffffff));
 	sl.push_back("ename team " + TeamName);
 
 	for (int i = 0; i < numHedgehogs; i++)
--- a/hedgewars/CCHandlers.inc	Mon Jul 02 16:21:07 2007 +0000
+++ b/hedgewars/CCHandlers.inc	Mon Jul 02 18:35:31 2007 +0000
@@ -54,11 +54,16 @@
    begin
    inc(TeamsCount);
    ParseCommand('ammstore 93919294221912103323', true);
-   TryDo(TeamsCount <= 5, 'Too many teams', true);
-   AddTeam
-   end;
+   TryDo(TeamsCount <= 6, 'Too many teams', true);
+   AddTeam;
+
 
-if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true
+   if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true;
+   val(s, CurrentTeam^.Color);
+   TryDo(CurrentTeam^.Color <> 0, 'Error: black team color', true);
+   CurrentTeam^.AdjColor:= CurrentTeam^.Color;
+   AdjustColor(CurrentTeam^.AdjColor)
+   end
 end;
 
 procedure chTeamLocal(var s: shortstring);
@@ -98,14 +103,6 @@
 CurrentTeam^.FortName:= s
 end;
 
-procedure chColor(var id: shortstring);
-begin
-if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/color"', true);
-val(id, CurrentTeam^.Color);
-CurrentTeam^.AdjColor:= CurrentTeam^.Color;
-AdjustColor(CurrentTeam^.AdjColor)
-end;
-
 procedure chAddHH(var id: shortstring);
 var s: shortstring;
     Gear: PGear;
--- a/hedgewars/uConsole.pas	Mon Jul 02 16:21:07 2007 +0000
+++ b/hedgewars/uConsole.pas	Mon Jul 02 18:35:31 2007 +0000
@@ -308,7 +308,6 @@
 RegisterVariable('-down'   , vtCommand, @chDown_m       , false);
 RegisterVariable('+attack' , vtCommand, @chAttack_p     , false);
 RegisterVariable('-attack' , vtCommand, @chAttack_m     , false);
-RegisterVariable('color'   , vtCommand, @chColor        , false);
 RegisterVariable('switch'  , vtCommand, @chSwitch       , false);
 RegisterVariable('nextturn', vtCommand, @chNextTurn     , false);
 RegisterVariable('timer'   , vtCommand, @chTimer        , false);