• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ Breaking int limits

Addams

OTMadness.com OTSes Services
Staff member
Board Moderator
Joined
Sep 29, 2009
Messages
2,920
Solutions
342
Reaction score
1,688
Location
Egypt
Is there any list out there of the exact values/lines I need to change to higher ints to break those limits? Using TFS 1.5
  • Max player's/monster's damage
  • Max player's/monster's health
  • Max player's/monster's healing
  • Max player's mana
I haven't tried yet, I know how that works.
I have to find every Health, Mana, MaxHealth, MaxMana, Healing, and Damage data ints and then change them from int32_t to int64_t and every other function that uses them (That's why it seems so hard and requires too many changes).
The only thing I've changed is the schema values health, healthmax, mana, and manamax from int to bigint.
I really appreciate it if someone who has already broken one or all of the above gives me a hand/list of what to change exactly to make things easier for me.
I've contacted @Shadow_ but sadly he doesn't have a saved list of changes and he only made it by changing them one by one manually and searching using Notepad++ but he said that he'll help if I got any issues during the process.
 
Last edited:
Well, not everyone is born knowing how to use git and visual studio code or any other ide.
Unless you trace every code part contains something related to health/mana/damage you will have to miss something which will result in crash/bug/visual bug (negative random value) so i preferred doing it manual to make sure nothing will affect my server when its live, don’t worry i do use both ^^ but notepad ++ search engine and options are still bold 🤣
 
Unless you trace every code part contains something related to health/mana/damage you will have to miss something which will result in crash/bug/visual bug (negative random value) so i preferred doing it manual to make sure nothing will affect my server when its live, don’t worry i do use both ^^ but notepad ++ search engine and options are still bold 🤣
Yeah i like notepad++ for many things, but for that topic in specific visual studio code is way better because it shows you all the diff files you are modifying from the git repo live:
So you know exactly what you're editing in the whole folder you're opening and looking for before doing the push.
And for looking into key words:
This one is basically the same than notepad++, you can even filter for match case, whole word or regex :D
 
Yeah i like notepad++ for many things, but for that topic in specific visual studio code is way better because it shows you all the diff files you are modifying from the git repo live:
So you know exactly what you're editing in the whole folder you're opening and looking for before doing the push.
And for looking into key words:
This one is basically the same than notepad++, you can even filter for match case, whole word or regex :D
Interesting information since i started using git 2 months ago when i had a sudden data loss i started looking into it, thanks for the info its really useful to know that VSC works with git! thanks :p
 
I prefer CLion over Microsoft tools. UI/UX is much better. Visual Studio looks like "it worked this way 20 years ago, it must work this way, people used to it".
There is 30 days free trial of CLion with full functionality: CLion: A Cross-Platform IDE for C and C++ by JetBrains (https://www.jetbrains.com/clion/)

@M0ustafa
Ex. search for all uses of healthMax in sources: click left mouse button on variable, while holding CTRL and it shows full list:
1653560069400.png


Anyway.. best tool to find all invalid types will be C++ compiler. Only thing it won't find will be type casts like:
"for some calculations reason someone casted int to uint"
C++:
uint32_t healthUInt = (uint32_t) health;
Compile, read errors, fix, compile again..
 
Visual Studio looks like "it worked this way 20 years ago, it must work this way, people used to it".
That's why they are mentioning Visual Studio CODE, completely different than Visual Studio.
Ex. search for all uses of healthMax in sources: click left mouse button on variable, while holding CTRL and it shows full list:
Also possible in VS and VSCode.
 
I prefer CLion over Microsoft tools. UI/UX is much better. Visual Studio looks like "it worked this way 20 years ago, it must work this way, people used to it".
There is 30 days free trial of CLion with full functionality: CLion: A Cross-Platform IDE for C and C++ by JetBrains (https://www.jetbrains.com/clion/)

@M0ustafa
Ex. search for all uses of healthMax in sources: click left mouse button on variable, while holding CTRL and it shows
Thank you, that looks way easier than reading them 1 by 1 using Notepad++ search, I think I will give that a try as long as it has 30 days trial version.
The list shown for Healthmax looks cleaner and very easy to read than my previous searches on Notepad++, I will also take a look at Visual Studio Code.
Anyway.. best tool to find all invalid types will be C++ compiler. Only thing it won't find will be type casts like:
"for some calculations reason someone casted int to uint"
C++:
uint32_t healthUInt = (uint32_t) health;
Compile, read errors, fix, compile again..
Looks like there's no easy way to make it and no saved commits/list around so I will have to stuck with changing, compiling, checking/reading errors, fixing, and recompiling.
I hope I won't just forget any int because 1 forgotten int would cause so many unnecessary issues.
I will just wait a little more for Shadow_ as he is doing some diff checks and comparing so he might make things easier for me.
 
Thank you, that looks way easier than reading them 1 by 1 using Notepad++ search, I think I will give that a try as long as it has 30 days trial version.
The list shown for Healthmax looks cleaner and very easy to read than my previous searches on Notepad++, I will also take a look at Visual Studio Code.

Looks like there's no easy way to make it and no saved commits/list around so I will have to stuck with changing, compiling, checking/reading errors, fixing, and recompiling.
I hope I won't just forget any int because 1 forgotten int would cause so many unnecessary issues.
I will just wait a little more for Shadow_ as he is doing some diff checks and comparing so he might make things easier for me.
I haven't use CLion and i don't know how much does it cost, but visual studio code is free btw. As for the diffs, ask to shadows for the specific files you need and use a Beyond Compare or Meld to get the diff from both files, that way you will be able to see what changes he did.
 
short-cli-basics-8-grep.mov_.png


grep is well fitting for this kind of tasks, grep is your friend
 
I haven't use CLion and i don't know how much does it cost, but visual studio code is free btw
If it's close to Clion's search then I would go for the free one, I will test both anyway ASAP.
As for the diffs, ask to shadows for the specific files you need and use a Beyond Compare or Meld to get the diff from both files, that way you will be able to see what changes he did.
Thank you, He was using Notepad++ diff plugin but I will ask him to try using Beyond Compare or Meld to see if they're any better.
short-cli-basics-8-grep.mov_.png


grep is well fitting for this kind of tasks, grep is your friend
I have my test server on Windows now, It will be a pain to move everything to a Linux machine. So I will just stuck with the above solutions, Thank you anyway.
Not sure if the grep-like software for Windows would do the same job tho, Never tried it on Windows.
 
Last edited:
If it's close to Clion's search then I would go for the free one, I will test both anyway ASAP.

Thank you, He was using Notepad++ diff plugin but I will ask him to try using Beyond Compare or Meld to see if they're any better.

I have my test server on Windows now, It will be a pain to move everything to a Linux machine. So I will just stuck with the above solutions, Thank you anyway.
Not sure if the grep-like software for Windows would do the same job tho, Never tried it on Windows.
I think you should host your server on a Linux machine tbh, grep is a great tool because it gonna let you work on any linux server that doesn't have a graphical desktop (most of them), fix issues etc, although you can always use git to work on your local and just pull the changes from your machine.
 
I prefer CLion over Microsoft tools. UI/UX is much better. Visual Studio looks like "it worked this way 20 years ago, it must work this way, people used to it".
There is 30 days free trial of CLion with full functionality: CLion: A Cross-Platform IDE for C and C++ by JetBrains (https://www.jetbrains.com/clion/)

@M0ustafa
Ex. search for all uses of healthMax in sources: click left mouse button on variable, while holding CTRL and it shows full list:
View attachment 68124


Anyway.. best tool to find all invalid types will be C++ compiler. Only thing it won't find will be type casts like:
"for some calculations reason someone casted int to uint"
C++:
uint32_t healthUInt = (uint32_t) health;
Compile, read errors, fix, compile again..
how you plan to find the following structs that saves the damage value to break the limit of int32 ?

Like countBlock, intervalInfo, uniform_random, normal_random


those are structures and functions that are limited to int32 which must be int64 in-order you exceed the limits, if you changed health stuff only you will probably face some issues in files like game.cpp and protocolgame.cpp which have things related to health i can't see it in the list.
 
how you plan to find the following structs that saves the damage value to break the limit of int32 ?

Like countBlock, intervalInfo, uniform_random, normal_random


those are structures and functions that are limited to int32 which must be int64 in-order you exceed the limits, if you changed health stuff only you will probably face some issues in files like game.cpp and protocolgame.cpp which have things related to health i can't see it in the list.
Ex. I've changed variable type from int32_t to int16_t and assigned to it value of int32_t variable.
Variable is now yellow in code and when I move mouse over it, it shows what is a problem.
1653659768320.png

You can also open Problems tab at bottom of CLion window, sort by name and fix all narrowing conversion errors:
1653660604667.png
 
I am done with this with the great help I got from @Shadow_ although he had a bad health condition and he was/still busy with his own server launch.
He even finished/changed some files by himself and sent them to me and also sent me his own source files so I can compare/recheck everything by myself.
Thank you everyone, I have tried Clion too and it was kinda better than Visual Studio Code for me, It showed the usages of each function where Visual Studio Code got stuck showing references sometimes.
I have a little unharmful issue related to the breaking, I will create a separate thread for it.
 
I am done with this with the great help I got from @Shadow_ although he had a bad health condition and he was/still busy with his own server launch.
He even finished/changed some files by himself and sent them to me and also sent me his own source files so I can compare/recheck everything by myself.
Thank you everyone, I have tried Clion too and it was kinda better than Visual Studio Code for me, It showed the usages of each function where Visual Studio Code got stuck showing references sometimes.
I have a little unharmful issue related to the breaking, I will create a separate thread for it.
can't you share the changes needed to break the limits? greetings
 
Back
Top