YAPOG  0.0.1
Yet Another Pokemon Online Game
RandomTileLayoutHandler.cpp
Go to the documentation of this file.
5 
6 namespace yap
7 {
10  , tiles_ ()
11  {
12  }
13 
15  {
16  for (const Tile* tile : tiles_)
17  delete tile;
18  }
19 
21  {
22  tiles_.Add (tile);
23  }
24 
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