Crossfire Server, Trunk  1.75.0
City bell module

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

Files

file  cfcitybell.cpp
 

Data Structures

struct  Region
 One region with bells. More...
 

Functions

void cfcitybell_close ()
 
void cfcitybell_init (Settings *, ServerSettings *serverSettings)
 Citybells module initialisation. More...
 
static int clock_listener (int *type,...)
 Global event handling, only uses EVENT_CLOCK. More...
 
static void load_bells (BufferReader *reader, const char *filename)
 Load a .bells file. More...
 
static void ring_bell (void)
 Ring the city bells for each player. More...
 

Variables

std::unordered_map< std::string, std::string > Region::bells
 Map between a god's name and the message to display. More...
 
std::string Region::fallback
 Message if the god's name is not in Region::bells. More...
 
static event_registration global_handler
 
static int last_hr
 
static std::unordered_map< std::string, Region * > regions
 All defined regions. More...
 

Detailed Description

Rings the temple bells in the main cities.

Function Documentation

◆ cfcitybell_close()

void cfcitybell_close ( )

Definition at line 165 of file cfcitybell.cpp.

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

+ Here is the call graph for this function:

◆ cfcitybell_init()

void cfcitybell_init ( Settings ,
ServerSettings serverSettings 
)

Citybells module initialisation.

Parameters
settingsserver settings.

Definition at line 153 of file cfcitybell.cpp.

References assets_add_collector_hook(), clock_listener(), ServerSettings::disabled_plugins, EVENT_CLOCK, events_register_global_handler(), get_tod(), global_handler, timeofday_t::hour, last_hr, load_bells(), and serverSettings.

+ 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 124 of file cfcitybell.cpp.

References code, EVENT_CLOCK, get_tod(), timeofday_t::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 51 of file cfcitybell.cpp.

References Region::bells, bufferreader_current_line(), bufferreader_next_line(), Region::fallback, is_valid_types_gen::line, llevError, LOG(), regions, 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 91 of file cfcitybell.cpp.

References object::contr, determine_god(), draw_ext_info, first_player, is_valid_types_gen::found, get_region_by_map(), object::map, MSG_SUBTYPE_NONE, MSG_TYPE_MISC, region::name, NDI_ORANGE, NDI_UNIQUE, player::next, player::ob, 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 39 of file cfcitybell.cpp.

Referenced by load_bells().

◆ fallback

std::string Region::fallback

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

Definition at line 40 of file cfcitybell.cpp.

Referenced by load_bells().

◆ global_handler

event_registration global_handler
static

Definition at line 147 of file cfcitybell.cpp.

Referenced by cfcitybell_close(), and cfcitybell_init().

◆ last_hr

int last_hr
static

Definition at line 35 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 44 of file cfcitybell.cpp.

Referenced by cfcitybell_close(), getRegions(), load_bells(), and ring_bell().