Make NEW_FOW default and move from using Host Pointer to Next Pointer
This commit is contained in:
parent
1cdc4f5726
commit
238c49231f
4 changed files with 22 additions and 28 deletions
|
@ -231,7 +231,7 @@ IFLAGS= -I$(TOPDIR)/src/include $(XIFLAGS) -I$(TOPDIR)/src/movie/vp31/include
|
|||
## USE_LUA Lua scripting support
|
||||
DFLAGS= $(THREAD) $(CCL) $(VERSION) $(VIDEO) $(ZDEFS) $(DSOUND) $(DEBUG) \
|
||||
-DHAVE_EXPANSION -DUNIT_ON_MAP -DNEW_AI -DUSE_FLAC -DUSE_OGG -DUSE_MAD \
|
||||
-DUSE_HP_FOR_XP # -DNEW_MAPDRAW=1 -DNEW_FOW -DNEW_SHIPS
|
||||
-DUSE_HP_FOR_XP -DNEW_FOW # -DNEW_MAPDRAW=1 -DNEW_SHIPS
|
||||
|
||||
## choose optimise level
|
||||
#CFLAGS=-g -O0 $(PROFILE) -pipe -Wcast-align -Wall -Werror $(IFLAGS) $(DFLAGS)
|
||||
|
|
|
@ -82,9 +82,10 @@
|
|||
**
|
||||
** A generic link pointer. This member is currently used, if an
|
||||
** unit is on the map, to link all units on the same map field
|
||||
** together. This member is currently unused, if the unit is
|
||||
** removed (see Unit::Removed). F.E.: A worker is removed, if he
|
||||
** is in a mine or depot. Or an unit is on board a transporter.
|
||||
** together. This member points the the unit that the current
|
||||
** is onboard/inside when a unit is removed (see Unit::Removed).
|
||||
** F.E.: A worker is removed, if he is in a mine or depot.
|
||||
** Or an unit is on board a transporter.
|
||||
**
|
||||
** Unit::Name
|
||||
**
|
||||
|
@ -118,12 +119,6 @@
|
|||
** unit. (Unit::Stats::SightRange, Unit::Stats::Armor,
|
||||
** Unit::Stats::HitPoints, ...)
|
||||
**
|
||||
** Unit::Host
|
||||
**
|
||||
** The unit that the current unit is on board. Used to obtain
|
||||
** information from parent unit. The new fog of war uses the
|
||||
** host's sight range.
|
||||
**
|
||||
** Unit::CurrentSightRange
|
||||
**
|
||||
** Current sight range of a unit, this changes when a unit enters
|
||||
|
@ -481,7 +476,6 @@ struct _unit_ {
|
|||
Player* Player; /// Owner of this unit
|
||||
UnitStats* Stats; /// Current unit stats
|
||||
#ifdef NEW_FOW
|
||||
Unit* Host; /// Unit that this unit is inside
|
||||
int CurrentSightRange; /// Unit's Current Sight Range
|
||||
#endif
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ local SCM CclUnit(SCM list)
|
|||
unit->Reset=0; // JOHNS ????
|
||||
DebugCheck( unit->Slot!=slot );
|
||||
} else if( gh_eq_p(value,gh_symbol2scm("next")) ) {
|
||||
value=gh_car(list);
|
||||
unit->Next=UnitSlots[gh_scm2int(gh_car(list))];
|
||||
list=gh_cdr(list);
|
||||
DebugLevel0Fn("FIXME: 'next of unit %d\n" _C_ slot);
|
||||
#if 0
|
||||
|
@ -564,9 +564,7 @@ local SCM CclUnit(SCM list)
|
|||
} else if( gh_eq_p(value,gh_symbol2scm("currentsightrange")) ) {
|
||||
unit->CurrentSightRange=gh_scm2int(gh_car(list));
|
||||
list=gh_cdr(list);
|
||||
} else if( gh_eq_p(value,gh_symbol2scm("host")) ) {
|
||||
unit->Host=UnitSlots[gh_scm2int(gh_car(list))];
|
||||
list=gh_cdr(list);
|
||||
} else if( gh_eq_p(value,gh_symbol2scm("hosttile")) ) {
|
||||
value=gh_car(list);
|
||||
list=gh_cdr(list);
|
||||
MapMarkSight(player,gh_scm2int(gh_car(value)),
|
||||
|
|
|
@ -487,13 +487,12 @@ global void PlaceUnit(Unit* unit,int x,int y)
|
|||
//
|
||||
// Update fog of war, if unit belongs to player on this computer
|
||||
//
|
||||
if( unit->Host && !unit->Host->Data.Builded.Cancel ) {
|
||||
MapUnmarkSight(unit->Player,unit->Host->X+unit->Host->Type->TileWidth/2
|
||||
,unit->Host->Y+unit->Host->Type->TileHeight/2
|
||||
if( unit->Next && !unit->Next->Data.Builded.Cancel && unit->Removed ) {
|
||||
MapUnmarkSight(unit->Player,unit->Next->X+unit->Next->Type->TileWidth/2
|
||||
,unit->Next->Y+unit->Next->Type->TileHeight/2
|
||||
,unit->CurrentSightRange);
|
||||
|
||||
unit->Host = NULL;
|
||||
}
|
||||
unit->Next = NULL;
|
||||
unit->CurrentSightRange=unit->Type->Stats->SightRange;
|
||||
MapMarkSight(unit->Player,x,y,unit->CurrentSightRange);
|
||||
#else
|
||||
|
@ -593,7 +592,9 @@ global void RemoveUnit(Unit* unit, Unit* host)
|
|||
}
|
||||
}
|
||||
if( host ) {
|
||||
unit->Host=host;
|
||||
unit->Next=host;
|
||||
} else {
|
||||
unit->Next=NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -690,7 +691,9 @@ global void RemoveUnit(Unit* unit, Unit* host)
|
|||
|
||||
DebugLevel3Fn("%d %p %p\n" _C_ UnitNumber(unit) _C_ unit _C_ unit->Next);
|
||||
UnitCacheRemove(unit);
|
||||
|
||||
// UnitCache uses Next, need to set next again
|
||||
unit->Next=host;
|
||||
|
||||
MustRedraw|=RedrawMinimap;
|
||||
CheckUnitToBeDrawn(unit);
|
||||
}
|
||||
|
@ -3821,8 +3824,7 @@ global void SaveUnit(const Unit* unit,FILE* file)
|
|||
}
|
||||
|
||||
if( unit->Next ) {
|
||||
fprintf(file,"'next '%s ",ref=UnitReference(unit->Next));
|
||||
free(ref);
|
||||
fprintf(file,"'next '%d ",UnitNumber(unit->Next));
|
||||
}
|
||||
|
||||
fprintf(file,"'tile '(%d %d) ",unit->X,unit->Y);
|
||||
|
@ -3869,10 +3871,10 @@ global void SaveUnit(const Unit* unit,FILE* file)
|
|||
fprintf(file," 'selected");
|
||||
}
|
||||
#ifdef NEW_FOW
|
||||
if( unit->Host ) {
|
||||
fprintf(file," 'host %d '(%d %d)",UnitNumber(unit->Host),
|
||||
unit->Host->X+unit->Host->Type->TileWidth/2,
|
||||
unit->Host->Y+unit->Host->Type->TileHeight/2);
|
||||
if( unit->Next && unit->Removed ) {
|
||||
fprintf(file," 'hosttile '(%d %d) ",
|
||||
unit->Next->X+unit->Next->Type->TileWidth/2,
|
||||
unit->Next->Y+unit->Next->Type->TileHeight/2);
|
||||
}
|
||||
#endif
|
||||
fprintf(file," 'visible \"");
|
||||
|
|
Loading…
Add table
Reference in a new issue