[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus data/ccl/units.ccl src/clone/selectio...
From: |
Crestez Leonard |
Subject: |
[Stratagus-CVS] stratagus data/ccl/units.ccl src/clone/selectio... |
Date: |
Thu, 24 Jul 2003 15:27:34 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Crestez Leonard <address@hidden> 03/07/24 15:27:33
Modified files:
data/ccl : units.ccl
src/clone : selection.c spells.c unit.c unit_draw.c
src/include : unit.h unittype.h
src/map : ccl_map.c map_fog.c
src/unit : ccl_unit.c ccl_unittype.c unittype.c
Log message:
Fixed rare bug with saving right after casting holy vision, the game
would
crash on load. Moved Revealer flag to UnitType.
Patches:
Index: stratagus/data/ccl/units.ccl
diff -u stratagus/data/ccl/units.ccl:1.37 stratagus/data/ccl/units.ccl:1.38
--- stratagus/data/ccl/units.ccl:1.37 Tue Jul 22 10:32:21 2003
+++ stratagus/data/ccl/units.ccl Thu Jul 24 15:27:32 2003
@@ -26,7 +26,7 @@
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
;;
-;; $Id: units.ccl,v 1.37 2003/07/22 14:32:21 n0body Exp $
+;; $Id: units.ccl,v 1.38 2003/07/24 19:27:32 n0body Exp $
;; Load the animations for the units.
(load "ccl/anim.ccl" #f #t)
@@ -411,6 +411,7 @@
'decay-rate 1
'type-land
'building
+ 'revealer
'critter
'can-see-submarine
'sounds '())
Index: stratagus/src/clone/selection.c
diff -u stratagus/src/clone/selection.c:1.46
stratagus/src/clone/selection.c:1.47
--- stratagus/src/clone/selection.c:1.46 Tue Jul 22 10:32:21 2003
+++ stratagus/src/clone/selection.c Thu Jul 24 15:27:32 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: selection.c,v 1.46 2003/07/22 14:32:21 n0body Exp $
+// $Id: selection.c,v 1.47 2003/07/24 19:27:32 n0body Exp $
//@{
@@ -150,7 +150,7 @@
*/
global int SelectUnit(Unit* unit)
{
- if (unit->Revealer) { // Revealers cannot be selected
+ if (unit->Type->Revealer) { // Revealers cannot be selected
DebugLevel0Fn("Selecting revealer?\n");
return 0;
}
@@ -975,7 +975,7 @@
char *ref;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: selection $Id: selection.c,v 1.46 2003/07/22
14:32:21 n0body Exp $\n\n");
+ fprintf(file,";;; MODULE: selection $Id: selection.c,v 1.47 2003/07/24
19:27:32 n0body Exp $\n\n");
fprintf(file,"(set-group-id! %d)\n",GroupId);
fprintf(file,"(selection %d '(",NumSelected);
Index: stratagus/src/clone/spells.c
diff -u stratagus/src/clone/spells.c:1.91 stratagus/src/clone/spells.c:1.92
--- stratagus/src/clone/spells.c:1.91 Fri Jul 11 10:35:30 2003
+++ stratagus/src/clone/spells.c Thu Jul 24 15:27:32 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: spells.c,v 1.91 2003/07/11 14:35:30 n0body Exp $
+// $Id: spells.c,v 1.92 2003/07/24 19:27:32 n0body Exp $
/*
** And when we cast our final spell
@@ -1544,16 +1544,17 @@
unit->Mana -= spell->ManaCost; // get mana cost
// FIXME: Don't use UnitTypeByIdent during runtime.
target = MakeUnit(UnitTypeByIdent("unit-revealer"), unit->Player);
- target->Revealer = 1;
target->Orders[0].Action = UnitActionStill;
target->HP = 0;
target->X = x;
target->Y = y;
target->TTL=GameCycle+CYCLES_PER_SECOND+CYCLES_PER_SECOND/2;
target->CurrentSightRange=target->Stats->SightRange;
+
+ target->Removed=1;
MapMarkSight(target->Player,x,y,target->CurrentSightRange);
- //target->TTL=GameCycle+target->Type->DecayRate*6*CYCLES_PER_SECOND;
+ target->TTL=GameCycle+target->Type->DecayRate*6*CYCLES_PER_SECOND;
CheckUnitToBeDrawn(target);
PlayGameSound(spell->Casted.Sound,MaxSampleVolume);
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.279 stratagus/src/clone/unit.c:1.280
--- stratagus/src/clone/unit.c:1.279 Tue Jul 22 10:32:21 2003
+++ stratagus/src/clone/unit.c Thu Jul 24 15:27:32 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.279 2003/07/22 14:32:21 n0body Exp $
+// $Id: unit.c,v 1.280 2003/07/24 19:27:32 n0body Exp $
//@{
@@ -1115,7 +1115,7 @@
int h;
DebugCheck( !unit->Type ); // FIXME: Can this happen, if yes it is a bug
-
+
x = unit->X;
y = unit->Y;
w = w0 = unit->Type->TileWidth;
@@ -4153,9 +4153,6 @@
fprintf(file," 'moving");
}
fprintf(file," 'rs %d",unit->Rs);
- if( unit->Revealer ) {
- fprintf(file," 'revealer");
- }
fprintf(file," 'units-contained-count %d",unit->InsideCount);
fprintf(file,"\n 'units-contained #(");
uins=unit->UnitInside;
@@ -4276,7 +4273,7 @@
int InRun, RunStart;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: units $Id: unit.c,v 1.279 2003/07/22 14:32:21
n0body Exp $\n\n");
+ fprintf(file,";;; MODULE: units $Id: unit.c,v 1.280 2003/07/24 19:27:32
n0body Exp $\n\n");
//
// Local variables
Index: stratagus/src/clone/unit_draw.c
diff -u stratagus/src/clone/unit_draw.c:1.145
stratagus/src/clone/unit_draw.c:1.146
--- stratagus/src/clone/unit_draw.c:1.145 Tue Jul 22 10:32:21 2003
+++ stratagus/src/clone/unit_draw.c Thu Jul 24 15:27:32 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_draw.c,v 1.145 2003/07/22 14:32:21 n0body Exp $
+// $Id: unit_draw.c,v 1.146 2003/07/24 19:27:32 n0body Exp $
//@{
@@ -649,7 +649,7 @@
global void SaveDecorations(FILE* file)
{
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: decorations $Id: unit_draw.c,v 1.145 2003/07/22
14:32:21 n0body Exp $\n\n");
+ fprintf(file,";;; MODULE: decorations $Id: unit_draw.c,v 1.146 2003/07/24
19:27:32 n0body Exp $\n\n");
fprintf(file,"(mana-sprite \"%s\" %d %d %d %d)\n",
ManaSprite.File,ManaSprite.HotX,ManaSprite.HotY,
@@ -1791,7 +1791,6 @@
int state;
int constructed;
-
visible=BuildingVisibleOnMap(unit);
if( ReplayRevealMap ) {
@@ -1867,7 +1866,7 @@
int y;
const UnitType* type;
- if ( unit->Revealer ) { // Revealers are not drawn
+ if ( unit->Type->Revealer ) { // Revealers are not drawn
DebugLevel3Fn("Drawing revealer %d\n" _C_ UnitNumber(unit));
return;
}
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.198 stratagus/src/include/unit.h:1.199
--- stratagus/src/include/unit.h:1.198 Tue Jul 22 10:32:21 2003
+++ stratagus/src/include/unit.h Thu Jul 24 15:27:32 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.h,v 1.198 2003/07/22 14:32:21 n0body Exp $
+// $Id: unit.h,v 1.199 2003/07/24 19:27:32 n0body Exp $
#ifndef __UNIT_H__
#define __UNIT_H__
@@ -314,12 +314,6 @@
** Pointer to the original owner of an unit. It will be NULL if
** the unit was not rescued.
**
-** Unit::Revealer
-**
-** `revealer' is unit that has to keep the fog of war revealed
-** for some time, this unit cannot be used in usual manner.
-** JOHNS: Should be moved into unit-type!
-**
** Unit::OnBoard[::MAX_UNITS_ONBOARD]
**
** A table of units on board. This can be units in a transporter
@@ -583,8 +577,6 @@
** ,used for fancy buildings
*/
unsigned Rs : 8;
- unsigned Revealer : 1; /// reveal the fog of war
-
#if 0
#define MAX_UNITS_ONBOARD 6 /// max number of units in transporter
// FIXME: use the new next pointer
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.90
stratagus/src/include/unittype.h:1.91
--- stratagus/src/include/unittype.h:1.90 Tue Jul 22 10:32:22 2003
+++ stratagus/src/include/unittype.h Thu Jul 24 15:27:32 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.h,v 1.90 2003/07/22 14:32:22 n0body Exp $
+// $Id: unittype.h,v 1.91 2003/07/24 19:27:32 n0body Exp $
#ifndef __UNITTYPE_H__
#define __UNITTYPE_H__
@@ -254,6 +254,10 @@
**
** Which units can it attack
**
+** Unit::Revealer
+**
+** A special unit used to reveal the map for a time.
+**
** UnitType::LandUnit
**
** Land animated
@@ -302,9 +306,15 @@
**
** Maximum units on board (for transporters)
**
-** UnitType::GivesOil
+** UnitType::GivesResource
+**
+** This equals to the resource Id of the resource given
+** or 0 (TimeCost) for other buildings.
**
-** We get here oil
+** UnitType::MustBuildOnTop
+**
+** Points to the type of building it must be build on or
+** NoUnitP otherwise. Buggy, works for oil platforms.
**
** UnitType::CanStore[::MaxCosts]
**
@@ -338,14 +348,6 @@
**
** FIXME: docu
**
-** UnitType::OilPatch
-**
-** FIXME: docu
-**
-** UnitType::GoldMine
-**
-** FIXME: docu
-**
** UnitType::Hero
**
** FIXME: docu
@@ -568,6 +570,7 @@
#define CanTargetSea 2 /// Can attack sea units
#define CanTargetAir 4 /// Can attack air units
+ unsigned Revealer : 1; /// reveal the fog of war
unsigned LandUnit : 1; /// Land animated
unsigned AirUnit : 1; /// Air animated
unsigned SeaUnit : 1; /// Sea animated
Index: stratagus/src/map/ccl_map.c
diff -u stratagus/src/map/ccl_map.c:1.33 stratagus/src/map/ccl_map.c:1.34
--- stratagus/src/map/ccl_map.c:1.33 Fri Jul 18 16:26:20 2003
+++ stratagus/src/map/ccl_map.c Thu Jul 24 15:27:33 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_map.c,v 1.33 2003/07/18 20:26:20 grumbel Exp $
+// $Id: ccl_map.c,v 1.34 2003/07/24 19:27:33 n0body Exp $
//@{
@@ -289,7 +289,6 @@
//time to cycle, and radius to mark.
// FIXME: Don't use UnitTypeByIdent during runtime.
target = MakeUnit(UnitTypeByIdent("unit-revealer"), ThisPlayer);
- target->Revealer = 1;
target->Orders[0].Action = UnitActionStill;
target->HP = 0;
target->X = gh_scm2int(x);
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.95 stratagus/src/map/map_fog.c:1.96
--- stratagus/src/map/map_fog.c:1.95 Fri Jul 11 10:35:32 2003
+++ stratagus/src/map/map_fog.c Thu Jul 24 15:27:33 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_fog.c,v 1.95 2003/07/11 14:35:32 n0body Exp $
+// $Id: map_fog.c,v 1.96 2003/07/24 19:27:33 n0body Exp $
//@{
@@ -56,6 +56,10 @@
----------------------------------------------------------------------------*/
#ifdef DEBUG
+
+// Uncomment this to see FOW visibility for every tile
+// #define DEBUG_FOG_OF_WAR
+
#define noTIMEIT /// defined time function
#endif
@@ -388,7 +392,7 @@
case 0: // Unexplored
case 1:
// We are at minimum, don't do anything shouldn't
happen.
- DebugCheck( 1 );
+ //DebugCheck( 1 );
break;
case 2:
// Check visible Tile, then deduct...
@@ -2675,7 +2679,7 @@
#endif
// Used to debug NEW_FOW problems
-#if !defined(HIERARCHIC_PATHFINDER) && 0
+#if !defined(HIERARCHIC_PATHFINDER) && defined(DEBUG_FOG_OF_WAR)
extern int VideoDrawText(int x,int y,unsigned font,const unsigned char* text);
#define GameFont 1
{
Index: stratagus/src/unit/ccl_unit.c
diff -u stratagus/src/unit/ccl_unit.c:1.59 stratagus/src/unit/ccl_unit.c:1.60
--- stratagus/src/unit/ccl_unit.c:1.59 Fri Jul 11 10:35:34 2003
+++ stratagus/src/unit/ccl_unit.c Thu Jul 24 15:27:33 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_unit.c,v 1.59 2003/07/11 14:35:34 n0body Exp $
+// $Id: ccl_unit.c,v 1.60 2003/07/24 19:27:33 n0body Exp $
//@{
@@ -717,8 +717,6 @@
} else if( gh_eq_p(value,gh_symbol2scm("rs")) ) {
unit->Rs=gh_scm2int(gh_car(list));
list=gh_cdr(list);
- } else if( gh_eq_p(value,gh_symbol2scm("revealer")) ) {
- unit->Revealer=1;
} else if( gh_eq_p(value,gh_symbol2scm("units-contained-count")) ) {
insidecount=gh_scm2int(gh_car(list));
list=gh_cdr(list);
@@ -812,17 +810,16 @@
UpdateForNewUnit(unit,0);
unit->HP = unit->Type->_HitPoints;
}
- //
+
+ // Revealers are units that can see while removed
+ if ( unit->Removed && unit->Type->Revealer ) {
+ MapMarkSight(unit->Player,unit->X,unit->Y,unit->CurrentSightRange);
+ }
+
// Place on map
- //
if( !unit->Removed && !unit->Destroyed && !unit->Type->Vanishes ) {
unit->Removed=1;
PlaceUnit(unit,unit->X,unit->Y);
-
- //
- // Connect unit to position (on-board,building,in store,in deposite)
- //
- } else {
}
// FIXME: johns: works only for debug code.
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.68
stratagus/src/unit/ccl_unittype.c:1.69
--- stratagus/src/unit/ccl_unittype.c:1.68 Tue Jul 22 10:32:22 2003
+++ stratagus/src/unit/ccl_unittype.c Thu Jul 24 15:27:33 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_unittype.c,v 1.68 2003/07/22 14:32:22 n0body Exp $
+// $Id: ccl_unittype.c,v 1.69 2003/07/24 19:27:33 n0body Exp $
//@{
@@ -263,6 +263,8 @@
} else if( gh_eq_p(value,gh_symbol2scm("num-directions")) ) {
type->NumDirections=gh_scm2int(gh_car(list));
list=gh_cdr(list);
+ } else if( gh_eq_p(value,gh_symbol2scm("revealer")) ) {
+ type->Revealer=1;
} else if( gh_eq_p(value,gh_symbol2scm("sight-range")) ) {
type->_SightRange=gh_scm2int(gh_car(list));
list=gh_cdr(list);
@@ -482,6 +484,7 @@
}
} else {
// FIXME: this leaves a half initialized unit-type
+ printf("\n%s\n",type->Name);
errl("Unsupported tag",value);
}
}
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.78 stratagus/src/unit/unittype.c:1.79
--- stratagus/src/unit/unittype.c:1.78 Tue Jul 22 10:32:22 2003
+++ stratagus/src/unit/unittype.c Thu Jul 24 15:27:33 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.78 2003/07/22 14:32:22 n0body Exp $
+// $Id: unittype.c,v 1.79 2003/07/24 19:27:33 n0body Exp $
//@{
@@ -861,6 +861,9 @@
if( type->Critter ) {
fprintf(file," 'critter\n");
}
+ if( type->Revealer ) {
+ fprintf(file," 'revealer\n");
+ }
if( type->Submarine ) {
fprintf(file," 'submarine\n");
}
@@ -1005,7 +1008,7 @@
int j;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.78 2003/07/22
14:32:22 n0body Exp $\n\n");
+ fprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.79 2003/07/24
19:27:33 n0body Exp $\n\n");
// Original number to internal unit-type name.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus data/ccl/units.ccl src/clone/selectio...,
Crestez Leonard <=