Replaced _stricmp in previous commit with strcmp.

Minor edits to some code.
This commit is contained in:
NovaRain
2019-12-16 15:31:50 +08:00
parent 7ed8dd286c
commit cb9f759d71
6 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -653,10 +653,10 @@ int ret1 - pass -1 to cancel the execution of the handler (only for HOOK_STD
HOOK_TARGETOBJECT (hs_targetobject.int)
Runs when the targeting cursor moves over an object, or when the player tries to attack the target object.
Runs when the targeting cursor hovers over an object, or when the player tries to attack the target object.
You can override the target object or prevent the player from attacking the chosen target.
int arg1 - event type: 0 - when the cursor moves over the object, 1 - when trying to attack the target object
int arg1 - event type: 0 - when the cursor hovers over the object, 1 - when trying to attack the target object
int arg2 - 1 when the target object is valid to attack, 0 otherwise
Obj arg3 - the target object
+1 -1
View File
@@ -278,7 +278,7 @@ void Drugs::init() {
int set = -1;
char section[4];
for (int i = 1; i <= count; i++) {
_itoa_s(i, section, 10);
_itoa(i, section, 10);
int pid = iniGetInt(section, "PID", 0, iniDrugs);
if (pid > 0) {
CheckEngineNumEffects(set, pid);
+3 -3
View File
@@ -127,11 +127,11 @@ static void LoadElevators(const char* elevFile) {
elevatorsFrms[i].buttons = iniGetInt(section, "ButtonsFrm", elevatorsFrms[i].buttons, elevFile);
char setting[32];
for (int j = 0; j < exitsPerElevator; j++) {
sprintf_s(setting, "ID%d", j + 1);
sprintf(setting, "ID%d", j + 1);
elevatorExits[i][j].id = iniGetInt(section, setting, elevatorExits[i][j].id, elevFile);
sprintf_s(setting, "Elevation%d", j + 1);
sprintf(setting, "Elevation%d", j + 1);
elevatorExits[i][j].elevation = iniGetInt(section, setting, elevatorExits[i][j].elevation, elevFile);
sprintf_s(setting, "Tile%d", j + 1);
sprintf(setting, "Tile%d", j + 1);
elevatorExits[i][j].tile = iniGetInt(section, setting, elevatorExits[i][j].tile, elevFile);
}
}
+2 -2
View File
@@ -513,7 +513,7 @@ static long __fastcall TargetObjectHook(DWORD isValid, DWORD object, long type)
static void __declspec(naked) gmouse_bk_process_hook() {
__asm {
push 0; // type
mov ecx, eax; // 1 - valid (object) or 0 - invalid
mov ecx, eax; // 1 - valid(object) or 0 - invalid
mov edx, edi; // object under mouse
call TargetObjectHook;
mov edi, eax;
@@ -524,7 +524,7 @@ static void __declspec(naked) gmouse_bk_process_hook() {
static void __declspec(naked) gmouse_handle_event_hook() {
__asm {
push 1; // type
mov ecx, eax; // 1 - valid (object) or 0 - invalid
mov ecx, eax; // 1 - valid(object) or 0 - invalid
cmp dword ptr ds:[targetRet], 0;
je default;
// override
+4 -4
View File
@@ -33,12 +33,12 @@ static Delegate<DWORD> onAdjustFid;
static DWORD sizeLimitMode;
static DWORD invSizeMaxLimit;
static DWORD reloadWeaponKey = 0;
static DWORD itemFastMoveKey = 0;
static DWORD skipFromContainer = 0;
void InventoryKeyPressedHook(DWORD dxKey, bool pressed) {
// TODO: move this out into a script
if (pressed && reloadWeaponKey && dxKey == reloadWeaponKey && IsMapLoaded() && (GetLoopFlags() & ~(COMBAT | PCOMBAT)) == 0) {
DWORD maxAmmo, curAmmo;
fo::GameObject* item = fo::GetActiveItem();
@@ -282,13 +282,13 @@ static const char* _stdcall SizeInfoMessage(fo::GameObject* item) {
if (size == 1) {
const char* message = fo::MessageSearch(&fo::var::proto_main_msg_file, 543);
if (message == nullptr)
strncpy_s(SizeMsgBuf, "It occupies 1 unit.", _TRUNCATE);
strcpy(SizeMsgBuf, "It occupies 1 unit.");
else
_snprintf_s(SizeMsgBuf, _TRUNCATE, message, size);
strncpy_s(SizeMsgBuf, message, _TRUNCATE);
} else {
const char* message = fo::MessageSearch(&fo::var::proto_main_msg_file, 542);
if (message == nullptr)
_snprintf_s(SizeMsgBuf, _TRUNCATE, "It occupies %d units.", size);
sprintf(SizeMsgBuf, "It occupies %d units.", size);
else
_snprintf_s(SizeMsgBuf, _TRUNCATE, message, size);
}
+1 -1
View File
@@ -184,7 +184,7 @@ static void __fastcall game_init_databases_hook1() {
fo::PathNode* node = fo::var::paths;
while (node->next) {
if (!_stricmp(node->path, masterPatch)) break;
if (!strcmp(node->path, masterPatch)) break;
node = node->next;
}
fo::var::master_db_handle = node; // set pointer to master_patches node