GeoGen API Reference
Public Types | Public Member Functions | List of all members
geogen::runtime::ScriptParameters Class Reference

Contains configuration of map size, rendering bounds and any additional parameters the script may have. More...

Inherits geogen::utils::OwningMap< ScriptParameter >, and geogen::Serializable.

Public Types

typedef std::map< String,
ScriptParameter const * >
::const_iterator 
const_iterator
 A constant iterator.
 
typedef std::map< String,
ScriptParameter * >::iterator 
iterator
 An iterator.
 

Public Member Functions

 ScriptParameters (unsigned defaultMapWidth, unsigned defaultMapHeight, unsigned minMapWidth, unsigned minMapHeight, unsigned maxMapWidth, unsigned maxMapHeight)
 Initializes a new instance of the ScriptParameters class. More...
 
 ScriptParameters ()
 Initializes a new instance of the ScriptParameters class.
 
 ScriptParameters (ScriptParameters const &)
 Copy constructor. More...
 
ScriptParametersoperator= (ScriptParameters const &)
 Assignment operator. More...
 
unsigned GetMapWidth () const
 Gets current width of the map. More...
 
unsigned GetDefaultMapWidth () const
 Gets the default width of the map. More...
 
unsigned GetMinMapWidth () const
 Gets the minimum width of the map. More...
 
unsigned GetMaxMapWidth () const
 Gets the maximum width of the map. More...
 
void SetMapWidth (unsigned width)
 Sets the width of the map. More...
 
unsigned GetMapHeight () const
 Gets current height of the map. More...
 
unsigned GetDefaultMapHeight () const
 Gets the default height of the map. More...
 
unsigned GetMinMapHeight () const
 Gets the minimum height of the map. More...
 
unsigned GetMaxMapHeight () const
 Gets the maximum height of the map. More...
 
void SetMapHeight (unsigned height)
 Sets the height of the map. More...
 
int GetRenderOriginX () const
 Gets X coordinate of the render origin. More...
 
void SetRenderOriginX (int renderOriginX)
 Sets X coordinate of the render origin. More...
 
int GetRenderOriginY () const
 Gets Y coordinate of the render origin. More...
 
void SetRenderOriginY (int renderOriginY)
 Sets Y coordinate of the render origin. More...
 
unsigned GetRenderWidth () const
 Gets width of the render. More...
 
void SetRenderWidth (unsigned renderWidth)
 Sets width of the render. More...
 
unsigned GetRenderHeight () const
 Gets height of the render. More...
 
void SetRenderHeight (unsigned renderHeight)
 Sets height of the render. More...
 
void SetRenderRectangle (Rectangle renderRectangle)
 Sets the render rectangle. More...
 
double GetRenderScale () const
 Gets scale of the render. More...
 
void SetRenderScale (double renderScale)
 Sets scale of the render. More...
 
random::RandomSeed GetRandomSeed () const
 Gets the random seed. More...
 
void SetRandomSeed (random::RandomSeed randomSeed)
 Sets the random seed. More...
 
std::vector< String > & GetEnabledMaps ()
 Gets a reference to a list of maps that are requested by the . More...
 
std::vector< String > const & GetEnabledMaps () const
 
bool IsMapInfinite (Direction direction) const
 Determines whether the map is infinite in given direction. More...
 
void ResetToDefaults ()
 Resets all parameters to their default values.
 
virtual void Serialize (IOStream &stream) const
 Writes the human readable string representation of this instance to the given stream. More...
 
- Public Member Functions inherited from geogen::utils::OwningMap< ScriptParameter >
bool AddItem (String const &name, ScriptParameter *value)
 Adds an item to the collection. More...
 
unsigned Size () const
 Gets the number of items in the collection. More...
 
std::map< String,
ScriptParameterconst * >
::const_iterator 
Begin () const
 Gets an iterator pointing to the first item in the collection (in order by names). More...
 
std::map< String,
ScriptParameter * >::iterator 
Begin ()
 Gets an iterator pointing to the first item in the collection (in order by names). More...
 
std::map< String,
ScriptParameterconst * >
::const_iterator 
End () const
 Gets the ending iterator. More...
 
std::map< String,
ScriptParameter * >::iterator 
End ()
 Gets the ending iterator. More...
 
std::map< String,
ScriptParameterconst * >
::const_iterator 
FindItem (String const &key) const
 Gets an iterator pointing to an item with given name, or an ending iterator if the collection doesn't contain item with than name. More...
 
std::map< String,
ScriptParameter * >::iterator 
FindItem (String const &key)
 Gets an iterator pointing to an item with given name, or an ending iterator if the collection doesn't contain item with than name. More...
 
bool ContainsItem (String const &key) const
 Determines whether the collection contains item with given name. More...
 
ScriptParameterconst * GetItem (String const &key) const
 Gets an item with given name. More...
 
ScriptParameter * GetItem (String const &key)
 Gets an item with given name. More...
 
virtual ~OwningMap ()
 Virtual destructor. Destroys all owned items.
 
- Public Member Functions inherited from geogen::Serializable
virtual void SerializeWithTabs (IOStream &stream, unsigned tabs) const
 Serialize with tabs. More...
 
String ToString () const
 Convert this instance into a human readable string representation. More...
 

Additional Inherited Members

- Protected Attributes inherited from geogen::utils::OwningMap< ScriptParameter >
std::map< String,
ScriptParameter * > 
table
 

Detailed Description

Contains configuration of map size, rendering bounds and any additional parameters the script may have.

Examples:
AdvancedScriptParameters.cpp, MultipleTiles.cpp, and ScriptParameters.cpp.

Constructor & Destructor Documentation

