Crossfire Server, Trunk
City bell module

Rings the temple bells in the main cities. More...

Files

file  cfcitybell.cpp
 

Data Structures

struct  Region
 

Functions

void cfcitybell_close ()
 
void cfcitybell_init (Settings *settings)
 
static int clock_listener (int *type,...)
 
static void load_bells (BufferReader *reader, const char *filename)
 
static void ring_bell (void)
 

Variables

std::unordered_map< std::string, std::string > Region::bells
 
std::string Region::fallback
 
static event_registration global_handler
 
static int last_hr
 
static std::unordered_map< std::string, Region * > regions
 

Detailed Description

Rings the temple bells in the main cities.

Function Documentation

◆ cfcitybell_close()

void cfcitybell_close ( )

Definition at line 173 of file cfcitybell.cpp.

References EVENT_CLOCK, events_unregister_global_handler(), global_handler, and regions.

+ Here is the call graph for this function:

◆ cfcitybell_init()

void cfcitybell_init ( Settings settings)

Citybells module initialisation.

Parameters
settingsserver settings.

Definition at line 155 of file cfcitybell.cpp.

References clock_listener(), Settings::disabled_plugins, EVENT_CLOCK, events_register_global_handler(), get_tod(), global_handler, Settings::hooks, Settings::hooks_count, Settings::hooks_filename, _timeofday::hour, last_hr, load_bells(), linked_char::name, linked_char::next, and settings.

+ Here is the call graph for this function:

◆ clock_listener()

static int clock_listener ( int *  type,
  ... 
)
static

Global event handling, only uses EVENT_CLOCK.

Parameters
typeThe event type.
Returns
0.

Definition at line 125 of file cfcitybell.cpp.

References make_face_from_files::args, EVENT_CLOCK, get_tod(), _timeofday::hour, last_hr, ring_bell(), and is_valid_types_gen::type.

Referenced by cfcitybell_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_bells()

static void load_bells ( BufferReader reader,
const char *  filename 
)
static

Load a .bells file.

Parameters
readerreader.
filenamefile name.

Definition at line 52 of file cfcitybell.cpp.

References bufferreader_current_line(), bufferreader_next_line(), disinfect::count, replace::current, npc_dialog::filename, is_valid_types_gen::line, llevError, LOG(), regions, inja::string_view::split(), and split_string().

Referenced by cfcitybell_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ring_bell()

static void ring_bell ( void  )
static

Ring the city bells for each player.

Definition at line 92 of file cfcitybell.cpp.

References determine_god(), draw_ext_info(), first_player, is_valid_types_gen::found, get_region_by_map(), navar-midane_pickup::msg, MSG_SUBTYPE_NONE, MSG_TYPE_MISC, regiondef::name, NDI_ORANGE, NDI_UNIQUE, pl::next, pl::ob, ring_occidental_mages::r, and regions.

Referenced by clock_listener().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ bells

std::unordered_map<std::string, std::string> Region::bells

Map between a god's name and the message to display.

Definition at line 40 of file cfcitybell.cpp.

◆ fallback

std::string Region::fallback

Message if the god's name is not in Region::bells.

Definition at line 41 of file cfcitybell.cpp.

◆ global_handler

event_registration global_handler
static

Definition at line 148 of file cfcitybell.cpp.

Referenced by cfcitybell_close(), and cfcitybell_init().

◆ last_hr

int last_hr
static

Definition at line 36 of file cfcitybell.cpp.

Referenced by cfcitybell_init(), and clock_listener().

◆ regions

std::unordered_map<std::string, Region *> regions
static

All defined regions.

Definition at line 45 of file cfcitybell.cpp.

Referenced by cfcitybell_close(), CREResourcesWindow::fillMaps(), load_bells(), and ring_bell().