Skip to content

Commit

Permalink
Added clean-up param
Browse files Browse the repository at this point in the history
  • Loading branch information
Wincent01 committed Sep 10, 2024
1 parent 06063c8 commit a086fe7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
10 changes: 10 additions & 0 deletions dGame/dCinema/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ void Recorder::ActingDispatch(Entity* actor, const std::vector<Record*>& records
if (concludeRecord) {
if (variables != nullptr) {
variables->Conclude();

if (concludeRecord->cleanUp) {
variables->CleanUp();
}
}
}

Expand Down Expand Up @@ -1044,11 +1048,17 @@ void Cinema::Recording::ConcludeRecord::Serialize(tinyxml2::XMLDocument& documen

element->SetAttribute("t", m_Delay);

element->SetAttribute("cleanUp", true);

parent->InsertEndChild(element);
}

void Cinema::Recording::ConcludeRecord::Deserialize(tinyxml2::XMLElement* element) {
m_Delay = element->DoubleAttribute("t");

if (element->Attribute("cleanUp")) {
cleanUp = element->BoolAttribute("clean-up");
}
}

Cinema::Recording::VisibilityRecord::VisibilityRecord(bool visible) {
Expand Down
2 changes: 2 additions & 0 deletions dGame/dCinema/Recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ class SignalRecord : public Record
class ConcludeRecord : public Record
{
public:
bool cleanUp = false;

ConcludeRecord() = default;

void Act(Entity* actor) override;
Expand Down
14 changes: 8 additions & 6 deletions dGame/dCinema/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,16 @@ void Cinema::Scene::CheckTicket(Entity* player) {
}
}

if (!IsPlayerInShowingDistance(player)) {
m_HasBeenOutside.emplace(player->GetObjectID());
if (m_ShowingDistance != 0.0f) {
if (!IsPlayerInShowingDistance(player)) {
m_HasBeenOutside.emplace(player->GetObjectID());

return;
}
return;
}

if (m_HasBeenOutside.find(player->GetObjectID()) == m_HasBeenOutside.end()) {
return;
if (m_HasBeenOutside.find(player->GetObjectID()) == m_HasBeenOutside.end()) {
return;
}
}

m_Audience.emplace(player->GetObjectID());
Expand Down

0 comments on commit a086fe7

Please sign in to comment.