Skip to content

Commit

Permalink
Merge pull request #2220 from MatteoPiovanelli-Laser/fix_warnings
Browse files Browse the repository at this point in the history
Fix warnings
  • Loading branch information
ivan-mogilko authored Nov 10, 2023
2 parents f291906 + f3e65dd commit 87212e9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 45 deletions.
25 changes: 9 additions & 16 deletions Editor/AGS.Editor/AGSEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -784,22 +784,15 @@ private void DefineMacrosAccordingToGameSettings(IPreprocessor preprocessor)
{
preprocessor.DefineMacro("DEBUG", "1");
}
if (_game.Settings.EnforceObjectBasedScript)
{
preprocessor.DefineMacro("STRICT", "1");
}
if (_game.Settings.EnforceNewStrings)
{
preprocessor.DefineMacro("STRICT_STRINGS", "1");
}
if (_game.Settings.EnforceNewAudio)
{
preprocessor.DefineMacro("STRICT_AUDIO", "1");
}
if (!_game.Settings.UseOldCustomDialogOptionsAPI)
{
preprocessor.DefineMacro("NEW_DIALOGOPTS_API", "1");
}
// Some settings have become obsolete and now have default values
// EnforceObjectBasedScript => true
preprocessor.DefineMacro("STRICT", "1");
// EnforceNewStrings => true
preprocessor.DefineMacro("STRICT_STRINGS", "1");
// EnforceNewAudio => true
preprocessor.DefineMacro("STRICT_AUDIO", "1");
// UseOldCustomDialogOptionsAPI => false
preprocessor.DefineMacro("NEW_DIALOGOPTS_API", "1");
if (!_game.Settings.UseOldKeyboardHandling)
{
preprocessor.DefineMacro("NEW_KEYINPUT_API", "1");
Expand Down
35 changes: 13 additions & 22 deletions Editor/AGS.Editor/Panes/ScintillaWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2017,35 +2017,24 @@ private bool ShowAutoCompleteForEnum(string typeName)
private bool ShouldShowThis(ScriptToken token, List<ScriptDefine> defines)
{
Settings gameSettings = Factory.AGSEditor.CurrentGame.Settings;
if ((token.IfNDefOnly == "STRICT") && (gameSettings.EnforceObjectBasedScript))
// Some settings have become obsolete and now have default values
// EnforceObjectBasedScript => true
if (token.IfNDefOnly == "STRICT")
{
return false;
}
if ((token.IfDefOnly == "STRICT") && (!gameSettings.EnforceObjectBasedScript))
// EnforceNewStrings => true
if (token.IfNDefOnly == "STRICT_STRINGS")
{
return false;
}
if ((token.IfNDefOnly == "STRICT_STRINGS") && (gameSettings.EnforceNewStrings))
// EnforceNewAudio => true
if (token.IfNDefOnly == "STRICT_AUDIO")
{
return false;
}
if ((token.IfDefOnly == "STRICT_STRINGS") && (!gameSettings.EnforceNewStrings))
{
return false;
}
if ((token.IfNDefOnly == "STRICT_AUDIO") && (gameSettings.EnforceNewAudio))
{
return false;
}
if ((token.IfDefOnly == "STRICT_AUDIO") && (!gameSettings.EnforceNewAudio))
{
return false;
}
if ((token.IfNDefOnly == "NEW_DIALOGOPTS_API") && (!gameSettings.UseOldCustomDialogOptionsAPI))
{
return false;
}
if ((token.IfDefOnly == "NEW_DIALOGOPTS_API") && (gameSettings.UseOldCustomDialogOptionsAPI))
// UseOldCustomDialogOptionsAPI => false
if (token.IfNDefOnly == "NEW_DIALOGOPTS_API")
{
return false;
}
Expand Down Expand Up @@ -2086,16 +2075,18 @@ private bool ShouldShowThis(ScriptToken token, List<ScriptDefine> defines)
// as precompiler. Instead it makes its own parsing, and somewhat limits perfomance and capabilities.
// This is (one) reason why all those checks are made here explicitly, instead of relying on some
// prefetched macro list.
// Some settings have become obsolete and now have default values
// EnforceObjectBasedScript => true
if (token.IfNDefOnly != null && token.IfNDefOnly.StartsWith("STRICT_IN_"))
{
ScriptAPIVersion? v = GetAPIVersionFromString(token.IfNDefOnly.Substring("STRICT_IN_".Length));
if (v.HasValue && (gameSettings.EnforceObjectBasedScript && v <= gameSettings.ScriptCompatLevelReal))
if (v.HasValue && (v <= gameSettings.ScriptCompatLevelReal))
return false;
}
if (token.IfDefOnly != null && token.IfDefOnly.StartsWith("STRICT_IN_"))
{
ScriptAPIVersion? v = GetAPIVersionFromString(token.IfDefOnly.Substring("STRICT_IN_".Length));
if (v.HasValue && !(gameSettings.EnforceObjectBasedScript && v <= gameSettings.ScriptCompatLevelReal))
if (v.HasValue && !(v <= gameSettings.ScriptCompatLevelReal))
return false;
}
return true;
Expand Down
1 change: 1 addition & 0 deletions Editor/AGS.Native/NativeDLL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<TreatSpecificWarningsAsErrors>4013; 4477</TreatSpecificWarningsAsErrors>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
6 changes: 3 additions & 3 deletions Solutions/Common.Lib/Common.Lib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\Common;..\..\Common\libinclude;..\..\Common\libsrc\alfont-2.0.9;..\..\Common\libsrc\freetype-2.1.3\include;..\..\libsrc\allegro\include;..\..\libsrc\glm;..\..\libsrc\miniz;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_WINDOWS;_CRT_SECURE_NO_WARNINGS;ALLEGRO_STATICLINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
Expand Down Expand Up @@ -321,7 +321,7 @@
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\Common;..\..\Common\libinclude;..\..\Common\libsrc\alfont-2.0.9;..\..\Common\libsrc\freetype-2.1.3\include;..\..\libsrc\allegro\include;..\..\libsrc\glm;..\..\libsrc\miniz;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_WINDOWS;_CRT_SECURE_NO_WARNINGS;ALLEGRO_STATICLINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
Expand Down Expand Up @@ -486,7 +486,7 @@
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\Common;..\..\Common\libinclude;..\..\Common\libsrc\alfont-2.0.9;..\..\Common\libsrc\freetype-2.1.3\include;..\..\libsrc\allegro\include;..\..\libsrc\glm;..\..\libsrc\miniz;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_WINDOWS;_CRT_SECURE_NO_WARNINGS;ALLEGRO_STATICLINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader />
Expand Down
4 changes: 2 additions & 2 deletions Solutions/Compiler.Lib/Compiler.Lib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\Common;..\..\Compiler;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
Expand Down Expand Up @@ -139,7 +139,7 @@
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\Common;..\..\Compiler;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader />
Expand Down
4 changes: 2 additions & 2 deletions Solutions/Compiler2.Lib/Compiler2.Lib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\Common;..\..\Compiler;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;WINDOWS_VERSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
Expand Down Expand Up @@ -146,7 +146,7 @@
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\Common;..\..\Compiler;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;WINDOWS_VERSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader />
Expand Down

0 comments on commit 87212e9

Please sign in to comment.