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

Function parseConstellationColor

src/celengine/cmdparser.cpp:908–945  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

906}
907
908int parseConstellationColor(CommandConstellationColor* cmd, string s, Vec3d *col, int act)
909{
910 istringstream in(s);
911
912 Tokenizer tokenizer(&in);
913 int flags = 0;
914
915 if(!act)
916 cmd->unsetColor();
917 else
918 cmd->setColor((float)col->x, (float)col->y, (float)col->z);
919
920 Tokenizer::TokenType ttype = tokenizer.nextToken();
921 while (ttype != Tokenizer::TokenEnd)
922 {
923 if (ttype == Tokenizer::TokenName)
924 {
925 string name = tokenizer.getNameValue();
926 if (compareIgnoringCase(name, "all") == 0 && act==1)
927 cmd->all=1;
928 else if (compareIgnoringCase(name, "all") == 0 && act==0)
929 cmd->none=1;
930 else
931 cmd->setConstellations(name);
932
933 ttype = tokenizer.nextToken();
934 if (ttype == Tokenizer::TokenBar)
935 ttype = tokenizer.nextToken();
936 }
937 else
938 {
939 DPRINTF(0, "Command Parser: error parsing render flags\n");
940 return 0;
941 }
942 }
943
944 return flags;
945}

Callers 1

parseCommandMethod · 0.85

Calls 6

compareIgnoringCaseFunction · 0.85
unsetColorMethod · 0.80
nextTokenMethod · 0.80
getNameValueMethod · 0.80
setConstellationsMethod · 0.80
setColorMethod · 0.45

Tested by

no test coverage detected