diff options
-rw-r--r-- | src/emap/craft.c | 2 | ||||
-rw-r--r-- | src/emap/craftconf.c | 8 | ||||
-rw-r--r-- | src/emap/itemdb.c | 4 | ||||
-rw-r--r-- | src/emap/npc.c | 1 |
4 files changed, 8 insertions, 7 deletions
diff --git a/src/emap/craft.c b/src/emap/craft.c index c33ec64..f9f6f54 100644 --- a/src/emap/craft.c +++ b/src/emap/craft.c @@ -205,7 +205,7 @@ struct craft_vardata *craft_str_to_craft(const char *craftstr) strutil_free(craftdata); return false; } - VECTOR_ENSURE(crslot->items, slot + 1, 1); + VECTOR_ENSURE(crslot->items, 1, 1); VECTOR_INSERTZEROED(crslot->items, slot); struct item_pair *pair = &VECTOR_INDEX(crslot->items, slot); pair->index = index; diff --git a/src/emap/craftconf.c b/src/emap/craftconf.c index 0c9d329..7056d4f 100644 --- a/src/emap/craftconf.c +++ b/src/emap/craftconf.c @@ -100,7 +100,7 @@ static void craft_read_source_inventory(struct craft_db_entry *entry, struct config_setting_t *item; int invLen = VECTOR_LENGTH(entry->inventories); - VECTOR_ENSURE(entry->inventories, invLen + 1, 1); + VECTOR_ENSURE(entry->inventories, 1, 1); VECTOR_INSERTZEROED(entry->inventories, invLen); struct craft_db_inventory *inventory = &VECTOR_INDEX(entry->inventories, invLen); @@ -145,7 +145,7 @@ static void craft_read_create_items(struct craft_db_entry *entry, struct config_setting_t *item; int invLen = VECTOR_LENGTH(entry->create_items); - VECTOR_ENSURE(entry->create_items, invLen + 1, 1); + VECTOR_ENSURE(entry->create_items, 1, 1); VECTOR_INSERTZEROED(entry->create_items, invLen); struct craft_items_collection *collection = &VECTOR_INDEX(entry->create_items, invLen); VECTOR_INIT(*collection); @@ -171,7 +171,7 @@ static void craft_read_create_items(struct craft_db_entry *entry, continue; } - VECTOR_ENSURE(*collection, collecitonLen + 1, 1); + VECTOR_ENSURE(*collection, 1, 1); VECTOR_INSERTZEROED(*collection, collecitonLen); struct item_pair *pair = &VECTOR_INDEX(*collection, collecitonLen); pair->index = itemId; @@ -282,7 +282,7 @@ static void craft_read_items_collection(struct craft_db_entry *entry, continue; } - VECTOR_ENSURE(*vector, len + 1, 1); + VECTOR_ENSURE(*vector, 1, 1); VECTOR_INSERTZEROED(*vector, len); struct item_pair *pair = &VECTOR_INDEX(*vector, len); len ++; diff --git a/src/emap/itemdb.c b/src/emap/itemdb.c index 4c33853..366b05d 100644 --- a/src/emap/itemdb.c +++ b/src/emap/itemdb.c @@ -149,7 +149,7 @@ void eitemdb_readdb_additional_fields_pre(int *itemid, continue; const int val = libconfig->setting_get_int(it2); - VECTOR_ENSURE(data->allowedCards, cnt + 1, 1); + VECTOR_ENSURE(data->allowedCards, 1, 1); VECTOR_INSERTZEROED(data->allowedCards, cnt); struct ItemCardExt *allowedCard = &VECTOR_INDEX(data->allowedCards, cnt); @@ -178,7 +178,7 @@ void eitemdb_readdb_additional_fields_pre(int *itemid, const char *name = config_setting_name(it2); if (name && strncmp(name, "id", 2) && strncmp(name, "Id", 2)) continue; - VECTOR_ENSURE(data->allowedAmmo, cnt + 1, 1); + VECTOR_ENSURE(data->allowedAmmo, 1, 1); VECTOR_PUSH(data->allowedAmmo, atoi(name + 2)); cnt ++; } diff --git a/src/emap/npc.c b/src/emap/npc.c index 59f41cf..e4c2427 100644 --- a/src/emap/npc.c +++ b/src/emap/npc.c @@ -181,6 +181,7 @@ bool enpc_duplicate_script_sub_pre(struct npc_data **ndPtr, CREATE(code, struct script_code, 1); const int sz = VECTOR_LENGTH(snd->u.scr.script->script_buf); + VECTOR_INIT(code->script_buf); VECTOR_ENSURE(code->script_buf, sz , 1); VECTOR_PUSHARRAY(code->script_buf, VECTOR_DATA(snd->u.scr.script->script_buf), sz); |