mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Run code formatting on EventsCodeGenerator.cpp
This commit is contained in:

committed by
Florian Rival

parent
93e8dd4002
commit
cb14f7cfa5
@@ -4,7 +4,9 @@
|
|||||||
* reserved. This project is released under the MIT License.
|
* reserved. This project is released under the MIT License.
|
||||||
*/
|
*/
|
||||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "GDCore/CommonTools.h"
|
#include "GDCore/CommonTools.h"
|
||||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||||
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
|
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
|
||||||
@@ -898,24 +900,25 @@ gd::String EventsCodeGenerator::GenerateObject(
|
|||||||
//(references to) objects lists. We statically declare and construct them to
|
//(references to) objects lists. We statically declare and construct them to
|
||||||
// avoid re-creating them at runtime. Arrays are passed as reference in JS and
|
// avoid re-creating them at runtime. Arrays are passed as reference in JS and
|
||||||
// we always use the same static arrays, making this possible.
|
// we always use the same static arrays, making this possible.
|
||||||
auto declareMapOfObjects = [this](
|
auto declareMapOfObjects =
|
||||||
const std::vector<gd::String>& objects,
|
[this](const std::vector<gd::String>& objects,
|
||||||
const gd::EventsCodeGenerationContext& context) {
|
const gd::EventsCodeGenerationContext& context) {
|
||||||
gd::String objectsMapName = GetCodeNamespaceAccessor() + "mapOf";
|
gd::String objectsMapName = GetCodeNamespaceAccessor() + "mapOf";
|
||||||
gd::String mapDeclaration;
|
gd::String mapDeclaration;
|
||||||
for (auto& objectName : objects) {
|
for (auto& objectName : objects) {
|
||||||
// The map name must be unique for each set of objects lists.
|
// The map name must be unique for each set of objects lists.
|
||||||
objectsMapName += ManObjListName(GetObjectListName(objectName, context));
|
objectsMapName +=
|
||||||
|
ManObjListName(GetObjectListName(objectName, context));
|
||||||
|
|
||||||
if (!mapDeclaration.empty()) mapDeclaration += ", ";
|
if (!mapDeclaration.empty()) mapDeclaration += ", ";
|
||||||
mapDeclaration += "\"" + ConvertToString(objectName) +
|
mapDeclaration += "\"" + ConvertToString(objectName) +
|
||||||
"\": " + GetObjectListName(objectName, context);
|
"\": " + GetObjectListName(objectName, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddCustomCodeOutsideMain(objectsMapName + " = Hashtable.newFrom({" +
|
AddCustomCodeOutsideMain(objectsMapName + " = Hashtable.newFrom({" +
|
||||||
mapDeclaration + "});");
|
mapDeclaration + "});");
|
||||||
return objectsMapName;
|
return objectsMapName;
|
||||||
};
|
};
|
||||||
|
|
||||||
gd::String output;
|
gd::String output;
|
||||||
if (type == "objectList") {
|
if (type == "objectList") {
|
||||||
|
Reference in New Issue
Block a user