public bool push(LDPOINT p) //Pushes p onto the pile. Returns true if unsuccesful, false otherwise. { if (numItems < (MAXPILE - 1)) { items[numItems++] = p; return(false); } else { Console.WriteLine("MAXIMUM PILE SPACE EXCEEDED!."); return(true); } }
public LDPOINT pull() //Pulls p off of the pile. { LDPOINT p = new LDPOINT(); int pos = (int)(Landis.Extension.Succession.Landispro.system1.frand() * (float)numItems); if (pos < 0 || pos >= numItems) { pos = 0; } p = items[pos]; for (int i = pos; i < numItems - 1; i++) { items[i] = items[i + 1]; } numItems--; return(p); }
public LDPOINT return_a_point_from_index(int index, int cellNo) { if (cellNo > FireRegimeUnitsList[index].Count) { Console.Write("Fire index error -"); Console.Write(index); Console.WriteLine(); throw new Exception("Fire index error, contact development team"); } cellNo--; LDPOINT p = FireRegimeUnitsList[index][cellNo]; //std::vector<LDPOINT>::iterator sitePtr; //sitePtr = FireRegimeUnitsList[index].begin(); //FireRegimeUnitsList[index].erase(sitePtr + cellNo); FireRegimeUnitsList[index].RemoveAt(cellNo); FireRegimeCurrentIndex[index] = (FireRegimeCurrentIndex[index] + 1) % 70000; return(p); }
public void create_FireRegimeUnitsListByIndex() { int i = 0; int j = 0; int x; int max_FRUIndex = 0; for (i = 1; i <= m_iRows; i++) { for (j = 1; j <= m_iCols; j++) { x = (i - 1) * m_iCols; x = x + j - 1; LDPOINT p = new LDPOINT(j, i); FireRegimeUnitsList[map[x].FRUIndex].Add(p); } } for (i = 0; i < 70000; i++) { FireRegimeCurrentIndex[i] = 0; } }
public bool IsEqual(LDPOINT right) { return((x == right.x) && (y == right.y)); }