Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bug Reports

Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here.

Reply
 
Thread Tools Display Modes
  #31  
Old 11-27-2012, 05:00 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

You could create a new character and then look at the inventory entry in the database before clicking enter world. At least you could verify what the initial
save value is.



EDIT: Another thing to look at is how SummonItem modifies its charges:

Code:
	ItemInst* inst = database.CreateItem(item, charges);
		if (inst) {
			// Custom logic for SummonItem
			if ((inst->GetCharges()==0))
				inst->SetCharges(1);
			if ((inst->GetCharges()>0))
				inst->SetCharges(inst->GetCharges());
		<...>
		}
It creates the item first, and then goes back and modifies the inst charges.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #32  
Old 11-27-2012, 05:13 PM
Tabasco's Avatar
Tabasco
Discordant
 
Join Date: Sep 2009
Posts: 269
Default

There are already provisions for it in most places, but the loss occurs in Database::StoreCharacter(), which is called right after starting items are populated.

The charges field in the inventory table is unsigned and the item charges are written without any testing.

Code:
            MakeAnyLenString
            (
                &invquery,
                "INSERT INTO inventory SET "
                "charid=%0u, slotid=%0d, itemid=%0u, charges=%0d, color=%0u",
                charid, i, newinv->GetItem()->ID,
                newinv->GetCharges(), newinv->GetColor()
            );
Reply With Quote
  #33  
Old 11-27-2012, 06:12 PM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Quote:
Originally Posted by Caryatis View Post
Because you did something retarded by removing the table completely instead of say, cleaning it out and just adding the 10 items to it. You think its cleaner to edit the source but that just shows your inexperience.
Hi Caryatis, thanks for your feedback. I have no problems admitting my inexperience with the eqemu source, however I am not inexperienced in software development and design.

Your assumption that "I think it's cleaner" is incorrect. I looked at my requirements and considered the options available. I chose the option that satisfied my requirements and was both simple and pragmatic.

Quote:
Originally Posted by Caryatis View Post
Ever think of making the charges column signed? Probably wouldn't dissolve your computer if you tried.
If you read through the thread you see we have covered this already, it will not fix the issue. I agree with you though that it probably wont dissolve my computer.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #34  
Old 02-18-2013, 07:52 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Necro!

I came across this issue again and the following code now works as a work-around.

Code:
i->PutItem( i->FindFreeSlot(0,0), *pDB->CreateBaseItem( pDB->GetItem( YOUR_ITEM_ID ), 0 ) );
CreateBaseItem must be called, only calling GetItem will result in the item being out of charges.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?

Last edited by Drajor; 02-18-2013 at 07:53 AM.. Reason: Spelling.. I just walked 20km!
Reply With Quote
  #35  
Old 02-18-2013, 08:59 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

I'm looking at the current code in SharedDatabase::SetStartingItems, and it does call CreateBaseItem.

The code you posted has a memory leak since the ItemInst* returned from CreateBaseItem is never deleted.
Reply With Quote
  #36  
Old 02-18-2013, 11:17 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Good catch, thank you!
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:09 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3