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
  #1  
Old 05-16-2010, 08:59 AM
fourier
Sarnak
 
Join Date: Aug 2009
Location: MO
Posts: 35
Default Possible divide by 0 unhandled in AddLootDropToNPC

Not sure if this should be posted here or on projecteq since its a database issue unhandled by code. I noticed this happened in code and matching db revision 1410. In loottables.cpp in function (with non pool based looting enabled):

Code:
void ZoneDatabase::AddLootDropToNPC(NPC* npc,int32 lootdrop_id, ItemList* itemlist) 

.....

unsigned int drop_chance = rand() % totalchance;
If totalchance is 0 as a result of:

Code:
// line 396:
 	for (r = 0; r < lds->NumEntries; r++) {
		totalchance += lds->Entries[r].chance;
	}
Then drop_chance will not be assigned and a divide by 0 error will occur. Mathematically , x % 0 should return x (Knuth says), but it seems c++ treats it as a dbz.

I fixed this by deleting rows in lootdrop_entries that had 0 value for the chance column. One example was ssratemple's shissar lorekeeper, if i recall correctly.
Reply With Quote
  #2  
Old 05-16-2010, 10:58 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,497
Default

Good catch on the 0% chances. I am fixing PEQ's database on this right now. There were 11 entries total as of the last database push.
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 05:23 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