File: api_server_notify.c

package info (click to toggle)
freeciv 3.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 242,732 kB
  • sloc: ansic: 459,107; cpp: 33,398; sh: 8,632; makefile: 7,457; python: 2,133; xml: 1,419
file content (82 lines) | stat: -rw-r--r-- 2,875 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*****************************************************************************
 Freeciv - Copyright (C) 2005 - The Freeciv Project
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
*****************************************************************************/

#ifdef HAVE_CONFIG_H
#include <fc_config.h>
#endif

/* common */
#include "featured_text.h"
#include "research.h"

/* common/scriptcore */
#include "luascript.h"

/* server */
#include "notify.h"

#include "api_server_notify.h"


/*****************************************************************************
  Notify players which have embassies with pplayer with the given message.
*****************************************************************************/
void api_notify_embassies_msg(lua_State *L, Player *pplayer, Tile *ptile,
                              int event, const char *message)
{
  LUASCRIPT_CHECK_STATE(L);

  notify_embassies(pplayer, ptile, event, ftc_any, "%s", message);
}

/*****************************************************************************
  Notify pplayer of a complex event.
*****************************************************************************/
void api_notify_event_msg(lua_State *L, Player *pplayer, Tile *ptile,
                          int event, const char *message)
{
  LUASCRIPT_CHECK_STATE(L);

  notify_player(pplayer, ptile, event, ftc_any, "%s", message);
}

/*****************************************************************************
  Notify players sharing research with the player.
*****************************************************************************/
void api_notify_research_msg(lua_State *L, Player *pplayer, bool include_plr,
                             int event, const char *message)
{
  struct research *pres;

  LUASCRIPT_CHECK_STATE(L);

  pres = research_get(pplayer);

  notify_research(pres, include_plr ? NULL : pplayer, event,
                  ftc_any, "%s", message);
}

/*****************************************************************************
  Notify players sharing research with the player.
*****************************************************************************/
void api_notify_research_embassies_msg(lua_State *L, Player *pplayer,
                                       int event, const char *message)
{
  struct research *pres;

  LUASCRIPT_CHECK_STATE(L);

  pres = research_get(pplayer);

  notify_research_embassies(pres, NULL, event, ftc_any, "%s", message);
}