Prepared new orders.

This commit is contained in:
johns 2001-01-24 01:25:02 +00:00
parent befbb4c51e
commit ce0a331413
4 changed files with 79 additions and 13 deletions

View file

@ -9,11 +9,10 @@
// FreeCraft - A free fantasy real time strategy game engine
//
/**@name map_fog.c - The map fog of war handling. */
/*
** (c) Copyright 1999,2000 by Lutz Sammer and Vladi Shabanski
**
** $Id$
*/
//
// (c) Copyright 1999-2001 by Lutz Sammer and Vladi Shabanski
//
// $Id$
//@{
@ -338,7 +337,11 @@ global void MapUpdateVisible(void)
// This is not a big deal as far as only mines are
// concerned, but for more units (like parasited ones
// in *craft), maybe we should create a dedicated queue...
#ifdef NEW_ORDERS
if( unit->Orders[0].Action==UnitActionMineGold ) {
#else
if( unit->Command.Action==UnitActionMineGold ) {
#endif
mine=GoldMineOnMap(unit->X,unit->Y);
if( mine ) { // Somtimes, the peon is at home :).
#ifdef NEW_FOW

View file

@ -660,9 +660,16 @@ global void FireMissile(Unit* unit)
// None missile hits immediately!
//
if( ((MissileType*)unit->Type->Missile.Missile)->Class==MissileClassNone ) {
#ifdef NEW_ORDERS
// No goal, take target coordinates
if( !(goal=unit->Orders[0].Goal) ) {
dx=unit->Orders[0].X;
dy=unit->Orders[0].Y;
#else
if( !(goal=unit->Command.Data.Move.Goal) ) {
dx=unit->Command.Data.Move.DX;
dy=unit->Command.Data.Move.DY;
#endif
if( WallOnMap(dx,dy) ) {
if( HumanWallOnMap(dx,dy) ) {
// FIXME: don't use UnitTypeByIdent here, this is slow!
@ -692,7 +699,12 @@ global void FireMissile(Unit* unit)
ReleaseUnit(goal);
}
// FIXME: should I clear this here?
#ifdef NEW_ORDERS
goal=unit->Orders[0].Goal=NULL;
#else
unit->Command.Data.Move.Goal=NULL;
#endif
return;
}
if( goal->Removed ) {
@ -704,10 +716,18 @@ global void FireMissile(Unit* unit)
#ifdef REFS_DEBUG
DebugCheck( !goal->Refs );
#endif
#ifdef NEW_ORDERS
goal=unit->Orders[0].Goal=NULL;
#else
unit->Command.Data.Move.Goal=NULL;
#endif
return;
}
#ifdef NEW_ORDERS
if( !goal->HP || goal->Orders[0].Action==UnitActionDie ) {
#else
if( !goal->HP || goal->Command.Action==UnitActionDie ) {
#endif
DebugLevel3Fn("Missile-none hits dead unit!\n");
#ifdef REFS_DEBUG
DebugCheck( !goal->Refs );
@ -716,7 +736,11 @@ global void FireMissile(Unit* unit)
#ifdef REFS_DEBUG
DebugCheck( !goal->Refs );
#endif
#ifdef NEW_ORDERS
goal=unit->Orders[0].Goal=NULL;
#else
unit->Command.Data.Move.Goal=NULL;
#endif
return;
}
@ -729,7 +753,11 @@ global void FireMissile(Unit* unit)
x=unit->X*TileSizeX+TileSizeX/2; // missile starts in tile middle
y=unit->Y*TileSizeY+TileSizeY/2;
#ifdef NEW_ORDERS
if( (goal=unit->Orders[0].Goal) ) {
#else
if( (goal=unit->Command.Data.Move.Goal) ) {
#endif
// Check if goal is correct unit.
if( goal->Destroyed ) {
DebugLevel0Fn("destroyed unit\n");
@ -740,7 +768,11 @@ global void FireMissile(Unit* unit)
ReleaseUnit(goal);
}
// FIXME: should I clear this here?
#ifdef NEW_ORDERS
goal=unit->Orders[0].Goal=NULL;
#else
unit->Command.Data.Move.Goal=NULL;
#endif
return;
}
DebugCheck( !goal->Type ); // Target invalid?
@ -748,8 +780,13 @@ global void FireMissile(Unit* unit)
NearestOfUnit(goal,unit->X,unit->Y,&dx,&dy);
DebugLevel3Fn("Fire to unit at %d,%d\n",dx,dy);
} else {
#ifdef NEW_ORDERS
dx=unit->Orders[0].X;
dy=unit->Orders[0].Y;
#else
dx=unit->Command.Data.Move.DX;
dy=unit->Command.Data.Move.DY;
#endif
}
//

View file

@ -9,11 +9,10 @@
// FreeCraft - A free fantasy real time strategy game engine
//
/**@name selection.c - The units' selection. */
/*
** (c) Copyright 1999,2000 by Patrice Fortier
**
** $Id$
*/
//
// (c) Copyright 1999-2001 by Patrice Fortier
//
// $Id$
//@{
@ -188,9 +187,15 @@ global int SelectUnitsByType(Unit* base)
// if unit is a cadaver or hidden (not on map)
// no unit can be selected.
#ifdef NEW_ORDERS
if( base->Removed || base->Orders[0].Action==UnitActionDie ) {
return 0;
}
#else
if( base->Removed || base->Command.Action==UnitActionDie ) {
return 0;
}
#endif
UnSelectAll();
Selected[0]=base;
@ -386,10 +391,17 @@ global int SelectUnitsInRectangle(int tx,int ty,int w,int h)
continue;
}
// FIXME: Can we get this?
#ifdef NEW_ORDERS
if( !unit->Removed && unit->Orders[0].Action!=UnitActionDie ) {
SelectSingleUnit(unit);
return 1;
}
#else
if( !unit->Removed && unit->Command.Action!=UnitActionDie ) {
SelectSingleUnit(unit);
return 1;
}
#endif
}
//
@ -432,10 +444,17 @@ global int SelectUnitsInRectangle(int tx,int ty,int w,int h)
// FIXME: isn't it enough to see a field of the building?
continue;
}
#ifdef NEW_ORDERS
if( !unit->Removed && unit->Orders[0].Action!=UnitActionDie ) {
SelectSingleUnit(unit);
return 1;
}
#else
if( !unit->Removed && unit->Command.Action!=UnitActionDie ) {
SelectSingleUnit(unit);
return 1;
}
#endif
}
return 0;

View file

@ -3,7 +3,7 @@
// | __) \_ __ \_/ __ \_/ __ \/ \ \/\_ __ \__ \\ __\\ __\
// | \ | | \/\ ___/\ ___/\ \____| | \// __ \| | | |
// \___ / |__| \___ >\___ >\______ /|__| (____ /__| |__|
// \/ \/ \/ \/ \/
// \/ \/ \/ \/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// FreeCraft - A free fantasy real time strategy game engine
@ -728,8 +728,15 @@ global int SpellCast( int SpellId, Unit* unit, Unit* target, int x, int y )
for( i=0; i<NumUnits; ++i ) {
// FIXME: this tries to draw all corps, ohje
if( (Units[i]->Type->Vanishes || Units[i]->Command.Action==UnitActionDie)
&& Units[i]->X == x && Units[i]->Y == y ) {
#ifdef NEW_ORDERS
if( (Units[i]->Type->Vanishes
|| Units[i]->Orders[0].Action==UnitActionDie)
&& Units[i]->X == x && Units[i]->Y == y ) {
#else
if( (Units[i]->Type->Vanishes
|| Units[i]->Command.Action==UnitActionDie)
&& Units[i]->X == x && Units[i]->Y == y ) {
#endif
//FIXME: URGENT: remove corpse
//RemoveUnit( Units[i] );
//UnitLost( Units[i] );