Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

viewcalculation.cpp File Reference

functions for calculating the view of units and buildings More...

#include "global.h"
#include "viewcalculation.h"
#include "mapalgorithms.h"
#include "vehicletype.h"
#include "buildingtype.h"
#include "errors.h"
#include "gameeventsystem.h"

Include dependency graph for viewcalculation.cpp:

Go to the source code of this file.

Functions

void clearvisibility (GameMap *gamemap, int reset)
VisibilityStates calcvisibilityfield (GameMap *gamemap, tfield *fld, int player, int add, int initial, int additionalEnemyJamming)
 calculates the view on a given field.
int evaluatevisibilityfield (GameMap *gamemap, tfield *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)
 evaluates the view on the whole map.
int evaluateviewcalculation (GameMap *gamemap, const MapCoordinate &pos, int distance, int player_fieldcount_mask, bool disableShareView)
 evaluates the view on a part of the map.
int computeview (GameMap *gamemap, int player_fieldcount_mask, bool disableShareView)
 completely computes the view
int getPlayersWithSharedViewMask (int player, GameMap *gamemap)

Variables

SigC::Signal0< void > buildingSeen


Detailed Description

functions for calculating the view of units and buildings

Definition in file viewcalculation.cpp.


Function Documentation

VisibilityStates calcvisibilityfield GameMap gamemap,
tfield 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!

Parameters:
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 244 of file viewcalculation.cpp.

References tfield::building, BuildingType::buildingheight, chsatellit, chschwimmend, tfield::View::direct, ContainerBase::getOwner(), getPlayersWithSharedViewMask(), Vehicle::height, tfield::View::jamming, tfield::View::mine, tfield::mineowner(), tfield::mines, GameMap::player, tfield::View::satellite, tfield::View::sonar, Player::stat, Player::supervisor, Building::typ, tfield::vehicle, tfield::view, tfield::View::view, tfield::visible, visible_ago, visible_all, visible_not, and visible_now.

Referenced by ReplayMapDisplay::displayMovingUnit(), and evaluatevisibilityfield().

void clearvisibility GameMap gamemap,
int  reset
 

Definition at line 222 of file viewcalculation.cpp.

References tfield::view.

Referenced by computeview().

int computeview GameMap gamemap,
int  player_fieldcount_mask = 0,
bool  disableShareView = false
 

completely computes the view

Parameters:
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.
Returns:
the number of fields that have a changed visibility for the given players. If nothing changes, the map must not be displayed again after the view calculation

Definition at line 387 of file viewcalculation.cpp.

References Vehicle::addview(), clearvisibility(), evaluateviewcalculation(), and Vehicle::getPosition().

Referenced by benchgame(), continuenetworkgame(), destructbuildinglevel2(), diplomaticChange(), execaction_pg(), trunreplay::execnextreplaymove(), execuseraction(), execuseraction2(), GuiFunctions::BuildingConstruction::execute(), SetViewSharing::execute(), getVisibilityStatistics(), loadGame(), loadmap(), loadStartupMap(), putMine(), trunreplay::run(), tgiveunitawaydlg::run(), runai(), StartMultiplayerGame::start(), startnextcampaignmap(), and viewcomp().

int evaluateviewcalculation GameMap gamemap,
const MapCoordinate pos,
int  distance,
int  player_fieldcount_mask = 0,
bool  disableShareView = false
 

evaluates the view on a part of the map.

Radar and jamming values must have already been applied to the field!

Parameters:
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.
player_fieldcount_mask determines, which players should be counted when the view has changed
disableShareView sharing the view between different players is disabled.
Returns:
the number of fields which have a changed visibility status

Definition at line 344 of file viewcalculation.cpp.

References cgp_initialMapVisibility, Player::diplomacy, evaluatevisibilityfield(), Player::exist(), GameMap::getField(), GameMap::getgameparameter(), maxmalq, GameMap::player, DiplomaticStateVector::sharesView(), MapCoordinate::x, GameMap::xsize, MapCoordinate::y, and GameMap::ysize.

int evaluateviewcalculation GameMap gamemap,
int  player_fieldcount_mask = 0,
bool  disableShareView = false
 

evaluates the view on the whole map.

Radar and jamming values must have already been applied to the field!

Parameters:
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.
Returns:
the number of fields which have a changed visibility status

Definition at line 323 of file viewcalculation.cpp.

Referenced by RecalculateAreaView::addView(), computeview(), SelfDestruct::destruct(), VehicleAttack::execute(), GuiFunctions::VehicleBuildingGui::execute(), Reinforcements::execute(), ChangeBuildingOwner::execute(), JumpDrive::jump(), and BaseVehicleMovement::moveunitxy().

int evaluatevisibilityfield GameMap gamemap,
tfield fld,
int  player,
int  add,
int  initial
 

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!

Parameters:
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 299 of file viewcalculation.cpp.

References tfield::building, buildingSeen, calcvisibilityfield(), cconnection_seen, Building::connection, tfield::setVisibility(), tfield::visible, visible_ago, visible_all, and visible_now.

Referenced by tsearchreactionfireingunits::checkfield(), evaluateviewcalculation(), and BaseVehicleMovement::moveunitxy().

int getPlayersWithSharedViewMask int  player,
GameMap gamemap
 

Definition at line 412 of file viewcalculation.cpp.

References Player::diplomacy, Player::exist(), GameMap::player, and DiplomaticStateVector::sharesView().

Referenced by calcvisibilityfield(), and evaluateviewcalculation().


Variable Documentation

SigC::Signal0<void> buildingSeen
 

Definition at line 31 of file viewcalculation.cpp.

Referenced by BuildingSeen::arm(), and evaluatevisibilityfield().


Generated on Tue Jun 24 02:15:04 2008 for Advanced Strategic Command by  doxygen 1.4.2