![]() |
Crossfire Server, Trunk
1.75.0
|
This module links unused exits to random maps. The random map parameters vary based on the map it is in, but each exit will always use the same random seed to have the same layout and content. More...
Files | |
file | random_house_generator.cpp |
Data Structures | |
struct | house_zone_struct |
Link between a map and the exits to generate for it. More... | |
Functions | |
static void | add_exit_to_item (object *exit, const house_zone_struct *zone, const mapstruct *map) |
Change an empty exit to point to a random map. More... | |
static void | add_exits_to_map (const mapstruct *map) |
Checks if the map should be processed, and if so process it. More... | |
static int | cfrhg_globalEventListener (int *type,...) |
Global server event handling. More... | |
static int | get_exit_seed (const object *exit, const mapstruct *map) |
Get the random map seed. More... | |
static const house_zone_struct * | get_map_zone (const mapstruct *map) |
Get the random map parameters of a map. More... | |
static int | is_suitable_exit (object *exit) |
Should we add a random map to this exit? More... | |
void | random_house_generator_close () |
Close the module. More... | |
void | random_house_generator_init (Settings *, ServerSettings *settings) |
Module initialisation. More... | |
Variables | |
static event_registration | eg |
const char * | house_zone_struct::mappath |
Full map path. More... | |
const char * | house_zone_struct::monsterstyle |
Style of monsters. More... | |
static const house_zone_struct | zones [] |
Maps we work on. More... | |
This module links unused exits to random maps. The random map parameters vary based on the map it is in, but each exit will always use the same random seed to have the same layout and content.
Exits will only point to a random map if both their slaying and msg fields are empty.
|
static |
Change an empty exit to point to a random map.
exit | exit to alter. |
zone | zone we're part of, to know the random map parameters. |
map | map the exit is on. |
Definition at line 136 of file random_house_generator.cpp.
References add_string(), get_exit_seed(), MAX_BUF, house_zone_struct::monsterstyle, object::msg, and object::slaying.
Referenced by add_exits_to_map().
|
static |
Checks if the map should be processed, and if so process it.
map | map to work on. |
Definition at line 162 of file random_house_generator.cpp.
References add_exit_to_item(), FOR_MAP_FINISH, FOR_MAP_PREPARE, get_map_zone(), is_suitable_exit(), MAP_HEIGHT, and MAP_WIDTH.
Referenced by cfrhg_globalEventListener().
|
static |
Global server event handling.
Only uses EVENT_MAPLOAD.
type | unused. |
Definition at line 186 of file random_house_generator.cpp.
References add_exits_to_map(), code, EVENT_MAPLOAD, and is_valid_types_gen::type.
Referenced by random_house_generator_init().
Get the random map seed.
Will always yield the same value for the same (position included) exit.
exit | exit to get the seed of. |
map | map the exit is on. |
Definition at line 110 of file random_house_generator.cpp.
References object::arch, HUGE_BUF, archetype::name, mapstruct::path, object::x, and object::y.
Referenced by add_exit_to_item().
|
static |
Get the random map parameters of a map.
map | map to get the zone of. |
Definition at line 72 of file random_house_generator.cpp.
References house_zone_struct::mappath, mapstruct::path, and zones.
Referenced by add_exits_to_map().
|
static |
Should we add a random map to this exit?
exit | exit to check. |
Definition at line 90 of file random_house_generator.cpp.
References EXIT, object::msg, object::slaying, and object::type.
Referenced by add_exits_to_map().
void random_house_generator_close | ( | ) |
Close the module.
Definition at line 221 of file random_house_generator.cpp.
References eg, EVENT_MAPLOAD, and events_unregister_global_handler().
void random_house_generator_init | ( | Settings * | , |
ServerSettings * | settings | ||
) |
Module initialisation.
Definition at line 211 of file random_house_generator.cpp.
References cfrhg_globalEventListener(), eg, EVENT_MAPLOAD, events_register_global_handler(), and settings.
|
static |
Definition at line 206 of file random_house_generator.cpp.
Referenced by events_register_global_handler(), random_house_generator_close(), and random_house_generator_init().
const char* house_zone_struct::mappath |
Full map path.
Definition at line 46 of file random_house_generator.cpp.
Referenced by get_map_zone().
const char* house_zone_struct::monsterstyle |
Style of monsters.
Definition at line 47 of file random_house_generator.cpp.
Referenced by add_exit_to_item().
|
static |
Maps we work on.
Definition at line 51 of file random_house_generator.cpp.
Referenced by add_npc_to_random_map(), and get_map_zone().