Handling of chunks of cave. More...
|struct chunk *||chunk_write (int y0, int x0, int height, int width, bool monsters, bool objects, bool traps)|
|Write a chunk to memory and return a pointer to it. |
|void||chunk_list_add (struct chunk *c)|
|Add an entry to the chunk list - any problems with the length of this will be more in the memory used by the chunks themselves rather than the list. |
|bool||chunk_list_remove (char *name)|
|Remove an entry from the chunk list, return whether it was found. |
|struct chunk *||chunk_find_name (char *name)|
|Find a chunk by name. |
|bool||chunk_find (struct chunk *c)|
|Find a chunk by pointer. |
|void||symmetry_transform (int *y, int *x, int y0, int x0, int height, int width, int rotate, bool reflect)|
|Transform y, x coordinates by rotation, reflection and translation Stolen from PosChengband. |
|bool||chunk_copy (struct chunk *dest, struct chunk *source, int y0, int x0, int rotate, bool reflect)|
|Write a chunk, transformed, to a given offset in another chunk. |
|void||chunk_validate_objects (struct chunk *c)|
|Validate that the chunk contains no NULL objects. |
|struct chunk **||chunk_list|
|list of pointers to saved chunks |
|u16b||chunk_list_max = 0|
|current max actual chunk index |
Handling of chunks of cave.
Copyright (c) 2014 Nick McConnell
This work is free software; you can redistribute it and/or modify it under the terms of either:
a) the GNU General Public License as published by the Free Software Foundation, version 2, or
b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.
This file maintains a list of saved chunks of world which can be reloaded at any time. The intitial example of this is the town, which is saved immediately after generation and restored when the player returns there.
The copying routines are also useful for generating a level in pieces and then copying those pieces into the actual level chunk.
|bool chunk_copy||(||struct chunk *||dest,|
|struct chunk *||source,|
Write a chunk, transformed, to a given offset in another chunk.
Note that objects are copied from the old chunk and not retained there
|dest||the chunk where the copy is going|
|source||the chunk being copied|
|reflect||transformation parameters - see symmetry_transform()|
References cave_monster(), angband_constants::f_max, FALSE, square::feat, chunk::feat_count, trap::fx, monster::fx, trap::fy, monster::fy, chunk::good_item, h, chunk::height, monster::held_obj, i, square::info, object::ix, object::iy, monster::midx, square::mon, mon_pop(), chunk::mon_rating, trap::next, object::next, square::obj, chunk::obj_rating, monster::race, sqinfo_copy, square_monster(), square_object(), chunk::squares, symmetry_transform(), square::trap, TRUE, w, chunk::width, and z_info.
Add an entry to the chunk list - any problems with the length of this will be more in the memory used by the chunks themselves rather than the list.
|c||the chunk being added to the list|
|bool chunk_list_remove||(||char *||name||)|
Validate that the chunk contains no NULL objects.
Only checks for nonzero tval.
|c||is the chunk to validate.|
Referenced by cave_generate().
Write a chunk to memory and return a pointer to it.
Optionally write monsters, objects and/or traps, and in those cases delete those things from the source chunk
|x0||coordinates of the top left corner of the chunk being written|
|width||dimensions of the chunk being written|
|monsters||whether monsters get written|
|objects||whether objects get written|
|traps||whether traps get written|
References cave, cave_monster(), cave_new(), delete_monster(), square::feat, trap::fx, monster::fx, trap::fy, monster::fy, height, monster::held_obj, square::info, object::ix, object::iy, square::mon, monster::race, sqinfo_copy, square_monster(), square_object(), chunk::squares, square::trap, and width.
Referenced by cave_generate().
|void symmetry_transform||(||int *||y,|
Transform y, x coordinates by rotation, reflection and translation Stolen from PosChengband.
|x||the coordinates being transformed|
|x0||how much the coordinates are being translated|
|height||height of the chunk|
|width||width of the chunk|
|rotate||how much to rotate, in multiples of 90 degrees clockwise|
|reflect||whether to reflect horizontally|
Referenced by chunk_copy().
|struct chunk** chunk_list|
list of pointers to saved chunks
|u16b chunk_list_max = 0|
current max actual chunk index