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

Function CreateScriptedRotation

src/celengine/parseobject.cpp:975–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

973
974
975static ScriptedRotation*
976CreateScriptedRotation(Hash* rotationData,
977 const string& path)
978{
979#if !defined(CELX)
980 clog << "ScriptedRotation not usable without scripting support.\n";
981 return NULL;
982#else
983
984 // Function name is required
985 string funcName;
986 if (!rotationData->getString("Function", funcName))
987 {
988 clog << "Function name missing from scripted rotation definition.\n";
989 return NULL;
990 }
991
992 // Module name is optional
993 string moduleName;
994 rotationData->getString("Module", moduleName);
995
996 string* pathCopy = new string(path);
997 Value* pathValue = new Value(*pathCopy);
998 rotationData->addValue("AddonPath", *pathValue);
999
1000 ScriptedRotation* scriptedRotation = new ScriptedRotation();
1001 if (scriptedRotation != NULL)
1002 {
1003 if (!scriptedRotation->initialize(moduleName, funcName, rotationData))
1004 {
1005 delete scriptedRotation;
1006 scriptedRotation = NULL;
1007 }
1008 }
1009
1010 return scriptedRotation;
1011#endif
1012}
1013
1014
1015// Parse rotation information. Unfortunately, Celestia didn't originally have

Callers 1

CreateRotationModelFunction · 0.85

Calls 3

getStringMethod · 0.80
addValueMethod · 0.80
initializeMethod · 0.45

Tested by

no test coverage detected