Jump to content

Recommended Posts

Hello, i have a little problem. How can i fix thix problem?

 

char_item.cpp: In member function 'bool CHARACTER::IsEmptyItemGrid(TItemPos, BYTE, int) const':
char_item.cpp:666: warning: comparison is always false due to limited range of data type

 

char_item.cpp

Link to comment
https://metin2.dev/topic/22637-game_error_log/
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

File cannot be downloaded, please post in CODE-tag here so we can help you with it.

 

The problem is just a warning. You have a comparison in this very line that always leads to false. And why is that so? Well, the warning pretty much explains it: Limited range of data types. Since it looks like you tried to upload char_item.cpp I'll give you an example of this error:

 

unsigned int itemid = GetID(); //GetID() is defined in item.h and returns DWORD, which equals unsigned int

if(itemid < 0) //Comparison always false due to unsigned int being unable to hold a negative value.
{
  //Will never be executed!
}

In this example we call GetID() which is defined in item.h and returns a DWORD value. DWORD equals unsigned int. And as we know, unsigned means that this variable cannot contain negative values. If we now try to do the comparison like above (check if it's lower than 0, meaning negative value) then the comparison is always false. You'd cast it to int datatype but that's very tricky and not recommended. Especially since you're dealing with a comparison here... You can also just edit the comparison to be more reasonable with the datatype. If you by any chance get the same problem with with function calls to APIs you may or may not be forced to cast it to int instead. I recommend you reading further information if you wanna do this (for example https://www.pluralsight.com/blog/software-development/convert-unsigned-int-to-signed-int).

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
https://metin2.dev/topic/22637-game_error_log/#findComment-122836
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.