[+]New unit-type flag "NonSolid", which allow the building to be entered by other units. The same behaviour occur if you set the building's health to 0.
Patch from Cybermind
This commit is contained in:
parent
b1365caee7
commit
9ef297b3a7
3 changed files with 13 additions and 6 deletions
src
|
@ -645,6 +645,7 @@ enum {
|
|||
TELEPORTER_INDEX,
|
||||
SHIELDPIERCE_INDEX,
|
||||
SAVECARGO_INDEX,
|
||||
NONSOLID_INDEX,
|
||||
WALL_INDEX,
|
||||
NBARALREADYDEFINED
|
||||
};
|
||||
|
@ -1011,6 +1012,7 @@ public:
|
|||
unsigned Teleporter : 1; /// Can teleport other units.
|
||||
unsigned ShieldPiercing : 1; /// Can directly damage shield-protected units, without shield damaging.
|
||||
unsigned SaveCargo : 1; /// Unit unloads his passengers after death.
|
||||
unsigned NonSolid : 1; /// Unit can be entered by other units.
|
||||
unsigned Wall : 1; /// Use special logic for Direction field.
|
||||
|
||||
CVariable *Variable; /// Array of user defined variables.
|
||||
|
|
|
@ -106,7 +106,9 @@ static const char INDESTRUCTIBLE_KEY[] = "Indestructible";
|
|||
static const char TELEPORTER_KEY[] = "Teleporter";
|
||||
static const char SHIELDPIERCE_KEY[] = "ShieldPiercing";
|
||||
static const char SAVECARGO_KEY[] = "LoseCargo";
|
||||
static const char NONSOLID_KEY[] = "NonSolid";
|
||||
static const char WALL_KEY[] = "Wall";
|
||||
|
||||
// names of the variable.
|
||||
static const char HITPOINTS_KEY[] = "HitPoints";
|
||||
static const char BUILD_KEY[] = "Build";
|
||||
|
@ -154,7 +156,7 @@ CUnitTypeVar::CBoolKeys::CBoolKeys() {
|
|||
SHOREBUILDING_KEY, CANATTACK_KEY,BUILDEROUTSIDE_KEY,
|
||||
BUILDERLOST_KEY,CANHARVEST_KEY,HARVESTER_KEY,SELECTABLEBYRECTANGLE_KEY,
|
||||
ISNOTSELECTABLE_KEY,DECORATION_KEY,INDESTRUCTIBLE_KEY,TELEPORTER_KEY,SHIELDPIERCE_KEY,
|
||||
SAVECARGO_KEY, WALL_KEY};
|
||||
SAVECARGO_KEY, NONSOLID_KEY, WALL_KEY};
|
||||
|
||||
for (int i = 0; i < NBARALREADYDEFINED; ++i) {
|
||||
buildin[i].offset = i;
|
||||
|
@ -1049,6 +1051,8 @@ static int CclDefineUnitType(lua_State *l)
|
|||
type->ShieldPiercing = LuaToBoolean(l, -1);
|
||||
} else if (!strcmp(value, "SaveCargo")) {
|
||||
type->SaveCargo = LuaToBoolean(l, -1);
|
||||
} else if (!strcmp(value, "NonSolid")) {
|
||||
type->NonSolid = LuaToBoolean(l, -1);
|
||||
} else if (!strcmp(value, "Wall")) {
|
||||
type->Wall = LuaToBoolean(l, -1);
|
||||
} else if (!strcmp(value, "Sounds")) {
|
||||
|
@ -2304,6 +2308,7 @@ void UpdateUnitVariables(const CUnit &unit)
|
|||
type->BoolFlag[TELEPORTER_INDEX].value = type->Teleporter;
|
||||
type->BoolFlag[SHIELDPIERCE_INDEX].value = type->ShieldPiercing;
|
||||
type->BoolFlag[SAVECARGO_INDEX].value = type->SaveCargo;
|
||||
type->BoolFlag[NONSOLID_INDEX].value = type->NonSolid;
|
||||
type->BoolFlag[WALL_INDEX].value = type->Wall;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ CUnitType::CUnitType() :
|
|||
BuilderOutside(0), BuilderLost(0), CanHarvest(0), Harvester(0),
|
||||
Neutral(0), SelectableByRectangle(0), IsNotSelectable(0), Decoration(0),
|
||||
Indestructible(0), Teleporter(0), ShieldPiercing(0), SaveCargo(0),
|
||||
Wall(0), Variable(NULL),
|
||||
NonSolid(0), Wall(0), Variable(NULL),
|
||||
GivesResource(0), Supply(0), Demand(0), FieldFlags(0), MovementMask(0),
|
||||
Sprite(NULL), ShadowSprite(NULL)
|
||||
{
|
||||
|
@ -289,13 +289,13 @@ void UpdateStats(int reset)
|
|||
}
|
||||
type->MovementMask |= MapFieldNoBuilding;
|
||||
//
|
||||
// A little chaos, buildings without HP can be entered.
|
||||
// A little chaos, buildings without HP or with special flag can be entered.
|
||||
// The oil-patch is a very special case.
|
||||
//
|
||||
if (type->Variable[HP_INDEX].Max) {
|
||||
type->FieldFlags = MapFieldBuilding;
|
||||
} else {
|
||||
if (type->NonSolid || !type->Variable[HP_INDEX].Max) {
|
||||
type->FieldFlags = MapFieldNoBuilding;
|
||||
} else {
|
||||
type->FieldFlags = MapFieldBuilding;
|
||||
}
|
||||
} else switch (type->UnitType) {
|
||||
case UnitTypeLand: // on land
|
||||
|
|
Loading…
Add table
Reference in a new issue