Skip to content

Commit

Permalink
made stealthed attackers reveal Basic Visibility of themselves to the…
Browse files Browse the repository at this point in the history
…ir targets
  • Loading branch information
Dilvish-fo committed May 2, 2015
1 parent d453abb commit d1da5f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 10 additions & 2 deletions combat/CombatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,10 +889,18 @@ namespace {
// do actual attacks
Attack(attacker, *weapon_it, target, combat_state.combat_info, bout, round);

// mark attackers as valid targets for attacked object's owners, so
// attacker they can be counter-attacked in subsequent rounds if it
// mark attacker as valid target for attacked object's owner, so that regardless
// of visibility the attacker can be counter-attacked in subsequent rounds if it
// was not already attackable
combat_state.empire_infos[target->Owner()].target_ids.insert(attacker->ID());
// Also ensure that attacker (and their fleet if attacker was a ship) are
// revealed with at least BASIC_VISIBILITY to the taget empire
combat_state.combat_info.empire_object_visibility[target->Owner()][attacker->ID()] =
std::max(GetUniverse().GetObjectVisibilityByEmpire(attacker->ID(), target->Owner()), VIS_BASIC_VISIBILITY);
if (attacker->ObjectType() == OBJ_SHIP && attacker->ContainerObjectID() != INVALID_OBJECT_ID) {
combat_state.combat_info.empire_object_visibility[target->Owner()][attacker->ContainerObjectID()] =
std::max(GetUniverse().GetObjectVisibilityByEmpire(attacker->ContainerObjectID(), target->Owner()), VIS_BASIC_VISIBILITY);
}
} // end for over weapons
}

Expand Down
12 changes: 12 additions & 0 deletions server/ServerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,16 @@ namespace {
// indexed by fleet id, which empire ids to inform that a fleet is destroyed
std::map<int, std::set<int> > empires_to_update_of_fleet_destruction;

// update visibilities.
for (Universe::EmpireObjectVisibilityMap::const_iterator empire_it = combat_info.empire_object_visibility.begin();
empire_it != combat_info.empire_object_visibility.end(); ++empire_it)
{
for (Universe::ObjectVisibilityMap::const_iterator object_it = empire_it->second.begin(); object_it != empire_it->second.end(); ++object_it) {
Visibility vis = object_it->second;
universe.SetEmpireObjectVisibility(empire_it->first, object_it->first, vis);
}
}

// update which empires know objects are destroyed. this may
// duplicate the destroyed object knowledge that is set when the
// object is destroyed with Universe::Destroy, but there may also
Expand Down Expand Up @@ -2745,6 +2755,8 @@ void ServerApp::ProcessCombats() {
UpdateEmpireCombatDestructionInfo(combats);

DisseminateSystemCombatInfo(combats);
// update visibilities with any new info gleaned during combat
m_universe.UpdateEmpireLatestKnownObjectsAndVisibilityTurns();

CreateCombatSitReps(combats);

Expand Down

0 comments on commit d1da5f5

Please sign in to comment.