#include "global.h"
#include "viewcalculation.h"
#include "mapalgorithms.h"
#include "vehicletype.h"
#include "buildingtype.h"
#include "errors.h"
#include "gameeventsystem.h"
#include "actions/changeview.h"
#include "actions/viewregistration.h"
Include dependency graph for viewcalculation.cpp:

Go to the source code of this file.
Functions | |
| void | clearvisibility (GameMap *gamemap) |
| VisibilityStates | calcvisibilityfield (GameMap *gamemap, MapField *fld, int player, int add, int initial, int additionalEnemyJamming) |
| calculates the view on a given field. | |
| int | evaluatevisibilityfield (GameMap *gamemap, MapField *fld, int player, int add, int initial) |
| evaluates the view on a given field and saves it for that field. | |
| int | evaluateviewcalculation (GameMap *gamemap, int player_fieldcount_mask, bool disableShareView, const Context *context) |
| evaluates the view on the whole map. | |
| int | evaluateviewcalculation (GameMap *gamemap, const MapCoordinate &pos, int distance, int player_fieldcount_mask, bool disableShareView, const Context *context) |
| evaluates the view on a part of the map. | |
| int | computeview (GameMap *gamemap, int player_fieldcount_mask, bool disableShareView, const Context *context) |
| completely computes the view | |
| int | getPlayersWithSharedViewMask (int player, GameMap *gamemap) |
Variables | |
| SigC::Signal0< void > | buildingSeen |
Definition in file viewcalculation.cpp.
| VisibilityStates calcvisibilityfield | ( | GameMap * | gamemap, | |
| MapField * | fld, | |||
| int | player, | |||
| int | add, | |||
| int | initial, | |||
| int | additionalEnemyJamming | |||
| ) |
calculates the view on a given field.
Radar and jamming values must have already been applied to the field!
| gamemap | the map that contains field | |
| fld | the field to evaluate | |
| player | the player that the view is calculated for | |
| add | a bitmapped variable containing the players that share their view with player | |
| initial | the initial visibility of the map when starting the game. | |
| additionalEnemyJamming | if > 0 run an WhatIf analysis and don't save the result |
Definition at line 249 of file viewcalculation.cpp.
References MapField::building, chsatellit, chschwimmend, MapField::View::direct, ContainerBase::getOwner(), GameMap::getPlayerCount(), getPlayersWithSharedViewMask(), MapField::getVehicle(), Vehicle::height, ContainerBaseType::height, MapField::View::jamming, MapField::View::mine, MapField::mineowner(), MapField::mines, GameMap::player, MapField::View::satellite, MapField::secondvehicle, MapField::View::sonar, Player::stat, Player::supervisor, Building::typ, MapField::view, MapField::View::view, MapField::visible, visible_ago, visible_all, visible_not, and visible_now.
Referenced by ReplayMapDisplay::displayMovingUnit(), and evaluatevisibilityfield().
| void clearvisibility | ( | GameMap * | gamemap | ) |
Definition at line 225 of file viewcalculation.cpp.
References Player::buildingList, GameMap::field, GameMap::getPlayerCount(), GameMap::player, Player::vehicleList, GameMap::xsize, and GameMap::ysize.
Referenced by computeview().
| int computeview | ( | GameMap * | gamemap, | |
| int | player_fieldcount_mask = 0, |
|||
| bool | disableShareView = false, |
|||
| const Context * | context = NULL | |||
| ) |
completely computes the view
| gamemap | the map that the view is generated on | |
| player_fieldcount_mask | bitmapped variable containing the players for whom the changed fields are calculated | |
| disableShareView | sharing the view between different players is disabled. |
Definition at line 450 of file viewcalculation.cpp.
References Player::buildingList, clearvisibility(), evaluateviewcalculation(), Player::exist(), GameMap::getField(), GameMap::getPlayerCount(), GameMap::player, Player::vehicleList, GameMap::xsize, and GameMap::ysize.
Referenced by benchgame(), continueNetworkGame(), editAlliances(), execaction_pg(), trunreplay::execnextreplaymove(), SetViewSharing::execute(), MapModificationEvent::execute(), executeUserAction(), getVisibilityStatistics(), TransferControlCommand::go(), PutMineCommand::go(), JumpDriveCommand::go(), DiplomacyCommand::go(), loadGameFromFile(), loadmap(), loadStartupMap(), WholeMapRenderer::renderVisibility(), trunreplay::run(), runai(), StartMultiplayerGame::start(), startMap(), startnextcampaignmap(), and viewcomp().
| int evaluateviewcalculation | ( | GameMap * | gamemap, | |
| const MapCoordinate & | pos, | |||
| int | distance, | |||
| int | player_fieldcount_mask = 0, |
|||
| bool | disableShareView = false, |
|||
| const Context * | context = NULL | |||
| ) |
evaluates the view on a part of the map.
Radar and jamming values must have already been applied to the field!
| gamemap | the map that the view is calculated of | |
| pos | the central position around which the view is calculated | |
| distance | the radius of the circle around pos in which the view is evaluated. The view is calculated in AT LEAST this circle, in reality it is a rectangle containing this circle. This is not the number of fields, but the distance in points (with 10 points = 1 field) | |
| player_fieldcount_mask | determines, which players should be counted when the view has changed | |
| disableShareView | sharing the view between different players is disabled. |
Definition at line 380 of file viewcalculation.cpp.
References cgp_initialMapVisibility, ActionRegistry::ChangeView, Player::diplomacy, evaluatevisibilityfield(), Player::exist(), GameMap::getField(), GameMap::getgameparameter(), GameMap::getPlayerCount(), maxmalq, GameMap::player, playerNum, DiplomaticStateVector::sharesView(), MapField::visible, MapCoordinate::x, GameMap::xsize, MapCoordinate::y, and GameMap::ysize.
| int evaluateviewcalculation | ( | GameMap * | gamemap, | |
| int | player_fieldcount_mask = 0, |
|||
| bool | disableShareView = false, |
|||
| const Context * | context = NULL | |||
| ) |
evaluates the view on the whole map.
Radar and jamming values must have already been applied to the field!
| gamemap | the map that the view is calculated of | |
| player_fieldcount_mask | determines, which players should be counted when the view has changed | |
| disableShareView | sharing the view between different players is disabled. |
Definition at line 332 of file viewcalculation.cpp.
Referenced by RecalculateAreaView::addView(), computeview(), Reinforcements::execute(), ChangeBuildingOwner::execute(), DestructUnitCommand::go(), DestructBuildingCommand::go(), SpawnUnit::runAction(), SpawnBuilding::runAction(), MoveUnit::runAction(), DestructContainer::runAction(), and VehicleAttackAction::undoAction().
evaluates the view on a given field and saves it for that field.
Calls calcvisibilityfield for the calculation Radar and jamming values must have already been applied to the field!
| gamemap | the map that contains field | |
| fld | the field to evaluate | |
| player | the player that the view is calculated for | |
| add | a bitmapped variable containing the players that share their view with player | |
| initial | the initial visibility of the map when starting the game. |
Definition at line 308 of file viewcalculation.cpp.
References MapField::building, buildingSeen, calcvisibilityfield(), cconnection_seen, Building::connection, MapField::setVisibility(), MapField::visible, visible_ago, visible_all, and visible_now.
Referenced by evaluateviewcalculation(), and MoveUnit::runAction().
| int getPlayersWithSharedViewMask | ( | int | player, | |
| GameMap * | gamemap | |||
| ) |
Definition at line 474 of file viewcalculation.cpp.
References Player::diplomacy, Player::exist(), GameMap::getPlayerCount(), GameMap::player, and DiplomaticStateVector::sharesView().
Referenced by calcvisibilityfield(), and evaluateviewcalculation().
| SigC::Signal0<void> buildingSeen |
Definition at line 34 of file viewcalculation.cpp.
Referenced by BuildingSeen::arm(), and evaluatevisibilityfield().
1.5.1