소스 검색

configurable window position

Laserlicht 4 달 전
부모
커밋
14f0b82f17

+ 4 - 1
client/windows/CCastleInterface.cpp

@@ -2120,7 +2120,10 @@ CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner, const ImagePath & i
 	assert(guildWindow.size() == 1 || guildWindow.size() == GAME->interface()->castleInt->town->getTown()->mageLevel);
 	auto selectedGuildWindow = guildWindow.size() == 1 ? guildWindow[0] : guildWindow[owner->town->mageGuildLevel() - 1];
 
-	window = std::make_shared<CPicture>(selectedGuildWindow, 332, 76);
+	auto windowPosition = owner->town->getTown()->clientInfo.guildWindowPosition;
+	if(windowPosition == Point(0, 0)) // TODO: remove legacy for compatibility
+		windowPosition = Point(332, 76);
+	window = std::make_shared<CPicture>(selectedGuildWindow, windowPosition.x, windowPosition.y);
 
 	resdatabar = std::make_shared<CMinorResDataBar>();
 	resdatabar->moveBy(pos.topLeft(), true);

+ 1 - 0
config/factions/castle.json

@@ -153,6 +153,7 @@
 				[ { "x": 570, "y":  82 }, { "x": 672, "y":  82 }, { "x": 570, "y": 157 }, { "x": 672, "y": 157 } ],
 				[ { "x": 183, "y":  42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ]
 			],
+			"guildWindowPosition": { "x": 332, "y": 76 },
 			"moatAbility" : "castleMoat",
 			// primaryResource not specified so town get both Wood and Ore for resource bonus
 

+ 1 - 0
config/factions/conflux.json

@@ -158,6 +158,7 @@
 				[ { "x": 183, "y":  42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
 				[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
 			],
+			"guildWindowPosition": { "x": 332, "y": 76 },
 			"primaryResource" : "mercury",
 			"moatAbility" : "castleMoat",
 

+ 1 - 0
config/factions/dungeon.json

@@ -154,6 +154,7 @@
 				[ { "x": 183, "y":  42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
 				[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
 			],
+			"guildWindowPosition": { "x": 332, "y": 76 },
 			"primaryResource" : "sulfur",
 			"moatAbility" : "dungeonMoat",
 

+ 1 - 0
config/factions/fortress.json

@@ -152,6 +152,7 @@
 				[ { "x":  48, "y":  53 }, { "x":  48, "y": 147 }, { "x":  48, "y": 241 }, { "x":  48, "y": 335 }, { "x":  48, "y": 429 } ],
 				[ { "x": 570, "y":  82 }, { "x": 672, "y":  82 }, { "x": 570, "y": 157 }, { "x": 672, "y": 157 } ]
 			],
+			"guildWindowPosition": { "x": 332, "y": 76 },
 			"moatAbility" : "fortressMoat",
 			// primaryResource not specified so town get both Wood and Ore for resource bonus
 

+ 1 - 0
config/factions/inferno.json

@@ -155,6 +155,7 @@
 				[ { "x": 183, "y":  42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
 				[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
 			],
+			"guildWindowPosition": { "x": 332, "y": 76 },
 			"primaryResource" : "mercury",
 			"moatAbility" : "infernoMoat",
 

+ 1 - 0
config/factions/necropolis.json

@@ -159,6 +159,7 @@
 				[ { "x": 183, "y":  42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
 				[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
 			],
+			"guildWindowPosition": { "x": 332, "y": 76 },
 			"moatAbility" : "necropolisMoat",
 			// primaryResource not specified so town get both Wood and Ore for resource bonus
 

+ 1 - 0
config/factions/rampart.json

@@ -158,6 +158,7 @@
 				[ { "x": 183, "y":  42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
 				[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
 			],
+			"guildWindowPosition": { "x": 332, "y": 76 },
 			"primaryResource" : "crystal",
 			"moatAbility" : "rampartMoat",
 

+ 1 - 0
config/factions/stronghold.json

@@ -150,6 +150,7 @@
 				[ { "x":  48, "y":  53 }, { "x":  48, "y": 147 }, { "x":  48, "y": 241 }, { "x":  48, "y": 335 }, { "x":  48, "y": 429 } ],
 				[ { "x": 570, "y":  82 }, { "x": 672, "y":  82 }, { "x": 570, "y": 157 }, { "x": 672, "y": 157 } ]
 			],
+			"guildWindowPosition": { "x": 332, "y": 76 },
 			"moatAbility" : "strongholdMoat",
 			// primaryResource not specified so town get both Wood and Ore for resource bonus
 

+ 1 - 0
config/factions/tower.json

@@ -154,6 +154,7 @@
 				[ { "x": 183, "y":  42 }, { "x": 183, "y": 148 }, { "x": 183, "y": 253 } ],
 				[ { "x": 491, "y": 325 }, { "x": 591, "y": 325 } ]
 			],
+			"guildWindowPosition": { "x": 332, "y": 76 },
 			"moatAbility" : "towerMoat",
 
 			"buildings" :

+ 11 - 0
config/schemas/faction.json

@@ -183,6 +183,17 @@
 						"format" : "imageFile"
 					}
 				},
+				"guildWindowPosition" : { 
+					"type" : "array",
+					"items" : {
+						"type" : "object",
+						"additionalProperties" : false,
+						"properties" : {
+							"x" :     { "type" : "number", "description" : "X coordinate on screen" },
+							"y" :     { "type" : "number", "description" : "Y coordinate on screen" }
+						}
+					}
+				},
 				"guildSpellPositions" : {
 					"type" : "array",
 					"description" : "Positions of spells in mage guild",

+ 1 - 0
lib/entities/faction/CTown.h

@@ -90,6 +90,7 @@ public:
 		ImagePath townBackground;
 		std::vector<ImagePath> guildBackground;
 		std::vector<ImagePath> guildWindow;
+		Point guildWindowPosition;
 		std::vector<std::vector<Point>> guildSpellPositions;
 		AnimationPath buildingsIcons;
 		ImagePath hallBackground;

+ 1 - 0
lib/entities/faction/CTownHandler.cpp

@@ -565,6 +565,7 @@ void CTownHandler::loadClientData(CTown &town, const JsonNode & source) const
 	info.townBackground = ImagePath::fromJson(source["townBackground"]);
 	info.buildingsIcons = AnimationPath::fromJson(source["buildingsIcons"]);
 	info.tavernVideo = VideoPath::fromJson(source["tavernVideo"]);
+	info.guildWindowPosition  = Point(source["guildWindowPosition"]["x"].Integer(), source["guildWindowPosition"]["y"].Integer());
 
 	info.guildSpellPositions.clear();
 	for(auto & level : source["guildSpellPositions"].Vector())