HomeWildfire Games

read starting tech, disabled tech, ... from map JSON file, refs #1404

Description

read starting tech, disabled tech, ... from map JSON file, refs #1404

Details

Committed
mimoFeb 5 2015, 11:29 PM
Parents
rP16269: Some more gui cleanup.
Branches
Unknown
Tags
Unknown

Event Timeline

elexis added a subscriber: elexis.Nov 10 2017, 5:09 PM

In this commit (refs #1404) , the starting phase, disabled techs, disabled templates and starting entities garrisoned were added to the JSON part of the map.

This seems right for all properties that apply to players.
But the Garrison property contains entity IDs (thus is incompatible with random map scripts) and would better fit to the other places that hold the Entity information, i.e. XML <Entity> list IMO.
(See rP16279 for a map using the property.)

CXMLReader::ReadEntities of MapReader.cpp loads the entities and it sets all properties of the other simulation components as well, so it could set this one too.
One might argue that the C++ code only sets the properties that are shared by almost all (i.e. foremost gaia and actor) entities while the Garrison and other simulation properties should not be present in C++ to keep the engine split from the public mod.
On the other hand we likely want to make the Garrison property a setting in Atlas.

elexis added inline comments.Jan 11 2020, 7:29 PM
/ps/trunk/binaries/data/mods/public/simulation/helpers/Setup.js
51

Assigning this value means that the reference is being passed on, not the object copied.
So if the GarrisonHolder will change that object, it will change that object in all other places in the code that uses the same object reference.
So this even changes the m_InitAttributes object in Simulation[2].cpp.
It sounds cleaner to pass the object with a function call that reads the object without taking over references without modifying the object.