Skip to content

Commit

Permalink
Fix batch
Browse files Browse the repository at this point in the history
- Fixed agents refusing to move
- Fixed crash when exploding a weapon with empty clip
- Fixed crash when opening agent inventory with 0 agents
- Fixed mission abort algorithm that calculates who can retreat and who
dies
- Fixed crash when vehicle attacks vehicle
- Fixed crash when trying to use ground vehicles (disabled them until
they're implemented)
- Fixed single vehicle ordered around not using teleporter
- Fixed vehicle trying to shoot down any projectile, including beams
  • Loading branch information
Istrebitel committed Sep 27, 2017
1 parent 14bfec9 commit 712fc26
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions game/state/aequipment.cpp
Expand Up @@ -633,8 +633,8 @@ void AEquipment::explode(GameState &state)
case AEquipmentType::Type::Ammo:
{
auto payload = getPayloadType();
// If brainsucker then nothing
if (payload->damage_type->effectType == DamageType::EffectType::Brainsucker)
// If no payload or brainsucker then nothing
if (!payload || payload->damage_type->effectType == DamageType::EffectType::Brainsucker)
{
break;
}
Expand Down
2 changes: 1 addition & 1 deletion game/state/battle/battle.cpp
Expand Up @@ -1945,7 +1945,7 @@ int Battle::killStrandedUnits(GameState &state, StateRef<Organisation> org, bool
}
}
// Exit must be three times closer than enemy for escape to be possible
if (distanceToEnemy / 3.0f > distanceToExit)
if (distanceToEnemy / 3.0f < distanceToExit)
{
countKilled++;
if (!preview)
Expand Down
2 changes: 1 addition & 1 deletion game/state/battle/battleunitmission.cpp
Expand Up @@ -1906,7 +1906,7 @@ void BattleUnitMission::start(GameState &state, BattleUnit &u)
currentPlannedPath.clear();
}
}
if (currentPlannedPath.empty() == 0)
if (currentPlannedPath.empty())
{
this->setPathTo(state, u, targetLocation);
}
Expand Down
9 changes: 7 additions & 2 deletions game/state/city/vehicle.cpp
Expand Up @@ -1010,8 +1010,8 @@ sp<TileObjectProjectile> Vehicle::findClosestHostileMissile(GameState &state,
sp<TileObjectProjectile> closestEnemy;
for (auto &projectile : state.current_city->projectiles)
{
// Can't shoot down non-homing projectiles
if (!projectile->trackedVehicle)
// Can't shoot down projectiles w/o voxelMap
if (!projectile->voxelMap)
{
continue;
}
Expand Down Expand Up @@ -1304,6 +1304,11 @@ bool Vehicle::addMission(GameState &state, VehicleMission *mission, bool toBack)

bool Vehicle::setMission(GameState &state, VehicleMission *mission)
{
if (type->type == VehicleType::Type::Ground)
{
LogError("Ground vehicles not yet implemented!");
return true;
}
missions.clear();
missions.emplace_front(mission);
missions.front()->start(state, *this);
Expand Down
2 changes: 1 addition & 1 deletion game/state/tileview/pathfinding.cpp
Expand Up @@ -1174,7 +1174,7 @@ void City::groupMove(GameState &state, std::list<StateRef<Vehicle>> &selectedVeh

Vec3<int> targetPos{targetLocation.x, targetLocation.y, altitude};
// FIXME: Don't clear missions if not replacing current mission
v->setMission(state, VehicleMission::gotoLocation(state, *v, targetPos));
v->setMission(state, VehicleMission::gotoLocation(state, *v, targetPos, useTeleporter));
}
return;
}
Expand Down
3 changes: 0 additions & 3 deletions game/state/tileview/tileobject_shadow.cpp
Expand Up @@ -116,9 +116,6 @@ void TileObjectShadow::setPosition(Vec3<float> newPosition)
}
else
{
// May be a normal occurance (e.g. landing pads have a 'hole'
LogInfo("Nothing beneath {%f,%f,%f} to receive shadow", newPosition.x, newPosition.y,
newPosition.z);
shadowPosition.z = 0;
// Mark it as not to be drawn
this->fellOffTheBottomOfTheMap = true;
Expand Down
5 changes: 3 additions & 2 deletions game/ui/base/aequipscreen.cpp
Expand Up @@ -960,12 +960,13 @@ AEquipScreen::Mode AEquipScreen::getMode()
// vehicles

// If viewing an enemy
if (currentAgent->unit && currentAgent->unit->owner != state->current_battle->currentPlayer)
if (currentAgent && currentAgent->unit &&
currentAgent->unit->owner != state->current_battle->currentPlayer)
{
return Mode::Enemy;
}
// If agent in battle
if (currentAgent->unit && currentAgent->unit->tileObject)
if (currentAgent && currentAgent->unit && currentAgent->unit->tileObject)
{
return Mode::Battle;
}
Expand Down
2 changes: 1 addition & 1 deletion game/ui/city/cityview.cpp
Expand Up @@ -1370,7 +1370,7 @@ bool CityView::handleMouseDown(Event *e)
if (vehicle)
{
orderAttack(
StateRef<Building>{state.get(), Vehicle::getId(*state, vehicle)});
StateRef<Vehicle>{state.get(), Vehicle::getId(*state, vehicle)});
setSelectionState(SelectionState::Normal);
}
break;
Expand Down
1 change: 1 addition & 0 deletions tools/extractors/docs/video.txt
Expand Up @@ -11,6 +11,7 @@ City:
- vehicles dodge attacks
- vehicles auto-adjust height
- point defense
- teleport

Battle:

Expand Down

0 comments on commit 712fc26

Please sign in to comment.