diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-23 16:11:51 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-23 16:11:51 +0000 |
commit | 62c6e90f201643b5cebb81ce4bc58cd4a28cf8f6 (patch) | |
tree | 84426a12a3037ea6cfeea842331260a0d99b9718 /src | |
parent | 43fe20d3fa5793b185d5f399c5c48075d4d6f842 (diff) | |
download | hercules-62c6e90f201643b5cebb81ce4bc58cd4a28cf8f6.tar.gz hercules-62c6e90f201643b5cebb81ce4bc58cd4a28cf8f6.tar.bz2 hercules-62c6e90f201643b5cebb81ce4bc58cd4a28cf8f6.tar.xz hercules-62c6e90f201643b5cebb81ce4bc58cd4a28cf8f6.zip |
- Standarized PF_MEMORIZE to be 50% cast time on all skills (instead of -50% for targetted skills and -66% for ground skills >.>)
- Cleared up the comment on what item_check does and how it works.
- Changed the pointer dummy_item to a normal struct variable.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7316 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/itemdb.c | 46 | ||||
-rw-r--r-- | src/map/skill.c | 5 | ||||
-rw-r--r-- | src/map/unit.c | 12 |
4 files changed, 26 insertions, 39 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index b5ea9fe40..324994d69 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1859,7 +1859,7 @@ int clif_selllist(struct map_session_data *sd) { nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd, MAX_INVENTORY * 10 + 4);
+ WFIFOHEAD(fd, MAX_INVENTORY * 10 + 4);
WFIFOW(fd,0)=0xc7;
for(i=0;i<MAX_INVENTORY;i++) {
if(sd->status.inventory[i].nameid > 0 && sd->inventory_data[i]) {
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index dfc59416d..a577b1baa 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -24,7 +24,7 @@ static struct dbt* item_db; static struct item_group itemgroup_db[MAX_ITEMGROUP];
-struct item_data *dummy_item=NULL; //This is the default dummy item used for non-existant items. [Skotlex]
+struct item_data dummy_item; //This is the default dummy item used for non-existant items. [Skotlex]
/*==========================================
* 名前で検索用
@@ -37,7 +37,7 @@ int itemdb_searchname_sub(DBKey key,void *data,va_list ap) char *str;
str=va_arg(ap,char *);
dst=va_arg(ap,struct item_data **);
- if(item == dummy_item) return 0;
+ if(item == &dummy_item) return 0;
if( strcmpi(item->name,str)==0 ) //by lupus
*dst=item;
return 0;
@@ -74,7 +74,7 @@ static int itemdb_searchname_array_sub(DBKey key,void * data,va_list ap) struct item_data *item=(struct item_data *)data;
char *str;
str=va_arg(ap,char *);
- if (item == dummy_item)
+ if (item == &dummy_item)
return 1; //Invalid item.
if(stristr(item->jname,str))
return 0;
@@ -135,7 +135,7 @@ int itemdb_group (int nameid) struct item_data* itemdb_exists(int nameid)
{
struct item_data* id = idb_get(item_db,nameid);
- if (id == dummy_item) return NULL;
+ if (id == &dummy_item) return NULL;
return id;
}
@@ -201,16 +201,14 @@ static void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask) }
static void create_dummy_data(void) {
- if (dummy_item)
- aFree(dummy_item);
-
- dummy_item=(struct item_data *)aCalloc(1,sizeof(struct item_data));
- dummy_item->nameid=500;
- dummy_item->weight=1;
- dummy_item->type=3; //Etc item
- strncpy(dummy_item->name,"UNKNOWN_ITEM",ITEM_NAME_LENGTH-1);
- strncpy(dummy_item->jname,"UNKNOWN_ITEM",ITEM_NAME_LENGTH-1);
- dummy_item->view_id = 512; //Use apple sprite.
+ memset(&dummy_item, 0, sizeof(struct item_data));
+ dummy_item.nameid=500;
+ dummy_item.weight=1;
+ dummy_item.value_sell = 1;
+ dummy_item.type=3; //Etc item
+ strncpy(dummy_item.name,"UNKNOWN_ITEM",ITEM_NAME_LENGTH-1);
+ strncpy(dummy_item.jname,"UNKNOWN_ITEM",ITEM_NAME_LENGTH-1);
+ dummy_item.view_id = 512; //Use apple sprite.
}
static void* create_item_data(DBKey key, va_list args) {
@@ -234,7 +232,7 @@ struct item_data* itemdb_load(int nameid) static void* return_dummy_data(DBKey key, va_list args) {
if (battle_config.error_log)
ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", key.i);
- return dummy_item;
+ return &dummy_item;
}
/*==========================================
@@ -1170,7 +1168,7 @@ static int itemdb_final_sub (DBKey key,void *data,va_list ap) id->unequip_script = NULL;
}
// Whether to clear the item data (exception: do not clear the dummy item data
- if (flag && id != dummy_item)
+ if (flag && id != &dummy_item)
aFree(id);
return 0;
@@ -1186,16 +1184,12 @@ void itemdb_reload(void) void do_final_itemdb(void)
{
item_db->destroy(item_db, itemdb_final_sub, 1);
- if (dummy_item) {
- if (dummy_item->script)
- script_free_code(dummy_item->script);
- if (dummy_item->equip_script)
- script_free_code(dummy_item->equip_script);
- if (dummy_item->unequip_script)
- script_free_code(dummy_item->unequip_script);
- aFree(dummy_item);
- dummy_item = NULL;
- }
+ if (dummy_item.script)
+ script_free_code(dummy_item.script);
+ if (dummy_item.equip_script)
+ script_free_code(dummy_item.equip_script);
+ if (dummy_item.unequip_script)
+ script_free_code(dummy_item.unequip_script);
}
int do_init_itemdb(void)
diff --git a/src/map/skill.c b/src/map/skill.c index d2438c855..6bb438690 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -8152,6 +8152,11 @@ int skill_castfix_sc (struct block_list *bl, int time) time -= time * (sc->data[SC_SUFFRAGIUM].val1 * 15) / 100; status_change_end(bl, SC_SUFFRAGIUM, -1); } + if (sc->data[SC_MEMORIZE].timer != -1) { + time>>=1; + if ((--sc->data[SC_MEMORIZE].val2) <= 0) + status_change_end(bl, SC_MEMORIZE, -1); + } if (sc->data[SC_POEMBRAGI].timer != -1) time -= time * sc->data[SC_POEMBRAGI].val2 / 100; } diff --git a/src/map/unit.c b/src/map/unit.c index a4534f766..0ca1e2559 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -873,12 +873,6 @@ int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int break; } - if (sc && sc->data[SC_MEMORIZE].timer != -1 && casttime > 0) { - casttime = casttime/2; - if ((--sc->data[SC_MEMORIZE].val2) <= 0) - status_change_end(src, SC_MEMORIZE, -1); - } - if( casttime>0 || temp){ clif_skillcasting(src, src->id, target_id, 0,0, skill_num,casttime); @@ -995,12 +989,6 @@ int unit_skilluse_pos2( struct block_list *src, int skill_x, int skill_y, int sk unit_stop_attack(src); ud->state.skillcastcancel = castcancel; - if (sc && sc->data[SC_MEMORIZE].timer != -1 && casttime > 0){ - casttime = casttime/3; - if ((--sc->data[SC_MEMORIZE].val2)<=0) - status_change_end(src, SC_MEMORIZE, -1); - } - if( casttime>0 ) { unit_stop_walking( src, 1); clif_skillcasting(src, src->id, 0, skill_x,skill_y, skill_num,casttime); |