浏览代码

Adding macros for targeted object binding

nordsoft 2 年之前
父节点
当前提交
521328addd
共有 3 个文件被更改,包括 5 次插入4 次删除
  1. 1 0
      client/gui/CGuiHandler.h
  2. 2 2
      client/gui/InterfaceObjectConfigurable.cpp
  3. 2 2
      client/lobby/RandomMapTab.cpp

+ 1 - 0
client/gui/CGuiHandler.h

@@ -165,6 +165,7 @@ struct SSetCaptureState
 };
 
 #define OBJ_CONSTRUCTION SObjectConstruction obj__i(this)
+#define OBJ_CONSTRUCTION_TARGETED(obj) SObjectConstruction obj__i(obj)
 #define OBJECT_CONSTRUCTION_CAPTURING(actions) defActions = actions; SSetCaptureState obj__i1(true, actions); SObjectConstruction obj__i(this)
 #define OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(actions) SSetCaptureState obj__i1(true, actions); SObjectConstruction obj__i(this)
 

+ 2 - 2
client/gui/InterfaceObjectConfigurable.cpp

@@ -27,7 +27,7 @@
 
 
 InterfaceObjectConfigurable::InterfaceObjectConfigurable(const JsonNode & config, int used, Point offset):
-	CIntObject(used, offset)
+	InterfaceObjectConfigurable(used, offset)
 {
 	init(config);
 }
@@ -202,7 +202,7 @@ std::shared_ptr<CToggleGroup> InterfaceObjectConfigurable::buildToggleGroup(cons
 	group->pos += position;
 	if(!config["items"].isNull())
 	{
-		SObjectConstruction obj__i(group.get());
+		OBJ_CONSTRUCTION_TARGETED(group.get());
 		int itemIdx = -1;
 		for(const auto & item : config["items"].Vector())
 		{

+ 2 - 2
client/lobby/RandomMapTab.cpp

@@ -533,7 +533,7 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
 		players.push_back(std::make_shared<CToggleGroup>([&, totalPlayers, plId](int sel)
 		{
 			variables["player_id"].Integer() = plId;
-			SObjectConstruction obj__i(players[plId].get());
+			OBJ_CONSTRUCTION_TARGETED(players[plId].get());
 			for(int teamId = 0; teamId < totalPlayers; ++teamId)
 			{
 				auto button = std::dynamic_pointer_cast<CToggleButton>(players[plId]->buttons[teamId]);
@@ -549,7 +549,7 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
 			}
 		}));
 		
-		SObjectConstruction obj__i(players.back().get());
+		OBJ_CONSTRUCTION_TARGETED(players.back().get());
 		for(int teamId = 0; teamId < totalPlayers; ++teamId)
 		{
 			variables["point"]["x"].Integer() = variables["cellOffset"]["x"].Integer() + plId * variables["cellMargin"]["x"].Integer();