diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp
index ed57c2c..19acace 100644
a
|
b
|
|
19 | 19 | |
20 | 20 | #include "MapReader.h" |
21 | 21 | |
| 22 | #include "boost/algorithm/string/split.hpp" |
| 23 | #include "boost/algorithm/string/classification.hpp" |
22 | 24 | #include "graphics/Camera.h" |
23 | 25 | #include "graphics/CinemaTrack.h" |
24 | 26 | #include "graphics/Entity.h" |
… |
… |
|
28 | 30 | #include "graphics/Terrain.h" |
29 | 31 | #include "graphics/TerrainTextureEntry.h" |
30 | 32 | #include "graphics/TerrainTextureManager.h" |
| 33 | #include "graphics/Unit.h" |
31 | 34 | #include "lib/timer.h" |
32 | 35 | #include "lib/external_libraries/libsdl.h" |
33 | 36 | #include "maths/MathUtil.h" |
… |
… |
private:
|
433 | 436 | int el_template, el_player; |
434 | 437 | int el_position, el_orientation, el_obstruction; |
435 | 438 | int el_actor; |
| 439 | int el_actorSelections; |
436 | 440 | int at_x, at_y, at_z; |
437 | 441 | int at_group, at_group2; |
438 | 442 | int at_id; |
… |
… |
void CXMLReader::Init(const VfsPath& xml_filename)
|
485 | 489 | EL(orientation); |
486 | 490 | EL(obstruction); |
487 | 491 | EL(actor); |
| 492 | EL(actorSelections); |
488 | 493 | AT(x); AT(y); AT(z); |
489 | 494 | AT(group); AT(group2); |
490 | 495 | AT(angle); |
… |
… |
int CXMLReader::ReadEntities(XMBElement parent, double end_time)
|
986 | 991 | CFixedVector3D Position; |
987 | 992 | CFixedVector3D Orientation; |
988 | 993 | long Seed = -1; |
| 994 | std::set<CStr8> actorSelections; |
989 | 995 | |
990 | 996 | // Obstruction control groups. |
991 | 997 | entity_id_t ControlGroup = INVALID_ENTITY; |
… |
… |
int CXMLReader::ReadEntities(XMBElement parent, double end_time)
|
1042 | 1048 | ENSURE(Seed >= 0); |
1043 | 1049 | } |
1044 | 1050 | } |
| 1051 | else if (element_name == el_actorSelections) |
| 1052 | { |
| 1053 | CStr8 cdata = setting.GetText(); |
| 1054 | boost::algorithm::split(actorSelections, cdata, boost::is_any_of("|")); |
| 1055 | } |
1045 | 1056 | else |
1046 | 1057 | debug_warn(L"Invalid map XML data"); |
1047 | 1058 | } |
… |
… |
int CXMLReader::ReadEntities(XMBElement parent, double end_time)
|
1083 | 1094 | if (Seed != -1) |
1084 | 1095 | cmpVisual->SetActorSeed((u32)Seed); |
1085 | 1096 | // TODO: variation/selection strings |
| 1097 | CUnit* unit = cmpVisual->GetUnit(); |
| 1098 | if (unit) |
| 1099 | unit->SetActorSelections(actorSelections); |
1086 | 1100 | } |
1087 | 1101 | |
1088 | 1102 | if (PlayerID == m_MapReader.m_PlayerID && (boost::algorithm::ends_with(TemplateName, L"civil_centre") || m_MapReader.m_StartingCameraTarget == INVALID_ENTITY)) |
diff --git a/source/graphics/MapWriter.cpp b/source/graphics/MapWriter.cpp
index 9d59ac0..03b97a9 100644
a
|
b
|
|
27 | 27 | #include "Terrain.h" |
28 | 28 | #include "TerrainTextureEntry.h" |
29 | 29 | #include "TerrainTextureManager.h" |
| 30 | #include "Unit.h" |
30 | 31 | |
| 32 | |
| 33 | #include "boost/algorithm/string/join.hpp" |
31 | 34 | #include "maths/MathUtil.h" |
32 | 35 | #include "maths/NUSpline.h" |
33 | 36 | #include "ps/CLogger.h" |
… |
… |
void CMapWriter::WriteXML(const VfsPath& filename,
|
392 | 395 | XML_Element("Actor"); |
393 | 396 | XML_Attribute("seed", seed); |
394 | 397 | } |
395 | | // TODO: variation/selection strings |
| 398 | |
| 399 | CUnit* unit = cmpVisual->GetUnit(); |
| 400 | if (unit) |
| 401 | { |
| 402 | CStr actorSelections = boost::algorithm::join(unit->GetActorSelections(), "|"); |
| 403 | |
| 404 | XML_Element("ActorSelections"); |
| 405 | XML_CDATA(actorSelections.c_str()); |
| 406 | } |
396 | 407 | } |
397 | 408 | } |
398 | 409 | } |