MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetHullGeometryResPath

Method GetHullGeometryResPath

trinity/Eve/SpaceObjectFactory/EveSOFDNA.cpp:1023–1056  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Return the redfile path to the model's geometry (gr2) --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1021// Return the redfile path to the model's geometry (gr2)
1022// --------------------------------------------------------------------------------
1023std::string EveSOFDNA::GetHullGeometryResPath() const
1024{
1025 // multi-hull geometry is different and needs some string mangeling
1026 if( m_hullDatas.size() == 1 )
1027 {
1028 return m_hullDatas[0]->geometryResFilePath;
1029 }
1030
1031 std::string modifiedResPath = m_hullDatas[0]->geometryResFilePath;
1032
1033 // collect gr2 string insert based on variant numbers
1034 std::string variantNumber;
1035 for( auto it = m_hullNames.cbegin(); it != m_hullNames.cend(); ++it )
1036 {
1037 variantNumber += it->back();
1038 }
1039
1040 // build a path to the shared folder
1041 std::vector<std::string> nameParts;
1042 StringSplit( nameParts, m_hullNames[0].c_str(), '_' );
1043 if( !nameParts.empty() )
1044 {
1045 // .../asc1/asc1_T3_s4v1/asc1_T3_s4v1.gr2 -> /asc1/asc1_T3_s4v1/asc1_T3_1232.gr2
1046 std::string oldGeo = nameParts.back() + ".gr2";
1047 std::string newGeo = variantNumber + ".gr2";
1048 StringReplace( modifiedResPath, oldGeo.c_str(), newGeo.c_str() );
1049 // .../asc1/asc1_T3_s4v1/asc1_T3_1232.gr2 -> /asc1/asc1_T3_all/asc1_T3_1232.gr2
1050 std::string oldFolder = nameParts.back() + "/";
1051 std::string newFolder = "all/";
1052 StringReplace( modifiedResPath, oldFolder.c_str(), newFolder.c_str() );
1053 }
1054
1055 return modifiedResPath;
1056}
1057
1058// --------------------------------------------------------------------------------
1059// Description:

Callers 4

CreateMeshMethod · 0.80
SetupImpactEffectsMethod · 0.80
SetupDecalSetsMethod · 0.80
CreatePlacementMethod · 0.80

Calls 4

StringSplitFunction · 0.85
StringReplaceFunction · 0.85
sizeMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected