Example #1
0
	void DoAll() {
		VertexList.Reset();
		for (int i = 0; i < ministryCount; i++) {
			DFS(VertexList.Current(), VertexList.Current());
			VertexList.Next();
		}
		VertexList.Reset();
		while (Vertex* C = VertexList.Current()) {
			if (!C->Visited) {	//Ja virsotne nav tikusi apmeklēta, tai nav ministrijas
				Error* E2 = new Error(C->ID);
				E2List.AddSort(E2);
			}
			if (C->Difference > 0) {
				Error_4* E4 = new Error_4(C->ID, C->Difference);
				E4List.AddSort(E4);
			}
			if (C->TaggedBy.Size() > 1) { //Ja virsotni apmeklējusi vairāk kā viena ministrija, ir kopīga pozīcija
				VertexPointer* vp = new VertexPointer(C);
				CPList.AddSort(vp);
			}
			VertexList.Next();
		}
		VertexList.Reset();
	}
Example #2
0
int GWindow::WillAccept(List<char> &Formats, GdcPt2 Pt, int KeyState)
{
	int Status = DROPEFFECT_NONE;
	
	for (char *f=Formats.First(); f; )
	{
		if (stricmp(f, LGI_FileDropFormat) == 0)
		{
			f = Formats.Next();
			Status = DROPEFFECT_COPY;
		}
		else
		{
			Formats.Delete(f);
			DeleteArray(f);
			f = Formats.Current();
		}
	}
	
	return Status;
}
Example #3
0
	void AddVertex(int parent, int child, unsigned int amount) {
		VertexList.Reset();
		Vertex* NewSub = new Vertex(child, amount);
		Vertex* ParentV = NULL;
		Vertex* ChildV = NULL;
		VertexPointer* ParentToSub;
		bool SubIsNew = true;
		while(Vertex* C = VertexList.Current()) {
			if(C->ID == child) { SubIsNew = false; ChildV = C; if(ParentV) break; } //Atrod pozīciju un apakšpozīciju, ja tādas eksistē
			if(C->ID == parent) { ParentV = C; if(!SubIsNew) break; }
			VertexList.Next();
		}
		VertexList.Reset();
		if(ParentV) {
			if(SubIsNew) ParentToSub = new VertexPointer(NewSub); //Norāde uz apakšpozīciju
			else {
				ParentToSub = new VertexPointer(ChildV);
				if(ChildV->Amount == 4000000100) ChildV->Amount = amount; //Apakšpozīcija iepriekš bija bez virspozīcijas
			}
			if (ParentV->Subs.FindInVP(child)) return; //Ja apakšpozīcija jau ir pievienota, to ignorē
			ParentV->Subs.Add(ParentToSub); //Pievieno apakšpozīciju dotajai virspozīcijai
			if(SubIsNew) VertexList.Add(NewSub); //Pievieno apakšpozīciju virsotņu sarakstam (ja tā ir jauna)
		} else {
			ParentV = new Vertex(parent, 4000000100); //Norāda, ka pozīcijai nav virspozīcijas (neattiecas uz ministrijām)
			if(SubIsNew) ParentToSub = new VertexPointer(NewSub);
			else {
				ParentToSub = new VertexPointer(ChildV);
				ChildV->Amount = amount; //Tā kā, ja pievieno jau eksistējošu apakšpozīciju, Amount nemainās, to var piešķirt. 
			}
			ParentV->Subs.Add(ParentToSub);
			VertexList.Add(ParentV);
			if(SubIsNew) VertexList.Add(NewSub);
		}
		if (child <= ministryCount) {
			Error* e1 = new Error(child); //Mēģina pievienot ministriju kā apakšpozīciju
			E1List.AddSort(e1);
		}
	}