stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus doc/ChangeLog.html src/action/action_...


From: Crestez Leonard
Subject: [Stratagus-CVS] stratagus doc/ChangeLog.html src/action/action_...
Date: Fri, 24 Oct 2003 23:12:17 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Crestez Leonard <address@hidden>        03/10/24 23:12:17

Modified files:
        doc            : ChangeLog.html 
        src/action     : action_resource.c 
        src/include    : stratagus.h 
        src/missile    : ccl_missile.c missile.c 
        src/ui         : ccl_ui.c menus.c ui.c 
        src/unit       : unittype.c 

Log message:
        Fixed missile orientation. Fixed some leaks. Removed DEMOLISH_DAMAGE.

Patches:
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.561 stratagus/doc/ChangeLog.html:1.562
--- stratagus/doc/ChangeLog.html:1.561  Fri Oct 24 00:40:48 2003
+++ stratagus/doc/ChangeLog.html        Fri Oct 24 23:12:16 2003
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-----   $Id: ChangeLog.html,v 1.561 2003/10/24 04:40:48 mr-russ Exp $
+----   $Id: ChangeLog.html,v 1.562 2003/10/25 03:12:16 n0body Exp $
 
 ----   (c) Copyright 1998-2003 by Lutz Sammer
 
@@ -36,6 +36,7 @@
 <li>Future 2.00 Release<p>
     <ul>
     <li>++
+    <li>Applied patch #2116 (correct missile directions) (from Ludovic Jarod 
Dauphin).
     <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).
Index: stratagus/src/action/action_resource.c
diff -u stratagus/src/action/action_resource.c:1.60 
stratagus/src/action/action_resource.c:1.61
--- stratagus/src/action/action_resource.c:1.60 Fri Oct 24 20:41:08 2003
+++ stratagus/src/action/action_resource.c      Fri Oct 24 23:12:16 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_resource.c,v 1.60 2003/10/25 00:41:08 n0body Exp $
+//     $Id: action_resource.c,v 1.61 2003/10/25 03:12:16 n0body Exp $
 
 //@{
 
