MCPcopy Create free account
hub / github.com/CelestiaProject/Celestia / LoadSolarSystemObjects

Function LoadSolarSystemObjects

src/celengine/solarsys.cpp:1066–1277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1064
1065
1066bool LoadSolarSystemObjects(istream& in,
1067 Universe& universe,
1068 const std::string& directory)
1069{
1070 Tokenizer tokenizer(&in);
1071 Parser parser(&tokenizer);
1072
1073 while (tokenizer.nextToken() != Tokenizer::TokenEnd)
1074 {
1075 // Read the disposition; if none is specified, the default is Add.
1076 Disposition disposition = AddObject;
1077 if (tokenizer.getTokenType() == Tokenizer::TokenName)
1078 {
1079 if (tokenizer.getNameValue() == "Add")
1080 {
1081 disposition = AddObject;
1082 tokenizer.nextToken();
1083 }
1084 else if (tokenizer.getNameValue() == "Replace")
1085 {
1086 disposition = ReplaceObject;
1087 tokenizer.nextToken();
1088 }
1089 else if (tokenizer.getNameValue() == "Modify")
1090 {
1091 disposition = ModifyObject;
1092 tokenizer.nextToken();
1093 }
1094 }
1095
1096 // Read the item type; if none is specified the default is Body
1097 string itemType("Body");
1098 if (tokenizer.getTokenType() == Tokenizer::TokenName)
1099 {
1100 itemType = tokenizer.getNameValue();
1101 tokenizer.nextToken();
1102 }
1103
1104 if (tokenizer.getTokenType() != Tokenizer::TokenString)
1105 {
1106 sscError(tokenizer, "object name expected");
1107 return false;
1108 }
1109
1110 // The name list is a string with zero more names. Multiple names are
1111 // delimited by colons.
1112 string nameList = tokenizer.getStringValue().c_str();
1113
1114 if (tokenizer.nextToken() != Tokenizer::TokenString)
1115 {
1116 sscError(tokenizer, "bad parent object name");
1117 return false;
1118 }
1119 string parentName = tokenizer.getStringValue().c_str();
1120
1121 Value* objectDataValue = parser.readValue();
1122 if (objectDataValue == NULL)
1123 {

Callers 2

processMethod · 0.85
initSimulationMethod · 0.85

Calls 15

sscErrorFunction · 0.85
CreateReferencePointFunction · 0.85
CreateBodyFunction · 0.85
FillinSurfaceFunction · 0.85
CreateLocationFunction · 0.85
nextTokenMethod · 0.80
getTokenTypeMethod · 0.80
getNameValueMethod · 0.80
readValueMethod · 0.80
getHashMethod · 0.80
findPathMethod · 0.80
starMethod · 0.80

Tested by

no test coverage detected