Commit 95a8e09c authored by Eiko Oltmanns's avatar Eiko Oltmanns

restore buildListFirstItemSignalConnections when loading game

parent 5891786e
......@@ -372,6 +372,7 @@ void cBuilding::render_rubble (SDL_Surface* surface, const SDL_Rect& dest, float
}
}
//------------------------------------------------------------------------------
void cBuilding::render_beton (SDL_Surface* surface, const SDL_Rect& dest, float zoomFactor) const
{
SDL_Rect tmp = dest;
......@@ -399,6 +400,18 @@ void cBuilding::render_beton (SDL_Surface* surface, const SDL_Rect& dest, float
}
}
//------------------------------------------------------------------------------
void cBuilding::connectFirstBuildListItem()
{
buildListFirstItemSignalConnectionManager.disconnectAll();
if (!buildList.empty())
{
buildListFirstItemSignalConnectionManager.connect(buildList[0].remainingMetalChanged, [this]() { buildListFirstItemDataChanged(); });
buildListFirstItemSignalConnectionManager.connect(buildList[0].typeChanged, [this]() { buildListFirstItemDataChanged(); });
}
}
//------------------------------------------------------------------------------
void cBuilding::render_simple (SDL_Surface* surface, const SDL_Rect& dest, float zoomFactor, unsigned long long animationTime, int alpha) const
{
int frameNr = dir;
......@@ -1329,12 +1342,7 @@ void cBuilding::setBuildList (std::vector<cBuildListItem> buildList_)
{
buildList = std::move (buildList_);
buildListFirstItemSignalConnectionManager.disconnectAll();
if (!buildList.empty())
{
buildListFirstItemSignalConnectionManager.connect (buildList[0].remainingMetalChanged, [this]() { buildListFirstItemDataChanged(); });
buildListFirstItemSignalConnectionManager.connect (buildList[0].typeChanged, [this]() { buildListFirstItemDataChanged(); });
}
connectFirstBuildListItem();
buildListChanged();
}
......@@ -1344,12 +1352,7 @@ void cBuilding::addBuildListItem (cBuildListItem item)
{
buildList.push_back (std::move (item));
buildListFirstItemSignalConnectionManager.disconnectAll();
if (!buildList.empty())
{
buildListFirstItemSignalConnectionManager.connect (buildList[0].remainingMetalChanged, [this]() { buildListFirstItemDataChanged(); });
buildListFirstItemSignalConnectionManager.connect (buildList[0].typeChanged, [this]() { buildListFirstItemDataChanged(); });
}
connectFirstBuildListItem();
buildListChanged();
}
......@@ -1359,12 +1362,7 @@ void cBuilding::removeBuildListItem (size_t index)
{
buildList.erase (buildList.begin() + index);
buildListFirstItemSignalConnectionManager.disconnectAll();
if (!buildList.empty())
{
buildListFirstItemSignalConnectionManager.connect (buildList[0].remainingMetalChanged, [this]() { buildListFirstItemDataChanged(); });
buildListFirstItemSignalConnectionManager.connect (buildList[0].typeChanged, [this]() { buildListFirstItemDataChanged(); });
}
connectFirstBuildListItem();
buildListChanged();
}
......
......@@ -316,6 +316,7 @@ public:
uiData = UnitsUiData.getBuildingUI(data.getId());
}
registerOwnerEvents();
connectFirstBuildListItem();
}
}
......@@ -330,6 +331,7 @@ private:
void render_rubble (SDL_Surface* surface, const SDL_Rect& dest, float zoomFactor, bool drawShadow) const;
void render_beton (SDL_Surface* surface, const SDL_Rect& dest, float zoomFactor) const;
void connectFirstBuildListItem();
bool isWorking; // is the building currently working?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment