EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   COMMITTED: Sprintf bug in SKILLS__GAIN log message (https://www.eqemulator.org/forums/showthread.php?t=39250)

iluvseq 01-20-2015 02:24 PM

COMMITTED: Sprintf bug in SKILLS__GAIN log message
 
The patch below fixes a sprintf() format bug in SKILLS__GAIN log messages. The current code formats with %.4f but 'Chance' is actually an int32 so it gets skipped as an input parameter, causing the log message to put Chance in the (mod X) position and chancemodi to never be logged at all.

Code:

--- a/zone/client.cpp
+++ b/zone/client.cpp
@@ -2232,10 +2232,10 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha
    if(zone->random.Real(0, 99) < Chance)
    {
      SetSkill(skillid, GetRawSkill(skillid) + 1);
-    _log(SKILLS__GAIN, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
+    _log(SKILLS__GAIN, "Skill %d at value %d successfully gain with %d%% chance (mod %d)", skillid, skillval, Chance, chancemodi);
      return true;
    } else {
-    _log(SKILLS__GAIN, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
+    _log(SKILLS__GAIN, "Skill %d at value %d failed to gain with %d%% chance (mod %d)", skillid, skillval, Chance, chancemodi);
    }
  } else {
    _log(SKILLS__GAIN, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill);



All times are GMT -4. The time now is 07:42 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.