geogen::runtime::ScriptParameters::ScriptParameters ( unsigned  defaultMapWidth,
unsigned  defaultMapHeight,
unsigned  minMapWidth,
unsigned  minMapHeight,
unsigned  maxMapWidth,
unsigned  maxMapHeight 
)
inline

Initializes a new instance of the ScriptParameters class.

Parameters
defaultMapWidthThe default map width.
defaultMapHeightThe default map height.
minMapWidthThe minimum map width.
minMapHeightThe minimum map height.
maxMapWidthThe maximum map width.
maxMapHeightThe maximum map height.
geogen::runtime::ScriptParameters::ScriptParameters ( ScriptParameters const &  )

Copy constructor.

Parameters
parameter1The other instance.

Member Function Documentation

unsigned geogen::runtime::ScriptParameters::GetDefaultMapHeight ( ) const
inline

Gets the default height of the map.

Returns
Default height of the map.
unsigned geogen::runtime::ScriptParameters::GetDefaultMapWidth ( ) const
inline

Gets the default width of the map.

Returns
Default width of the map.
std::vector<String>& geogen::runtime::ScriptParameters::GetEnabledMaps ( )
inline

Gets a reference to a list of maps that are requested by the .

Returns
The enabled maps.
unsigned geogen::runtime::ScriptParameters::GetMapHeight ( ) const
inline

Gets current height of the map.

If map height wasn't set yet, default height will be returned.

Returns
Current map height.
unsigned geogen::runtime::ScriptParameters::GetMapWidth ( ) const
inline

Gets current width of the map.

If map width wasn't set yet, default width will be returned.

Returns
Current map width.
unsigned geogen::runtime::ScriptParameters::GetMaxMapHeight ( ) const
inline

Gets the maximum height of the map.

Returns
Maximum height of the map. MAP_SIZE_INFINITE

if infinite.

unsigned geogen::runtime::ScriptParameters::GetMaxMapWidth ( ) const
inline

Gets the maximum width of the map.

Returns
Maximum width of the map. MAP_SIZE_INFINITE

if infinite.

unsigned geogen::runtime::ScriptParameters::GetMinMapHeight ( ) const
inline

Gets the minimum height of the map.

Returns
Minimum height of the map. Always greater than 0.
unsigned geogen::runtime::ScriptParameters::GetMinMapWidth ( ) const
inline

Gets the minimum width of the map.

Returns
Minimum width of the map. Always greater than 0.
random::RandomSeed geogen::runtime::ScriptParameters::GetRandomSeed ( ) const
inline

Gets the random seed.

Returns
The random seed.
unsigned geogen::runtime::ScriptParameters::GetRenderHeight ( ) const
inline

Gets height of the render.

Returns
Height of the render.
int geogen::runtime::ScriptParameters::GetRenderOriginX ( ) const
inline

Gets X coordinate of the render origin.

Returns
X coordinate of the render origin.
int geogen::runtime::ScriptParameters::GetRenderOriginY ( ) const
inline

Gets Y coordinate of the render origin.

Returns
Y coordinate of the render origin.
double geogen::runtime::ScriptParameters::GetRenderScale ( ) const
inline

Gets scale of the render.

Returns
Scale of the render.
unsigned geogen::runtime::ScriptParameters::GetRenderWidth ( ) const
inline

Gets width of the render.

Returns
Width of the render.
bool ScriptParameters::IsMapInfinite ( Direction  direction) const

Determines whether the map is infinite in given direction.

Parameters
directionThe direction.
Returns
true if the map is infinite in given direction, false otherwise.
ScriptParameters & ScriptParameters::operator= ( ScriptParameters const &  other)

Assignment operator.

Parameters
parameter1The other instance.
Returns
A deep copy of this ScriptParameters.
void ScriptParameters::Serialize ( IOStream stream) const
virtual

Writes the human readable string representation of this instance to the given stream.

Parameters
streamThe stream.

Implements geogen::Serializable.

void ScriptParameters::SetMapHeight ( unsigned  height)

Sets the height of the map.

Parameters
heightThe new height. If MAP_SIZE_AUTOMATIC, default height will be used.
Examples:
MultipleTiles.cpp.
void ScriptParameters::SetMapWidth ( unsigned  width)

Sets the width of the map.

Parameters
widthThe new width. If MAP_SIZE_AUTOMATIC, default width will be used.
Examples:
MultipleTiles.cpp.
void geogen::runtime::ScriptParameters::SetRandomSeed ( random::RandomSeed  randomSeed)
inline

Sets the random seed.

Parameters
randomSeedThe random seed.
void geogen::runtime::ScriptParameters::SetRenderHeight ( unsigned  renderHeight)
inline

Sets height of the render.

Parameters
renderHeightHeight of the render.
Examples:
ScriptParameters.cpp.
void geogen::runtime::ScriptParameters::SetRenderOriginX ( int  renderOriginX)
inline

Sets X coordinate of the render origin.

Parameters
renderOriginXX coordinate of the render origin.
void geogen::runtime::ScriptParameters::SetRenderOriginY ( int  renderOriginY)
inline

Sets Y coordinate of the render origin.

Parameters
renderOriginYY coordinate of the render origin.
void geogen::runtime::ScriptParameters::SetRenderRectangle ( Rectangle  renderRectangle)
inline

Sets the render rectangle.

Parameters
renderRectThe render rectangle.
Examples:
MultipleTiles.cpp.
void ScriptParameters::SetRenderScale ( double  renderScale)

Sets scale of the render.

Parameters
renderScaleScale of the render.
void geogen::runtime::ScriptParameters::SetRenderWidth ( unsigned  renderWidth)
inline

Sets width of the render.

Parameters
renderWidthWidth of the render.