Manuel-K / devilutionX-QOL-patches

QOL improvements for devilutionX
25 stars 4 forks source link

Make CalculateTextWidth take const char* instead of just char* #2

Closed jstasiak closed 4 years ago

jstasiak commented 4 years ago

It doesn't modify the contents of the string at any point so it's safe to declare it as taking a pointer to const char. This allows building DevilutionX with the patch applied, otherwise a compiler may prevent compilation from happening because there are some pointers to const char passed to the function, for example (in the monster bar patch):

static const char* resText = "RES: ";
(...)
int resOffset = 0 + CalculateTextWidth(resText);
Manuel-K commented 4 years ago

That's one of the things that I haven't modified from the original. It might be a good idea to change it, but so far I haven't had any trouble building on gcc.

Can you rebase the change to the current version? On the other hand, it might be a good idea to backport it to the version that's meant for devilutionX 0.5.0.

Manuel-K commented 4 years ago

The change has been included as ba0f9f801a6b5e2621d5299228018b5ad2cfe31f

Manuel-K commented 4 years ago

Thank you