That's not a must; it makes no difference wether you call if(...) xxxx; or if(...){xxxx;} as long as xxxx is a "one liner"Remove curly brackets "{}" from the switch statements.
C++:case 1: if (btnAddIntButton != NULL) AddIntButtonMethod1(btnAddIntButton, 500); break;
You are right and curly brackets makes the code more safer and not be able to pass from other switch.That's not a must; it makes no difference wether you call if(...) xxxx; or if(...){xxxx;} as long as xxxx is a "one liner"
Moreover, if(...){} allows for more "lines" for a single if.
int iAmmo = 0;
void *sAmmoBtn;
void (*old_m_Count)(void *instance);
void m_Count(void *instance) {
if (instance != NULL) {
if (sAmmoBtn != NULL) {
*(int *) ((uint64_t) instance + 0x10) = iAmmo;
}
}
return old_m_Count(instance);
}