stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src action/command.c clone/selection....


From: Crestez Leonard
Subject: [Stratagus-CVS] stratagus/src action/command.c clone/selection....
Date: Tue, 28 Oct 2003 15:20:46 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Crestez Leonard <address@hidden>        03/10/28 15:20:46

Modified files:
        src/action     : command.c 
        src/clone      : selection.c unit.c 
        src/include    : actions.h commands.h network.h 
        src/network    : commands.c 
        src/ui         : botpanel.c 

Log message:
        Fixed critter bug, renamed cancel-building to dismiss (TODO: allow to 
sell buildings.)

Patches:
Index: stratagus/src/action/command.c
diff -u stratagus/src/action/command.c:1.112 
stratagus/src/action/command.c:1.113
--- stratagus/src/action/command.c:1.112        Sun Oct 26 06:06:21 2003
+++ stratagus/src/action/command.c      Tue Oct 28 15:20:41 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: command.c,v 1.112 2003/10/26 11:06:21 mr-russ Exp $
+//     $Id: command.c,v 1.113 2003/10/28 20:20:41 n0body Exp $
 
 //@{
 
@@ -690,19 +690,21 @@
 }
 
 /**
-**     Cancel the building construction.
+**     Cancel the building construction, or kill an unit.
 **
 **     @param unit     pointer to unit.
 **     @param worker   pointer to unit.
 */
-global void CommandCancelBuilding(Unit* unit,
-    Unit* worker __attribute__((unused)))
+global void CommandDismiss(Unit* unit)
 {
     //
     // Check if building is still under construction? (NETWORK!)
     //
     if (unit->Orders[0].Action == UnitActionBuilded) {
        unit->Data.Builded.Cancel = 1;
+    } else {
+       DebugLevel0("Suicide unit ... \n");
+       LetUnitDie(unit);
     }
     ClearSavedAction(unit);
 }
Index: stratagus/src/clone/selection.c
diff -u stratagus/src/clone/selection.c:1.52 
stratagus/src/clone/selection.c:1.53
--- stratagus/src/clone/selection.c:1.52        Fri Oct 24 00:40:49 2003
+++ stratagus/src/clone/selection.c     Tue Oct 28 15:20:42 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: selection.c,v 1.52 2003/10/24 04:40:49 mr-russ Exp $
+//     $Id: selection.c,v 1.53 2003/10/28 20:20:42 n0body Exp $
 
 //@{
 
@@ -46,6 +46,7 @@
 #include "map.h"
 #include "ui.h"
 #include "commands.h"
+#include "network.h"
 
 #include "ccl.h"
 
@@ -104,7 +105,7 @@
 
     // FIXME: make this configurable
     if (unit->Value == unit->Type->ClicksToExplode) {
-       LetUnitDie(unit);
+       SendCommandDismiss(unit);
        unit->Value = 0;
     }
 }
@@ -984,7 +985,7 @@
     char* ref;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: selection $Id: selection.c,v 1.52 2003/10/24 
04:40:49 mr-russ Exp $\n\n");
+    CLprintf(file, ";;; MODULE: selection $Id: selection.c,v 1.53 2003/10/28 
20:20:42 n0body Exp $\n\n");
 
     CLprintf(file, "(set-group-id! %d)\n", GroupId);
     CLprintf(file, "(selection %d '(", NumSelected);
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.319 stratagus/src/clone/unit.c:1.320
--- stratagus/src/clone/unit.c:1.319    Mon Oct 27 22:48:48 2003
+++ stratagus/src/clone/unit.c  Tue Oct 28 15:20:43 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.c,v 1.319 2003/10/28 03:48:48 jsalmon3 Exp $
+//     $Id: unit.c,v 1.320 2003/10/28 20:20:43 n0body Exp $
 
 //@{
 
@@ -796,7 +796,7 @@
        unit->Player->UpgradeTimers.Upgrades[unit->Data.Research.Upgrade - 
Upgrades] = 0;
     }
 
