-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add enum for FatalError + void-alize all functions taking no arguments #202
Conversation
@@ -346,7 +346,7 @@ void CreateStainlessClasses() { | |||
for (i = 129; i < 246; i++) { | |||
gStainless_classes[i - 129].res_class = i; | |||
if (!BrResClassAdd(&gStainless_classes[i - 129])) { | |||
FatalError(94); | |||
FatalError(kFatalError_OOMCarmageddon_S, gStainless_classes[i - 129].identifier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error type 94 needs a string argument.
if (!gHorizon_material) { | ||
FatalError(89); | ||
if (gHorizon_material == NULL) { | ||
FatalError(kFatalError_FindSkyMaterial_S, "HORIZON.MAT"); // 2nd argument added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error type 89 needs a string argument.
@@ -1532,7 +1532,7 @@ void GetDamageProgram(FILE* pF, tCar_spec* pCar_spec, tImpact_location pImpact_l | |||
} | |||
} | |||
if (the_clause->effects[j].type < 0) { | |||
FatalError(91); | |||
FatalError(kFatalError_UnknownDamageType_S, str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error type 91 needs a string argument as well
if (!total) { | ||
FatalError(82); | ||
if (total == 0) { | ||
FatalError(kFatalError_LoadModelFile_S, str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error type 82 needs a string argument as well.
f176074
to
2670b75
Compare
2670b75
to
fd9d3c4
Compare
@@ -314,14 +314,14 @@ int LoadNPixelmaps(tBrender_storage* pStorage_space, FILE* pF, int pCount) { | |||
PathCat(the_path, the_path, str); | |||
total = DRPixelmapLoadMany(the_path, temp_array, COUNT_OF(temp_array)); | |||
if (total == 0) { | |||
FatalError(79); | |||
FatalError(kFatalError_LoadPixelmapFile_S, str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error type 79 needs a string as well.
if (!total) { | ||
FatalError(80); | ||
if (total == 0) { | ||
FatalError(kFatalError_LoadShadeTableFile_S, str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error type 80 needs a string as well.
if (!total) { | ||
FatalError(81); | ||
if (total == 0) { | ||
FatalError(kFatalError_LoadMaterialFile_S, str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error type 81 needs a string as well.
Nice one! Great that it uncovered some places where we weren't passing the expected string arg too! |
Add an enum for the first argument of
FatalError
. The suffix_S
means it takes one string arguments.By doing this, I found a few places where an error expects a string argument, but did not pass one.
Add explicit
void
to all functions accepting no arguments because in C,void no_args()
declares a function that takes an unspecified (but not variable) number of parameters (and returns nothing). So all calls are valid (according to the prototype) in C.I did the
()
->(void)
using the following command.Afterwards I manually checked the changes and reverted a few unneeded conversions.