summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-27 09:15:05 +0000
committerKevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-27 09:15:05 +0000
commit55434bd1ddfeb0b66247dbe4c420048863d44446 (patch)
treefb053a26628370a14b6f596265fcb89c0475541e /src
parent677598256feaad3bcef53805ad8c70e744a9b7d3 (diff)
downloadhercules-55434bd1ddfeb0b66247dbe4c420048863d44446.tar.gz
hercules-55434bd1ddfeb0b66247dbe4c420048863d44446.tar.bz2
hercules-55434bd1ddfeb0b66247dbe4c420048863d44446.tar.xz
hercules-55434bd1ddfeb0b66247dbe4c420048863d44446.zip
Changed the last commit so it must be called with @reloaditemdb2. @reloaditemdb only removes the item_data from the itemdb subsystem. If you don't like my code you can uncomment the macro I_HATE_KEVIN in item_db.c so it isn't even compiled.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12662 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c16
-rw-r--r--src/map/clif.c31
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/itemdb.c39
-rw-r--r--src/map/itemdb.h2
-rw-r--r--src/map/storage.h2
6 files changed, 46 insertions, 46 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 691035c61..628666df3 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -4049,7 +4049,7 @@ int atcommand_partyrecall(const int fd, struct map_session_data* sd, const char*
int atcommand_reloaditemdb(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
nullpo_retr(-1, sd);
- itemdb_reload();
+ itemdb_reload(0);
clif_displaymessage(fd, msg_txt(97)); // Item database reloaded.
return 0;
@@ -4058,6 +4058,19 @@ int atcommand_reloaditemdb(const int fd, struct map_session_data* sd, const char
/*==========================================
*
*------------------------------------------*/
+int atcommand_reloaditemdb2(const int fd, struct map_session_data* sd, const char* command, const char* message)
+{
+ nullpo_retr(-1, sd);
+ itemdb_reload(1);
+ clif_displaymessage(fd, msg_txt(97)); // Item database reloaded.
+
+ return 0;
+}
+
+
+/*==========================================
+ *
+ *------------------------------------------*/
int atcommand_reloadmobdb(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
nullpo_retr(-1, sd);
@@ -8373,6 +8386,7 @@ AtCommandInfo atcommand_info[] = {
{ "localbroadcast", 40, atcommand_localbroadcast }, // + /lb and /nlb
{ "recallall", 80, atcommand_recallall },
{ "reloaditemdb", 99, atcommand_reloaditemdb },
+ { "reloaditemdb2", 99, atcommand_reloaditemdb2 },
{ "reloadmobdb", 99, atcommand_reloadmobdb },
{ "reloadskilldb", 99, atcommand_reloadskilldb },
{ "reloadscript", 99, atcommand_reloadscript },
diff --git a/src/map/clif.c b/src/map/clif.c
index 66a01b867..55e9b1776 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1894,27 +1894,20 @@ void clif_storagelist(struct map_session_data *sd,struct storage *stor)
if(stor->storage_[i].nameid<=0)
continue;
id = itemdb_search(stor->storage_[i].nameid);
- if(!id)
- {
- //Item not found, was probably deleted and then map server reloaded/item db reloaded
- storage_delitem(sd, stor, i, stor->storage_[i].amount);
- return;
- }
- else
- if(!itemdb_isstackable2(id))
- { //Equippable
- WBUFW(bufe,ne*20+4)=i+1;
- clif_item_sub(bufe, ne*20+6, &stor->storage_[i], id, id->equip);
- clif_addcards(WBUFP(bufe, ne*20+16), &stor->storage_[i]);
- ne++;
- } else { //Stackable
- WBUFW(buf,n*s+4)=i+1;
- clif_item_sub(buf, n*s+6, &stor->storage_[i], id,-1);
+ if(!itemdb_isstackable2(id))
+ { //Equippable
+ WBUFW(bufe,ne*20+4)=i+1;
+ clif_item_sub(bufe, ne*20+6, &stor->storage_[i], id, id->equip);
+ clif_addcards(WBUFP(bufe, ne*20+16), &stor->storage_[i]);
+ ne++;
+ } else { //Stackable
+ WBUFW(buf,n*s+4)=i+1;
+ clif_item_sub(buf, n*s+6, &stor->storage_[i], id,-1);
#if PACKETVER >= 5
- clif_addcards(WBUFP(buf,n*s+14), &stor->storage_[i]);
+ clif_addcards(WBUFP(buf,n*s+14), &stor->storage_[i]);
#endif
- n++;
- }
+ n++;
+ }
}
if(n){
#if PACKETVER < 5
diff --git a/src/map/guild.c b/src/map/guild.c
index 0f4ec272b..b4104f4d0 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1594,7 +1594,7 @@ int guild_broken(int guild_id,int flag)
if( (gc=guild_castle_search(i)) != NULL ){
if(gc->guild_id == guild_id){
safestrncpy(name, gc->castle_event, 50);
- npc_event_do(strcat(name,"::OnGuildBreak"));
+ npc_event_do("::OnGuildBreak");
}
}
}
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 6cfbbca97..5fc174989 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1015,18 +1015,6 @@ static void destroy_item_data(struct item_data* self, int free_self)
/*==========================================
* Looks for an item, returns NULL if not found
*------------------------------------------*/
-struct item_data* itemdb_search2(int nameid)
-{
- if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) )
- {
- DBKey key;
- if( itemdb_array[nameid] )
- return itemdb_array[nameid];
- key.i = nameid;
- return NULL;
- }
- return (struct item_data*)idb_get(itemdb_other,nameid);
-}
static int itemdb_final_sub(DBKey key,void *data,va_list ap)
{
@@ -1038,6 +1026,9 @@ static int itemdb_final_sub(DBKey key,void *data,va_list ap)
return 0;
}
+//Uncomment this if you're an elitist jerk who thinks this code is unecessary
+//#define I_HATE_KEVIN
+#ifndef I_HATE_KEVIN
int itemdb_reload_check_npc(DBKey key,void * data,va_list ap)
{
struct npc_data * nd = (struct npc_data *)data;
@@ -1049,7 +1040,7 @@ int itemdb_reload_check_npc(DBKey key,void * data,va_list ap)
while(i < nd->u.shop.count)
{
- if(itemdb_search2(nd->u.shop.shop_item[i].nameid) == NULL)
+ if(itemdb_exists(nd->u.shop.shop_item[i].nameid) == NULL)
{
nd->u.shop.count--;
@@ -1094,7 +1085,7 @@ static int itemdb_reload_check(DBKey key,void *data,va_list ap)
if(!sd->status.inventory[i].nameid)
continue;
- id = itemdb_search2(sd->status.inventory[i].nameid);
+ id = itemdb_exists(sd->status.inventory[i].nameid);
if(id == NULL)
{
sd->inventory_data[i] = NULL;
@@ -1112,7 +1103,7 @@ static int itemdb_reload_check(DBKey key,void *data,va_list ap)
if(!sd->status.cart[i].nameid)
continue;
- id = itemdb_search2(sd->status.cart[i].nameid);
+ id = itemdb_exists(sd->status.cart[i].nameid);
if(id == NULL)
{
sd->inventory_data[i] = NULL;
@@ -1131,7 +1122,7 @@ static int itemdb_reload_check(DBKey key,void *data,va_list ap)
if(!sd->status.inventory[i].nameid)
continue;
- if(itemdb_search2(sd->status.inventory[i].nameid) == NULL)
+ if(itemdb_exists(sd->status.inventory[i].nameid) == NULL)
storage_delitem(sd, stor, i, stor->storage_[i].amount);
}
}
@@ -1154,7 +1145,7 @@ void itemdb_foreach_mobdb(void)
continue;
for(j=0; j < MAX_MOB_DROP; j++)
{
- id = itemdb_search2(mdb->dropitem[j].nameid);
+ id = itemdb_exists(mdb->dropitem[j].nameid);
if(id == NULL)
{
mdb->dropitem[j].nameid = 0;
@@ -1163,17 +1154,21 @@ void itemdb_foreach_mobdb(void)
}
}
}
+#endif
-void itemdb_reload(void)
+void itemdb_reload(int flag)
{
do_final_itemdb();
do_init_itemdb();
- //Update ALL items on the server
- map_foreachpc(itemdb_reload_check);
- npc_foreach(itemdb_reload_check_npc);
- itemdb_foreach_mobdb();
+ if(flag)
+ {
+ //Update ALL items on the server
+ map_foreachpc(itemdb_reload_check);
+ npc_foreach(itemdb_reload_check_npc);
+ itemdb_foreach_mobdb();
+ }
}
void do_final_itemdb(void)
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index cbbee0932..0ea53748d 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -137,7 +137,7 @@ int itemdb_isidentified(int);
int itemdb_isstackable(int);
int itemdb_isstackable2(struct item_data *);
-void itemdb_reload(void);
+void itemdb_reload(int flag);
void do_final_itemdb(void);
int do_init_itemdb(void);
diff --git a/src/map/storage.h b/src/map/storage.h
index fa33e2050..0822d37ce 100644
--- a/src/map/storage.h
+++ b/src/map/storage.h
@@ -11,7 +11,6 @@ struct item;
//#include "map.h"
struct map_session_data;
-struct storage *account2storage2(int account_id);
int storage_storageopen(struct map_session_data *sd);
int storage_storageadd(struct map_session_data *sd,int index,int amount);
int storage_storageget(struct map_session_data *sd,int index,int amount);
@@ -24,7 +23,6 @@ void do_final_storage(void);
void do_reconnect_storage(void);
struct storage* account2storage(int account_id);
struct storage* account2storage2(int account_id);
-int storage_delete(int account_id);
int storage_storage_quit(struct map_session_data *sd, int flag);
int storage_storage_save(int account_id, int final);
int storage_storage_saved(int account_id); //Ack from char server that guild store was saved.