瀏覽代碼

Merge pull request #1441 from Azaezel/alpha41/controlConfusion

handle relfecting the health of the controlled object
Brian Roberts 6 月之前
父節點
當前提交
cdaa6533b2
共有 2 個文件被更改,包括 11 次插入1 次删除
  1. 5 0
      Engine/source/T3D/fps/guiHealthBarHud.cpp
  2. 6 1
      Engine/source/T3D/fps/guiHealthTextHud.cpp

+ 5 - 0
Engine/source/T3D/fps/guiHealthBarHud.cpp

@@ -147,6 +147,11 @@ void GuiHealthBarHud::onRender(Point2I offset, const RectI &updateRect)
    if (!conn)
       return;
    ShapeBase* control = dynamic_cast<ShapeBase*>(conn->getControlObject());
+
+   //cover the case of a connection controling an object in turn controlling another
+   if (control && control->getControlObject())
+      control = control->getControlObject();
+
    if (!control || !(control->getTypeMask() & (PlayerObjectType | VehicleObjectType)))
       return;
 

+ 6 - 1
Engine/source/T3D/fps/guiHealthTextHud.cpp

@@ -148,7 +148,12 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
    GameConnection* conn = GameConnection::getConnectionToServer();  
    if (!conn)  
       return;  
-   ShapeBase* control = dynamic_cast<ShapeBase*>(conn->getControlObject());  
+   ShapeBase* control = dynamic_cast<ShapeBase*>(conn->getControlObject());
+
+   //cover the case of a connection controling an object in turn controlling another
+   if (control && control->getControlObject())
+      control = control->getControlObject();
+
    if (!control || !(control->getTypeMask() & (PlayerObjectType | VehicleObjectType)))
       return;