bool Semester::dropLine(Node *snode, Node *par, Course *course){ Node *temp = snode, *temp2 = par; std::vector<int> pos; bool dragtemp; while(temp != NULL){ if(!drageffect){ pos = checkDragEffect(temp); if(pos.size() != 0){ dropUpdate(temp2, temp, course); drageffect = false; return true; } } temp2 = temp; switch(temp->GetNodeType()){ case NODE_NORMAL: temp = temp->GetChild(); break; case NODE_SPLIT: dragtemp = drageffect; if(dropLine(temp->GetChild(1), temp, course)) return true; drageffect = dragtemp; temp = temp->GetChild(); break; case NODE_CHOICE: default: break; } } if(!drageffect){ if(temp2 != NULL && temp2 == par){ pos = checkUnder(temp2->GetX()+125, temp2->GetY() - 70); } else if(temp2 != NULL && temp2->GetNodeType() == NODE_SPLIT){ pos = checkUnder(temp2->GetX()-125, temp2->GetY() - 70); } else pos = checkUnder(temp2); if(pos.size() != 0){ dropUpdate(temp2, temp, course); return true; } } else drageffect = false; return false; }
bool Semester::drop(wxPoint dragpos, Course *course){ this->dragpos = dragpos; return dropLine(root, NULL, course); }
void PlayingField::dropLinesBetweenIndices(int startIndex, int endIndex) { for (int i = endIndex - 1; i >= startIndex; i--) { dropLine(i); } }