[Scummvm-git-logs] scummvm master -> 04d06191ea2480541f6a43161957d9d7d1d5bff8

tag2015 noreply at scummvm.org
Wed Jun 4 19:43:16 UTC 2025


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
894aa9532f AGS: Fix conditions using bitwise OR instead of logic OR
04d06191ea AGS: Fix conditions using bitwise AND instead of logic AND


Commit: 894aa9532fec918922dd62f351ed4068f5c92de5
    https://github.com/scummvm/scummvm/commit/894aa9532fec918922dd62f351ed4068f5c92de5
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2025-06-04T21:42:30+02:00

Commit Message:
AGS: Fix conditions using bitwise OR instead of logic OR

Fix #15294

Changed paths:
    engines/ags/engine/ac/dialog.cpp
    engines/ags/engine/ac/game.cpp
    engines/ags/engine/ac/global_audio.cpp
    engines/ags/engine/ac/global_button.cpp
    engines/ags/engine/ac/global_dialog.cpp
    engines/ags/engine/ac/global_file.cpp
    engines/ags/engine/ac/global_game.cpp
    engines/ags/engine/ac/global_gui.cpp
    engines/ags/engine/ac/global_hotspot.cpp
    engines/ags/engine/ac/global_label.cpp
    engines/ags/engine/ac/global_room.cpp
    engines/ags/engine/ac/global_screen.cpp
    engines/ags/engine/ac/global_slider.cpp
    engines/ags/engine/ac/global_textbox.cpp
    engines/ags/engine/ac/global_walkable_area.cpp
    engines/ags/engine/ac/gui.cpp
    engines/ags/engine/ac/gui_control.cpp
    engines/ags/engine/ac/inv_window.cpp
    engines/ags/engine/ac/listbox.cpp
    engines/ags/engine/ac/overlay.cpp
    engines/ags/engine/gui/gui_dialog.cpp
    engines/ags/engine/script/script.cpp


diff --git a/engines/ags/engine/ac/dialog.cpp b/engines/ags/engine/ac/dialog.cpp
index 0e890a2c7c6..54cdd07c207 100644
--- a/engines/ags/engine/ac/dialog.cpp
+++ b/engines/ags/engine/ac/dialog.cpp
@@ -855,7 +855,8 @@ bool DialogOptions::Run() {
 				mouseison = i - 1; break;
 			}
 		}