@@ -84,8 +84,8 @@
        y = unit->Orders->Y;
        // Wood gone, look somewhere else.
        if ((!ForestOnMap(x, y)) && (!unit->IX) && (!unit->IY)) {
-           if (!FindTerrainType(UnitMovementMask(unit), MapFieldForest, 0, 10,
-                   unit->Player, unit->X, unit->Y, &x, &y)) {
+           if (!FindTerrainType(UnitMovementMask(unit), MapFieldForest, 0, 16,
+                   unit->Player, unit->Orders->X, unit->Orders->Y, &x, &y)) {
                DebugLevel3Fn("No wood in range\n");
                return -1;
            } else {
Index: stratagus/src/include/stratagus.h
diff -u stratagus/src/include/stratagus.h:1.22 
stratagus/src/include/stratagus.h:1.23
--- stratagus/src/include/stratagus.h:1.22      Fri Oct 17 14:46:47 2003
+++ stratagus/src/include/stratagus.h   Fri Oct 24 23:12:16 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: stratagus.h,v 1.22 2003/10/17 18:46:47 jsalmon3 Exp $
+//     $Id: stratagus.h,v 1.23 2003/10/25 03:12:16 n0body Exp $
 
 #ifndef __STRATAGUS_H__
 #define __STRATAGUS_H__
@@ -326,7 +326,6 @@
 #endif
 
 #define MAGIC_FOR_NEW_UNITS    33      /// How many percent of max mana for 
new units
-#define DEMOLISH_DAMAGE                400     /// Damage for demolish attack
 
 /*----------------------------------------------------------------------------
 --     Some limits
Index: stratagus/src/missile/ccl_missile.c
diff -u stratagus/src/missile/ccl_missile.c:1.35 
stratagus/src/missile/ccl_missile.c:1.36
--- stratagus/src/missile/ccl_missile.c:1.35    Mon Oct 20 20:18:31 2003
+++ stratagus/src/missile/ccl_missile.c Fri Oct 24 23:12:16 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_missile.c,v 1.35 2003/10/21 00:18:31 n0body Exp $
+//     $Id: ccl_missile.c,v 1.36 2003/10/25 03:12:16 n0body Exp $
 
 //@{
 
@@ -88,7 +88,7 @@
        mtype = NewMissileTypeSlot(str);        // str consumed!
     }
 
-    mtype->NumDirections = 8;
+    mtype->NumDirections = 1;
     //
     // Parse the arguments, already the new tagged format.
     //
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.101 
stratagus/src/missile/missile.c:1.102
--- stratagus/src/missile/missile.c:1.101       Mon Oct 20 21:06:58 2003
+++ stratagus/src/missile/missile.c     Fri Oct 24 23:12:16 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: missile.c,v 1.101 2003/10/21 01:06:58 mohydine Exp $
+//     $Id: missile.c,v 1.102 2003/10/25 03:12:16 n0body Exp $
 
 //@{
 
@@ -782,6 +782,7 @@
 **     @param missile  Missile pointer.
 **     @param dx       Delta in x.
 **     @param dy       Delta in y.
+**     @internal We have : SpriteFrame / (2 * (Numdirection - 1)) == 
DirectionToHeading / 256.
 */
 local void MissileNewHeadingFromXY(Missile* missile, int dx, int dy)
 {
@@ -790,21 +791,26 @@
 
     DebugCheck(missile == NULL);
     DebugCheck(missile->Type == NULL);
+    DebugCheck(!(missile->Type->NumDirections & 1)); // Only support for 
impair number of directions.
+    if (missile->Type->NumDirections == 1 || (dx == 0 && dy == 0)) {
+        return ;
+    }
+// reinitialise the direction but with skipping Animation step.
     if (missile->SpriteFrame < 0) {
        missile->SpriteFrame = -missile->SpriteFrame;
     }
     missile->SpriteFrame /= missile->Type->NumDirections / 2 + 1;
     missile->SpriteFrame *= missile->Type->NumDirections / 2 + 1;
 
-    nextdir = 256 / missile->Type->NumDirections;
+    nextdir = 128 / (missile->Type->NumDirections - 1);
     DebugCheck(nextdir == 0);
-    dir = ((DirectionToHeading(dx, dy) + nextdir / 2) & 0xFF) / nextdir;
-    if (dir <= LookingS / nextdir) {   // north->east->south
-       missile->SpriteFrame += dir;
-    } else {
-       missile->SpriteFrame += 256 / nextdir - dir;
-       missile->SpriteFrame = -missile->SpriteFrame;
-    }
+    dir = ((DirectionToHeading(10 * dx, 10 * dy) + nextdir / 2) & 0xFF) / 
nextdir;
+    if (dir >= missile->Type->NumDirections) {
+        dir -= (missile->Type->NumDirections - 1) * 2;
+    }
+    DebugCheck(dir >= missile->Type->NumDirections);
+    DebugCheck(dir < -missile->Type->NumDirections + 1);
+    missile->SpriteFrame = dir;
 }
 /**
 **     Init the move.
@@ -817,15 +823,15 @@
     int dy;
 
     DebugCheck(missile == 0);
+    dx = missile->DX - missile->X;
+    dy = missile->DY - missile->Y;
+    MissileNewHeadingFromXY(missile, dx, dy);
     if (!(missile->State & 1)) {
-        dx = missile->DX - missile->X;
-        dy = missile->DY - missile->Y;
         missile->CurrentStep = 0;
         missile->TotalStep = 0;
         if (dx == 0 && dy == 0) {
             return 1;
         }
-        MissileNewHeadingFromXY(missile, dx, dy);
        // initialize
         missile->TotalStep = MapDistance(missile->SourceX, missile->SourceY, 
missile->DX, missile->DY);
         missile->State++;
@@ -1339,7 +1345,7 @@
 
     DebugCheck(file == NULL);
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.101 
2003/10/21 01:06:58 mohydine Exp $\n\n");
+    CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.102 
2003/10/25 03:12:16 n0body Exp $\n\n");
 
     //
     // Original number to internal missile-type name.
@@ -1445,7 +1451,7 @@
 
     DebugCheck(file == NULL);
     CLprintf(file,"\n;;; -----------------------------------------\n");
-    CLprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.101 2003/10/21 
01:06:58 mohydine Exp $\n\n");
+    CLprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.102 2003/10/25 
03:12:16 n0body Exp $\n\n");
 
     for (missiles = GlobalMissiles; *missiles; ++missiles) {
        SaveMissile(*missiles, file);
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.141 stratagus/src/ui/ccl_ui.c:1.142
--- stratagus/src/ui/ccl_ui.c:1.141     Thu Oct 23 21:58:34 2003
+++ stratagus/src/ui/ccl_ui.c   Fri Oct 24 23:12:17 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_ui.c,v 1.141 2003/10/24 01:58:34 n0body Exp $
+//     $Id: ccl_ui.c,v 1.142 2003/10/25 03:12:17 n0body Exp $
 
 //@{
 
@@ -292,6 +292,7 @@
     if (TitleScreen) {
        for (i = 0; TitleScreen[i]; ++i) {
            free(TitleScreen[i]);
+           TitleScreen[i]=NULL;
        }
     }
     if (!gh_null_p(list)) {
@@ -2267,6 +2268,9 @@
                            int i;
 
                            n = item->d.pulldown.noptions = gh_length(value);
+                           if (item->d.pulldown.options) {
+                               free(item->d.pulldown.options);
+                           }
                            item->d.pulldown.options = (unsigned 
char**)malloc(sizeof(unsigned char*)*n);
                            for (i = 0; i < n; ++i) {
                                item->d.pulldown.options[i] = 
gh_scm2newstr(gh_car(value), NULL);
@@ -2802,9 +2806,7 @@
            } else if (gh_eq_p(value, gh_symbol2scm("cancel-build"))) {
                ba.Action = ButtonCancelBuild;
            } else {
-               s1 = gh_scm2newstr(value, NULL);
-               fprintf(stderr, "Unsupported action %s\n",s1);
-               free(s1);
+               errl("Unsupported button action ",value);
            }
        } else if (gh_eq_p(value, gh_symbol2scm("value"))) {
            value = gh_car(list);
Index: stratagus/src/ui/menus.c
diff -u stratagus/src/ui/menus.c:1.571 stratagus/src/ui/menus.c:1.572
--- stratagus/src/ui/menus.c:1.571      Mon Oct 20 21:08:30 2003
+++ stratagus/src/ui/menus.c    Fri Oct 24 23:12:17 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: menus.c,v 1.571 2003/10/21 01:08:30 mohydine Exp $
+//     $Id: menus.c,v 1.572 2003/10/25 03:12:17 n0body Exp $
 
 //@{
 
@@ -7184,6 +7184,10 @@
        }
     }
     ++n;
+    //  Reallocate pulldown options.
+    if (mi->d.pulldown.options) {
+       free (mi->d.pulldown.options);
+    }
     mi->d.pulldown.options = (unsigned char **)malloc(n * sizeof(unsigned char 
*));
     for (i = 0, n = 0; i < PlayerRaces.Count; ++i) {
        if (PlayerRaces.Visible[i]) {
Index: stratagus/src/ui/ui.c
diff -u stratagus/src/ui/ui.c:1.85 stratagus/src/ui/ui.c:1.86
--- stratagus/src/ui/ui.c:1.85  Sat Oct 18 13:18:22 2003
+++ stratagus/src/ui/ui.c       Fri Oct 24 23:12:17 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ui.c,v 1.85 2003/10/18 17:18:22 jsalmon3 Exp $
+//     $Id: ui.c,v 1.86 2003/10/25 03:12:17 n0body Exp $
 
 //@{
 
@@ -644,7 +644,7 @@
     int i;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.85 2003/10/18 17:18:22 
jsalmon3 Exp $\n\n");
+    CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.86 2003/10/25 03:12:17 n0body 
Exp $\n\n");
 
     // Contrast, Brightness, Saturation
     CLprintf(file, "(set-contrast! %d)\n", TheUI.Contrast);
@@ -806,6 +806,14 @@
        }
        free(UI_Table);
        UI_Table = NULL;
+    }
+
+    // Free Title screen.
+    if (TitleScreen) {
+       for (i = 0; TitleScreen[i]; ++i) {
+           free(TitleScreen[i]);
+           TitleScreen[i]=NULL;
+       }
     }
 
     // FIXME: Johns: Implement this correctly or we will lose memory!
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.116 stratagus/src/unit/unittype.c:1.117
--- stratagus/src/unit/unittype.c:1.116 Fri Oct 24 00:40:50 2003
+++ stratagus/src/unit/unittype.c       Fri Oct 24 23:12:17 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.c,v 1.116 2003/10/24 04:40:50 mr-russ Exp $
+//     $Id: unittype.c,v 1.117 2003/10/25 03:12:17 n0body Exp $
 
 //@{
 
@@ -1148,7 +1148,7 @@
     char** sp;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.116 2003/10/24 
04:40:50 mr-russ Exp $\n\n");
+    CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.117 2003/10/25 
03:12:17 n0body Exp $\n\n");
 
     // Original number to internal unit-type name.
 
@@ -1505,6 +1505,9 @@
        }
        if (type->CorpseName) {
            free(type->CorpseName);
+       }
+       if (type->CanCastSpell) {
+           free(type->CanCastSpell);
        }
 
        for (res = 0; res < MaxCosts; ++res) {




reply via email to

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