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.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index 1929808ca..83afc9538 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -399,8 +399,11 @@ int guild_created(int account_id,int guild_id) {
//struct guild *g;
sd->status.guild_id=guild_id;
clif->guild_created(sd,0); // Success
- if(battle_config.guild_emperium_check)
- pc->delitem(sd, pc->search_inventory(sd, ITEMID_EMPERIUM), 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME); //emperium consumption
+ if (battle_config.guild_emperium_check) {
+ int n = pc->search_inventory(sd, ITEMID_EMPERIUM);
+ if (n != INDEX_NOT_FOUND)
+ pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME); //emperium consumption
+ }
return 0;
}
@@ -413,20 +416,18 @@ int guild_request_info(int guild_id)
//Information request with event
int guild_npc_request_info(int guild_id,const char *event)
{
- if( guild->search(guild_id) )
- {
- if( event && *event )
+ if (guild->search(guild_id) != NULL) {
+ if (event != NULL && *event != '\0')
npc->event_do(event);
return 0;
}
- if( event && *event )
- {
+ if (event != NULL && *event != '\0') {
struct eventlist *ev;
struct DBData prev;
- ev=(struct eventlist *)aCalloc(sizeof(struct eventlist),1);
- memcpy(ev->name,event,strlen(event));
+ CREATE(ev, struct eventlist, 1);
+ safestrncpy(ev->name, event, sizeof(ev->name));
//The one in the db (if present) becomes the next event from this.
if (guild->infoevent_db->put(guild->infoevent_db, DB->i2key(guild_id), DB->ptr2data(ev), &prev))
ev->next = DB->data2ptr(&prev);