From 21d96f1de1e27b8426b3b2c2e9d6e672f1c5875b Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 24 May 2018 11:02:32 +1000 Subject: [PATCH] Don't show 'place yes' and 'delete yes' for selected block description in inventory. But still show 'place no' and 'delete no' --- ClassicalSharp/2D/Widgets/TableWidget.cs | 11 ++--- src/ClassicalSharp.sln | 56 ++++++++++++------------ src/Client/Widgets.c | 7 +-- 3 files changed, 36 insertions(+), 38 deletions(-) diff --git a/ClassicalSharp/2D/Widgets/TableWidget.cs b/ClassicalSharp/2D/Widgets/TableWidget.cs index e686d0fe8..9daf964b7 100644 --- a/ClassicalSharp/2D/Widgets/TableWidget.cs +++ b/ClassicalSharp/2D/Widgets/TableWidget.cs @@ -187,13 +187,10 @@ namespace ClassicalSharp.Gui.Widgets { buffer.Append(BlockInfo.Name[block]); if (game.ClassicMode) return; - buffer.Append(" (ID "); - buffer.AppendNum(block); - buffer.Append("&f, place "); - buffer.Append(BlockInfo.CanPlace[block] ? "&aYes" : "&cNo"); - buffer.Append("&f, delete "); - buffer.Append(BlockInfo.CanDelete[block] ? "&aYes" : "&cNo"); - buffer.Append("&f)"); + buffer.Append(" (ID ").AppendNum(block).Append("&f"); + if (!BlockInfo.CanPlace[block]) { buffer.Append( ", place &cNo&f"); } + if (!BlockInfo.CanDelete[block]) { buffer.Append(", delete &cNo&f"); } + buffer.Append(')'); } int lastCreatedIndex = -1000; diff --git a/src/ClassicalSharp.sln b/src/ClassicalSharp.sln index daafd912c..d77789ca7 100644 --- a/src/ClassicalSharp.sln +++ b/src/ClassicalSharp.sln @@ -1,28 +1,28 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client", "Client\Client.vcxproj", "{8A7D82BD-178A-4785-B41B-70EDE998920A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8A7D82BD-178A-4785-B41B-70EDE998920A}.Debug|x64.ActiveCfg = Debug|x64 - {8A7D82BD-178A-4785-B41B-70EDE998920A}.Debug|x64.Build.0 = Debug|x64 - {8A7D82BD-178A-4785-B41B-70EDE998920A}.Debug|x86.ActiveCfg = Debug|Win32 - {8A7D82BD-178A-4785-B41B-70EDE998920A}.Debug|x86.Build.0 = Debug|Win32 - {8A7D82BD-178A-4785-B41B-70EDE998920A}.Release|x64.ActiveCfg = Release|x64 - {8A7D82BD-178A-4785-B41B-70EDE998920A}.Release|x64.Build.0 = Release|x64 - {8A7D82BD-178A-4785-B41B-70EDE998920A}.Release|x86.ActiveCfg = Release|Win32 - {8A7D82BD-178A-4785-B41B-70EDE998920A}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client", "Client\Client.vcxproj", "{8A7D82BD-178A-4785-B41B-70EDE998920A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8A7D82BD-178A-4785-B41B-70EDE998920A}.Debug|x64.ActiveCfg = Debug|x64 + {8A7D82BD-178A-4785-B41B-70EDE998920A}.Debug|x64.Build.0 = Debug|x64 + {8A7D82BD-178A-4785-B41B-70EDE998920A}.Debug|x86.ActiveCfg = Debug|Win32 + {8A7D82BD-178A-4785-B41B-70EDE998920A}.Debug|x86.Build.0 = Debug|Win32 + {8A7D82BD-178A-4785-B41B-70EDE998920A}.Release|x64.ActiveCfg = Release|x64 + {8A7D82BD-178A-4785-B41B-70EDE998920A}.Release|x64.Build.0 = Release|x64 + {8A7D82BD-178A-4785-B41B-70EDE998920A}.Release|x86.ActiveCfg = Release|Win32 + {8A7D82BD-178A-4785-B41B-70EDE998920A}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Client/Widgets.c b/src/Client/Widgets.c index ba2977bfc..0976a2f87 100644 --- a/src/Client/Widgets.c +++ b/src/Client/Widgets.c @@ -558,9 +558,10 @@ static void TableWidget_MakeBlockDesc(STRING_TRANSIENT String* desc, BlockID blo String_AppendString(desc, &name); if (Game_ClassicMode) return; - const UInt8* place = Block_CanPlace[block] ? "&aYes" : "&cNo"; - const UInt8* del = Block_CanDelete[block] ? "&aYes" : "&cNo"; - String_Format3(desc, " (ID %b&f, place %c&f, delete %c&f)", &block, place, del); + String_Format1(desc, " (ID %b&f", &block); + if (!Block_CanPlace[block]) { String_AppendConst(desc, ", place &cNo&f"); } + if (!Block_CanDelete[block]) { String_AppendConst(desc, ", delete &cNo&f"); } + String_Append(desc, ')'); } static void TableWidget_UpdateDescTexPos(TableWidget* widget) {