Go to the documentation of this file.
48 #include <unordered_map>
58 #define CITYLIFE_NAME "citylife"
61 #define FIRST_MOVE_KEY "citylife_first_move"
85 std::vector<spawn_point>
points;
92 static std::unordered_map<std::string, mapzone *>
maps;
104 auto find =
maps.find(
map->path);
105 return find ==
maps.end() ? nullptr : find->second;
233 code = va_arg(
args,
int);
258 va_arg(
args,
object *);
259 va_arg(
args,
object *);
260 va_arg(
args,
char *);
262 event = va_arg(
args,
object *);
270 LOG(
llevInfo,
"citylife: %s attacked, reverting to default behaviour\n",
who->name);
288 LOG(
llevInfo,
"citylife: removing event from object %s which we didn't generate\n",
who->name);
293 if (strcmp(
value,
"1") == 0) {
301 else if (
RANDOM()%100 < 30) {
302 int16_t sx =
who->x, sy =
who->y;
333 if (zone->
zones.empty()) {
336 if (zone->
points.empty()) {
353 if (
line[0] ==
'\0' ||
line[0] ==
'#') {
357 char *space = strchr(
line,
' ');
365 if (strcmp(
line,
"map") == 0) {
371 if (existing ==
maps.end()) {
375 zone = existing->second;
383 if (strcmp(
line,
"population") == 0) {
387 if (strcmp(
line,
"zone") == 0) {
401 if (strcmp(
line,
"point") == 0) {
409 zone->
points.push_back(p);
413 if (strcmp(
line,
"arch") == 0) {
#define GET_MAP_OB(M, X, Y)
object * object_find_by_type_subtype(const object *who, int type, int subtype)
size_t bufferreader_current_line(BufferReader *br)
static std::unordered_map< std::string, mapzone * > maps
void LOG(LogLevel logLevel, const char *format,...)
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
mapstruct * has_been_loaded(const char *name)
static int eventListener(int *type,...)
static event_registration c
void events_unregister_object_handler(const char *id)
static void add_npc_to_point(const mapzone *zone, mapstruct *map)
std::vector< spawn_point > points
static const mapzone * get_zone_for_map(mapstruct *map)
const char * object_get_value(const object *op, const char *const key)
object * object_insert_in_ob(object *op, object *where)
static const house_zone_struct zones[]
event_registration events_register_global_handler(int eventcode, f_plug_event hook)
static event_registration m
void events_register_object_handler(const char *id, f_plug_event handler)
void object_free_drop_inventory(object *ob)
void add_hook(const char *name, collectorHook hook)
void citylife_init(Settings *settings)
static void load_citylife(BufferReader *reader, const char *filename)
int move_ob(object *op, int dir, object *originator)
void events_unregister_global_handler(int eventcode, event_registration id)
size_t split_string(char *str, char *array[], size_t array_size, char sep)
sstring add_string(const char *str)
static void check_zone(const mapzone *zone, const char *path)
std::vector< spawn_zone > zones
std::vector< char * > disabled_plugins
void object_free(object *ob, int flags)
static void add_npcs_to_map(mapstruct *map)
std::vector< std::string > available_archetypes
static void add_npc_to_zone(const mapzone *zone, mapstruct *map)
object * create_archetype(const char *name)
static int citylife_globalEventListener(int *type,...)
unsigned long event_registration
static void add_npc_to_random_map(void)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
#define CLEAR_FLAG(xyz, p)
object * arch_to_object(archetype *at)
void object_remove(object *op)
archetype * try_find_archetype(const char *name)
event
DIALOGCHECK MINARGS 1 MAXARGS 2
int object_teleport(object *op, mapstruct *map, int x, int y)
static object * get_npc(const mapzone *zone)
static std::vector< std::string > split(const std::string &field, const std::string &by)
int object_set_value(object *op, const char *key, const char *value, int add_key)
char * bufferreader_next_line(BufferReader *br)