-		if ((mouseison < 0) | (mouseison >= numdisp)) mouseison = -1;
+		if ((mouseison < 0) || (mouseison >= numdisp))
+			mouseison = -1;
 	}
 
 	if (parserInput != nullptr) {
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index 574cc9ede18..1ce17e4ffdf 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -1127,7 +1127,7 @@ int __GetLocationType(int xxx, int yyy, int allowHotspot0) {
 		return 0;
 	xxx = vpt.first.X;
 	yyy = vpt.first.Y;
-	if ((xxx >= _GP(thisroom).Width) | (xxx < 0) | (yyy < 0) | (yyy >= _GP(thisroom).Height))
+	if ((xxx >= _GP(thisroom).Width) || (xxx < 0) || (yyy < 0) || (yyy >= _GP(thisroom).Height))
 		return 0;
 
 	// check characters, objects and walkbehinds, work out which is
@@ -1275,11 +1275,11 @@ void replace_tokens(const char *srcmes, char *destm, size_t maxlen) {
 			}
 			char tval[10];
 			if (tokentype == 1) {
-				if ((inx < 1) | (inx >= _GP(game).numinvitems))
+				if ((inx < 1) || (inx >= _GP(game).numinvitems))
 					quit("!Display: invalid inv item specified in @IN@");
 				snprintf(tval, sizeof(tval), "%d", _G(playerchar)->inv[inx]);
 			} else {
-				if ((inx < 0) | (inx >= MAXGSVALUES))
+				if ((inx < 0) || (inx >= MAXGSVALUES))
 					quit("!Display: invalid global int index speicifed in @GI@");
 				snprintf(tval, sizeof(tval), "%d", GetGlobalInt(inx));
 			}
diff --git a/engines/ags/engine/ac/global_audio.cpp b/engines/ags/engine/ac/global_audio.cpp
index aea181a97f0..8dea2bb400a 100644
--- a/engines/ags/engine/ac/global_audio.cpp
+++ b/engines/ags/engine/ac/global_audio.cpp
@@ -313,14 +313,14 @@ void SetMusicVolume(int newvol) {
 void SetMusicMasterVolume(int newvol) {
 	const int min_volume = _G(loaded_game_file_version) < kGameVersion_330 ? 0 :
 	                       -LegacyMusicMasterVolumeAdjustment - (kRoomVolumeMax * LegacyRoomVolumeFactor);
-	if ((newvol < min_volume) | (newvol > 100))
+	if ((newvol < min_volume) || (newvol > 100))
 		quitprintf("!SetMusicMasterVolume: invalid volume - must be from %d to %d", min_volume, 100);
 	_GP(play).music_master_volume = newvol + LegacyMusicMasterVolumeAdjustment;
 	update_music_volume();
 }
 
 void SetSoundVolume(int newvol) {
-	if ((newvol < 0) | (newvol > 255))
+	if ((newvol < 0) || (newvol > 255))
 		quit("!SetSoundVolume: invalid volume - must be from 0-255");
 	_GP(play).sound_volume = newvol;
 	Game_SetAudioTypeVolume(AUDIOTYPE_LEGACY_AMBIENT_SOUND, (newvol * 100) / 255, VOL_BOTH);
@@ -346,7 +346,7 @@ void SetChannelVolume(int chan, int newvol) {
 }
 
 void SetDigitalMasterVolume(int newvol) {
-	if ((newvol < 0) | (newvol > 100))
+	if ((newvol < 0) || (newvol > 100))
 		quit("!SetDigitalMasterVolume: invalid volume - must be from 0-100");
 	_GP(play).digital_master_volume = newvol;
 #if !AGS_PLATFORM_SCUMMVM
@@ -422,7 +422,7 @@ void PlaySilentMIDI(int mnum) {
 }
 
 void SetSpeechVolume(int newvol) {
-	if ((newvol < 0) | (newvol > 255))
+	if ((newvol < 0) || (newvol > 255))
 		quit("!SetSpeechVolume: invalid volume - must be from 0-255");
 
 	auto *ch = AudioChans::GetChannel(SCHAN_SPEECH);
@@ -432,7 +432,7 @@ void SetSpeechVolume(int newvol) {
 }
 
 void SetVoiceMode(int newmod) {
-	if ((newmod < kSpeech_First) | (newmod > kSpeech_Last))
+	if ((newmod < kSpeech_First) || (newmod > kSpeech_Last))
 		quitprintf("!SetVoiceMode: invalid mode number %d", newmod);
 	_GP(play).speech_mode = (SpeechMode)newmod;
 }
diff --git a/engines/ags/engine/ac/global_button.cpp b/engines/ags/engine/ac/global_button.cpp
index c868d6ae9d4..5e09820b547 100644
--- a/engines/ags/engine/ac/global_button.cpp
+++ b/engines/ags/engine/ac/global_button.cpp
@@ -35,9 +35,9 @@ using namespace AGS::Shared;
 
 void SetButtonText(int guin, int objn, const char *newtx) {
 	VALIDATE_STRING(newtx);
-	if ((guin < 0) | (guin >= _GP(game).numgui))
+	if ((guin < 0) || (guin >= _GP(game).numgui))
 		quit("!SetButtonText: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount()))
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
 		quit("!SetButtonText: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUIButton)
 		quit("!SetButtonText: specified control is not a button");
@@ -48,8 +48,10 @@ void SetButtonText(int guin, int objn, const char *newtx) {
 
 
 void AnimateButton(int guin, int objn, int view, int loop, int speed, int repeat) {
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!AnimateButton: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!AnimateButton: invalid object number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!AnimateButton: invalid GUI number");
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
+		quit("!AnimateButton: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUIButton)
 		quit("!AnimateButton: specified control is not a button");
 
@@ -58,11 +60,14 @@ void AnimateButton(int guin, int objn, int view, int loop, int speed, int repeat
 
 
 int GetButtonPic(int guin, int objn, int ptype) {
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!GetButtonPic: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!GetButtonPic: invalid object number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!GetButtonPic: invalid GUI number");
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
+		quit("!GetButtonPic: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUIButton)
 		quit("!GetButtonPic: specified control is not a button");
-	if ((ptype < 0) | (ptype > 3)) quit("!GetButtonPic: invalid pic type");
+	if ((ptype < 0) || (ptype > 3))
+		quit("!GetButtonPic: invalid pic type");
 
 	GUIButton *guil = (GUIButton *)_GP(guis)[guin].GetControl(objn);
 
@@ -83,11 +88,14 @@ int GetButtonPic(int guin, int objn, int ptype) {
 }
 
 void SetButtonPic(int guin, int objn, int ptype, int slotn) {
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!SetButtonPic: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!SetButtonPic: invalid object number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!SetButtonPic: invalid GUI number");
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
+		quit("!SetButtonPic: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUIButton)
 		quit("!SetButtonPic: specified control is not a button");
-	if ((ptype < 1) | (ptype > 3)) quit("!SetButtonPic: invalid pic type");
+	if ((ptype < 1) || (ptype > 3))
+		quit("!SetButtonPic: invalid pic type");
 
 	GUIButton *guil = (GUIButton *)_GP(guis)[guin].GetControl(objn);
 	if (ptype == 1) {
diff --git a/engines/ags/engine/ac/global_dialog.cpp b/engines/ags/engine/ac/global_dialog.cpp
index 3f1076b43f2..387eba0d7cf 100644
--- a/engines/ags/engine/ac/global_dialog.cpp
+++ b/engines/ags/engine/ac/global_dialog.cpp
@@ -36,7 +36,7 @@ namespace AGS3 {
 using namespace AGS::Shared;
 
 void RunDialog(int tum) {
-	if ((tum < 0) | (tum >= _GP(game).numdialog))
+	if ((tum < 0) || (tum >= _GP(game).numdialog))
 		quit("!RunDialog: invalid topic number specified");
 
 	can_run_delayed_command();
@@ -70,9 +70,9 @@ void StopDialog() {
 }
 
 void SetDialogOption(int dlg, int opt, int onoroff, bool dlg_script) {
-	if ((dlg < 0) | (dlg >= _GP(game).numdialog))
+	if ((dlg < 0) || (dlg >= _GP(game).numdialog))
 		quit("!SetDialogOption: Invalid topic number specified");
-	if ((opt < 1) | (opt > _G(dialog)[dlg].numoptions)) {
+	if ((opt < 1) || (opt > _G(dialog)[dlg].numoptions)) {
 		// Pre-3.1.1 games had "dialog scripts" that were written in different language and
 		// parsed differently; its "option-on/off" commands were more permissive.
 		if (dlg_script) {
@@ -91,9 +91,9 @@ void SetDialogOption(int dlg, int opt, int onoroff, bool dlg_script) {
 }
 
 int GetDialogOption(int dlg, int opt) {
-	if ((dlg < 0) | (dlg >= _GP(game).numdialog))
+	if ((dlg < 0) || (dlg >= _GP(game).numdialog))
 		quit("!GetDialogOption: Invalid topic number specified");
-	if ((opt < 1) | (opt > _G(dialog)[dlg].numoptions))
+	if ((opt < 1) || (opt > _G(dialog)[dlg].numoptions))
 		quit("!GetDialogOption: Invalid option number specified");
 	opt--;
 
diff --git a/engines/ags/engine/ac/global_file.cpp b/engines/ags/engine/ac/global_file.cpp
index c6a927e32d8..84b6445070f 100644
--- a/engines/ags/engine/ac/global_file.cpp
+++ b/engines/ags/engine/ac/global_file.cpp
@@ -134,7 +134,7 @@ void FileRead(int32_t handle, char *toread) {
 
 	size_t lle = (uint32_t)in->ReadInt32();
 	// This tests for the legacy string (limited by 200 chars)
-	if ((lle >= 200) | (lle < 1)) {
+	if ((lle >= 200) || (lle < 1)) {
 		debug_script_warn("FileRead: file was not written by FileWrite");
 		return;
 	}
diff --git a/engines/ags/engine/ac/global_game.cpp b/engines/ags/engine/ac/global_game.cpp
index bc45a58335f..3ede3f1d102 100644
--- a/engines/ags/engine/ac/global_game.cpp
+++ b/engines/ags/engine/ac/global_game.cpp
@@ -196,7 +196,7 @@ void FillSaveList(std::vector<SaveListItem> &saves, size_t max_count) {
 }
 
 void SetGlobalInt(int index, int valu) {
-	if ((index < 0) | (index >= MAXGSVALUES))
+	if ((index < 0) || (index >= MAXGSVALUES))
 		quitprintf("!SetGlobalInt: invalid index %d, supported range is %d - %d", index, 0, MAXGSVALUES - 1);
 
 	if (_GP(play).globalscriptvars[index] != valu) {
@@ -208,20 +208,20 @@ void SetGlobalInt(int index, int valu) {
 
 
 int GetGlobalInt(int index) {
-	if ((index < 0) | (index >= MAXGSVALUES))
+	if ((index < 0) || (index >= MAXGSVALUES))
 		quitprintf("!GetGlobalInt: invalid index %d, supported range is %d - %d", index, 0, MAXGSVALUES - 1);
 	return _GP(play).globalscriptvars[index];
 }
 
 void SetGlobalString(int index, const char *newval) {
-	if ((index < 0) | (index >= MAXGLOBALSTRINGS))
+	if ((index < 0) || (index >= MAXGLOBALSTRINGS))
 		quitprintf("!SetGlobalString: invalid index %d, supported range is %d - %d", index, 0, MAXGLOBALSTRINGS - 1);
 	debug_script_log("GlobalString %d set to '%s'", index, newval);
 	snprintf(_GP(play).globalstrings[index], MAX_MAXSTRLEN, "%s", newval);
 }
 
 void GetGlobalString(int index, char *strval) {
-	if ((index < 0) | (index >= MAXGLOBALSTRINGS))
+	if ((index < 0) || (index >= MAXGLOBALSTRINGS))
 		quitprintf("!GetGlobalString: invalid index %d, supported range is %d - %d", index, 0, MAXGLOBALSTRINGS - 1);
 	snprintf(strval, MAX_MAXSTRLEN, "%s", _GP(play).globalstrings[index]);
 }
@@ -588,7 +588,7 @@ void GetLocationName(int xxx, int yyy, char *tempo) {
 		return;
 	xxx = vpt.first.X;
 	yyy = vpt.first.Y;
-	if ((xxx >= _GP(thisroom).Width) | (xxx < 0) | (yyy < 0) | (yyy >= _GP(thisroom).Height))
+	if ((xxx >= _GP(thisroom).Width) || (xxx < 0) || (yyy < 0) || (yyy >= _GP(thisroom).Height))
 		return;
 
 	int onhs, aa;
@@ -658,7 +658,7 @@ int SaveScreenShot(const char *namm) {
 }
 
 void SetMultitasking(int mode) {
-	if ((mode < 0) | (mode > 1))
+	if ((mode < 0) || (mode > 1))
 		quit("!SetMultitasking: invalid mode parameter");
 	// Save requested setting
 	_GP(usetup).multitasking = mode != 0;
diff --git a/engines/ags/engine/ac/global_gui.cpp b/engines/ags/engine/ac/global_gui.cpp
index 7a7710b1fe4..f435781c2a3 100644
--- a/engines/ags/engine/ac/global_gui.cpp
+++ b/engines/ags/engine/ac/global_gui.cpp
@@ -62,7 +62,7 @@ int FindGUIID(const char *GUIName) {
 }
 
 void InterfaceOn(int ifn) {
-	if ((ifn < 0) | (ifn >= _GP(game).numgui))
+	if ((ifn < 0) || (ifn >= _GP(game).numgui))
 		quit("!GUIOn: invalid GUI specified");
 
 	EndSkippingUntilCharStops();
@@ -78,7 +78,8 @@ void InterfaceOn(int ifn) {
 }
 
 void InterfaceOff(int ifn) {
-	if ((ifn < 0) | (ifn >= _GP(game).numgui)) quit("!GUIOff: invalid GUI specified");
+	if ((ifn < 0) || (ifn >= _GP(game).numgui))
+		quit("!GUIOff: invalid GUI specified");
 	if (!_GP(guis)[ifn].IsVisible()) {
 		return;
 	}
@@ -146,14 +147,14 @@ void SetGUIClickable(int guin, int clickable) {
 
 // pass trans=0 for fully solid, trans=100 for fully transparent
 void SetGUITransparency(int ifn, int trans) {
-	if ((ifn < 0) | (ifn >= _GP(game).numgui))
+	if ((ifn < 0) || (ifn >= _GP(game).numgui))
 		quit("!SetGUITransparency: invalid GUI number");
 
 	GUI_SetTransparency(&_GP(scrGui)[ifn], trans);
 }
 
 void CentreGUI(int ifn) {
-	if ((ifn < 0) | (ifn >= _GP(game).numgui))
+	if ((ifn < 0) || (ifn >= _GP(game).numgui))
 		quit("!CentreGUI: invalid GUI number");
 
 	GUI_Centre(&_GP(scrGui)[ifn]);
@@ -190,7 +191,7 @@ int GetFontLineSpacing(int fontnum) {
 }
 
 void SetGUIBackgroundPic(int guin, int slotn) {
-	if ((guin < 0) | (guin >= _GP(game).numgui))
+	if ((guin < 0) || (guin >= _GP(game).numgui))
 		quit("!SetGUIBackgroundPic: invalid GUI number");
 
 	GUI_SetBackgroundGraphic(&_GP(scrGui)[guin], slotn);
@@ -241,7 +242,7 @@ int GetGUIAt(int xx, int yy) {
 }
 
 void SetTextWindowGUI(int guinum) {
-	if ((guinum < -1) | (guinum >= _GP(game).numgui))
+	if ((guinum < -1) || (guinum >= _GP(game).numgui))
 		quit("!SetTextWindowGUI: invalid GUI number");
 
 	if (guinum < 0);  // disable it
diff --git a/engines/ags/engine/ac/global_hotspot.cpp b/engines/ags/engine/ac/global_hotspot.cpp
index 24e9dfb1883..796dc54c48b 100644
--- a/engines/ags/engine/ac/global_hotspot.cpp
+++ b/engines/ags/engine/ac/global_hotspot.cpp
@@ -44,14 +44,14 @@ namespace AGS3 {
 using namespace AGS::Shared;
 
 void DisableHotspot(int hsnum) {
-	if ((hsnum < 1) | (hsnum >= MAX_ROOM_HOTSPOTS))
+	if ((hsnum < 1) || (hsnum >= MAX_ROOM_HOTSPOTS))
 		quit("!DisableHotspot: invalid hotspot specified");
 	_G(croom)->hotspot[hsnum].Enabled = false;
 	debug_script_log("Hotspot %d disabled", hsnum);
 }
 
 void EnableHotspot(int hsnum) {
-	if ((hsnum < 1) | (hsnum >= MAX_ROOM_HOTSPOTS))
+	if ((hsnum < 1) || (hsnum >= MAX_ROOM_HOTSPOTS))
 		quit("!EnableHotspot: invalid hotspot specified");
 	_G(croom)->hotspot[hsnum].Enabled = true;
 	debug_script_log("Hotspot %d re-enabled", hsnum);
diff --git a/engines/ags/engine/ac/global_label.cpp b/engines/ags/engine/ac/global_label.cpp
index 63e888d0f8f..86f4d005317 100644
--- a/engines/ags/engine/ac/global_label.cpp
+++ b/engines/ags/engine/ac/global_label.cpp
@@ -33,9 +33,9 @@ using namespace AGS::Shared;
 
 
 void SetLabelColor(int guin, int objn, int colr) {
-	if ((guin < 0) | (guin >= _GP(game).numgui))
+	if ((guin < 0) || (guin >= _GP(game).numgui))
 		quit("!SetLabelColor: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount()))
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
 		quit("!SetLabelColor: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUILabel)
 		quit("!SetLabelColor: specified control is not a label");
@@ -46,8 +46,10 @@ void SetLabelColor(int guin, int objn, int colr) {
 
 void SetLabelText(int guin, int objn, const char *newtx) {
 	VALIDATE_STRING(newtx);
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!SetLabelText: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!SetLabelTexT: invalid object number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!SetLabelText: invalid GUI number");
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
+		quit("!SetLabelTexT: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUILabel)
 		quit("!SetLabelText: specified control is not a label");
 
@@ -56,9 +58,10 @@ void SetLabelText(int guin, int objn, const char *newtx) {
 }
 
 void SetLabelFont(int guin, int objn, int fontnum) {
-
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!SetLabelFont: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!SetLabelFont: invalid object number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!SetLabelFont: invalid GUI number");
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
+		quit("!SetLabelFont: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUILabel)
 		quit("!SetLabelFont: specified control is not a label");
 
diff --git a/engines/ags/engine/ac/global_room.cpp b/engines/ags/engine/ac/global_room.cpp
index ae78481ef05..8f70fde2c07 100644
--- a/engines/ags/engine/ac/global_room.cpp
+++ b/engines/ags/engine/ac/global_room.cpp
@@ -148,7 +148,7 @@ void NewRoomNPC(int charid, int nrnum, int newx, int newy) {
 void ResetRoom(int nrnum) {
 	if (nrnum == _G(displayed_room))
 		quit("!ResetRoom: cannot reset current room");
-	if ((nrnum < 0) | (nrnum >= MAX_ROOMS))
+	if ((nrnum < 0) || (nrnum >= MAX_ROOMS))
 		quit("!ResetRoom: invalid room number");
 
 	if (isRoomStatusValid(nrnum)) {
diff --git a/engines/ags/engine/ac/global_screen.cpp b/engines/ags/engine/ac/global_screen.cpp
index 05b5f66160c..5bcd6cf4d65 100644
--- a/engines/ags/engine/ac/global_screen.cpp
+++ b/engines/ags/engine/ac/global_screen.cpp
@@ -43,7 +43,8 @@ using namespace AGS::Engine;
 
 
 void FlipScreen(int amount) {
-	if ((amount < 0) | (amount > 3)) quit("!FlipScreen: invalid argument (0-3)");
+	if ((amount < 0) || (amount > 3))
+		quit("!FlipScreen: invalid argument (0-3)");
 	_GP(play).screen_flipped = amount;
 }
 
diff --git a/engines/ags/engine/ac/global_slider.cpp b/engines/ags/engine/ac/global_slider.cpp
index 85012df035a..7a8a5fe36f8 100644
--- a/engines/ags/engine/ac/global_slider.cpp
+++ b/engines/ags/engine/ac/global_slider.cpp
@@ -33,7 +33,8 @@ using namespace AGS::Shared;
 
 
 void SetSliderValue(int guin, int objn, int valn) {
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!SetSliderValue: invalid GUI number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!SetSliderValue: invalid GUI number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUISlider)
 		quit("!SetSliderValue: specified control is not a slider");
 
@@ -42,7 +43,8 @@ void SetSliderValue(int guin, int objn, int valn) {
 }
 
 int GetSliderValue(int guin, int objn) {
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!GetSliderValue: invalid GUI number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!GetSliderValue: invalid GUI number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUISlider)
 		quit("!GetSliderValue: specified control is not a slider");
 
diff --git a/engines/ags/engine/ac/global_textbox.cpp b/engines/ags/engine/ac/global_textbox.cpp
index 55cff1a2f7e..7268c721524 100644
--- a/engines/ags/engine/ac/global_textbox.cpp
+++ b/engines/ags/engine/ac/global_textbox.cpp
@@ -34,9 +34,10 @@ using namespace AGS::Shared;
 
 
 void SetTextBoxFont(int guin, int objn, int fontnum) {
-
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!SetTextBoxFont: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!SetTextBoxFont: invalid object number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!SetTextBoxFont: invalid GUI number");
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
+		quit("!SetTextBoxFont: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUITextBox)
 		quit("!SetTextBoxFont: specified control is not a text box");
 
@@ -46,8 +47,10 @@ void SetTextBoxFont(int guin, int objn, int fontnum) {
 
 void GetTextBoxText(int guin, int objn, char *txbuf) {
 	VALIDATE_STRING(txbuf);
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!GetTextBoxText: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!GetTextBoxText: invalid object number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!GetTextBoxText: invalid GUI number");
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
+		quit("!GetTextBoxText: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUITextBox)
 		quit("!GetTextBoxText: specified control is not a text box");
 
@@ -56,8 +59,10 @@ void GetTextBoxText(int guin, int objn, char *txbuf) {
 }
 
 void SetTextBoxText(int guin, int objn, const char *txbuf) {
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!SetTextBoxText: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!SetTextBoxText: invalid object number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!SetTextBoxText: invalid GUI number");
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
+		quit("!SetTextBoxText: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUITextBox)
 		quit("!SetTextBoxText: specified control is not a text box");
 
diff --git a/engines/ags/engine/ac/global_walkable_area.cpp b/engines/ags/engine/ac/global_walkable_area.cpp
index 5695ac945f8..048e62c17c9 100644
--- a/engines/ags/engine/ac/global_walkable_area.cpp
+++ b/engines/ags/engine/ac/global_walkable_area.cpp
@@ -65,7 +65,7 @@ void SetAreaScaling(int area, int min, int max) {
 }
 
 void RemoveWalkableArea(int areanum) {
-	if ((areanum < 1) | (areanum > 15))
+	if ((areanum < 1) || (areanum > 15))
 		quit("!RemoveWalkableArea: invalid area number specified (1-15).");
 	_GP(play).walkable_areas_on[areanum] = 0;
 	redo_walkable_areas();
@@ -73,7 +73,7 @@ void RemoveWalkableArea(int areanum) {
 }
 
 void RestoreWalkableArea(int areanum) {
-	if ((areanum < 1) | (areanum > 15))
+	if ((areanum < 1) || (areanum > 15))
 		quit("!RestoreWalkableArea: invalid area number specified (1-15).");
 	_GP(play).walkable_areas_on[areanum] = 1;
 	redo_walkable_areas();
diff --git a/engines/ags/engine/ac/gui.cpp b/engines/ags/engine/ac/gui.cpp
index 24f13d79c69..98de129f65e 100644
--- a/engines/ags/engine/ac/gui.cpp
+++ b/engines/ags/engine/ac/gui.cpp
@@ -193,7 +193,7 @@ void GUI_SetPopupYPos(ScriptGUI *tehgui, int newpos) {
 }
 
 void GUI_SetTransparency(ScriptGUI *tehgui, int trans) {
-	if ((trans < 0) | (trans > 100))
+	if ((trans < 0) || (trans > 100))
 		quit("!SetGUITransparency: transparency value must be between 0 and 100");
 
 	_GP(guis)[tehgui->id].SetTransparencyAsPercentage(trans);
diff --git a/engines/ags/engine/ac/gui_control.cpp b/engines/ags/engine/ac/gui_control.cpp
index e7c8dee2cef..08edd7d9d50 100644
--- a/engines/ags/engine/ac/gui_control.cpp
+++ b/engines/ags/engine/ac/gui_control.cpp
@@ -219,7 +219,7 @@ int GUIControl_GetTransparency(GUIObject *guio) {
 }
 
 void GUIControl_SetTransparency(GUIObject *guio, int trans) {
-	if ((trans < 0) | (trans > 100))
+	if ((trans < 0) || (trans > 100))
 		quit("!SetGUITransparency: transparency value must be between 0 and 100");
 	guio->SetTransparency(GfxDef::Trans100ToLegacyTrans255(trans));
 }
diff --git a/engines/ags/engine/ac/inv_window.cpp b/engines/ags/engine/ac/inv_window.cpp
index 54ac655386f..eff819d4afb 100644
--- a/engines/ags/engine/ac/inv_window.cpp
+++ b/engines/ags/engine/ac/inv_window.cpp
@@ -370,7 +370,7 @@ bool InventoryScreen::Run() {
 	int isonitem = ((my - bartop) / highest) * ICONSPERLINE + (mx - barxp) / widest;
 	if (my <= bartop) isonitem = -1;
 	else if (isonitem >= 0) isonitem += top_item;
-	if ((isonitem < 0) | (isonitem >= numitems) | (isonitem >= top_item + num_visible_items))
+	if ((isonitem < 0) || (isonitem >= numitems) || (isonitem >= top_item + num_visible_items))
 		isonitem = -1;
 
 	eAGSMouseButton mbut;
@@ -380,7 +380,7 @@ bool InventoryScreen::Run() {
 	}
 
 	if (mbut == kMouseLeft) {
-		if ((my < 0) | (my > windowhit) | (mx < 0) | (mx > windowwid))
+		if ((my < 0) || (my > windowhit) || (mx < 0) || (mx > windowwid))
 			return true; // continue inventory screen loop
 		if (my < buttonyp) {
 			int clickedon = isonitem;
diff --git a/engines/ags/engine/ac/listbox.cpp b/engines/ags/engine/ac/listbox.cpp
index c8a5315864d..19216af8367 100644
--- a/engines/ags/engine/ac/listbox.cpp
+++ b/engines/ags/engine/ac/listbox.cpp
@@ -390,8 +390,10 @@ void ListBox_ScrollUp(GUIListBox *listbox) {
 
 
 GUIListBox *is_valid_listbox(int guin, int objn) {
-	if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!ListBox: invalid GUI number");
-	if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!ListBox: invalid object number");
+	if ((guin < 0) || (guin >= _GP(game).numgui))
+		quit("!ListBox: invalid GUI number");
+	if ((objn < 0) || (objn >= _GP(guis)[guin].GetControlCount()))
+		quit("!ListBox: invalid object number");
 	if (_GP(guis)[guin].GetControlType(objn) != kGUIListBox)
 		quit("!ListBox: specified control is not a list box");
 	return (GUIListBox *)_GP(guis)[guin].GetControl(objn);
diff --git a/engines/ags/engine/ac/overlay.cpp b/engines/ags/engine/ac/overlay.cpp
index 08bed1b70d1..cf8401a04b4 100644
--- a/engines/ags/engine/ac/overlay.cpp
+++ b/engines/ags/engine/ac/overlay.cpp
@@ -283,7 +283,7 @@ void Overlay_SetTransparency(ScriptOverlay *scover, int trans) {
 	auto *over = get_overlay(scover->overlayId);
 	if (!over)
 		quit("!invalid overlay ID specified");
-	if ((trans < 0) | (trans > 100))
+	if ((trans < 0) || (trans > 100))
 		quit("!SetTransparency: transparency value must be between 0 and 100");
 
 	over->transparency = GfxDef::Trans100ToLegacyTrans255(trans);
diff --git a/engines/ags/engine/gui/gui_dialog.cpp b/engines/ags/engine/gui/gui_dialog.cpp
index 57d429463e7..cafc3db6c32 100644
--- a/engines/ags/engine/gui/gui_dialog.cpp
+++ b/engines/ags/engine/gui/gui_dialog.cpp
@@ -111,7 +111,7 @@ int loadgamedialog() {
 		if (mes.code == CM_COMMAND) {
 			if (mes.id == ctrlok) {
 				int cursel = CSCISendControlMessage(ctrllist, CLB_GETCURSEL, 0, 0);
-				if ((cursel >= _G(numsaves)) | (cursel < 0))
+				if ((cursel >= _G(numsaves)) || (cursel < 0))
 					_G(lpTemp) = nullptr;
 				else {
 					toret = _G(filenumbers)[cursel];
diff --git a/engines/ags/engine/script/script.cpp b/engines/ags/engine/script/script.cpp
index 47422dad216..8a8c92842f5 100644
--- a/engines/ags/engine/script/script.cpp
+++ b/engines/ags/engine/script/script.cpp
@@ -940,7 +940,7 @@ void run_unhandled_event(const ObjectEvent &obj_evt, int evnt) {
 	// clicked Hotspot 0, so change the type code
 	if ((evtype == 1) & (evblocknum == 0) & (evnt != 0) & (evnt != 5) & (evnt != 6))
 		evtype = 4;
-	if ((evtype == 1) & ((evnt == 0) | (evnt == 5) | (evnt == 6)))
+	if ((evtype == 1) & ((evnt == 0) || (evnt == 5) || (evnt == 6)))
 		;  // character stands on hotspot, mouse moves over hotspot, any click
 	else if ((evtype == 2) & (evnt == 4));  // any click on object
 	else if ((evtype == 3) & (evnt == 4));  // any click on character


Commit: 04d06191ea2480541f6a43161957d9d7d1d5bff8
    https://github.com/scummvm/scummvm/commit/04d06191ea2480541f6a43161957d9d7d1d5bff8
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2025-06-04T21:42:31+02:00

Commit Message:
AGS: Fix conditions using bitwise AND instead of logic AND

Changed paths:
    engines/ags/engine/ac/character.cpp
    engines/ags/engine/ac/draw.cpp
    engines/ags/engine/ac/global_dialog.cpp
    engines/ags/engine/ac/global_hotspot.cpp
    engines/ags/engine/ac/global_room.cpp
    engines/ags/engine/ac/object.cpp
    engines/ags/engine/ac/room.cpp
    engines/ags/engine/ac/sys_events.cpp
    engines/ags/engine/ac/walkable_area.cpp
    engines/ags/engine/gui/my_listbox.cpp
    engines/ags/engine/gui/new_control.cpp
    engines/ags/engine/main/game_run.cpp
    engines/ags/engine/script/script.cpp
    engines/ags/shared/gui/gui_main.cpp


diff --git a/engines/ags/engine/ac/character.cpp b/engines/ags/engine/ac/character.cpp
index c9023035d02..223a34e4b4d 100644
--- a/engines/ags/engine/ac/character.cpp
+++ b/engines/ags/engine/ac/character.cpp
@@ -488,10 +488,13 @@ int Character_IsCollidingWithChar(CharacterInfo *char1, CharacterInfo *char2) {
 	if (char2 == nullptr)
 		quit("!AreCharactersColliding: invalid char2");
 
-	if (char1->room != char2->room) return 0; // not colliding
+	if (char1->room != char2->room)
+		return 0; // not colliding
 
-	if ((char1->y > char2->y - 5) && (char1->y < char2->y + 5)) ;
-	else return 0;
+	if ((char1->y > char2->y - 5) && (char1->y < char2->y + 5))
+		;
+	else
+		return 0;
 
 	int w1 = game_to_data_coord(GetCharacterWidth(char1->index_id));
 	int w2 = game_to_data_coord(GetCharacterWidth(char2->index_id));
@@ -499,7 +502,9 @@ int Character_IsCollidingWithChar(CharacterInfo *char1, CharacterInfo *char2) {
 	int xps1 = char1->x - w1 / 2;
 	int xps2 = char2->x - w2 / 2;
 
-	if ((xps1 >= xps2 - w1) & (xps1 <= xps2 + w2)) return 1;
+	if ((xps1 >= xps2 - w1) && (xps1 <= xps2 + w2))
+		return 1;
+
 	return 0;
 }
 
@@ -663,7 +668,7 @@ void Character_LoseInventory(CharacterInfo *chap, ScriptInvItem *invi) {
 	if (chap->inv[inum] > 0)
 		chap->inv[inum]--;
 
-	if ((chap->activeinv == inum) & (chap->inv[inum] < 1)) {
+	if ((chap->activeinv == inum) && (chap->inv[inum] < 1)) {
 		chap->activeinv = -1;
 		if ((chap == _G(playerchar)) && (GetCursorMode() == MODE_USE))
 			set_cursor_mode(0);
diff --git a/engines/ags/engine/ac/draw.cpp b/engines/ags/engine/ac/draw.cpp
index 117a9e23a6a..53375e779f3 100644
--- a/engines/ags/engine/ac/draw.cpp
+++ b/engines/ags/engine/ac/draw.cpp
@@ -2238,7 +2238,7 @@ void render_graphics(IDriverDependantBitmap *extraBitmap, int extraX, int extraY
 		return;
 	// Don't render if we've just entered new room and are before fade-in
 	// TODO: find out why this is not skipped for 8-bit games
-	if ((_G(in_new_room) > 0) & (_GP(game).color_depth > 1))
+	if ((_G(in_new_room) > 0) && (_GP(game).color_depth > 1))
 		return;
 
 	// TODO: find out if it's okay to move shake to update function
diff --git a/engines/ags/engine/ac/global_dialog.cpp b/engines/ags/engine/ac/global_dialog.cpp
index 387eba0d7cf..6aefde5fba3 100644
--- a/engines/ags/engine/ac/global_dialog.cpp
+++ b/engines/ags/engine/ac/global_dialog.cpp
@@ -84,7 +84,7 @@ void SetDialogOption(int dlg, int opt, int onoroff, bool dlg_script) {
 	opt--;
 
 	_G(dialog)[dlg].optionflags[opt] &= ~DFLG_ON;
-	if ((onoroff == 1) & ((_G(dialog)[dlg].optionflags[opt] & DFLG_OFFPERM) == 0))
+	if ((onoroff == 1) && ((_G(dialog)[dlg].optionflags[opt] & DFLG_OFFPERM) == 0))
 		_G(dialog)[dlg].optionflags[opt] |= DFLG_ON;
 	else if (onoroff == 2)
 		_G(dialog)[dlg].optionflags[opt] |= DFLG_OFFPERM;
diff --git a/engines/ags/engine/ac/global_hotspot.cpp b/engines/ags/engine/ac/global_hotspot.cpp
index 796dc54c48b..46c4842c386 100644
--- a/engines/ags/engine/ac/global_hotspot.cpp
+++ b/engines/ags/engine/ac/global_hotspot.cpp
@@ -115,7 +115,7 @@ void RunHotspotInteraction(int hotspothere, int mood) {
 		_GP(play).usedinv = _G(playerchar)->activeinv;
 	}
 
-	if ((_GP(game).options[OPT_WALKONLOOK] == 0) & (mood == MODE_LOOK));
+	if ((_GP(game).options[OPT_WALKONLOOK] == 0) && (mood == MODE_LOOK));
 	else if (_GP(play).auto_use_walkto_points == 0);
 	else if ((mood != MODE_WALK) && (_GP(play).check_interaction_only == 0))
 		MoveCharacterToHotspot(_GP(game).playercharacter, hotspothere);
diff --git a/engines/ags/engine/ac/global_room.cpp b/engines/ags/engine/ac/global_room.cpp
index 8f70fde2c07..33207f199ea 100644
--- a/engines/ags/engine/ac/global_room.cpp
+++ b/engines/ags/engine/ac/global_room.cpp
@@ -106,7 +106,7 @@ void NewRoom(int nrnum) {
 	} else if (_G(in_inv_screen)) {
 		_G(inv_screen_newroom) = nrnum;
 		return;
-	} else if ((_G(inside_script) == 0) & (_G(in_graph_script) == 0)) {
+	} else if ((_G(inside_script) == 0) && (_G(in_graph_script) == 0)) {
 		// Compatibility: old games had a *possibly unintentional* effect:
 		// if a character was walking, and a "change room" is called
 		// *NOT* from a script, but by some other trigger,
diff --git a/engines/ags/engine/ac/object.cpp b/engines/ags/engine/ac/object.cpp
index f25890f19ea..5f2a57e6d96 100644
--- a/engines/ags/engine/ac/object.cpp
+++ b/engines/ags/engine/ac/object.cpp
@@ -549,8 +549,10 @@ void get_object_blocking_rect(int objid, int *x1, int *y1, int *width, int *y2)
 }
 
 int isposinbox(int mmx, int mmy, int lf, int tp, int rt, int bt) {
-	if ((mmx >= lf) & (mmx <= rt) & (mmy >= tp) & (mmy <= bt)) return TRUE;
-	else return FALSE;
+	if ((mmx >= lf) && (mmx <= rt) && (mmy >= tp) && (mmy <= bt))
+		return TRUE;
+	else
+		return FALSE;
 }
 
 // xx,yy is the position in room co-ordinates that we are checking
diff --git a/engines/ags/engine/ac/room.cpp b/engines/ags/engine/ac/room.cpp
index d68c7e73435..8e4d11f3a10 100644
--- a/engines/ags/engine/ac/room.cpp
+++ b/engines/ags/engine/ac/room.cpp
@@ -516,7 +516,7 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
 		// if not restoring a game, always reset this room
 		reset_temp_room();
 	}
-	if ((newnum >= 0) & (newnum < MAX_ROOMS))
+	if ((newnum >= 0) && (newnum < MAX_ROOMS))
 		_G(croom) = getRoomStatus(newnum);
 	else _G(croom) = &_GP(troom);
 
@@ -705,7 +705,7 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
 	_G(new_room_loop) = SCR_NO_VALUE;
 	_G(new_room_placeonwalkable) = false;
 
-	if ((_G(new_room_pos) > 0) & (forchar != nullptr)) {
+	if ((_G(new_room_pos) > 0) && (forchar != nullptr)) {
 		if (_G(new_room_pos) >= 4000) {
 			_GP(play).entered_edge = 3;
 			forchar->y = _GP(thisroom).Edges.Top + get_fixed_pixel_size(1);
@@ -943,7 +943,7 @@ void first_room_initialization() {
 
 void check_new_room() {
 	// if they're in a new room, run Player Enters Screen and on_event(ENTER_ROOM)
-	if ((_G(in_new_room) > 0) & (_G(in_new_room) != 3)) {
+	if ((_G(in_new_room) > 0) && (_G(in_new_room) != 3)) {
 		EventHappened evh(EV_RUNEVBLOCK, EVB_ROOM, 0, EVROM_BEFOREFADEIN, _GP(game).playercharacter);
 		// make sure that any script calls don't re-call enters screen
 		int newroom_was = _G(in_new_room);
diff --git a/engines/ags/engine/ac/sys_events.cpp b/engines/ags/engine/ac/sys_events.cpp
index f8a04163924..3d5351609bb 100644
--- a/engines/ags/engine/ac/sys_events.cpp
+++ b/engines/ags/engine/ac/sys_events.cpp
@@ -166,7 +166,7 @@ static void on_mouse_wheel(const Common::Event &event) {
 static eAGSMouseButton mgetbutton() {
 	const int butis = mouse_button_poll();
 
-	if ((butis > 0) & (_G(butwas) > 0))
+	if ((butis > 0) && (_G(butwas) > 0))
 		return kMouseNone;  // don't allow holding button down
 
 	_G(butwas) = butis;
diff --git a/engines/ags/engine/ac/walkable_area.cpp b/engines/ags/engine/ac/walkable_area.cpp
index 9bf24155dfe..9865719326d 100644
--- a/engines/ags/engine/ac/walkable_area.cpp
+++ b/engines/ags/engine/ac/walkable_area.cpp
@@ -81,7 +81,7 @@ int get_area_scaling(int onarea, int xx, int yy) {
 			zoom_level = _GP(thisroom).WalkAreas[onarea].ScalingNear;
 		}
 		zoom_level += 100;
-	} else if ((onarea >= 0) & (onarea < MAX_WALK_AREAS))
+	} else if ((onarea >= 0) && (onarea < MAX_WALK_AREAS))
 		zoom_level = _GP(thisroom).WalkAreas[onarea].ScalingFar + 100;
 
 	if (zoom_level == 0)
diff --git a/engines/ags/engine/gui/my_listbox.cpp b/engines/ags/engine/gui/my_listbox.cpp
index 20519ae5a22..ab9b3390fcb 100644
--- a/engines/ags/engine/gui/my_listbox.cpp
+++ b/engines/ags/engine/gui/my_listbox.cpp
@@ -103,9 +103,9 @@ void MyListBox::draw(Bitmap *ds) {
 
 int MyListBox::pressedon(int mousex, int mousey) {
 	if (mousex > x + wid - ARROWWIDTH) {
-		if ((mousey - y < hit / 2) & (topitem > 0))
+		if ((mousey - y < hit / 2) && (topitem > 0))
 			topitem--;
-		else if ((mousey - y > hit / 2) &(topitem + numonscreen < items))
+		else if ((mousey - y > hit / 2) && (topitem + numonscreen < items))
 			topitem++;
 
 	} else {
@@ -175,7 +175,7 @@ int MyListBox::processmessage(int mcode, int wParam, NumberPtr lParam) {
 		if (selected >= items)
 			selected = items - 1;
 
-		if ((selected < topitem) & (selected >= 0))
+		if ((selected < topitem) && (selected >= 0))
 			topitem = selected;
 
 		if (topitem + numonscreen <= selected)
diff --git a/engines/ags/engine/gui/new_control.cpp b/engines/ags/engine/gui/new_control.cpp
index 03bfedaca13..a32806ccfb1 100644
--- a/engines/ags/engine/gui/new_control.cpp
+++ b/engines/ags/engine/gui/new_control.cpp
@@ -53,7 +53,7 @@ int NewControl::mouseisinarea(int mx, int my) {
 	if (_G(topwindowhandle) != wlevel)
 		return 0;
 
-	if ((mx > x) &(mx < x + wid) &(my > y) &(my < y + hit))
+	if ((mx > x) && (mx < x + wid) && (my > y) && (my < y + hit))
 		return 1;
 
 	return 0;
diff --git a/engines/ags/engine/main/game_run.cpp b/engines/ags/engine/main/game_run.cpp
index 6e44907fcfa..a7e01c5a587 100644
--- a/engines/ags/engine/main/game_run.cpp
+++ b/engines/ags/engine/main/game_run.cpp
@@ -96,7 +96,7 @@ static void ProperExit() {
 }
 
 static void game_loop_check_problems_at_start() {
-	if ((_G(in_enters_screen) != 0) & (_G(displayed_room) == _G(starting_room)))
+	if ((_G(in_enters_screen) != 0) && (_G(displayed_room) == _G(starting_room)))
 		quit("!A text script run in the Player Enters Screen event caused the screen to be updated. If you need to use Wait(), do so in After Fadein");
 	if ((_G(in_enters_screen) != 0) && (_G(done_es_error) == 0)) {
 		debug_script_warn("Wait() was used in Player Enters Screen - use Enters Screen After Fadein instead");
diff --git a/engines/ags/engine/script/script.cpp b/engines/ags/engine/script/script.cpp
index 8a8c92842f5..6483fcfa7d8 100644
--- a/engines/ags/engine/script/script.cpp
+++ b/engines/ags/engine/script/script.cpp
@@ -938,12 +938,12 @@ void run_unhandled_event(const ObjectEvent &obj_evt, int evnt) {
 		return;  // no unhandled_events for regions
 
 	// clicked Hotspot 0, so change the type code
-	if ((evtype == 1) & (evblocknum == 0) & (evnt != 0) & (evnt != 5) & (evnt != 6))
+	if ((evtype == 1) && (evblocknum == 0) && (evnt != 0) && (evnt != 5) && (evnt != 6))
 		evtype = 4;
-	if ((evtype == 1) & ((evnt == 0) || (evnt == 5) || (evnt == 6)))
+	if ((evtype == 1) && ((evnt == 0) || (evnt == 5) || (evnt == 6)))
 		;  // character stands on hotspot, mouse moves over hotspot, any click
-	else if ((evtype == 2) & (evnt == 4));  // any click on object
-	else if ((evtype == 3) & (evnt == 4));  // any click on character
+	else if ((evtype == 2) && (evnt == 4));  // any click on object
+	else if ((evtype == 3) && (evnt == 4));  // any click on character
 	else if (evtype > 0) {
 		can_run_delayed_command();
 		RuntimeScriptValue params[] = { evtype, evnt };
diff --git a/engines/ags/shared/gui/gui_main.cpp b/engines/ags/shared/gui/gui_main.cpp
index 807a9ea9a33..4ec96da9f4e 100644
--- a/engines/ags/shared/gui/gui_main.cpp
+++ b/engines/ags/shared/gui/gui_main.cpp
@@ -163,7 +163,7 @@ bool GUIMain::IsInteractableAt(int x, int y) const {
 	}
 	if (!IsClickable())
 		return false;
-	if ((x >= X) & (y >= Y) & (x < X + Width) & (y < Y + Height))
+	if ((x >= X) && (y >= Y) && (x < X + Width) && (y < Y + Height))
 		return true;
 	return false;
 }




More information about the Scummvm-git-logs mailing list