Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #16  
Old 03-04-2013, 10:58 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Quote:
Originally Posted by Uleat View Post
Do we need to change this to double from float and add a con check for '(base*mod) > ~0'?
Why? There shouldn't be an issue with range or precision using a float.
Reply With Quote
  #17  
Old 03-05-2013, 12:11 AM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Nope, you're right...

x = 3000000000, y = 3E+09, z = 3000000000

x as uint32 = 3,000,000,000
y as single = x
z as uint32 = y


I'm just not seeing where a conversion issue is occurring in the above procedure...
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #18  
Old 03-05-2013, 12:55 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

It isn't there, it's somewhere else the value is being used.

Here's an example from Client::Death()
Code:
	// now we apply the exp loss, unmem their spells, and make a corpse
	// unless they're a GM (or less than lvl 10
	if(!GetGM())
	{
		if(exploss > 0) {
			int32 newexp = GetEXP();
			if(exploss > newexp) {
				//lost more than we have... wtf..
				newexp = 1;
			} else {
				newexp -= exploss;
			}
			SetEXP(newexp, GetAAXP());
			//m_epp.perAA = 0;	//reset to no AA exp on death.
		}
There may be more that are less obvious. Some of the rez and sacrifice code is suspect, but I'm too lazy to do the math.
Reply With Quote
  #19  
Old 03-05-2013, 01:23 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

My source is a few weeks out of date but in Client::SetLevel the return value of GetEXPForLevel is being cast as a float numerous times. That would do it. Change float to double.

Quote:
float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) /
( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel()));
lu->exp = (uint32)(330.0f * tmpxp);
Holy sh*t wut!?
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #20  
Old 03-05-2013, 02:02 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Ugh I just realised exp is stored cumulatively..
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #21  
Old 03-05-2013, 01:55 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Float is probably ok there too. Without extracting that out into a test to see what the numbers are I'd guess you might lose a very small bit of precision, but a float isn't going to roll over to a negative number like a signed int would. Besides, that formula is just to tell the client how far to fill up the experience bar. If it was incorrect the server would still have the proper value and you'd level when you didn't expect it.
Reply With Quote
  #22  
Old 03-14-2013, 01:44 PM
Armm
Sarnak
 
Join Date: Feb 2013
Posts: 70
Default

Try what i posted here... Works for me..

http://www.eqemulator.org/forums/sho...466#post219466
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 11:31 PM.


 

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