MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / execute

Method execute

plugins/dm.gui/gui/GuiScript.cpp:407–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407void GuiScript::execute()
408{
409 // Go back to the beginning
410 _ip = 0;
411
412 while (_ip < _statements.size())
413 {
414 const Statement& st = getStatement(_ip++);
415
416 switch (st.type)
417 {
418 case Statement::ST_NOP:
419 break;
420 case Statement::ST_JMP:
421 _ip = st.jmpDest;
422 break;
423 case Statement::ST_SET:
424 if (st.args.size() == 2)
425 {
426 // Try to find the target variable
427 VariablePtr var = getVariableFromExpression(st.args[0]);
428
429 if (!var)
430 {
431 rWarning() << "Cannot assign to variable " << st.args[0] << std::endl;
432 continue;
433 }
434
435 std::string value = getValueFromExpression(st.args[1]);
436
437 if (!var->assignValueFromString(value))
438 {
439 rWarning() << "Cannot assign value " << st.args[1] << " to variable " << st.args[1] << std::endl;
440 }
441 }
442 break;
443 case Statement::ST_TRANSITION:
444 break;
445 case Statement::ST_IF:
446 // Evaluate expression
447 if (!st._condition || st._condition->evaluate() == false)
448 {
449 // Expression evaluated to false, jump over the block
450 _ip = st.jmpDest;
451 }
452 break;
453 case Statement::ST_SET_FOCUS:
454 break;
455 case Statement::ST_ENDGAME:
456 break;
457 case Statement::ST_RESET_TIME:
458 break;
459 case Statement::ST_SHOW_CURSOR:
460 break;
461 case Statement::ST_RESET_CINEMATICS:
462 break;
463 case Statement::ST_LOCALSOUND:
464 break;

Callers 10

TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
test.pyFile · 0.45
clonePatchFunction · 0.45
distToEdgeFunction · 0.45
attemptGetVertsLineFunction · 0.45
executeFunction · 0.45
updateMethod · 0.45

Calls 4

rWarningFunction · 0.85
assignValueFromStringMethod · 0.80
sizeMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected