Exemplo n.º 1
0
bool SaveGridToFile(Grid& grid, const char* filename)
{
//	check whether one of the standard attachments is attached and call
//	SaveGrid with that attachment
	if(grid.has_vertex_attachment(aPosition))
		return SaveGrid(grid, NULL, filename, aPosition);
	if(grid.has_vertex_attachment(aPosition2))
		return SaveGrid(grid, NULL, filename, aPosition2);
	if(grid.has_vertex_attachment(aPosition1))
		return SaveGrid(grid, NULL, filename, aPosition1);
	return false;
}
Exemplo n.º 2
0
afx_msg void CTuConfigTUDlg::OnAdd()
{
	if(!SaveGrid())
		return;
	
	CTu tu;
	if(m_nProcType == PROT_MODBUS)
	{
		tu.TYPE_PRIBOR=1;
		tu.FUNCTION = 5;
	}
	if(m_nProcType == PROT_SPA)
	{		
		tu.FUNCTION = 2;
		tu.DATATU_ON = 1;
		tu.DATATU_OFF = 0;
	}
	if((m_nProcType == PROT_IEC101)||(m_nProcType == PROT_IEC104))
	{
		tu.TYPE_PRIBOR=2;			
		tu.FUNCTION = 45;
	}
	if(m_nProcType == PROT_IEC103)
	{
		tu.TYPE_PRIBOR=2;
		tu.FUNCTION = 20;
		tu.DATATU_OFF = 1;
		tu.DATATU_ON = 2;
	}	
	m_TuArray.Add(tu);
	UpdateGrid();
	m_Grid.EnsureVisible(m_Grid.GetRowCount()-1,0);
}
Exemplo n.º 3
0
afx_msg void CRetrConfigDlg::OnDel()
{	
	CCellID SelectedCell;
	CWordArray arGrigIndexes;	

	for(int m = 1; m < m_Grid.GetRowCount(); m++)
	{
		SelectedCell.row=m;
		SelectedCell.col=0;
		BOOL bRowSelected = FALSE;
		for(int s = 1; s < m_Grid.GetColumnCount(); s++)
		{
			if(m_Grid.GetItemState(SelectedCell.row,s) & GVIS_SELECTED)
			{
				bRowSelected=TRUE;
				break;
			}
		}
		if(bRowSelected)
		{			
			arGrigIndexes.Add(SelectedCell.row);								
		}
	}
	for(int j = 0; j < arGrigIndexes.GetSize();j++)
	{				
		m_Grid.DeleteRow(arGrigIndexes[j]);				
		m_Retr.m_ManyRetrArray.RemoveAt(arGrigIndexes[j]-1);				
		for(int v = j+1; v < arGrigIndexes.GetSize();v++)
		{
			arGrigIndexes[v]--;
		}
	}	
	SaveGrid();		
	UpdateGrid();
}
Exemplo n.º 4
0
void Cmd_SaveNodes_f (edict_t *ent)
{
	if (!ent->myskills.administrator)
		return;

	SaveGrid();

	safe_cprintf(ent, PRINT_HIGH, "Saving nodes...\n", numnodes);
}
Exemplo n.º 5
0
afx_msg void CRetrConfigDlg::OnAddDiapason()
{
	if(!SaveGrid())
		return;

	CAddDiapRetr dlg;
	dlg.m_Main_Set = m_Main_Set;
	dlg.m_Retr = m_Retr;
	if(dlg.DoModal()==IDOK)
	{
		m_Retr = dlg.m_Retr;
		UpdateGrid();
	}
}	
Exemplo n.º 6
0
afx_msg void CTuConfigTUDlg::OnDel()
{
	CCellID SelectedCell;
	CWordArray arGrigIndexes;	

	for(int m = 1; m < m_Grid.GetRowCount(); m++)
	{
		SelectedCell.row=m;
		SelectedCell.col=0;
		BOOL bRowSelected = FALSE;
		for(int s = 1; s < m_Grid.GetColumnCount(); s++)
		{
			if(m_Grid.GetItemState(SelectedCell.row,s) & GVIS_SELECTED)
			{
				bRowSelected=TRUE;
				break;
			}
		}
		if(bRowSelected)
		{			
			arGrigIndexes.Add(SelectedCell.row);								
		}
	}
	for(int j = 0; j < arGrigIndexes.GetSize();j++)
	{				
		m_Grid.DeleteRow(arGrigIndexes[j]);				
		m_TuArray.RemoveAt(arGrigIndexes[j]-1);				
		for(int v = j+1; v < arGrigIndexes.GetSize();v++)
		{
			arGrigIndexes[v]--;
		}
	}	
	/*CCellID pCell = m_Grid.GetFocusCell();
	
	if((pCell.row > 0)&&(pCell.col >= 0))
	{
		m_TuArray.RemoveAt(pCell.row-1);		
	}*/
	SaveGrid();	
	UpdateGrid();
}
Exemplo n.º 7
0
afx_msg void CRetrConfigDlg::OnAdd()
{
	if(!SaveGrid())
		return;
	ManyRetr ManyRetr1;
	if((m_Retr.m_ManyRetrArray.GetSize() == 0)||(m_Grid.GetFocusCell().row == m_Grid.GetRowCount()-1))
	{
		m_Retr.m_ManyRetrArray.Add(ManyRetr1);
		UpdateGrid();
		m_Grid.EnsureVisible(m_Grid.GetRowCount()-1,0);
	}
	else
	{
		if(m_Grid.GetFocusCell().row > 0)
		{
			m_Retr.m_ManyRetrArray.InsertAt(m_Grid.GetFocusCell().row,ManyRetr1);
			UpdateGrid();		
		}
	}
	
}
Exemplo n.º 8
0
void CreateGrid (qboolean force) {
// ====path stuff
//int i;
// ====path stuff
int x,y,z,cnt=0;
vec3_t v,endpt;
trace_t tr1,tr2;
float v0,v1,v2;

  vec3_t min1={0,0,0};  // width 6x6
  vec3_t max1={0,0,0};

  vec3_t min2={-16,-16,0};// width 32x32 (was 24x24)
  vec3_t max2={+16,+16,0};

    numnodes=0;

	if (!force && LoadGrid())
		return;

  for (x=0;x<maxx;x++) {
    v0=g2v0(x); // convert grid(x) to v[0]
    for (y=0;y<maxy;y++) {
      v1=g2v1(y); // convert grid(y) to v[1]
      for (z=maxz-1;z>=0;z--) {
        v2=g2v2(z); // convert grid(z) to v[2]
        //--------------------------------------
        VectorSet(v,v0,v1,v2);
        // Skip world locations in solid/lava/slime/window/ladder
        if (gi.pointcontents(v) & MASK_OPAQUE) { z--; continue; }
        //-----------------------------------------------
        // At this point,v(x,y,z) is a point in mid-air
        //-----------------------------------------------
        // Trace small bbox down to see what is below
        VectorSet(endpt,v[0],v[1],-8192);
        // Stop at world locations in solid/lava/slime/window/ladder
        tr1=gi.trace(v,min1,max1,endpt,NULL,MASK_OPAQUE);
        // Set for-loop index to our endpt's grid(z)
        z=gridz(tr1.endpos[2]);
        // Skip if trace endpt hit func entity.
        if (tr1.ent && (tr1.ent->use || tr1.ent->think || tr1.ent->blocked)) continue;
        // Skip if trace endpt hit lava/slime/window/ladder.
        if (tr1.contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WINDOW)) continue;
        // Skip if trace endpt hit non-walkable slope
        if (tr1.plane.normal[2]<0.7) continue;
        //----------------------------------------
        // Test vertical clearance above v(x,y,z)
        //----------------------------------------
        VectorCopy(tr1.endpos,endpt);
        //tr1.endpos[2]+=2; // set start just above surface
        endpt[2]+=32;     // endpt at approx crouch height
        tr2=gi.trace(endpt,min2,max2,tr1.endpos,NULL,MASK_OPAQUE);//GHz - push down instead of up
        // Skip if not reachable by crouched bbox - trace incomplete?
       // if (tr2.fraction != 1.0) continue;
        // Skip if linewidth inside solid - too close to adjoining surface?
		if (tr2.startsolid || tr2.allsolid) continue;

		// GHz: check final position to see if it intersects with a solid
		tr1=gi.trace(tr2.endpos,min2,max2,tr2.endpos,NULL,MASK_OPAQUE);
		if (tr1.fraction != 1.0 || tr1.startsolid || tr1.allsolid)
			continue;
		if (!CheckBottom(tr2.endpos, min2, max2))
			continue;

		VectorCopy(tr2.endpos, endpt);//GHz
		endpt[2]+=32;//GHz
		//if (tr2.allsolid) continue;
        //-------------------------------------
        // Now, adjust downward for uniformity
        //-------------------------------------
       // AdjustDownward(NULL,endpt);
        // Houston,we have a valid node!
		if (NearbyGridNode(endpt, cnt))
			continue;//GHz
        VectorCopy(endpt,pathnode[cnt]); // copy to pathnode[] array
        cnt++; } } }

  numnodes=cnt;
  CullGrid();

  gi.dprintf("%d Nodes Created\n",numnodes);

//=====================================================
//================== pathfinding stuff ================
//=====================================================
/*
  // allocate memory for node array
  node = (node_t *) V_Malloc(numnodes*sizeof(node_t), TAG_LEVEL);

  // copy all the pathnode stuff to new node array
  for (i=0;i<numnodes;i++)
  {
	  VectorCopy(pathnode[i], node[i].origin);
	  node[i].nodenum = i;
  }
*/

  if (!force)
	SaveGrid();
}
Exemplo n.º 9
0
bool SaveGridToFile(Grid& grid, const char* filename, TAPos& aPos)
{
	return SaveGrid(grid, NULL, filename, aPos);
}
Exemplo n.º 10
0
bool SaveGridToFile(Grid& grid, ISubsetHandler& sh,
					const char* filename, TAPos& aPos)
{
	return SaveGrid(grid, &sh, filename, aPos);
}
Exemplo n.º 11
0
void CTuConfigTUDlg::OnOK()
{
	if(SaveGrid())
		CDialog::OnOK();
	
}
Exemplo n.º 12
0
void CRetrConfigDlg::OnOK()
{
	if(SaveGrid())
		CDialog::OnOK();
}