mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 05:13:59 +02:00
Now water buildings are supported properly
This commit is contained in:
@@ -772,8 +772,9 @@ namespace Game {
|
|||||||
isInside(pos) &&
|
isInside(pos) &&
|
||||||
isInsideSurface(toSurfCoords(pos)) &&
|
isInsideSurface(toSurfCoords(pos)) &&
|
||||||
(getCell(pos)->isFree(field) ? true : (buildingsOnly && !getCell(pos)->getUnit(field)->getType()->hasSkillClass(scBeBuilt))) &&
|
(getCell(pos)->isFree(field) ? true : (buildingsOnly && !getCell(pos)->getUnit(field)->getType()->hasSkillClass(scBeBuilt))) &&
|
||||||
(SkillType::toActualField(field) == fAir || getSurfaceCell(toSurfCoords(pos))->isFree()) &&
|
(SkillType::toActualField(field) == fAir ||
|
||||||
(SkillType::toActualField(field) == fAir || ((field & fWater) == fWater ? ((field & fLand) == fLand ? true : getDeepSubmerged(getCell(pos))) : !getDeepSubmerged(getCell(pos))));
|
(getSurfaceCell(toSurfCoords(pos))->isFree() &&
|
||||||
|
((field & fWater) == fWater ? ((field & fLand) == fLand ? true : getDeepSubmerged(getCell(pos))) : !getDeepSubmerged(getCell(pos)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1064,7 +1064,7 @@ namespace Game {
|
|||||||
Unit *builtUnit = new Unit(world->getNextUnitId(unit->getFaction()), newpath, buildPos, builtUnitType, unit->getFaction(), world->getMap(), facing);
|
Unit *builtUnit = new Unit(world->getNextUnitId(unit->getFaction()), newpath, buildPos, builtUnitType, unit->getFaction(), world->getMap(), facing);
|
||||||
if (toleratePos)
|
if (toleratePos)
|
||||||
builtUnit->setPos(pathFinder->computeNearestFreePos(builtUnit, buildPos, false, true));
|
builtUnit->setPos(pathFinder->computeNearestFreePos(builtUnit, buildPos, false, true));
|
||||||
if (world->getMap()->isFreeCells(builtUnit->getPos(), builtUnit->getType()->getSize(), builtUnit->getCurrField(), true)) {
|
if (world->getMap()->isFreeCells(builtUnit->getPos(), builtUnit->getType()->getSize(), (builtUnit->getCurrField() & fAir) == fAir ? fAir : fLandWater, true)) {
|
||||||
if (SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__);
|
if (SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__);
|
||||||
|
|
||||||
builtUnit->create();
|
builtUnit->create();
|
||||||
|
Reference in New Issue
Block a user