summaryrefslogtreecommitdiff
path: root/src/map/guild.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/guild.c')
-rw-r--r--src/map/guild.c206
1 files changed, 115 insertions, 91 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index 8b9c0fd43..28954edf1 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -51,13 +51,13 @@
#include <stdlib.h>
#include <string.h>
-struct guild_interface guild_s;
+static struct guild_interface guild_s;
struct guild_interface *guild;
/*==========================================
* Retrieves and validates the sd pointer for this guild member [Skotlex]
*------------------------------------------*/
-struct map_session_data *guild_sd_check(int guild_id, int account_id, int char_id)
+static struct map_session_data *guild_sd_check(int guild_id, int account_id, int char_id)
{
struct map_session_data *sd = map->id2sd(account_id);
@@ -74,14 +74,16 @@ struct map_session_data *guild_sd_check(int guild_id, int account_id, int char_i
}
// Modified [Komurka]
-int guild_skill_get_max (int id) {
+static int guild_skill_get_max(int id)
+{
if (id < GD_SKILLBASE || id >= GD_SKILLBASE+MAX_GUILDSKILL)
return 0;
return guild->skill_tree[id-GD_SKILLBASE].max;
}
// Retrieve skill_lv learned by guild
-int guild_checkskill(struct guild *g, int id) {
+static int guild_checkskill(struct guild *g, int id)
+{
int idx = id - GD_SKILLBASE;
nullpo_ret(g);
if (idx < 0 || idx >= MAX_GUILDSKILL)
@@ -92,7 +94,7 @@ int guild_checkskill(struct guild *g, int id) {
/*==========================================
* guild_skill_tree.txt reading - from jA [Komurka]
*------------------------------------------*/
-bool guild_read_guildskill_tree_db(char* split[], int columns, int current)
+static bool guild_read_guildskill_tree_db(char *split[], int columns, int current)
{// <skill id>,<max lv>,<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>
int k, id, skill_id;
@@ -125,7 +127,7 @@ bool guild_read_guildskill_tree_db(char* split[], int columns, int current)
/*==========================================
* Guild skill check - from jA [Komurka]
*------------------------------------------*/
-int guild_check_skill_require(struct guild *g,int id)
+static int guild_check_skill_require(struct guild *g, int id)
{
int i;
int idx = id-GD_SKILLBASE;
@@ -145,7 +147,7 @@ int guild_check_skill_require(struct guild *g,int id)
return 1;
}
-bool guild_read_castledb(char* str[], int columns, int current)
+static bool guild_read_castledb(char *str[], int columns, int current)
{// <castle id>,<map name>,<castle name>,<castle event>[,<reserved/unused switch flag>]
struct guild_castle *gc;
int index;
@@ -169,13 +171,13 @@ bool guild_read_castledb(char* str[], int columns, int current)
}
/// lookup: guild id -> guild*
-struct guild* guild_search(int guild_id)
+static struct guild *guild_search(int guild_id)
{
return (struct guild*)idb_get(guild->db,guild_id);
}
/// lookup: guild name -> guild*
-struct guild* guild_searchname(char* str)
+static struct guild *guild_searchname(char *str)
{
struct guild* g;
struct DBIterator *iter = db_iterator(guild->db);
@@ -192,13 +194,13 @@ struct guild* guild_searchname(char* str)
}
/// lookup: castle id -> castle*
-struct guild_castle* guild_castle_search(int gcid)
+static struct guild_castle *guild_castle_search(int gcid)
{
return (struct guild_castle*)idb_get(guild->castle_db,gcid);
}
/// lookup: map index -> castle*
-struct guild_castle* guild_mapindex2gc(short map_index)
+static struct guild_castle *guild_mapindex2gc(short map_index)
{
struct guild_castle* gc;
struct DBIterator *iter = db_iterator(guild->castle_db);
@@ -214,12 +216,12 @@ struct guild_castle* guild_mapindex2gc(short map_index)
}
/// lookup: map name -> castle*
-struct guild_castle* guild_mapname2gc(const char* mapname)
+static struct guild_castle *guild_mapname2gc(const char *mapname)
{
return guild->mapindex2gc(mapindex->name2id(mapname));
}
-struct map_session_data* guild_getavailablesd(struct guild* g)
+static struct map_session_data *guild_getavailablesd(struct guild *g)
{
int i;
@@ -230,7 +232,7 @@ struct map_session_data* guild_getavailablesd(struct guild* g)
}
/// lookup: player AID/CID -> member index
-int guild_getindex(const struct guild *g, int account_id, int char_id)
+static int guild_getindex(const struct guild *g, int account_id, int char_id)
{
int i;
@@ -245,7 +247,7 @@ int guild_getindex(const struct guild *g, int account_id, int char_id)
}
/// lookup: player sd -> member position
-int guild_getposition(struct guild* g, struct map_session_data* sd)
+static int guild_getposition(struct guild *g, struct map_session_data *sd)
{
int i;
@@ -257,7 +259,7 @@ int guild_getposition(struct guild* g, struct map_session_data* sd)
}
//Creation of member information
-void guild_makemember(struct guild_member *m,struct map_session_data *sd)
+static void guild_makemember(struct guild_member *m, struct map_session_data *sd)
{
nullpo_retv(sd);
nullpo_retv(m);
@@ -283,7 +285,7 @@ void guild_makemember(struct guild_member *m,struct map_session_data *sd)
* Server cache to be flushed to inter the Guild EXP
* @see DBApply
*/
-int guild_payexp_timer_sub(union DBKey key, struct DBData *data, va_list ap)
+static int guild_payexp_timer_sub(union DBKey key, struct DBData *data, va_list ap)
{
int i;
struct guild_expcache *c;
@@ -311,7 +313,8 @@ int guild_payexp_timer_sub(union DBKey key, struct DBData *data, va_list ap)
return 0;
}
-int guild_payexp_timer(int tid, int64 tick, int id, intptr_t data) {
+static int guild_payexp_timer(int tid, int64 tick, int id, intptr_t data)
+{
guild->expcache_db->clear(guild->expcache_db,guild->payexp_timer_sub);
return 0;
}
@@ -320,7 +323,7 @@ int guild_payexp_timer(int tid, int64 tick, int id, intptr_t data) {
* Taken from party_send_xy_timer_sub. [Skotlex]
* @see DBApply
*/
-int guild_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap)
+static int guild_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap)
{
struct guild *g = DB->data2ptr(data);
int i;
@@ -345,12 +348,13 @@ int guild_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap)
}
//Code from party_send_xy_timer [Skotlex]
-int guild_send_xy_timer(int tid, int64 tick, int id, intptr_t data) {
+static int guild_send_xy_timer(int tid, int64 tick, int id, intptr_t data)
+{
guild->db->foreach(guild->db,guild->send_xy_timer_sub,tick);
return 0;
}
-int guild_send_dot_remove(struct map_session_data *sd)
+static int guild_send_dot_remove(struct map_session_data *sd)
{
nullpo_ret(sd);
if (sd->status.guild_id)
@@ -359,7 +363,7 @@ int guild_send_dot_remove(struct map_session_data *sd)
}
//------------------------------------------------------------------------
-int guild_create(struct map_session_data *sd, const char *name)
+static int guild_create(struct map_session_data *sd, const char *name)
{
char tname[NAME_LENGTH];
struct guild_member m;
@@ -393,7 +397,8 @@ int guild_create(struct map_session_data *sd, const char *name)
}
//Whether or not to create guild
-int guild_created(int account_id,int guild_id) {
+static int guild_created(int account_id, int guild_id)
+{
struct map_session_data *sd=map->id2sd(account_id);
if(sd==NULL)
@@ -414,13 +419,13 @@ int guild_created(int account_id,int guild_id) {
}
//Information request
-int guild_request_info(int guild_id)
+static int guild_request_info(int guild_id)
{
return intif->guild_request_info(guild_id);
}
//Information request with event
-int guild_npc_request_info(int guild_id,const char *event)
+static int guild_npc_request_info(int guild_id, const char *event)
{
if (guild->search(guild_id) != NULL) {
if (event != NULL && *event != '\0')
@@ -443,7 +448,7 @@ int guild_npc_request_info(int guild_id,const char *event)
}
//Confirmation of the character belongs to guild
-int guild_check_member(const struct guild *g)
+static int guild_check_member(const struct guild *g)
{
int i;
struct map_session_data *sd;
@@ -469,7 +474,7 @@ int guild_check_member(const struct guild *g)
}
//Delete association with guild_id for all characters
-int guild_recv_noinfo(int guild_id)
+static int guild_recv_noinfo(int guild_id)
{
struct map_session_data *sd;
struct s_mapiterator* iter;
@@ -485,7 +490,7 @@ int guild_recv_noinfo(int guild_id)
}
//Get and display information for all member
-int guild_recv_info(const struct guild *sg)
+static int guild_recv_info(const struct guild *sg)
{
struct guild *g,before;
int i,bm,m;
@@ -634,7 +639,8 @@ int guild_recv_info(const struct guild *sg)
/*=============================================
* Player sd send a guild invatation to player tsd to join his guild
*--------------------------------------------*/
-int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
+static int guild_invite(struct map_session_data *sd, struct map_session_data *tsd)
+{
struct guild *g;
int i;
@@ -688,7 +694,8 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
/// Guild invitation reply.
/// flag: 0:rejected, 1:accepted
-int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag) {
+static int guild_reply_invite(struct map_session_data *sd, int guild_id, int flag)
+{
struct map_session_data* tsd;
nullpo_ret(sd);
@@ -746,7 +753,7 @@ int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag) {
//- If guild is not in memory, it is requested
//- Otherwise sd pointer is set up.
//- Player must be authed and must belong to a guild before invoking this method
-void guild_member_joined(struct map_session_data *sd)
+static void guild_member_joined(struct map_session_data *sd)
{
struct guild* g;
int i;
@@ -780,7 +787,8 @@ void guild_member_joined(struct map_session_data *sd)
/*==========================================
* Add a player to a given guild_id
*----------------------------------------*/
-int guild_member_added(int guild_id,int account_id,int char_id,int flag) {
+static int guild_member_added(int guild_id, int account_id, int char_id, int flag)
+{
struct map_session_data *sd = map->id2sd(account_id),*sd2;
struct guild *g;
@@ -828,7 +836,7 @@ int guild_member_added(int guild_id,int account_id,int char_id,int flag) {
* Player request leaving a given guild_id
* mes - non null terminated string
*----------------------------------------*/
-int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes)
+static int guild_leave(struct map_session_data *sd, int guild_id, int account_id, int char_id, const char *mes)
{
struct guild *g;
@@ -857,7 +865,8 @@ int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int c
* Request remove a player to a given guild_id
* mes - non null terminated string
*----------------------------------------*/
-int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) {
+static int guild_expulsion(struct map_session_data *sd, int guild_id, int account_id, int char_id, const char *mes)
+{
struct map_session_data *tsd;
struct guild *g;
int i,ps;
@@ -892,7 +901,7 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i
return 0;
}
-int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, const char* name, const char* mes)
+static int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes)
{
int i;
struct guild* g = guild->search(guild_id);
@@ -948,7 +957,8 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
return 0;
}
-void guild_retrieveitembound(int char_id,int aid,int guild_id) {
+static void guild_retrieveitembound(int char_id, int aid, int guild_id)
+{
#ifdef GP_BOUND_ITEMS
struct map_session_data *sd = map->charid2sd(char_id);
if (sd != NULL) { //Character is online
@@ -970,8 +980,9 @@ void guild_retrieveitembound(int char_id,int aid,int guild_id) {
#endif
}
-int guild_send_memberinfoshort(struct map_session_data *sd,int online)
-{ // cleaned up [LuzZza]
+// cleaned up [LuzZza]
+static int guild_send_memberinfoshort(struct map_session_data *sd, int online)
+{
struct guild *g;
nullpo_ret(sd);
@@ -1002,8 +1013,9 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online)
return 0;
}
-int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class, uint32 last_login)
-{ // cleaned up [LuzZza]
+// cleaned up [LuzZza]
+static int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class, uint32 last_login)
+{
int i, alv, c, idx = INDEX_NOT_FOUND, om = 0, oldonline = -1;
struct guild *g = guild->search(guild_id);
@@ -1068,7 +1080,7 @@ int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int on
/*====================================================
* Send a message to whole guild
*---------------------------------------------------*/
-int guild_send_message(struct map_session_data *sd, const char *mes)
+static int guild_send_message(struct map_session_data *sd, const char *mes)
{
int len = (int)strlen(mes);
nullpo_ret(sd);
@@ -1087,7 +1099,7 @@ int guild_send_message(struct map_session_data *sd, const char *mes)
/*====================================================
* Guild receive a message, will be displayed to whole member
*---------------------------------------------------*/
-int guild_recv_message(int guild_id,int account_id,const char *mes,int len)
+static int guild_recv_message(int guild_id, int account_id, const char *mes, int len)
{
struct guild *g;
if( (g=guild->search(guild_id))==NULL)
@@ -1099,7 +1111,7 @@ int guild_recv_message(int guild_id,int account_id,const char *mes,int len)
/*====================================================
* Member changing position in guild
*---------------------------------------------------*/
-int guild_change_memberposition(int guild_id,int account_id,int char_id,short idx)
+static int guild_change_memberposition(int guild_id, int account_id, int char_id, short idx)
{
return intif->guild_change_memberinfo(guild_id,account_id,char_id,GMI_POSITION,&idx,sizeof(idx));
}
@@ -1107,7 +1119,7 @@ int guild_change_memberposition(int guild_id,int account_id,int char_id,short id
/*====================================================
* Notification of new position for member
*---------------------------------------------------*/
-int guild_memberposition_changed(struct guild *g,int idx,int pos)
+static int guild_memberposition_changed(struct guild *g, int idx, int pos)
{
nullpo_ret(g);
Assert_ret(idx >= 0 && idx < MAX_GUILD);
@@ -1124,7 +1136,7 @@ int guild_memberposition_changed(struct guild *g,int idx,int pos)
/*====================================================
* Change guild title or member
*---------------------------------------------------*/
-int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char *name)
+static int guild_change_position(int guild_id, int idx, int mode, int exp_mode, const char *name)
{
struct guild_position p;
nullpo_ret(name);
@@ -1139,7 +1151,7 @@ int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char
/*====================================================
* Notification of member has changed his guild title
*---------------------------------------------------*/
-int guild_position_changed(int guild_id, int idx, const struct guild_position *p)
+static int guild_position_changed(int guild_id, int idx, const struct guild_position *p)
{
struct guild *g=guild->search(guild_id);
int i;
@@ -1160,7 +1172,7 @@ int guild_position_changed(int guild_id, int idx, const struct guild_position *p
/*====================================================
* Change guild notice
*---------------------------------------------------*/
-int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2)
+static int guild_change_notice(struct map_session_data *sd, int guild_id, const char *mes1, const char *mes2)
{
nullpo_ret(sd);
@@ -1172,7 +1184,7 @@ int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes
/*====================================================
* Notification of guild has changed his notice
*---------------------------------------------------*/
-int guild_notice_changed(int guild_id,const char *mes1,const char *mes2)
+static int guild_notice_changed(int guild_id, const char *mes1, const char *mes2)
{
int i;
struct guild *g=guild->search(guild_id);
@@ -1195,14 +1207,14 @@ int guild_notice_changed(int guild_id,const char *mes1,const char *mes2)
/*====================================================
* Change guild emblem
*---------------------------------------------------*/
-int guild_change_emblem(struct map_session_data *sd,int len,const char *data)
+static int guild_change_emblem(struct map_session_data *sd, int len, const char *data)
{
struct guild *g;
nullpo_ret(sd);
if (battle_config.require_glory_guild &&
!((g = sd->guild) && guild->checkskill(g, GD_GLORYGUILD)>0)) {
- clif->skill_fail(sd,GD_GLORYGUILD,USESKILL_FAIL_LEVEL,0);
+ clif->skill_fail(sd, GD_GLORYGUILD, USESKILL_FAIL_LEVEL, 0, 0);
return 0;
}
@@ -1212,7 +1224,7 @@ int guild_change_emblem(struct map_session_data *sd,int len,const char *data)
/*====================================================
* Notification of guild emblem changed
*---------------------------------------------------*/
-int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
+static int guild_emblem_changed(int len, int guild_id, int emblem_id, const char *data)
{
int i;
struct map_session_data *sd;
@@ -1272,7 +1284,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
/**
* @see DBCreateData
*/
-struct DBData create_expcache(union DBKey key, va_list args)
+static struct DBData create_expcache(union DBKey key, va_list args)
{
struct guild_expcache *c;
struct map_session_data *sd = va_arg(args, struct map_session_data*);
@@ -1289,7 +1301,7 @@ struct DBData create_expcache(union DBKey key, va_list args)
/*====================================================
* Return taxed experience from player sd to guild
*---------------------------------------------------*/
-uint64 guild_payexp(struct map_session_data *sd, uint64 exp)
+static uint64 guild_payexp(struct map_session_data *sd, uint64 exp)
{
struct guild *g;
struct guild_expcache *c;
@@ -1323,7 +1335,7 @@ uint64 guild_payexp(struct map_session_data *sd, uint64 exp)
* Add this experience to guild exp
* [Celest]
*---------------------------------------------------*/
-int guild_getexp(struct map_session_data *sd,int exp)
+static int guild_getexp(struct map_session_data *sd, int exp)
{
struct guild_expcache *c;
nullpo_ret(sd);
@@ -1342,7 +1354,7 @@ int guild_getexp(struct map_session_data *sd,int exp)
/*====================================================
* Ask to increase guildskill skill_id
*---------------------------------------------------*/
-int guild_skillup(struct map_session_data *sd, uint16 skill_id)
+static int guild_skillup(struct map_session_data *sd, uint16 skill_id)
{
struct guild* g;
int idx = skill_id - GD_SKILLBASE;
@@ -1366,7 +1378,8 @@ int guild_skillup(struct map_session_data *sd, uint16 skill_id)
/*====================================================
* Notification of guildskill skill_id increase request
*---------------------------------------------------*/
-int guild_skillupack(int guild_id,uint16 skill_id,int account_id) {
+static int guild_skillupack(int guild_id, uint16 skill_id, int account_id)
+{
struct map_session_data *sd=map->id2sd(account_id);
struct guild *g=guild->search(guild_id);
int i;
@@ -1395,7 +1408,8 @@ int guild_skillupack(int guild_id,uint16 skill_id,int account_id) {
return 0;
}
-void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) {
+static void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv)
+{
struct skill_unit_group* group = NULL;
int type = status->skill2sc(skill_id);
nullpo_retv(sd);
@@ -1421,7 +1435,7 @@ void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint1
* 0 = allied
* 1 = enemy
*---------------------------------------------------*/
-int guild_get_alliance_count(struct guild *g,int flag)
+static int guild_get_alliance_count(struct guild *g, int flag)
{
int i,c;
@@ -1435,7 +1449,7 @@ int guild_get_alliance_count(struct guild *g,int flag)
}
// Blocks all guild skills which have a common delay time.
-void guild_block_skill(struct map_session_data *sd, int time)
+static void guild_block_skill(struct map_session_data *sd, int time)
{
uint16 skill_id[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL };
int i;
@@ -1450,7 +1464,7 @@ void guild_block_skill(struct map_session_data *sd, int time)
* 1 = enemy
* Returns true if yes.
*---------------------------------------------------*/
-int guild_check_alliance(int guild_id1, int guild_id2, int flag)
+static int guild_check_alliance(int guild_id1, int guild_id2, int flag)
{
struct guild *g;
int i;
@@ -1466,7 +1480,8 @@ int guild_check_alliance(int guild_id1, int guild_id2, int flag)
/*====================================================
* Player sd, asking player tsd an alliance between their 2 guilds
*---------------------------------------------------*/
-int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) {
+static int guild_reqalliance(struct map_session_data *sd, struct map_session_data *tsd)
+{
struct guild *g[2];
int i;
@@ -1522,7 +1537,8 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
/*====================================================
* Player sd, answer to player tsd (account_id) for an alliance request
*---------------------------------------------------*/
-int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag) {
+static int guild_reply_reqalliance(struct map_session_data *sd, int account_id, int flag)
+{
struct map_session_data *tsd;
nullpo_ret(sd);
@@ -1582,7 +1598,8 @@ int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag)
/*====================================================
* Player sd asking to break alliance with guild guild_id
*---------------------------------------------------*/
-int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) {
+static int guild_delalliance(struct map_session_data *sd, int guild_id, int flag)
+{
nullpo_ret(sd);
if(map->agit_flag || map->agit2_flag) {
@@ -1598,7 +1615,7 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) {
/*====================================================
* Player sd, asking player tsd a formal enemy relation between their 2 guilds
*---------------------------------------------------*/
-int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd)
+static int guild_opposition(struct map_session_data *sd, struct map_session_data *tsd)
{
struct guild *g;
int i;
@@ -1641,7 +1658,8 @@ int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd)
/*====================================================
* Notification of a relationship between 2 guilds
*---------------------------------------------------*/
-int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag,const char *name1,const char *name2) {
+static int guild_allianceack(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2)
+{
struct guild *g[2] = { NULL };
int guild_id[2] = { 0 };
const char *guild_name[2] = { NULL };
@@ -1731,7 +1749,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
* Notification for the guild disbanded
* @see DBApply
*/
-int guild_broken_sub(union DBKey key, struct DBData *data, va_list ap)
+static int guild_broken_sub(union DBKey key, struct DBData *data, va_list ap)
{
struct guild *g = DB->data2ptr(data);
int guild_id=va_arg(ap,int);
@@ -1757,7 +1775,7 @@ int guild_broken_sub(union DBKey key, struct DBData *data, va_list ap)
* Invoked on Castles when a guild is broken. [Skotlex]
* @see DBApply
*/
-int castle_guild_broken_sub(union DBKey key, struct DBData *data, va_list ap)
+static int castle_guild_broken_sub(union DBKey key, struct DBData *data, va_list ap)
{
struct guild_castle *gc = DB->data2ptr(data);
int guild_id = va_arg(ap, int);
@@ -1778,7 +1796,7 @@ int castle_guild_broken_sub(union DBKey key, struct DBData *data, va_list ap)
}
//Invoked on /breakguild "Guild name"
-int guild_broken(int guild_id,int flag)
+static int guild_broken(int guild_id, int flag)
{
struct guild *g = guild->search(guild_id);
struct map_session_data *sd = NULL;
@@ -1822,7 +1840,7 @@ int guild_broken(int guild_id,int flag)
}
//Changes the Guild Master to the specified player. [Skotlex]
-int guild_gm_change(int guild_id, int char_id)
+static int guild_gm_change(int guild_id, int char_id)
{
struct guild *g = guild->search(guild_id);
char *name;
@@ -1848,7 +1866,7 @@ int guild_gm_change(int guild_id, int char_id)
}
//Notification from Char server that a guild's master has changed. [Skotlex]
-int guild_gm_changed(int guild_id, int account_id, int char_id)
+static int guild_gm_changed(int guild_id, int account_id, int char_id)
{
struct guild *g;
struct guild_member gm;
@@ -1905,7 +1923,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
/*====================================================
* Guild disbanded
*---------------------------------------------------*/
-int guild_break(struct map_session_data *sd, const char *name)
+static int guild_break(struct map_session_data *sd, const char *name)
{
struct guild *g;
struct unit_data *ud;
@@ -1967,7 +1985,7 @@ int guild_break(struct map_session_data *sd, const char *name)
* Creates a list of guild castle IDs to be requested
* from char-server.
*/
-void guild_castle_map_init(void)
+static void guild_castle_map_init(void)
{
int num = db_size(guild->castle_db);
@@ -1997,7 +2015,7 @@ void guild_castle_map_init(void)
* @param index Type of data to change
* @param value New value
*/
-int guild_castledatasave(int castle_id, int index, int value)
+static int guild_castledatasave(int castle_id, int index, int value)
{
struct guild_castle *gc = guild->castle_search(castle_id);
@@ -2058,7 +2076,7 @@ int guild_castledatasave(int castle_id, int index, int value)
return 0;
}
-void guild_castle_reconnect_sub(void *key, void *data, va_list ap)
+static void guild_castle_reconnect_sub(void *key, void *data, va_list ap)
{
int castle_id = GetWord((int)h64BPTRSIZE(key), 0);
int index = GetWord((int)h64BPTRSIZE(key), 1);
@@ -2071,7 +2089,7 @@ void guild_castle_reconnect_sub(void *key, void *data, va_list ap)
* disconnected.
* On reconnect pushes all changes to char-server for saving.
*/
-void guild_castle_reconnect(int castle_id, int index, int value)
+static void guild_castle_reconnect(int castle_id, int index, int value)
{
static struct linkdb_node *gc_save_pending = NULL;
@@ -2087,7 +2105,7 @@ void guild_castle_reconnect(int castle_id, int index, int value)
}
// Load castle data then invoke OnAgitInit* on last
-int guild_castledataloadack(int len, const struct guild_castle *gc)
+static int guild_castledataloadack(int len, const struct guild_castle *gc)
{
int i;
int n = (len-4) / sizeof(struct guild_castle);
@@ -2130,7 +2148,7 @@ int guild_castledataloadack(int len, const struct guild_castle *gc)
/*====================================================
* Start normal woe and triggers all npc OnAgitStart
*---------------------------------------------------*/
-void guild_agit_start(void)
+static void guild_agit_start(void)
{
// Run All NPC_Event[OnAgitStart]
int c = npc->event_doall("OnAgitStart");
@@ -2140,7 +2158,7 @@ void guild_agit_start(void)
/*====================================================
* End normal woe and triggers all npc OnAgitEnd
*---------------------------------------------------*/
-void guild_agit_end(void)
+static void guild_agit_end(void)
{
// Run All NPC_Event[OnAgitEnd]
int c = npc->event_doall("OnAgitEnd");
@@ -2150,7 +2168,7 @@ void guild_agit_end(void)
/*====================================================
* Start woe2 and triggers all npc OnAgitStart2
*---------------------------------------------------*/
-void guild_agit2_start(void)
+static void guild_agit2_start(void)
{
// Run All NPC_Event[OnAgitStart2]
int c = npc->event_doall("OnAgitStart2");
@@ -2160,7 +2178,7 @@ void guild_agit2_start(void)
/*====================================================
* End woe2 and triggers all npc OnAgitEnd2
*---------------------------------------------------*/
-void guild_agit2_end(void)
+static void guild_agit2_end(void)
{
// Run All NPC_Event[OnAgitEnd2]
int c = npc->event_doall("OnAgitEnd2");
@@ -2168,7 +2186,7 @@ void guild_agit2_end(void)
}
// How many castles does this guild have?
-int guild_checkcastles(struct guild *g)
+static int guild_checkcastles(struct guild *g)
{
int nb_cas = 0;
struct guild_castle* gc = NULL;
@@ -2184,7 +2202,7 @@ int guild_checkcastles(struct guild *g)
}
// Are these two guilds allied?
-bool guild_isallied(int guild_id, int guild_id2)
+static bool guild_isallied(int guild_id, int guild_id2)
{
int i;
struct guild* g = guild->search(guild_id);
@@ -2194,7 +2212,8 @@ bool guild_isallied(int guild_id, int guild_id2)
return( i < MAX_GUILDALLIANCE && g->alliance[i].opposition == 0 );
}
-void guild_flag_add(struct npc_data *nd) {
+static void guild_flag_add(struct npc_data *nd)
+{
int i;
nullpo_retv(nd);
@@ -2212,7 +2231,8 @@ void guild_flag_add(struct npc_data *nd) {
guild->flags[i] = nd;
}
-void guild_flag_remove(struct npc_data *nd) {
+static void guild_flag_remove(struct npc_data *nd)
+{
int i, cursor;
nullpo_retv(nd);
if( guild->flags_count == 0 )
@@ -2241,7 +2261,7 @@ void guild_flag_remove(struct npc_data *nd) {
/**
* @see DBApply
*/
-int eventlist_db_final(union DBKey key, struct DBData *data, va_list ap)
+static int eventlist_db_final(union DBKey key, struct DBData *data, va_list ap)
{
struct eventlist *next = NULL;
struct eventlist *current = DB->data2ptr(data);
@@ -2256,7 +2276,7 @@ int eventlist_db_final(union DBKey key, struct DBData *data, va_list ap)
/**
* @see DBApply
*/
-int guild_expcache_db_final(union DBKey key, struct DBData *data, va_list ap)
+static int guild_expcache_db_final(union DBKey key, struct DBData *data, va_list ap)
{
ers_free(guild->expcache_ers, DB->data2ptr(data));
return 0;
@@ -2265,7 +2285,7 @@ int guild_expcache_db_final(union DBKey key, struct DBData *data, va_list ap)
/**
* @see DBApply
*/
-int guild_castle_db_final(union DBKey key, struct DBData *data, va_list ap)
+static int guild_castle_db_final(union DBKey key, struct DBData *data, va_list ap)
{
struct guild_castle* gc = DB->data2ptr(data);
if( gc->temp_guardians )
@@ -2275,7 +2295,8 @@ int guild_castle_db_final(union DBKey key, struct DBData *data, va_list ap)
}
/* called when scripts are reloaded/unloaded */
-void guild_flags_clear(void) {
+static void guild_flags_clear(void)
+{
int i;
for( i = 0; i < guild->flags_count; i++ ) {
if( guild->flags[i] )
@@ -2285,7 +2306,8 @@ void guild_flags_clear(void) {
guild->flags_count = 0;
}
-void do_init_guild(bool minimal) {
+static void do_init_guild(bool minimal)
+{
if (minimal)
return;
@@ -2305,7 +2327,7 @@ void do_init_guild(bool minimal) {
timer->add_interval(timer->gettick()+GUILD_SEND_XY_INVERVAL,guild->send_xy_timer,0,0,GUILD_SEND_XY_INVERVAL);
}
-void do_final_guild(void)
+static void do_final_guild(void)
{
struct DBIterator *iter = db_iterator(guild->db);
struct guild *g;
@@ -2331,7 +2353,9 @@ void do_final_guild(void)
if( guild->flags )
aFree(guild->flags);
}
-void guild_defaults(void) {
+
+void guild_defaults(void)
+{
guild = &guild_s;
guild->init = do_init_guild;