-    DebugLevel3Fn("Lost %s(%d)\n" _C_ unit->Type->Ident _C_ UnitNumber(unit));
+    DebugLevel0Fn("Lost %s(%d)\n" _C_ unit->Type->Ident _C_ UnitNumber(unit));
 
     // Destroy resource-platform, must re-make resource patch.
     if (type->MustBuildOnTop && unit->Value > 0) {
@@ -2776,6 +2776,7 @@
 
     // removed units,  just remove.
     if (unit->Removed) {
+       DebugLevel0Fn("Killing a removed unit?\n");
        RemoveUnit(unit, NULL);
        UnitLost(unit);
        UnitClearOrders(unit);
@@ -3742,7 +3743,7 @@
     int RunStart;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.319 2003/10/28 03:48:48 
jsalmon3 Exp $\n\n");
+    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.320 2003/10/28 20:20:43 
n0body Exp $\n\n");
 
     //
     // Local variables
Index: stratagus/src/include/actions.h
diff -u stratagus/src/include/actions.h:1.57 
stratagus/src/include/actions.h:1.58
--- stratagus/src/include/actions.h:1.57        Sun Oct 26 14:46:05 2003
+++ stratagus/src/include/actions.h     Tue Oct 28 15:20:44 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: actions.h,v 1.57 2003/10/26 19:46:05 n0body Exp $
+//     $Id: actions.h,v 1.58 2003/10/28 20:20:44 n0body Exp $
 
 #ifndef __ACTIONS_H__
 #define __ACTIONS_H__
@@ -96,8 +96,8 @@
 extern void CommandUnload(Unit* unit,int x,int y,Unit* what,int flush);
     /// Prepare command build
 extern void CommandBuildBuilding(Unit*,int,int,UnitType*,int);
-    /// Prepare command cancel build
-extern void CommandCancelBuilding(Unit* unit,Unit* worker);
+    /// Prepare command dismiss
+extern void CommandDismiss(Unit* unit);
     /// Prepare command resource location
 extern void CommandResourceLoc(Unit* unit,int x,int y,int flush);
     /// Prepare command resource
Index: stratagus/src/include/commands.h
diff -u stratagus/src/include/commands.h:1.23 
stratagus/src/include/commands.h:1.24
--- stratagus/src/include/commands.h:1.23       Thu Oct 23 21:58:33 2003
+++ stratagus/src/include/commands.h    Tue Oct 28 15:20:44 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: commands.h,v 1.23 2003/10/24 01:58:33 n0body Exp $
+//     $Id: commands.h,v 1.24 2003/10/28 20:20:44 n0body Exp $
 
 #ifndef __COMMANDS_H__
 #define __COMMANDS_H__
@@ -97,7 +97,7 @@
     /// Send build building command
 extern void SendCommandBuildBuilding(Unit*,int,int,UnitType*,int);
     /// Send cancel building command
-extern void SendCommandCancelBuilding(Unit* unit,Unit* peon);
+extern void SendCommandDismiss(Unit* unit);
     /// Send harvest location command
 extern void SendCommandResourceLoc(Unit* unit,int x,int y,int flush);
     /// Send harvest command
Index: stratagus/src/include/network.h
diff -u stratagus/src/include/network.h:1.42 
stratagus/src/include/network.h:1.43
--- stratagus/src/include/network.h:1.42        Thu Oct 23 21:58:33 2003
+++ stratagus/src/include/network.h     Tue Oct 28 15:20:44 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: network.h,v 1.42 2003/10/24 01:58:33 n0body Exp $
+//     $Id: network.h,v 1.43 2003/10/28 20:20:44 n0body Exp $
 
 #ifndef __NETWORK_H__
 #define __NETWORK_H__
@@ -83,7 +83,7 @@
     MessageCommandBoard,               /// Unit command borad
     MessageCommandUnload,              /// Unit command unload
     MessageCommandBuild,               /// Unit command build building
-    MessageCommandCancelBuild,         /// Unit command cancel building
+    MessageCommandDismiss,             /// Unit command dismiss unit 
     MessageCommandResourceLoc,         /// Unit command resource location
     MessageCommandResource,            /// Unit command resource
     MessageCommandReturn,              /// Unit command return goods
Index: stratagus/src/network/commands.c
diff -u stratagus/src/network/commands.c:1.71 
stratagus/src/network/commands.c:1.72
--- stratagus/src/network/commands.c:1.71       Mon Oct 27 05:31:15 2003
+++ stratagus/src/network/commands.c    Tue Oct 28 15:20:44 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: commands.c,v 1.71 2003/10/27 10:31:15 pludov Exp $
+//     $Id: commands.c,v 1.72 2003/10/28 20:20:44 n0body Exp $
 
 //@{
 
@@ -143,7 +143,7 @@
        fprintf(LogFile, "(replay-log\n");
        fprintf(LogFile, "  'comment\t\"Generated by Stratagus Version " 
VERSION "\"\n");
        fprintf(LogFile, "  'comment\t\"Visit http://Stratagus.Org for more 
information\"\n");
-       fprintf(LogFile, "  'comment\t\"$Id: commands.c,v 1.71 2003/10/27 
10:31:15 pludov Exp $\"\n");
+       fprintf(LogFile, "  'comment\t\"$Id: commands.c,v 1.72 2003/10/28 
20:20:44 n0body Exp $\"\n");
        if (NetworkFildes == (Socket)-1) {
            fprintf(LogFile, "  'type\t\"%s\"\n", "single-player");
            fprintf(LogFile, "  'race\t%d\n", GameSettings.Presets[0].Race);
@@ -559,8 +559,8 @@
        SendCommandUnload(UnitSlots[unit], posx, posy, dunit, flags);
     } else if (!strcmp(name, "build")) {
        SendCommandBuildBuilding(UnitSlots[unit], posx, posy, 
UnitTypeByIdent(val), flags);
-    } else if (!strcmp(name, "cancel-build")) {
-       SendCommandCancelBuilding(UnitSlots[unit], dunit);
+    } else if (!strcmp(name, "dismiss")) {
+       SendCommandDismiss(UnitSlots[unit]);
     } else if (!strcmp(name, "resource-loc")) {
        SendCommandResourceLoc(UnitSlots[unit], posx, posy, flags);
     } else if (!strcmp(name, "resource")) {
@@ -887,14 +887,14 @@
 **     @param unit     pointer to unit.
 **     @param worker   Worker which should stop.
 */
-global void SendCommandCancelBuilding(Unit* unit, Unit* worker)
+global void SendCommandDismiss(Unit* unit)
 {
     // FIXME: currently unit and worker are same?
     if (NetworkFildes == (Socket)-1) {
-       CommandLog("cancel-build", unit, FlushCommands, -1, -1, worker, NULL, 
-1);
-       CommandCancelBuilding(unit, worker);
+       CommandLog("dismiss", unit, FlushCommands, -1, -1, NULL, NULL, -1);
+       CommandDismiss(unit);
     } else {
-       NetworkSendCommand(MessageCommandCancelBuild, unit, 0, 0, worker, 0,
+       NetworkSendCommand(MessageCommandDismiss, unit, 0, 0, NULL, 0,
            FlushCommands);
     }
 }
@@ -1277,15 +1277,9 @@
                -1);
            CommandBuildBuilding(unit, x, y, UnitTypes[dstnr], status);
            break;
-       case MessageCommandCancelBuild:
-           // dest is the worker building the unit...
-           dest = NoUnitP;
-           if (dstnr != (unsigned short)0xFFFF) {
-               dest = UnitSlots[dstnr];
-               DebugCheck(!dest || !dest->Type);
-           }
-           CommandLog("cancel-build", unit, FlushCommands, -1, -1, dest, NULL, 
-1);
-           CommandCancelBuilding(unit, dest);
+       case MessageCommandDismiss:
+           CommandLog("dismiss", unit, FlushCommands, -1, -1, NULL, NULL, -1);
+           CommandDismiss(unit);
            break;
        case MessageCommandResourceLoc:
            CommandLog("resource-loc", unit, status, x, y, NoUnitP, NULL, -1);
Index: stratagus/src/ui/botpanel.c
diff -u stratagus/src/ui/botpanel.c:1.93 stratagus/src/ui/botpanel.c:1.94
--- stratagus/src/ui/botpanel.c:1.93    Thu Oct 23 21:58:34 2003
+++ stratagus/src/ui/botpanel.c Tue Oct 28 15:20:45 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: botpanel.c,v 1.93 2003/10/24 01:58:34 n0body Exp $
+//     $Id: botpanel.c,v 1.94 2003/10/28 20:20:45 n0body Exp $
 
 //@{
 
@@ -103,7 +103,7 @@
     char* cp;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: buttons $Id: botpanel.c,v 1.93 2003/10/24 
01:58:34 n0body Exp $\n\n");
+    CLprintf(file, ";;; MODULE: buttons $Id: botpanel.c,v 1.94 2003/10/28 
20:20:45 n0body Exp $\n\n");
 
     for (i = 0; i < NumUnitButtons; ++i) {
        CLprintf(file, "(define-button 'pos %d 'level %d 'icon '%s\n",
@@ -964,8 +964,7 @@
        case ButtonCancelBuild:
            // FIXME: johns is this not sure, only building should have this?
            if (NumSelected == 1 && Selected[0]->Type->Building) {
-               SendCommandCancelBuilding(Selected[0],
-                   Selected[0]->Data.Builded.Worker);
+               SendCommandDismiss(Selected[0]);
            }
            ClearStatusLine();
            ClearCosts();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]