summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/int_guild.c1
-rw-r--r--src/common/db.h4
-rw-r--r--src/common/mmo.h3
-rw-r--r--src/map/atcommand.c8
-rw-r--r--src/map/chat.c2
-rw-r--r--src/map/clif.c18
-rw-r--r--src/map/guild.c18
-rw-r--r--src/map/intif.c12
-rw-r--r--src/map/npc.h9
-rw-r--r--src/map/npc_chat.c18
-rw-r--r--src/map/script.c46
11 files changed, 67 insertions, 72 deletions
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 6bd8ca568..427c57531 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -43,7 +43,6 @@ static bool guild_check_empty(struct guild *g);
int guild_calcinfo(struct guild *g);
int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len);
int mapif_guild_info(int fd,struct guild *g);
-int guild_break_sub(int key,void *data,va_list ap);
int inter_guild_tosql(struct guild *g,int flag);
static int guild_save_timer(int tid, int64 tick, int id, intptr_t data) {
diff --git a/src/common/db.h b/src/common/db.h
index 9d7bdda10..c00489b93 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -928,8 +928,8 @@ struct linkdb_node {
typedef void (*LinkDBFunc)(void* key, void* data, va_list args);
-void linkdb_insert (struct linkdb_node** head, void *key, void* data); // 重複を考慮しない
-void linkdb_replace (struct linkdb_node** head, void *key, void* data); // 重複を考慮する
+void linkdb_insert (struct linkdb_node** head, void *key, void* data); // Doesn't take into account duplicate keys
+void linkdb_replace (struct linkdb_node** head, void *key, void* data); // Takes into account duplicate keys
void* linkdb_search (struct linkdb_node** head, void *key);
void* linkdb_erase (struct linkdb_node** head, void *key);
void linkdb_final (struct linkdb_node** head);
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 594d1cb26..cb1e52311 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -536,6 +536,7 @@ struct guild_skill {
int id,lv;
};
+struct hChSysCh;
struct guild {
int guild_id;
short guild_lv, connect_member, max_member, average_lv;
@@ -558,7 +559,7 @@ struct guild {
short *instance;
unsigned short instances;
- void *channel;
+ struct hChSysCh *channel;
};
struct guild_castle {
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index d4b6c2382..b2d486520 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8647,7 +8647,7 @@ ACMD(join) {
} else if( hChSys.ally && sd->status.guild_id && strcmpi(name + 1, hChSys.ally_name) == 0 ) {
struct guild *g = sd->guild;
if( !g ) return false;/* unlikely, but we wont let it crash anyway. */
- channel = (struct hChSysCh *)g->channel;
+ channel = g->channel;
} else if( !( channel = strdb_get(clif->channel_db, name + 1) ) ) {
sprintf(atcmd_output, msg_txt(1400),name,command); // Unknown Channel '%s' (usage: %s <#channel_name>)
clif->message(fd, atcmd_output);
@@ -8691,8 +8691,8 @@ ACMD(join) {
int i;
for (i = 0; i < MAX_GUILDALLIANCE; i++) {
if( g->alliance[i].opposition == 0 && g->alliance[i].guild_id && (sg = guild->search(g->alliance[i].guild_id) ) ) {
- if( !(((struct hChSysCh*)sg->channel)->banned && idb_exists(((struct hChSysCh*)sg->channel)->banned, sd->status.account_id))) {
- clif->chsys_join((struct hChSysCh *)sg->channel,sd);
+ if( !(sg->channel->banned && idb_exists(sg->channel->banned, sd->status.account_id))) {
+ clif->chsys_join(sg->channel,sd);
}
}
}
@@ -8822,7 +8822,7 @@ ACMD(channel) {
if( hChSys.ally && sd->status.guild_id ) {
struct guild *g = sd->guild;
if( !g ) { dbi_destroy(iter); return false; }
- sprintf(atcmd_output, msg_txt(1409), hChSys.ally_name, db_size(((struct hChSysCh *)g->channel)->users));// - #%s ( %d users )
+ sprintf(atcmd_output, msg_txt(1409), hChSys.ally_name, db_size(g->channel->users));// - #%s ( %d users )
clif->message(fd, atcmd_output);
}
for(channel = dbi_first(iter); dbi_exists(iter); channel = dbi_next(iter)) {
diff --git a/src/map/chat.c b/src/map/chat.c
index 52d7f246a..50fe2aeb5 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -318,7 +318,7 @@ int chat_kickchat(struct map_session_data* sd, const char* kickusername) {
if (pc_has_permission(cd->usersd[i], PC_PERM_NO_CHAT_KICK))
return 0; //gm kick protection [Valaris]
- idb_put(cd->kick_list,cd->usersd[i]->status.char_id,(void*)1);
+ idb_iput(cd->kick_list,cd->usersd[i]->status.char_id,1);
chat->leave(cd->usersd[i],1);
return 0;
diff --git a/src/map/clif.c b/src/map/clif.c
index 5f61bafad..77d4d20d8 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10387,7 +10387,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
} else if( hChSys.ally && sd->status.guild_id && strcmpi(chname, hChSys.ally_name) == 0 ) {
struct guild *g = sd->guild;
if( !g ) return;
- channel = (struct hChSysCh *)g->channel;
+ channel = g->channel;
}
if( channel || (channel = strdb_get(clif->channel_db,chname)) ) {
int k;
@@ -10402,8 +10402,8 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
struct guild *g = sd->guild, *sg = NULL;
for (k = 0; k < MAX_GUILDALLIANCE; k++) {
if( g->alliance[k].opposition == 0 && g->alliance[k].guild_id && (sg = guild->search(g->alliance[k].guild_id) ) ) {
- if( !(((struct hChSysCh*)sg->channel)->banned && idb_exists(((struct hChSysCh*)sg->channel)->banned, sd->status.account_id)))
- clif->chsys_join((struct hChSysCh *)sg->channel,sd);
+ if( !(sg->channel->banned && idb_exists(sg->channel->banned, sd->status.account_id)))
+ clif->chsys_join(sg->channel,sd);
}
}
}
@@ -10683,19 +10683,19 @@ void clif_hercules_chsys_gjoin(struct guild *g1,struct guild *g2) {
struct hChSysCh *channel;
int j;
- if( (channel = (struct hChSysCh*)g1->channel) ) {
+ if( (channel = g1->channel) ) {
for(j = 0; j < g2->max_member; j++) {
if( (sd = g2->member[j].sd) != NULL ) {
- if( !(((struct hChSysCh*)g1->channel)->banned && idb_exists(((struct hChSysCh*)g1->channel)->banned, sd->status.account_id)))
+ if( !(g1->channel->banned && idb_exists(g1->channel->banned, sd->status.account_id)))
clif->chsys_join(channel,sd);
}
}
}
- if( (channel = (struct hChSysCh*)g2->channel) ) {
+ if( (channel = g2->channel) ) {
for(j = 0; j < g1->max_member; j++) {
if( (sd = g1->member[j].sd) != NULL ) {
- if( !(((struct hChSysCh*)g2->channel)->banned && idb_exists(((struct hChSysCh*)g2->channel)->banned, sd->status.account_id)))
+ if( !(g2->channel->banned && idb_exists(g2->channel->banned, sd->status.account_id)))
clif->chsys_join(channel,sd);
}
}
@@ -10706,7 +10706,7 @@ void clif_hercules_chsys_gleave(struct guild *g1,struct guild *g2) {
struct hChSysCh *channel;
int j;
- if( (channel = (struct hChSysCh*)g1->channel) ) {
+ if( (channel = g1->channel) ) {
for(j = 0; j < g2->max_member; j++) {
if( (sd = g2->member[j].sd) != NULL ) {
clif->chsys_left(channel,sd);
@@ -10714,7 +10714,7 @@ void clif_hercules_chsys_gleave(struct guild *g1,struct guild *g2) {
}
}
- if( (channel = (struct hChSysCh*)g2->channel) ) {
+ if( (channel = g2->channel) ) {
for(j = 0; j < g1->max_member; j++) {
if( (sd = g1->member[j].sd) != NULL ) {
clif->chsys_left(channel,sd);
diff --git a/src/map/guild.c b/src/map/guild.c
index 8a34b7f4b..909c360a8 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -454,7 +454,7 @@ int guild_recv_info(struct guild *sg) {
DBData data;
struct map_session_data *sd;
bool guild_new = false;
- void *aChSysSave = NULL;
+ struct hChSysCh *aChSysSave = NULL;
nullpo_ret(sg);
@@ -494,8 +494,8 @@ int guild_recv_info(struct guild *sg) {
if( sg->alliance[i].guild_id == sd->status.guild_id ) {
clif->chsys_join(channel,sd);
} else if( tg[i] != NULL ) {
- if( !(((struct hChSysCh*)tg[i]->channel)->banned && idb_exists(((struct hChSysCh*)tg[i]->channel)->banned, sd->status.account_id)))
- clif->chsys_join((struct hChSysCh*)tg[i]->channel,sd);
+ if( !(tg[i]->channel->banned && idb_exists(tg[i]->channel->banned, sd->status.account_id)))
+ clif->chsys_join(tg[i]->channel,sd);
}
}
}
@@ -506,7 +506,7 @@ int guild_recv_info(struct guild *sg) {
}
- aChSysSave = (void*)channel;
+ aChSysSave = channel;
}
before=*sg;
@@ -725,14 +725,14 @@ void guild_member_joined(struct map_session_data *sd)
if( hChSys.ally && hChSys.ally_autojoin ) {
struct guild* sg = NULL;
- struct hChSysCh *channel = (struct hChSysCh*)g->channel;
+ struct hChSysCh *channel = g->channel;
if( !(channel->banned && idb_exists(channel->banned, sd->status.account_id) ) )
clif->chsys_join(channel,sd);
for (i = 0; i < MAX_GUILDALLIANCE; i++) {
if( g->alliance[i].opposition == 0 && g->alliance[i].guild_id && (sg = guild->search(g->alliance[i].guild_id) ) ) {
- if( !(((struct hChSysCh*)sg->channel)->banned && idb_exists(((struct hChSysCh*)sg->channel)->banned, sd->status.account_id)))
- clif->chsys_join((struct hChSysCh*)sg->channel,sd);
+ if( !(sg->channel->banned && idb_exists(sg->channel->banned, sd->status.account_id)))
+ clif->chsys_join(sg->channel,sd);
}
}
}
@@ -1753,7 +1753,7 @@ int guild_broken(int guild_id,int flag)
gstorage->delete(guild_id);
if( hChSys.ally ) {
if( g->channel != NULL ) {
- clif->chsys_delete(( struct hChSysCh * )g->channel);
+ clif->chsys_delete(g->channel);
}
}
if( g->instance )
@@ -2231,7 +2231,7 @@ void do_final_guild(void) {
for( g = dbi_first(iter); dbi_exists(iter); g = dbi_next(iter) ) {
if( g->channel != NULL )
- clif->chsys_delete((struct hChSysCh *)g->channel);
+ clif->chsys_delete(g->channel);
if( g->instance != NULL ) {
aFree(g->instance);
g->instance = NULL;
diff --git a/src/map/intif.c b/src/map/intif.c
index 9d447b9c0..49fbe4721 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -288,7 +288,7 @@ int intif_saveregistry(struct map_session_data *sd) {
iter = db_iterator(sd->var_db);
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) {
const char *varname = NULL;
- void *src = NULL;
+ struct script_reg_state *src = NULL;
if( data->type != DB_DATA_PTR ) /* its a @number */
continue;
@@ -301,10 +301,10 @@ int intif_saveregistry(struct map_session_data *sd) {
src = DB->data2ptr(data);
/* no need! */
- if( !((struct script_reg_state*)src)->update )
+ if( !src->update )
continue;
- ((struct script_reg_state*)src)->update = false;
+ src->update = false;
len = strlen(varname)+1;
@@ -317,8 +317,8 @@ int intif_saveregistry(struct map_session_data *sd) {
WFIFOL(inter_fd, plen) = script_getvaridx(key.i64);
plen += 4;
- if( ((struct script_reg_state*)src)->type ) {
- struct script_reg_str *p = src;
+ if( src->type ) {
+ struct script_reg_str *p = (struct script_reg_str *)src;
WFIFOB(inter_fd, plen) = p->value ? 2 : 3;
plen += 1;
@@ -336,7 +336,7 @@ int intif_saveregistry(struct map_session_data *sd) {
}
} else {
- struct script_reg_num *p = src;
+ struct script_reg_num *p = (struct script_reg_num *)src;
WFIFOB(inter_fd, plen) = p->value ? 0 : 1;
plen += 1;
diff --git a/src/map/npc.h b/src/map/npc.h
index a3f07e79c..2f4401bf7 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -46,6 +46,7 @@ struct npc_shop_data {
struct npc_item_list *item;/* list */
unsigned short items;/* total */
};
+struct npc_parse;
struct npc_data {
struct block_list bl;
struct unit_data *ud;
@@ -67,7 +68,7 @@ struct npc_data {
unsigned short level;
unsigned short stat_point;
- void* chatdb; // pointer to a npc_parse struct (see npc_chat.c)
+ struct npc_parse *chatdb;
char* path;/* path dir */
enum npc_subtype subtype;
int src_id;
@@ -302,12 +303,6 @@ struct pcrematch_set {
/*
* Entire data structure hung off a NPC
- *
- * The reason I have done it this way (a void * in npc_data and then
- * this) was to reduce the number of patches that needed to be applied
- * to a ragnarok distribution to bring this code online. I
- * also wanted people to be able to grab this one file to get updates
- * without having to do a large number of changes.
*/
struct npc_parse {
struct pcrematch_set* active;
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index 1372fff21..3f4a1a1c1 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -91,9 +91,9 @@ void finalize_pcrematch_entry(struct pcrematch_entry* e)
struct pcrematch_set* lookup_pcreset(struct npc_data* nd, int setid)
{
struct pcrematch_set *pcreset;
- struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
+ struct npc_parse *npcParse = nd->chatdb;
if (npcParse == NULL)
- nd->chatdb = npcParse = (struct npc_parse *) aCalloc(sizeof(struct npc_parse), 1);
+ nd->chatdb = npcParse = (struct npc_parse *)aCalloc(sizeof(struct npc_parse), 1);
pcreset = npcParse->active;
@@ -112,7 +112,7 @@ struct pcrematch_set* lookup_pcreset(struct npc_data* nd, int setid)
}
if (pcreset == NULL) {
- pcreset = (struct pcrematch_set *) aCalloc(sizeof(struct pcrematch_set), 1);
+ pcreset = (struct pcrematch_set *)aCalloc(sizeof(struct pcrematch_set), 1);
pcreset->next = npcParse->inactive;
if (pcreset->next != NULL)
pcreset->next->prev = pcreset;
@@ -132,7 +132,7 @@ struct pcrematch_set* lookup_pcreset(struct npc_data* nd, int setid)
void activate_pcreset(struct npc_data* nd, int setid)
{
struct pcrematch_set *pcreset;
- struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
+ struct npc_parse *npcParse = nd->chatdb;
if (npcParse == NULL)
return; // Nothing to activate...
pcreset = npcParse->inactive;
@@ -165,7 +165,7 @@ void activate_pcreset(struct npc_data* nd, int setid)
void deactivate_pcreset(struct npc_data* nd, int setid)
{
struct pcrematch_set *pcreset;
- struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
+ struct npc_parse *npcParse = nd->chatdb;
if (npcParse == NULL)
return; // Nothing to deactivate...
if (setid == -1) {
@@ -202,7 +202,7 @@ void delete_pcreset(struct npc_data* nd, int setid)
{
int active = 1;
struct pcrematch_set *pcreset;
- struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
+ struct npc_parse *npcParse = nd->chatdb;
if (npcParse == NULL)
return; // Nothing to deactivate...
pcreset = npcParse->active;
@@ -299,7 +299,7 @@ void npc_chat_def_pattern(struct npc_data* nd, int setid, const char* pattern, c
*/
void npc_chat_finalize(struct npc_data* nd)
{
- struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
+ struct npc_parse *npcParse = nd->chatdb;
if (npcParse == NULL)
return;
@@ -318,8 +318,8 @@ void npc_chat_finalize(struct npc_data* nd)
*/
int npc_chat_sub(struct block_list* bl, va_list ap)
{
- struct npc_data* nd = (struct npc_data *) bl;
- struct npc_parse* npcParse = (struct npc_parse *) nd->chatdb;
+ struct npc_data *nd = (struct npc_data *) bl;
+ struct npc_parse *npcParse = nd->chatdb;
char* msg;
int len, i;
struct map_session_data* sd;
diff --git a/src/map/script.c b/src/map/script.c
index d36b1103a..cadf36820 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2837,20 +2837,20 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co
i64db_put(n, num, aStrdup(str));
if( script_getvaridx(num) )
script->array_update(
- (name[1] == '@') ?
- &st->stack->array_function_db :
- &st->script->script_arrays_db,
- num,
- false);
+ (name[1] == '@') ?
+ &st->stack->array_function_db :
+ &st->script->script_arrays_db,
+ num,
+ false);
} else {
i64db_remove(n, num);
if( script_getvaridx(num) )
script->array_update(
- (name[1] == '@') ?
- &st->stack->array_function_db :
- &st->script->script_arrays_db,
- num,
- true);
+ (name[1] == '@') ?
+ &st->stack->array_function_db :
+ &st->script->script_arrays_db,
+ num,
+ true);
}
}
}
@@ -2908,20 +2908,20 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co
i64db_iput(n, num, val);
if( script_getvaridx(num) )
script->array_update(
- (name[1] == '@') ?
- &st->stack->array_function_db :
- &st->script->script_arrays_db,
- num,
- false);
+ (name[1] == '@') ?
+ &st->stack->array_function_db :
+ &st->script->script_arrays_db,
+ num,
+ false);
} else {
i64db_remove(n, num);
if( script_getvaridx(num) )
script->array_update(
- (name[1] == '@') ?
- &st->stack->array_function_db :
- &st->script->script_arrays_db,
- num,
- true);
+ (name[1] == '@') ?
+ &st->stack->array_function_db :
+ &st->script->script_arrays_db,
+ num,
+ true);
}
}
}
@@ -4113,15 +4113,15 @@ void script_setarray_pc(struct map_session_data* sd, const char* varname, uint32
* Clears persistent variables from memory
**/
int script_reg_destroy(DBKey key, DBData *data, va_list ap) {
- void *src;
+ struct script_reg_state *src;
if( data->type != DB_DATA_PTR )/* got no need for those! */
return 0;
src = DB->data2ptr(data);
- if( ((struct script_reg_state*)src)->type ) {
- struct script_reg_str *p = src;
+ if( src->type ) {
+ struct script_reg_str *p = (struct script_reg_str *)src;
if( p->value )
aFree(p->value);