|
typedef std::vector
< std::vector< MapTile > > | MapTileMatrix |
|
Chunk * ChunkMatrix::get_center_chunk |
( |
| ) |
|
TODO update more code to use this instead of get_chunk_abs(main_char.get_y(), main_char.get_x())
- Returns
- the central chunk in the model.
- Parameters
-
abs_chunk_loc | the absolute chunk coordinates on the world map. |
- Returns
- a reference to the chunk from the local buffer.
Chunk * ChunkMatrix::get_chunk_abs |
( |
int |
row, |
|
|
int |
col |
|
) |
| |
The same as the other get_chunk_abs, but with two ints instead of an IntPoint.
- Returns
- an IntPoint representing the amount by which the top left corner of the ChunkMatrix is offset from the top left corner of the world.
bool ChunkMatrix::out_of_bounds |
( |
IntPoint |
local_chunk_point | ) |
|
Determines whether or not the given local coordinates on this small chunk map are out of bounds.
- Parameters
-
[in] | chunk_point | an IntPoint representing a chunk's location on the private "model" matrix. |
- Returns
- True if the given point cannot lie on the chunk map.
void ChunkMatrix::populate_initial |
( |
IntPoint |
center_chunk, |
|
|
MapTileMatrix & |
world_map |
|
) |
| |
Populates the chunk matrix initially, affecting the internal model.
- Parameters
-
[in] | center_chunk | An IntPoint representing the central chunk in the matrix |
[in] | world_map | The world map, passed by reference here to avoid copying. |
void ChunkMatrix::pretty_print |
( |
| ) |
|
Prints a graphic of the chunk matrix and its coordinates.
void ChunkMatrix::serialize_all |
( |
| ) |
|
Serializes all the chunks in the chunk_map.
void ChunkMatrix::set_offset |
( |
IntPoint |
point | ) |
|
Set the offset (amount by which the top left corner of the ChunkMatrix differs from the world's top left corner).
- Parameters
-
[in] | point | a point representing a location on the world map. |
void ChunkMatrix::shift_matrix |
( |
IntPoint |
directions, |
|
|
MapTileMatrix & |
world_map |
|
) |
| |
Shifts the contents of the chunk matrix.
Will shift the chunk buffer around on the world map, agnostic of the chunk buffer diameter. The concept of the chunk buffer is shown below. Periods are unloaded chunks on the world map, and x's are chunks within the chunk buffer (so, they are loaded). The buffer will move around, loading and unloading chunks as needed. Serialization and deserialization should all be handled in this function and the functions that it causes.
. . . . . . . . . . . . . . x x x . . . x x x . . . x x x . . . . . . .
- Parameters
-
directions | an IntPoint representing the direction to shift the matrix: (1, 0) means one chunk to the right; (-1, -1) means one chunk to the left and one chunk up; (0, -1) means 1 chunk up, etc. |
world_map | a reference to the world map. |
int ChunkMatrix::diameter |
|
private |
The diameter of this matrix.
vector<vector<Chunk> > ChunkMatrix::model |
|
private |
The base model where chunks are stored in a (diameter)*(diameter) two-dimensional vector.
The amount by which the top left corner of the matrix is offset from the world.
The documentation for this class was generated from the following files: