YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
RandomTileLayoutHandler.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Graphics/Game/World/Map/RandomTileLayoutHandler.hpp
"
2
#include "
YAPOG/Graphics/Game/World/Map/TileLayer.hpp
"
3
#include "
YAPOG/Graphics/Game/World/Map/Tile.hpp
"
4
#include "
YAPOG/System/RandomHelper.hpp
"
5
6
namespace
yap
7
{
8
RandomTileLayoutHandler::RandomTileLayoutHandler
()
9
:
TileLayoutHandler
()
10
, tiles_ ()
11
{
12
}
13
14
RandomTileLayoutHandler::~RandomTileLayoutHandler
()
15
{
16
for
(
const
Tile
* tile :
tiles_
)
17
delete
tile;
18
}
19
20
void
RandomTileLayoutHandler::AddTile
(
Tile
* tile)
21
{
22
tiles_
.
Add
(tile);
23
}
24
25
void
RandomTileLayoutHandler::HandleExecute
(
TileLayer
& tileLayer)
26
{
27
if
(
tiles_
.
Count
() <= 0)
28
return
;
29
30
for
(
uint
y = 0; y < tileLayer.
GetHeight
(); y++)
31
{
32
for
(
uint
x = 0; x < tileLayer.
GetWidth
(); ++x)
33
{
34
uint
index =
RandomHelper::GetNext
(0,
tiles_
.
Count
() - 1);
35
36
tileLayer.
SetTile
(x, y,
tiles_
[index]->Clone ());
37
}
38
}
39
}
40
}
// namespace yap
YAPOG
src
YAPOG
Graphics
Game
World
Map
RandomTileLayoutHandler.cpp
Generated on Mon Sep 17 2012 22:24:25 for YAPOG by
1.8.1.1