Freeciv-3.2
Loading...
Searching...
No Matches
Functions
notify.h File Reference
#include <stdarg.h>
#include "support.h"
#include "events.h"
#include "fc_types.h"
#include "featured_text.h"
#include "packets.h"
#include "srv_main.h"

Go to the source code of this file.

Functions

void package_chat_msg (struct packet_chat_msg *packet, const struct connection *sender, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void void vpackage_chat_msg (struct packet_chat_msg *packet, const struct connection *sender, const struct ft_color color, const char *format, va_list vargs)
 
void package_event (struct packet_chat_msg *packet, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void void vpackage_event (struct packet_chat_msg *packet, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format, va_list vargs)
 
void notify_conn (struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void void notify_conn_early (struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void void void notify_player (const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void void void void notify_embassies (const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void void void void void notify_team (const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void void void void void void notify_research (const struct research *presearch, const struct player *exclude, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void void void void void void void notify_research_embassies (const struct research *presearch, const struct player *exclude, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void event_cache_init (void)
 
void event_cache_free (void)
 
void event_cache_clear (void)
 
void event_cache_remove_old (void)
 
void event_cache_add_for_all (const struct packet_chat_msg *packet)
 
void event_cache_add_for_global_observers (const struct packet_chat_msg *packet)
 
void event_cache_add_for_player (const struct packet_chat_msg *packet, const struct player *pplayer)
 
struct event_cache_playersevent_cache_player_add (struct event_cache_players *players, const struct player *pplayer) fc__warn_unused_result
 
void event_cache_add_for_players (const struct packet_chat_msg *packet, struct event_cache_players *players)
 
void send_pending_events (struct connection *pconn, bool include_public)
 
void event_cache_phases_invalidate (void)
 
void event_cache_load (struct section_file *file, const char *section)
 
void event_cache_save (struct section_file *file, const char *section)
 

Function Documentation

◆ event_cache_add_for_all()

void event_cache_add_for_all ( const struct packet_chat_msg packet)

Add an event to the cache for all connections.

Definition at line 619 of file notify.c.

Referenced by chat_msg_to_all(), cmd_reply_line(), establish_new_connection(), event_cache_add_for_player(), notify_conn(), notify_conn_early(), and notify_team().

◆ event_cache_add_for_global_observers()

void event_cache_add_for_global_observers ( const struct packet_chat_msg packet)

Add an event to the cache for all global observers.

Definition at line 630 of file notify.c.

Referenced by chat_msg_to_global_observers().

◆ event_cache_add_for_player()

void event_cache_add_for_player ( const struct packet_chat_msg packet,
const struct player pplayer 
)

Add an event to the cache for one player.

N.B.: event_cache_add_for_player(&packet, NULL) will have the same effect as event_cache_add_for_all(&packet). N.B.: in pregame, this will never success, because players are not fixed.

Definition at line 645 of file notify.c.

Referenced by city_turn_notify(), dai_diplo_notify(), and notify_player().

◆ event_cache_add_for_players()

void event_cache_add_for_players ( const struct packet_chat_msg packet,
struct event_cache_players players 
)

Add an event to the cache for selected players. See event_cache_player_add() to see how to select players. This also free the players pointer argument.

N.B.: in pregame, this will never success, because players are not fixed.

Definition at line 671 of file notify.c.

Referenced by chat_msg_to_allies(), chat_msg_to_player(), notify_embassies(), notify_research(), notify_research_embassies(), and notify_team().

◆ event_cache_clear()

void event_cache_clear ( void  )

Remove all events from the cache.

Definition at line 594 of file notify.c.

Referenced by srv_main().

◆ event_cache_free()

void event_cache_free ( void  )

Frees the event cache.

Definition at line 582 of file notify.c.

Referenced by event_cache_init(), and server_game_free().

◆ event_cache_init()

void event_cache_init ( void  )

Initializes the event cache.

Definition at line 570 of file notify.c.

Referenced by server_game_init().

◆ event_cache_load()

void event_cache_load ( struct section_file file,
const char section 
)

Load the event cache from a savefile.

Definition at line 783 of file notify.c.

Referenced by sg_load_event_cache(), and sg_load_event_cache().

◆ event_cache_phases_invalidate()

void event_cache_phases_invalidate ( void  )

Mark all existing phase values in event cache invalid.

Definition at line 977 of file notify.c.

Referenced by begin_turn().

◆ event_cache_player_add()

struct event_cache_players * event_cache_player_add ( struct event_cache_players players,
const struct player pplayer 
)

Select players for event_cache_add_for_players(). Pass NULL as players argument to create a new selection. Usually the usage of this function would look to:

struct event_cache_players *players = NULL;

players_iterate(pplayer) { if (some_condition) { players = event_cache_player_add(players, pplayer); } } players_iterate_end; Now add to the cache. event_cache_add_for_players(&packet, players); // Free players.

Definition at line 703 of file notify.c.

Referenced by chat_msg_to_allies(), chat_msg_to_player(), event_cache_load(), notify_embassies(), notify_research(), notify_research_embassies(), and notify_team().

◆ event_cache_remove_old()

void event_cache_remove_old ( void  )

Remove the old events from the cache.

Definition at line 602 of file notify.c.

Referenced by begin_turn().

◆ event_cache_save()

void event_cache_save ( struct section_file file,
const char section 
)

Save the event cache into the savegame.

Definition at line 903 of file notify.c.

Referenced by sg_save_event_cache().

◆ notify_conn()

void notify_conn ( struct conn_list dest,
const struct tile ptile,
enum event_type  event,
const struct ft_color  color,
const char format,
  ... 
)

◆ notify_conn_early()

void void notify_conn_early ( struct conn_list dest,
const struct tile ptile,
enum event_type  event,
const struct ft_color  color,
const char format,
  ... 
)

◆ notify_embassies()

void void void void notify_embassies ( const struct player pplayer,
const struct tile ptile,
enum event_type  event,
const struct ft_color  color,
const char format,
  ... 
)

◆ notify_player()

void void void notify_player ( const struct player pplayer,
const struct tile ptile,
enum event_type  event,
const struct ft_color  color,
const char format,
  ... 
)

◆ notify_research()

void void void void void void notify_research ( const struct research presearch,
const struct player exclude,
enum event_type  event,
const struct ft_color  color,
const char format,
  ... 
)

◆ notify_research_embassies()

void void void void void void void notify_research_embassies ( const struct research presearch,
const struct player exclude,
enum event_type  event,
const struct ft_color  color,
const char format,
  ... 
)

◆ notify_team()

void void void void void notify_team ( const struct player pplayer,
const struct tile ptile,
enum event_type  event,
const struct ft_color  color,
const char format,
  ... 
)

◆ package_chat_msg()

void package_chat_msg ( struct packet_chat_msg packet,
const struct connection sender,
const struct ft_color  color,
const char format,
  ... 
)

◆ package_event()

void package_event ( struct packet_chat_msg packet,
const struct tile ptile,
enum event_type  event,
const struct ft_color  color,
const char format,
  ... 
)

◆ send_pending_events()

void send_pending_events ( struct connection pconn,
bool  include_public 
)

Send all available events. If include_public is TRUE, also fully global message will be sent.

Definition at line 753 of file notify.c.

Referenced by connection_attach_real(), establish_new_connection(), and srv_running().

◆ vpackage_chat_msg()

void void vpackage_chat_msg ( struct packet_chat_msg packet,
const struct connection sender,
const struct ft_color  color,
const char format,
va_list  vargs 
)

Fill a packet_chat_msg structure for a chat message.

Parameters
packetA pointer to the packet.
senderThe sender of the message.
colorThe requested color or ftc_any if not requested. Some colors are predefined in common/featured_text.h. You can pass a custom one using ft_color().
formatThe format of the message.
vargsThe extra arguments to build the message.

Definition at line 104 of file notify.c.

Referenced by package_chat_msg(), and send_chat_msg().

◆ vpackage_event()

void void vpackage_event ( struct packet_chat_msg packet,
const struct tile ptile,
enum event_type  event,
const struct ft_color  color,
const char format,
va_list  vargs 
)

Fill a packet_chat_msg structure for common server event.

Parameters
packetA pointer to the packet.
ptileA pointer to a tile the event is occurring.
eventThe event type.
colorThe requested color or ftc_any if not requested. Some colors are predefined in common/featured_text.h. You can pass a custom one using ft_color().
formatThe format of the message.
vargsThe extra arguments to build the message.

Definition at line 147 of file notify.c.

Referenced by dai_diplo_notify(), notify_conn(), notify_conn_early(), notify_embassies(), notify_player(), notify_research(), notify_research_embassies(), notify_team(), and package_event().