Page 1 of 1

Loading Items question

Posted: Fri Jul 24, 2009 4:17 pm
by John Adams
LE, forgive my noobness here ;) but I have a question about how World is loading items.

In net.cpp, I see where database.LoadItemList() gets called - so I follow that rabbit down the hole... where it then calls all these functions:

Code: Select all

void WorldDatabase::LoadItemList(){
	LoadBags();
	LoadFoods();
	LoadWeapons();
	LoadArmor();
	LoadShields();
	LoadSkillItems();
Let's go into each one of these individually.

LoadBags() : I am in a while loop for every Bag item in the database (314). Each while also executes LoadItemCommonData(id)

Code: Select all

Item* item = LoadItemCommonData(id);
LoadItemCommonData(id) : Runs a query --

Code: Select all

SELECT id, name, icon, count, tier, weight, description, show_name, attuneable, artifact, lore, temporary, notrade, novalue, nozone, nodestroy, crafted, good_only, evil_only, skill_id_req, skill_id_req2, skill_min, skill_max, slots, sell_price, stack_count, collectable, offers_quest_id, part_of_quest_id, recommended_level, adventure_default_level, max_charges, tradeskill_default_level, adventure_classes, tradeskill_classes from items
...with no "WHERE id = %li" or anything limiting the query to just the 1 bag item we're loading.

We do that for every single item we load, which from my uneducated view, appears like we are loading all 111,085 items for every item we're loading!

Is that true? Or am I missing out on some C++ magic somewhere?

I was looking into why item_details_skills were not being used, when I noticed this and had to ask. :)

Thanks for your patience.

Re: Loading Items question

Posted: Fri Jul 24, 2009 6:41 pm
by LethalEncounter
hehe, you are missing some the if statement :) It only does the query if the tmp_item_list list is empty.

Re: Loading Items question

Posted: Fri Jul 24, 2009 7:12 pm
by John Adams
Oh is that what that means? tee :oops: