XKSYU2021 2 hónapja
szülő
commit
8b2f43160a
2 módosított fájl, 71 hozzáadás és 7 törlés
  1. 2 2
      Ui for BDS/Config.h
  2. 69 5
      Ui for BDS/config.cpp

+ 2 - 2
Ui for BDS/Config.h

@@ -13,10 +13,10 @@ void Submit(HWND hWnd1);
 #define CONF_LevelSeed 51070
 #define CONF_MaxPlayer 51080
 
-#define CONF_OnlineMod 51090
+#define CONF_OnlineMode 51090
 #define CONF_LanVisible 51100
 #define CONF_Whitelist 51120
-#define CONF_OnlineMod_NOEDIT 51091
+#define CONF_OnlineMode_NOEDIT 51091
 #define CONF_LanVisible_NOEDIT 51101
 #define CONF_Whitelist_NOEDIT 51121
 

+ 69 - 5
Ui for BDS/config.cpp

@@ -58,7 +58,7 @@ static void ConfigSet_CHECK_1(std::vector<std::string>& configText, HWND hWnd1,
 		{
 			if (l.find(target) != std::string::npos)
 			{
-				if(IsDlgButtonChecked(hWnd1, id) != BST_CHECKED)
+				if(IsDlgButtonChecked(hWnd1, id) == BST_CHECKED)
 					l = target + "=true";
 				else l = target + "=false";
 				return;
@@ -66,7 +66,7 @@ static void ConfigSet_CHECK_1(std::vector<std::string>& configText, HWND hWnd1,
 		}
 	}
 }
-static void ConfigSet_CHECK_1(std::vector<std::string>& configText, HWND hWnd1, std::string target, int id, int no_id)
+static void ConfigSet_CHECK_2(std::vector<std::string>& configText, HWND hWnd1, std::string target, int id, int no_id)
 {
 	if (IsDlgButtonChecked(hWnd1, no_id) != BST_CHECKED)
 	{
@@ -74,7 +74,7 @@ static void ConfigSet_CHECK_1(std::vector<std::string>& configText, HWND hWnd1,
 		{
 			if (l.find(target) != std::string::npos)
 			{
-				if (IsDlgButtonChecked(hWnd1, id) != BST_CHECKED)
+				if (IsDlgButtonChecked(hWnd1, id) == BST_CHECKED)
 					l = target + "=false";
 				else l = target + "=true";
 				return;
@@ -84,17 +84,81 @@ static void ConfigSet_CHECK_1(std::vector<std::string>& configText, HWND hWnd1,
 }
 
 
-//special
-
+//DIY
+static void ConfigSet_CheckDIY_Mute(std::vector<std::string>& configText, HWND hWnd1, std::string target, int id, int no_id)
+{
+	if (IsDlgButtonChecked(hWnd1, no_id) != BST_CHECKED)
+	{
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				if (IsDlgButtonChecked(hWnd1, id) == BST_CHECKED)
+					l = target + "=Disabled";
+				else l = target + "=None";
+				return;
+			}
+		}
+	}
+}
+static void ConfigSet_CheckDIY_AntiCheat(std::vector<std::string>& configText, HWND hWnd1)
+{
+	if (IsDlgButtonChecked(hWnd1, CONF_AntiCheat_NOEDIT) != BST_CHECKED)
+	{
+		for (auto& l : configText)
+		{
+			char targetA, targetB, targetC, targetD;
+			if (l.find(targetA) != std::string::npos)
+			{
+				if (IsDlgButtonChecked(hWnd1, CONF_AntiCheat_OFF) == BST_CHECKED)
+					l = targetA + "=Disabled";
+				else if (IsDlgButtonChecked(hWnd1, CONF_AntiCheat_ON) == BST_CHECKED)
+					l = targetA + "=Disabled";
+				else l = targetA + "=None";
+				return;
+			}
+		}
+	}
+}
 
 
 //whole
 void Submit(HWND hWnd1)
 {
 	std::vector<std::string> configText = ConfigRead();
+
+	//EDIT
 	ConfigSet_EDIT(configText, hWnd1, 
 		"server-name",  CONF_ServerName);
 
+	ConfigSet_EDIT(configText, hWnd1,
+		"level-name", CONF_LevelName);
+	ConfigSet_EDIT(configText, hWnd1,
+		"level-seed", CONF_LevelSeed);
+	ConfigSet_EDIT(configText, hWnd1,
+		"max-players", CONF_MaxPlayer);
+	
+	//CHECK
+	ConfigSet_CHECK_1(configText, hWnd1,
+		"allow-cheats", CONF_Cheat, CONF_Cheat_NOEDIT);
+
+	ConfigSet_CHECK_1(configText, hWnd1,
+		"online-mode", CONF_OnlineMode, CONF_OnlineMode_NOEDIT);
+	ConfigSet_CHECK_1(configText, hWnd1,
+		"enable-lan-visibility", CONF_LanVisible, CONF_LanVisible_NOEDIT);
+	ConfigSet_CHECK_1(configText, hWnd1,
+		"allow-list", CONF_Whitelist, CONF_Whitelist_NOEDIT);
+
+	ConfigSet_CHECK_1(configText, hWnd1,
+		"texturepack-required", CONF_FroceTexture, CONF_FroceTexture_NOEDIT);
+	ConfigSet_CHECK_1(configText, hWnd1,
+		"disable-custom-skins", CONF_BanSkin, CONF_BanSkin_NOEDIT);
+
+	//CheckDIY
+	ConfigSet_CheckDIY_Mute(configText, hWnd1,
+		"chat-restriction", CONF_Mute, CONF_Mute_NOEDIT);
+
+
 	ConfigWrite(configText);
 	MessageBox(hWnd,
 		L"Òѳ¢ÊÔÌá½»", TITLE,