diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/db.c | 2 | ||||
-rw-r--r-- | src/map/itemdb.c | 12 | ||||
-rw-r--r-- | src/map/itemdb.h | 2 | ||||
-rw-r--r-- | src/map/pc.c | 24 |
4 files changed, 30 insertions, 10 deletions
diff --git a/src/common/db.c b/src/common/db.c index 99c758a8d..bd2bea424 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -1791,9 +1791,9 @@ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data) if (node->deleted) { db_free_remove(db, node); } else { - db->release(node->key, node->data, DB_RELEASE_BOTH); if (out_data) memcpy(out_data, &node->data, sizeof(*out_data)); + db->release(node->key, node->data, DB_RELEASE_BOTH); retval = 1; } break; diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 0ea97ed47..e2d2621f8 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1920,15 +1920,21 @@ int itemdb_uid_load() { *------------------------------------*/ static void itemdb_read(void) { int i; + DBData prev; if (iMap->db_use_sql_item_db) itemdb_read_sqldb(); else itemdb_readdb(); - for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i ) - if( itemdb_array[i] ) - strdb_put(itemdb->names, itemdb_array[i]->name, itemdb_array[i]); + for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i ) { + if( itemdb_array[i] ) { + if( itemdb->names->put(itemdb->names,DB->str2key(itemdb_array[i]->name),DB->ptr2data(itemdb_array[i]),&prev) ) { + struct item_data *data = DB->data2ptr(&prev); + ShowError("itemdb_read: duplicate AegisName '%s' in item ID %d and %d\n",itemdb_array[i]->name,itemdb_array[i]->nameid,data->nameid); + } + } + } itemdb_read_combos(); itemdb->read_groups(); diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 41f40895b..45d4311e1 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -124,7 +124,7 @@ struct item_data { //Lupus: I rearranged order of these fields due to compatibility with ITEMINFO script command // some script commands should be revised as well... unsigned int class_base[3]; //Specifies if the base can wear this item (split in 3 indexes per type: 1-1, 2-1, 2-2) - unsigned class_upper : 4; //Specifies if the upper-type can equip it (bitfield, 1: normal, 2: upper, 3: baby,4:third) + unsigned class_upper : 6; //Specifies if the upper-type can equip it (bitfield, 0x01: normal, 0x02: upper, 0x04: baby normal, 0x08: third normal, 0x10: third upper, 0x20: third baby) struct { unsigned short chance; int id; diff --git a/src/map/pc.c b/src/map/pc.c index e0f2bf2f8..0a815cb24 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4249,12 +4249,26 @@ int pc_isUseitem(struct map_session_data *sd,int n) (item->class_base[sd->class_&JOBL_2_1?1:(sd->class_&JOBL_2_2?2:0)]) )) return 0; - //Not usable by upper class. [Inkfish] + + //Not usable by upper class. [Haru] while( 1 ) { - if( item->class_upper&1 && !(sd->class_&(JOBL_UPPER|JOBL_THIRD|JOBL_BABY)) ) break; - if( item->class_upper&2 && sd->class_&(JOBL_UPPER|JOBL_THIRD) ) break; - if( item->class_upper&4 && sd->class_&JOBL_BABY ) break; - if( item->class_upper&8 && sd->class_&JOBL_THIRD ) break; + // Normal classes (no upper, no baby, no third classes) + if( item->class_upper&0x01 && !(sd->class_&(JOBL_UPPER|JOBL_THIRD|JOBL_BABY)) ) break; +#ifdef RENEWAL + // Upper classes (no third classes) + if( item->class_upper&0x02 && sd->class_&JOBL_UPPER && !(sd->class_&JOBL_THIRD) ) break; +#else + //pre-re has no use for the extra, so we maintain the previous for backwards compatibility + if( item->class_upper&0x02 && sd->class_&(JOBL_UPPER|JOBL_THIRD) ) break; +#endif + // Baby classes (no third classes) + if( item->class_upper&0x04 && sd->class_&JOBL_BABY && !(sd->class_&JOBL_THIRD) ) break; + // Third classes (no upper, no baby classes) + if( item->class_upper&0x08 && sd->class_&JOBL_THIRD && !(sd->class_&(JOBL_UPPER|JOBL_BABY)) ) break; + // Upper third classes + if( item->class_upper&0x10 && sd->class_&JOBL_THIRD && sd->class_&JOBL_UPPER ) break; + // Baby third classes + if( item->class_upper&0x20 && sd->class_&JOBL_THIRD && sd->class_&JOBL_BABY ) break; return 0; } |