Jump to content

Fix Too Long Cube Result List Text


Exygo

Recommended Posts

  • Bronze

How to fix 

Cube_request_result_list: Too long cube result list text. ?

 

Go in cube.cpp

Replace 

Spoiler

        if (resultText.size() - 20 >= CHAT_MAX_LEN)
        {
            sys_err("[CubeInfo] Too long cube result list text. (NPC: %d, length: %d)", npcVNUM, resultText.size());
            resultText.clear();
            resultCount = 0;
        }

 

With this:

Spoiler

        int WildFantasytFIXED;
        if (resultText.size() < 20)
        {
            WildFantasytFIXED = 20 - resultText.size();
        }
        else
        {
            WildFantasytFIXED = resultText.size() - 20;
        }
        if (WildFantasytFIXED >= CHAT_MAX_LEN)
        {
            sys_err("[CubeInfo] Too long cube result list text. (NPC: %d, FIXED_size_value_exygo: %d, length: %d)", npcVNUM, WildFantasytFIXED, resultText.size());
            resultText.clear();
            resultCount = 0;
        }

The problem was caused by a comparison between a negative number and a number

  • Love 1
Link to comment
Share on other sites

  • Bronze
size_t resultTextSize = resultText.size() < 20 ? 20 - resultText.size() : resultText.size() - 20;

if (resultTextSize >= CHAT_MAX_LEN)
{
	sys_err("[CubeInfo] Too long cube result list text. (NPC: %d, length: %d)", npcVNUM, resultText.size());
	resultText.clear();
	resultCount = 0;
}

 It's more effectively and short. Thank you for share this fix with us.

Kind Regards ~ Ken

  • Metin2 Dev 1
  • Love 2

Do not be sorry, be better.

Link to comment
Share on other sites

  • 2 months later...
  • Bronze
On 12/17/2015 at 8:19 PM, Ken said:

size_t resultTextSize = resultText.size() < 20 ? 20 - resultText.size() : resultText.size() - 20;

if (resultTextSize >= CHAT_MAX_LEN)
{
	sys_err("[CubeInfo] Too long cube result list text. (NPC: %d, length: %d)", npcVNUM, resultText.size());
	resultText.clear();
	resultCount = 0;
}

 It's more effectively and short. Thank you for share this fix with us.

Kind Regards ~ Ken

I was noob at that time and didn't know about that conversion ...

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.