[Igarden-commit] Garden/source/PlanTool WritablePlanView.cpp, 1.23, 1.23.2.1
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2007-01-06 15:49:59
|
Update of /cvsroot/igarden/Garden/source/PlanTool In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25234 Modified Files: Tag: Release_branch_v1 WritablePlanView.cpp Log Message: Allow adding backgrounds dropping within the radius of plants Index: WritablePlanView.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/PlanTool/WritablePlanView.cpp,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -C2 -d -r1.23 -r1.23.2.1 *** WritablePlanView.cpp 12 Sep 2005 11:52:16 -0000 1.23 --- WritablePlanView.cpp 6 Jan 2007 15:49:51 -0000 1.23.2.1 *************** *** 332,367 **** Path *path; bool placeInElem = false; // Assume false, prove otherwise XGDynArray<Element*> results; if(plot->GetElementsAtPoint(destPoint, this, results)) - elem = results[0]; - if(elem != NULL) { ! pathElem = dynamic_cast<PathElement*>(elem); ! if(pathElem != NULL) { ! path = pathElem->GetPathIfPresent(); ! if(path != NULL) { ! if(path->IsPathFillPossible()) { ! bgAction = new PlanBackgroundAction(plot, this, path, kUndoSetBackground); ! MEMCHECK(bgAction); ! bgAction->SetBackground(copiedItem); ! _planUndoer->PostAction(bgAction); ! ! if(copiedItem->GetMaterialType() == kMaterialTypeMulch) { ! long depth; ! ! copiedItem->GetInt32(kPlantHeight, &depth); ! path->SetBackdropDepth(depth); } - placeInElem = true; } - else - XGBeep(); } } } else // Set the background only if not on an element --- 332,378 ---- Path *path; bool placeInElem = false; // Assume false, prove otherwise + bool foundPath = false; // Assume false, prove otherwise XGDynArray<Element*> results; if(plot->GetElementsAtPoint(destPoint, this, results)) { ! long i, elemCount; ! ! elemCount = results.Length(); ! for(i = 0; i < elemCount; i++) { ! elem = results[i]; ! if(elem != NULL) { ! pathElem = dynamic_cast<PathElement*>(elem); ! if(pathElem != NULL) { ! path = pathElem->GetPathIfPresent(); ! if(path != NULL) { ! foundPath = true; ! if(path->IsPathFillPossible()) ! { ! bgAction = new PlanBackgroundAction(plot, this, path, kUndoSetBackground); ! MEMCHECK(bgAction); ! bgAction->SetBackground(copiedItem); ! _planUndoer->PostAction(bgAction); ! ! if(copiedItem->GetMaterialType() == kMaterialTypeMulch) ! { ! long depth; ! ! copiedItem->GetInt32(kPlantHeight, &depth); ! path->SetBackdropDepth(depth); ! } ! placeInElem = true; ! break; ! } } } } } + if(foundPath && !placeInElem) + XGBeep(); } else // Set the background only if not on an element |