stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus src/include/unittype.h doc/ChangeLog....


From: Russell Smith
Subject: [Stratagus-CVS] stratagus src/include/unittype.h doc/ChangeLog....
Date: Fri, 24 Oct 2003 00:40:51 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Russell Smith <address@hidden>  03/10/24 00:40:50

Modified files:
        src/include    : unittype.h 
        doc            : ChangeLog.html 
        doc/ccl        : unittype.html 
        src/clone      : selection.c 
        src/map        : minimap.c 
        src/unit       : ccl_unittype.c unittype.c 

Log message:
        Added Neutral Player Minimap Color
        Added Whether a Unit type is selectable or not

Patches:
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.560 stratagus/doc/ChangeLog.html:1.561
--- stratagus/doc/ChangeLog.html:1.560  Thu Oct 23 21:58:32 2003
+++ stratagus/doc/ChangeLog.html        Fri Oct 24 00:40:48 2003
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-----   $Id: ChangeLog.html,v 1.560 2003/10/24 01:58:32 n0body Exp $
+----   $Id: ChangeLog.html,v 1.561 2003/10/24 04:40:48 mr-russ Exp $
 
 ----   (c) Copyright 1998-2003 by Lutz Sammer
 
@@ -36,6 +36,7 @@
 <li>Future 2.00 Release<p>
     <ul>
     <li>++
+    <li>Added Neutral Minimap Color. (from Russell Smith).
     <li>Removed the demolish action, we now use the demolish spell. (from 
Crestez Leonard).
     <li>Applied patch #1969 (AI enhancement) (from Ludovic Pollet).
     <li>Added the demolish spell, though not complete (from Crestez Leonard).
Index: stratagus/doc/ccl/unittype.html
diff -u stratagus/doc/ccl/unittype.html:1.35 
stratagus/doc/ccl/unittype.html:1.36
--- stratagus/doc/ccl/unittype.html:1.35        Thu Oct 23 21:58:32 2003
+++ stratagus/doc/ccl/unittype.html     Fri Oct 24 00:40:48 2003
@@ -248,6 +248,14 @@
 of a terrain tile, for an almost perfect fit. It's a list of X (width) and Y 
(height)
 too. F.E. '(32 32) '(64 64)
 </dd>
+<dt>not-selectable</dt>
+<dd>set whether the unit is able to be selected or not.  Used for decoration 
units in
+the game.  F.E. 'not-selectable
+</dd>
+<dt>neutral-minimap-color</dt>
+<dd>sets the color of a unit when belonging to the neutral player. F.E. '(0 0 
0) for a
+black oil patch.
+</dd>
 <dt>icon</dt>
 <dd>Identifier to reference the icon shown in game for this unit-type.
 F.E. "icon-knight", "icon-gold-mine".
@@ -742,7 +750,7 @@
 <h4>Not Used</h4>
 
 <hr>
-Last changed: $Id: unittype.html,v 1.35 2003/10/24 01:58:32 n0body Exp $<br>
+Last changed: $Id: unittype.html,v 1.36 2003/10/24 04:40:48 mr-russ Exp $<br>
 All trademarks and copyrights on this page are owned by their respective 
owners.
 <address>(c) 2002-2003 by <a href="http://stratagus.org";>
 The Stratagus Project</a></address></body></html>
Index: stratagus/src/clone/selection.c
diff -u stratagus/src/clone/selection.c:1.51 
stratagus/src/clone/selection.c:1.52
--- stratagus/src/clone/selection.c:1.51        Thu Oct 23 21:58:33 2003
+++ stratagus/src/clone/selection.c     Fri Oct 24 00:40:49 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: selection.c,v 1.51 2003/10/24 01:58:33 n0body Exp $
+//     $Id: selection.c,v 1.52 2003/10/24 04:40:49 mr-russ Exp $
 
 //@{
 
@@ -123,13 +123,14 @@
 
     DebugCheck(count > MaxSelectable);
 
