MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / WriteConditionalStatement

Method WriteConditionalStatement

editor/DallasMainDlg.cpp:10579–10628  ·  view source on GitHub ↗

Writes out a conditional statement

Source from the content-addressed store, hash-verified

10577
10578// Writes out a conditional statement
10579void CDallasMainDlg::WriteConditionalStatement(HTREEITEM condition_node) {
10580 tTreeNodeData *data;
10581 HTREEITEM child_node;
10582
10583 if (CurrentOutputFile == NULL || condition_node == NULL)
10584 return;
10585
10586 data = (tTreeNodeData *)m_ScriptTree.GetItemData(condition_node);
10587 if (data == NULL || data->type != CONDITIONAL_STATEMENT_NODE)
10588 return;
10589
10590 // If it's an ALWAYS statement, just write out a 1 and get outta here
10591 if (data->ID == ALWAYS_STATEMENT) {
10592 cfprintf(CurrentOutputFile, "1");
10593 return;
10594 }
10595
10596 // Get the first child (literal or query)
10597 child_node = m_ScriptTree.GetChildItem(condition_node);
10598 if (child_node != NULL) {
10599 WriteFunctionParameter(child_node);
10600 } else {
10601 cfprintf(CurrentOutputFile, "???");
10602 }
10603
10604 // Get the second child (expression operator)
10605 if (child_node != NULL) {
10606 child_node = m_ScriptTree.GetNextSiblingItem(child_node);
10607 if (child_node != NULL) {
10608 tTreeNodeData *child_data;
10609 child_data = (tTreeNodeData *)m_ScriptTree.GetItemData(child_node);
10610 if (child_data != NULL && child_data->type == EXPRESSION_OPERATOR_NODE) {
10611 cfprintf(CurrentOutputFile, "%s", GetExpressionOperatorCodeName(child_data->subID));
10612 } else
10613 cfprintf(CurrentOutputFile, "/* Exp Op Error */");
10614 } else {
10615 cfprintf(CurrentOutputFile, "/* Exp Op Missing */");
10616 }
10617 }
10618
10619 // If it's a comparison, get the third child (literal or query)
10620 if (child_node != NULL && data->ID == COMPARISON_STATEMENT) {
10621 child_node = m_ScriptTree.GetNextSiblingItem(child_node);
10622 if (child_node != NULL) {
10623 WriteFunctionParameter(child_node);
10624 } else {
10625 cfprintf(CurrentOutputFile, "/* 2nd Comparison Value Missing */");
10626 }
10627 }
10628}
10629
10630// Writes out a query function call
10631void CDallasMainDlg::WriteQueryFunctionCall(HTREEITEM query_node) {

Callers

nothing calls this directly

Calls 1

cfprintfFunction · 0.85

Tested by

no test coverage detected