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

Function CreateScriptedOrbit

src/celengine/parseobject.cpp:578–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576
577
578static ScriptedOrbit*
579CreateScriptedOrbit(Hash* orbitData,
580 const string& path)
581{
582#if !defined(CELX)
583 clog << "ScriptedOrbit not usable without scripting support.\n";
584 return NULL;
585#else
586
587 // Function name is required
588 string funcName;
589 if (!orbitData->getString("Function", funcName))
590 {
591 clog << "Function name missing from script orbit definition.\n";
592 return NULL;
593 }
594
595 // Module name is optional
596 string moduleName;
597 orbitData->getString("Module", moduleName);
598
599 string* pathCopy = new string(path);
600 Value* pathValue = new Value(*pathCopy);
601 orbitData->addValue("AddonPath", *pathValue);
602
603 ScriptedOrbit* scriptedOrbit = new ScriptedOrbit();
604 if (scriptedOrbit != NULL)
605 {
606 if (!scriptedOrbit->initialize(moduleName, funcName, orbitData))
607 {
608 delete scriptedOrbit;
609 scriptedOrbit = NULL;
610 }
611 }
612
613 return scriptedOrbit;
614#endif
615}
616
617
618Orbit*

Callers 1

CreateOrbitFunction · 0.85

Calls 3

getStringMethod · 0.80
addValueMethod · 0.80
initializeMethod · 0.45

Tested by

no test coverage detected