Fixed parallel event bug

This commit is contained in:
2023-04-24 22:35:45 -07:00
parent e01b3d6346
commit 335f24f393
3 changed files with 28 additions and 2 deletions

View File

@ -25,13 +25,14 @@ namespace Dawn {
auto itEvents = this->events.begin(); auto itEvents = this->events.begin();
while(itEvents != this->events.end()) { while(itEvents != this->events.end()) {
auto event = *itEvents; auto event = *itEvents;
event->start(this, this);
eventCount++; eventCount++;
useEvent([&]{ useEvent([&]{
eventCompleteCount++; eventCompleteCount++;
if(eventCompleteCount >= eventCount) this->next(); if(eventCompleteCount >= eventCount) this->next();
}, event->eventFinished); }, event->eventFinished);
event->start(this, this);
itEvents++; itEvents++;
} }
} }

View File

@ -23,7 +23,7 @@ void VNSceneGen::test(
case VN_SCENE_EVENT_TYPE_TEXT: case VN_SCENE_EVENT_TYPE_TEXT:
initType = "VNTextEvent"; initType = "VNTextEvent";
toInclude = "games/vn/events/VNTextEvent.hpp"; toInclude = "games/vn/events/VNTextEvent.hpp";
line(body, eventName + "->" + "text = \"" + event->text.texts.begin()->text + "\";", ""); line(&afterLines, eventName + "->" + "text = \"" + event->text.texts.begin()->text + "\";", "");
break; break;
case VN_SCENE_EVENT_TYPE_POSITION: case VN_SCENE_EVENT_TYPE_POSITION:

View File

@ -0,0 +1,25 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "util/XmlParser.hpp"
namespace Dawn {
struct VNMarker {
std::string name;
};
class VNMarkerParser : public XmlParser<struct VNMarker> {
protected:
std::vector<std::string> getRequiredAttributes() override;
std::map<std::string, std::string> getOptionalAttributes() override;
int32_t onParse(
Xml *node,
std::map<std::string, std::string> values,
struct VNMarker *out,
std::string *error
) override;
};
}