MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / read

Method read

src/bzfs/CustomDynamicColor.cpp:48–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46//============================================================================//
47
48bool CustomDynamicColor::read(const char* cmd, std::istream& input) {
49 if (strcasecmp("varName", cmd) == 0) {
50 std::string varName;
51 if (!(input >> varName)) {
52 std::cout << "missing variable name" << std::endl;
53 return false;
54 }
55 dyncol->setVariableName(varName);
56 }
57 else if (strcasecmp("varTime", cmd) == 0) {
58 float varTime;
59 if (!(input >> varTime)) {
60 std::cout << "missing variable timing" << std::endl;
61 return false;
62 }
63 dyncol->setVariableTiming(varTime);
64 }
65 else if (strcasecmp("varNoAlpha", cmd) == 0) {
66 dyncol->setVariableNoAlpha(true);
67 }
68 else if (strcasecmp("delay", cmd) == 0) {
69 float delay;
70 if (!(input >> delay)) {
71 std::cout << "bad dyncol delay" << std::endl;
72 }
73 dyncol->setDelay(delay);
74 }
75 else if (strcasecmp("ramp", cmd) == 0) {
76 float duration;
77 if (!(input >> duration)) {
78 std::cout << "bad dyncol ramp duration" << std::endl;
79 return false;
80 }
81 fvec4 color;
82 if (!parseColorStream(input, color)) {
83 std::cout << "bad dyncol ramp color" << std::endl;
84 return false;
85 }
86 dyncol->addState(duration, color);
87 }
88 else if (strcasecmp("level", cmd) == 0) {
89 float duration;
90 if (!(input >> duration)) {
91 std::cout << "bad dyncol level duration" << std::endl;
92 return false;
93 }
94 fvec4 color;
95 if (!parseColorStream(input, color)) {
96 std::cout << "bad dyncol level color" << std::endl;
97 return false;
98 }
99 dyncol->addState(duration, color);
100 dyncol->addState(0.0f, color);
101 }
102 else if (strcasecmp("color", cmd) == 0) {
103 fvec4 color;
104 if (!parseColorStream(input, color)) {
105 std::cout << "bad dyncol color" << std::endl;

Callers

nothing calls this directly

Calls 8

parseColorStreamFunction · 0.85
setVariableNameMethod · 0.80
setVariableTimingMethod · 0.80
setVariableNoAlphaMethod · 0.80
setDelayMethod · 0.80
addStateMethod · 0.80
clearStatesMethod · 0.80
setTeamMaskMethod · 0.80

Tested by

no test coverage detected