1 /*****************************************************************************
2 Freeciv - Copyright (C) 2005 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 *****************************************************************************/
13
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
17
18 /* common */
19 #include "featured_text.h"
20 #include "research.h"
21
22 /* common/scriptcore */
23 #include "luascript.h"
24
25 /* server */
26 #include "notify.h"
27
28 #include "api_server_notify.h"
29
30
31 /*****************************************************************************
32 Notify players which have embassies with pplayer with the given message.
33 *****************************************************************************/
api_notify_embassies_msg(lua_State * L,Player * pplayer,Tile * ptile,int event,const char * message)34 void api_notify_embassies_msg(lua_State *L, Player *pplayer, Tile *ptile,
35 int event, const char *message)
36 {
37 LUASCRIPT_CHECK_STATE(L);
38
39 notify_embassies(pplayer, ptile, event, ftc_any, "%s", message);
40 }
41
42 /*****************************************************************************
43 Notify pplayer of a complex event.
44 *****************************************************************************/
api_notify_event_msg(lua_State * L,Player * pplayer,Tile * ptile,int event,const char * message)45 void api_notify_event_msg(lua_State *L, Player *pplayer, Tile *ptile,
46 int event, const char *message)
47 {
48 LUASCRIPT_CHECK_STATE(L);
49
50 notify_player(pplayer, ptile, event, ftc_any, "%s", message);
51 }
52
53 /*****************************************************************************
54 Notify players sharing research with the player.
55 *****************************************************************************/
api_notify_research_msg(lua_State * L,Player * pplayer,bool include_plr,int event,const char * message)56 void api_notify_research_msg(lua_State *L, Player *pplayer, bool include_plr,
57 int event, const char *message)
58 {
59 struct research *pres;
60
61 LUASCRIPT_CHECK_STATE(L);
62
63 pres = research_get(pplayer);
64
65 notify_research(pres, include_plr ? NULL : pplayer, event,
66 ftc_any, "%s", message);
67 }
68
69 /*****************************************************************************
70 Notify players sharing research with the player.
71 *****************************************************************************/
api_notify_research_embassies_msg(lua_State * L,Player * pplayer,int event,const char * message)72 void api_notify_research_embassies_msg(lua_State *L, Player *pplayer,
73 int event, const char *message)
74 {
75 struct research *pres;
76
77 LUASCRIPT_CHECK_STATE(L);
78
79 pres = research_get(pplayer);
80
81 notify_research_embassies(pres, NULL, event, ftc_any, "%s", message);
82 }
83