浏览代码

code review

Laserlicht 1 年之前
父节点
当前提交
da38ad5f5c
共有 4 个文件被更改,包括 26 次插入26 次删除
  1. 20 20
      config/campaign_regions.json
  2. 3 3
      docs/modders/Campaign_Format.md
  3. 1 1
      lib/campaign/CampaignState.cpp
  4. 2 2
      lib/campaign/CampaignState.h

+ 20 - 20
config/campaign_regions.json

@@ -2,7 +2,7 @@
 	"campaign_regions": [
 		{
 			"prefix": "G1",
-			"color_suffix_length": 1,
+			"colorSuffixLength": 1,
 			"desc": [
 				{ "infix": "A", "x": 57, "y": 314 },
 				{ "infix": "B", "x": 137, "y": 309 },
@@ -12,7 +12,7 @@
 
 		{
 			"prefix": "G2",
-			"color_suffix_length": 1,
+			"colorSuffixLength": 1,
 			"desc": [
 				{ "infix": "A", "x": 56, "y": 90 },
 				{ "infix": "B", "x": 316, "y": 49 },
@@ -23,7 +23,7 @@
 
 		{
 			"prefix": "G3",
-			"color_suffix_length": 1,
+			"colorSuffixLength": 1,
 			"desc": [
 				{ "infix": "A", "x": 289, "y": 376 },
 				{ "infix": "B", "x": 60, "y": 147 },
@@ -33,7 +33,7 @@
 
 		{
 			"prefix": "E1",
-			"color_suffix_length": 1,
+			"colorSuffixLength": 1,
 			"desc": [
 				{ "infix": "A", "x": 270, "y": 332 },
 				{ "infix": "B", "x": 138, "y": 113 },
@@ -47,7 +47,7 @@
 
 		{
 			"prefix": "E2",
-			"color_suffix_length": 1,
+			"colorSuffixLength": 1,
 			"desc": [
 				{ "infix": "A", "x": 131, "y": 202 },
 				{ "infix": "B", "x": 60, "y": 145 },
@@ -58,7 +58,7 @@
 
 		{
 			"prefix": "N1",
-			"color_suffix_length": 1,
+			"colorSuffixLength": 1,
 			"desc": [
 				{ "infix": "A", "x": 42, "y": 94 },
 				{ "infix": "B", "x": 309, "y": 290 },
@@ -68,7 +68,7 @@
 
 		{
 			"prefix": "S1",
-			"color_suffix_length": 1,
+			"colorSuffixLength": 1,
 			"desc": [
 				{ "infix": "A", "x": 263, "y": 199 },
 				{ "infix": "B", "x": 182, "y": 210 },
@@ -78,7 +78,7 @@
 
 		{
 			"prefix": "BR",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 18, "y": 233 },
 				{ "infix": "B", "x": 125, "y": 381 },
@@ -89,7 +89,7 @@
 
 		{
 			"prefix": "IS",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 294, "y": 399 },
 				{ "infix": "B", "x": 183, "y": 293 },
@@ -100,7 +100,7 @@
 
 		{
 			"prefix": "KR",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 148, "y": 323 },
 				{ "infix": "B", "x": 192, "y": 235 },
@@ -111,7 +111,7 @@
 
 		{
 			"prefix": "NI",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 118, "y": 111 },
 				{ "infix": "B", "x": 223, "y": 145 },
@@ -122,7 +122,7 @@
 
 		{
 			"prefix": "TA",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 228, "y": 233 },
 				{ "infix": "B", "x": 147, "y": 194 },
@@ -132,7 +132,7 @@
 
 		{
 			"prefix": "AR",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 135, "y": 238 },
 				{ "infix": "B", "x": 135, "y": 121 },
@@ -147,7 +147,7 @@
 
 		{
 			"prefix": "HS",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 141, "y": 326 },
 				{ "infix": "B", "x": 238, "y": 275 },
@@ -158,7 +158,7 @@
 
 		{
 			"prefix": "BB",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 167, "y": 342 },
 				{ "infix": "B", "x": 217, "y": 263 },
@@ -170,7 +170,7 @@
 
 		{
 			"prefix": "NB",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 6, "y": 292 },
 				{ "infix": "B", "x": 161, "y": 334 },
@@ -181,7 +181,7 @@
 
 		{
 			"prefix": "EL",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 11, "y": 73 },
 				{ "infix": "B", "x": 0, "y": 241 },
@@ -192,7 +192,7 @@
 
 		{
 			"prefix": "RN",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 84, "y": 319 },
 				{ "infix": "B", "x": 194, "y": 275 },
@@ -203,7 +203,7 @@
 
 		{
 			"prefix": "UA",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 157, "y": 409 },
 				{ "infix": "B", "x": 62, "y": 346 },
@@ -222,7 +222,7 @@
 
 		{
 			"prefix": "SP",
-			"color_suffix_length": 2,
+			"colorSuffixLength": 2,
 			"desc": [
 				{ "infix": "A", "x": 7, "y": 295 },
 				{ "infix": "B", "x": 44, "y": 141 },

+ 3 - 3
docs/modders/Campaign_Format.md

@@ -182,10 +182,10 @@ Predefined campaign regions are located in file `campaign_regions.json`
 
 ```js
 {
-    "background": "own_region_background.bmp",
+    "background": "ownRegionBackground.png",
 		"suffix": ["Enabled", "Selected", "Conquered"],
     "prefix": "G3",
-    "color_suffix_length": 1,
+    "colorSuffixLength": 1,
     "desc": [
         { "infix": "A", "x": 289, "y": 376 },
         { "infix": "B", "x": 60, "y": 147 },
@@ -198,7 +198,7 @@ Predefined campaign regions are located in file `campaign_regions.json`
 - `"prefix"` used to identify all images related to campaign. In this example (if background parameter wouldn't exists), background picture will be `G3_BG`
 - `"suffix"` optional - use other suffixes than the default `En`, `Se` and `Co` for the three different images
 - `"infix"` used to identify all images related to region. In this example, it will be pictures whose files names begin with `G3A_..., G3B_..., G3C_..."` 
-- `"color_suffix_length"` identifies suffix length for region colourful frames. 0 is no color suffix (no colorisation), 1 is used for `R, B, N, G, O, V, T, P`, value 2 is used for `Re, Bl, Br, Gr, Or, Vi, Te, Pi`
+- `"colorSuffixLength"` identifies suffix length for region colourful frames. 0 is no color suffix (no colorisation), 1 is used for `R, B, N, G, O, V, T, P`, value 2 is used for `Re, Bl, Br, Gr, Or, Vi, Te, Pi`
 
 ## Packing campaign
 

+ 1 - 1
lib/campaign/CampaignState.cpp

@@ -45,7 +45,7 @@ CampaignRegions CampaignRegions::fromJson(const JsonNode & node)
 {
 	CampaignRegions cr;
 	cr.campPrefix = node["prefix"].String();
-	cr.colorSuffixLength = static_cast<int>(node["color_suffix_length"].Float());
+	cr.colorSuffixLength = static_cast<int>(node["colorSuffixLength"].Float());
 	cr.campSuffix = node["suffix"].isNull() ? std::vector<std::string>() : std::vector<std::string>{node["suffix"].Vector()[0].String(), node["suffix"].Vector()[1].String(), node["suffix"].Vector()[2].String()};
 	cr.campBackground = node["background"].isNull() ? "" : node["background"].String();
 

+ 2 - 2
lib/campaign/CampaignState.h

@@ -33,8 +33,8 @@ class IGameCallback;
 class DLL_LINKAGE CampaignRegions
 {
 	std::string campPrefix;
-	std::vector<std::string> campSuffix = {};
-	std::string campBackground = "";
+	std::vector<std::string> campSuffix;
+	std::string campBackground;
 	int colorSuffixLength;
 
 	struct DLL_LINKAGE RegionDescription