-    if (count == 1 && units[0]->Type->ClicksToExplode) {
+    if (count == 1 && units[0]->Type->ClicksToExplode && 
+       units[0]->Type->Selectable) {
        HandleSuicideClick(units[0]);
     }
 
     UnSelectAll();
     for (n = i = 0; i < count; ++i) {
-       if (!units[i]->Removed) {
+       if (!units[i]->Removed && units[i]->Type->Selectable) {
            Selected[n++] = unit = units[i];
            unit->Selected = 1;
            if (count > 1) {
@@ -169,6 +170,10 @@
        return 0;
     }
 
+    if (!unit->Type->Selectable) {
+       return 0;
+    }
+
     Selected[NumSelected++] = unit;
     unit->Selected = 1;
     if (NumSelected > 1) {
@@ -285,6 +290,10 @@
        HandleSuicideClick(base);
     }
 
+    if (!base->Type->Selectable) {
+       return 0;
+    }
+
     UnSelectAll();
     Selected[0] = base;
     base->Selected = 1;
@@ -975,7 +984,7 @@
     char* ref;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: selection $Id: selection.c,v 1.51 2003/10/24 
01:58:33 n0body Exp $\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, "(set-group-id! %d)\n", GroupId);
     CLprintf(file, "(selection %d '(", NumSelected);
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.120 
stratagus/src/include/unittype.h:1.121
--- stratagus/src/include/unittype.h:1.120      Thu Oct 23 21:58:34 2003
+++ stratagus/src/include/unittype.h    Fri Oct 24 00:40:48 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.h,v 1.120 2003/10/24 01:58:34 n0body Exp $
+//     $Id: unittype.h,v 1.121 2003/10/24 04:40:48 mr-russ Exp $
 
 #ifndef __UNITTYPE_H__
 #define __UNITTYPE_H__
@@ -358,6 +358,11 @@
 **             Points to the type of building it must be build on or
 **             NoUnitP otherwise. Buggy, works for oil platforms.
 **
+**     UnitType::NeutralMinimapColorRGB
+**
+**             Says what color a unit will have when it's neutral and
+**             is displayed on the minimap.
+**
 **     UnitType::CanStore[::MaxCosts]
 **
 **             What resource types we can store here.
@@ -756,13 +761,15 @@
     unsigned Harvester : 1;            /// unit is a resource harvester.
 
     unsigned SelectableByRectangle : 1;        /// Selectable with mouse 
rectangle.
+    unsigned Selectable : 1;           /// Unit Is Selectable at all.
     unsigned Teleporter : 1;           /// Can teleport other units.
 
-    int                 CanStore[MaxCosts];    /// Resources that we can store 
here.
-    int                 GivesResource;         /// The resource this unit 
gives.
-    int                 MaxWorkers;            /// Maximum number of workers.
+    int                CanStore[MaxCosts];     /// Resources that we can store 
here.
+    int                GivesResource;          /// The resource this unit 
gives.
+    int                MaxWorkers;             /// Maximum number of workers.
     ResourceInfo* ResInfo[MaxCosts];   /// Resource information.
-    UnitType* MustBuildOnTop;          /// Must be built on top of something.
+    UnitType*  MustBuildOnTop;         /// Must be built on top of something.
+    VMemType   NeutralMinimapColorRGB; /// Minimap Color for Neutral Units.
 
 
     UnitSound Sound;                   /// Sounds for events
Index: stratagus/src/map/minimap.c
diff -u stratagus/src/map/minimap.c:1.71 stratagus/src/map/minimap.c:1.72
--- stratagus/src/map/minimap.c:1.71    Tue Oct  7 20:06:43 2003
+++ stratagus/src/map/minimap.c Fri Oct 24 00:40:49 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: minimap.c,v 1.71 2003/10/08 00:06:43 jsalmon3 Exp $
+//     $Id: minimap.c,v 1.72 2003/10/24 04:40:49 mr-russ Exp $
 
 //@{
 
@@ -330,17 +330,10 @@
 
        if (!BuildingVisibleOnMap(*table) && (*table)->SeenState != 3
                && !(*table)->SeenDestroyed && (type = (*table)->SeenType) ) {
-           //
-           //  FIXME: We should force unittypes to have a certain color on the 
minimap.
-           //
            if( (*table)->Player->Player == PlayerNumNeutral ) {
-               if (type->ClicksToExplode) {
-                   color = ColorNPC;
-               } else if (type->GivesResource == OilCost) {
-                   color = ColorBlack;
-               } else {
-                   color = ColorYellow;
-               }
+               color = 
VideoMapRGB((*table)->Type->NeutralMinimapColorRGB.D24.a,
+                       (*table)->Type->NeutralMinimapColorRGB.D24.b,
+                       (*table)->Type->NeutralMinimapColorRGB.D24.c);
            } else {
                color = (*table)->Player->Color;
            }
@@ -391,14 +384,9 @@
        //  FIXME: We should force unittypes to have a certain color on the 
minimap.
        //
        if (unit->Player->Player == PlayerNumNeutral) {
-           if (type->ClicksToExplode) {
-               color = ColorNPC;
-           } else if (type->GivesResource == OilCost) {
-               // FIXME: move to ccl (OilCost)
-               color = ColorBlack;
-           } else {
-               color = ColorYellow;
-           }
+           color = VideoMapRGB((*table)->Type->NeutralMinimapColorRGB.D24.a,
+               (*table)->Type->NeutralMinimapColorRGB.D24.b,
+               (*table)->Type->NeutralMinimapColorRGB.D24.c);
        } else if (unit->Player == ThisPlayer) {
            if (unit->Attacked && red_phase) {
                color = ColorRed;
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.98 
stratagus/src/unit/ccl_unittype.c:1.99
--- stratagus/src/unit/ccl_unittype.c:1.98      Thu Oct 23 21:58:34 2003
+++ stratagus/src/unit/ccl_unittype.c   Fri Oct 24 00:40:49 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unittype.c,v 1.98 2003/10/24 01:58:34 n0body Exp $
+//     $Id: ccl_unittype.c,v 1.99 2003/10/24 04:40:49 mr-russ Exp $
 
 //@{
 
@@ -126,6 +126,7 @@
        redefine = 0;
        //Set some default values
        type->_RegenerationRate = 0;
+       type->Selectable = 1;
     }
     type->NumDirections = 8;
 
@@ -279,6 +280,14 @@
            type->MustBuildOnTop = auxtype;
            free(str);
            list = gh_cdr(list);
+       } else if (gh_eq_p(value, gh_symbol2scm("not-selectable"))) {
+           type->Selectable = 0;
+       } else if (gh_eq_p(value, gh_symbol2scm("neutral-minimap-color"))) {
+           sublist = gh_car(list);
+           list = gh_cdr(list);
+           type->NeutralMinimapColorRGB.D24.a = gh_scm2int(gh_car(sublist));
+           type->NeutralMinimapColorRGB.D24.b = 
gh_scm2int(gh_car(gh_cdr(sublist)));
+           type->NeutralMinimapColorRGB.D24.c = 
gh_scm2int(gh_car(gh_cdr(gh_cdr(sublist))));
        } else if (gh_eq_p(value, gh_symbol2scm("box-size"))) {
            sublist = gh_car(list);
            list = gh_cdr(list);
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.115 stratagus/src/unit/unittype.c:1.116
--- stratagus/src/unit/unittype.c:1.115 Thu Oct 23 21:58:34 2003
+++ stratagus/src/unit/unittype.c       Fri Oct 24 00:40:50 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.c,v 1.115 2003/10/24 01:58:34 n0body Exp $
+//     $Id: unittype.c,v 1.116 2003/10/24 04:40:50 mr-russ Exp $
 
 //@{
 
@@ -761,6 +761,15 @@
     }
     CLprintf(file, "  'tile-size '(%d %d)", type->TileWidth, type->TileHeight);
     CLprintf(file, "  'box-size '(%d %d)\n", type->BoxWidth, type->BoxHeight);
+    
+    if(!type->Selectable) {
+       CLprintf(file, "  'not-selectable\n");
+    }
+
+    CLprintf(file, "  'neutral-minimap-color '(%d %d %d)\n",
+       type->NeutralMinimapColorRGB.D24.a,type->NeutralMinimapColorRGB.D24.b,
+       type->NeutralMinimapColorRGB.D24.c);
+
     CLprintf(file, "  'sight-range %d", type->_SightRange);
     if (all || type->ReactRangeComputer) {
        CLprintf(file, "  'computer-reaction-range %d", 
type->ReactRangeComputer);
@@ -1139,7 +1148,7 @@
     char** sp;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.115 2003/10/24 
01:58:34 n0body Exp $\n\n");
+    CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.116 2003/10/24 
04:40:50 mr-russ Exp $\n\n");
 
     // Original number to internal unit-type name.
 




reply via email to

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