Exemplo n.º 1
0
void CSVReader::ReloadValues()
{
	semTake(m_lock,WAIT_FOREVER);
	m_map.clear();
	FillMap();
	semGive(m_lock);
}
Exemplo n.º 2
0
CSVReader::CSVReader(const std::string& filePath)
: m_filePath(filePath), m_map()
{
	m_lock=semMCreate(SEM_Q_PRIORITY |
					 SEM_DELETE_SAFE |
					 SEM_INVERSION_SAFE);
	FillMap();
}
Exemplo n.º 3
0
CPathFinder::CPathFinder(CChar *pChar, CPointMap ptTarget)
{
	ADDTOCALLSTACK("CPathFinder::CPathFinder");
	EXC_TRY("CPathFinder Constructor");

	CPointMap pt;

	m_pChar = pChar;
	m_Target = ptTarget;

	pt = m_pChar->GetTopPoint();
	m_RealX = pt.m_x - (PATH_SIZE / 2);
	m_RealY = pt.m_y - (PATH_SIZE / 2);
	m_Target.m_x -= m_RealX;
	m_Target.m_y -= m_RealY;

	EXC_SET("FillMap");

	FillMap();

	EXC_CATCH;
}
Exemplo n.º 4
0
Map::Map()
{
	if (!font.loadFromFile("media/Consolas.ttf"))
		throw DataNotLoaded("Nie znaleziono czcionki");
	text[0].setFont(font);
	CreateMapFile("media/map.txt", "media/map3.txt");
	FillMap("media/map3.txt", "media/Tileset.png");
	getObjStatus("media/map3.txt");
	player[0] = new Player(1, 1, "media/Player1.png");
	player[1] = new Player(13, 11, "media/Player2.png");
	UpdateTime = clock();
	UpdateTime2 = clock();
	text[0].setFont(font);	
	text[0].setPosition(30.f, 420.f);
	text[0].setColor(sf::Color::Black);
	text[1].setFont(font);
	text[1].setPosition(30.f, 445.f);
	text[1].setColor(sf::Color::Black);
	text[2].setFont(font);
	text[2].setPosition(300.f, 480.f);
	text[2].setColor(sf::Color::Red);
	text[2].setString("Main menu");
}
//===========================================================================
//function : Init
//purpose  : 
//===========================================================================
void NMTDS_ShapesDataStructure::Init()
{
  Standard_Integer i, j, aNbSx, aNbS, aShift, aNbRanges;
  Standard_Integer iFirst, iLast;
  NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors aLx;
  NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors aLit;
  TopoDS_Iterator anIt;
  BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMSA;
  //
  anIt.Initialize(myCompositeShape);
  for (; anIt.More(); anIt.Next()) {
    const TopoDS_Shape& aSx=anIt.Value(); 
    BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMS;
    //
    if (!aMSA.Contains(aSx)) {
      FillMap(aSx, aMSA, aMS);
      aLx.Append(aMS);
    }
  }
  aNbS=aMSA.Extent(); 
  //
  // Fill myRanges
  i=aLx.Extent();
  myRanges.Resize(i);
  aLit.Initialize(aLx);
  for (i=1; aLit.More(); aLit.Next(), ++i) {
    const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSx=aLit.Value();
    aNbSx=aMSx.Extent();
    if (i==1) {
      iFirst=1;
      iLast=aNbSx;
      myRanges(i).SetFirst(iFirst);
      myRanges(i).SetLast(iLast);
      continue;
    }
    iFirst=myRanges(i-1).Last()+1;
    iLast=iFirst+aNbSx-1;
    myRanges(i).SetFirst(iFirst);
    myRanges(i).SetLast(iLast);
  }
  //
  myNumberOfShapesOfTheObject=aNbS;
  myNumberOfShapesOfTheTool=0;
  myLength=2*aNbS;
  //
  // Allocate the whole Table
  myListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences)
    Standard::Allocate(myLength*sizeof(BooleanOperations_ShapeAndInterferences));
  //
  // Fill the table
  
  aShift=0;
  for (j=1; j<=aNbS; ++j) {
    const TopoDS_Shape& aSx=aMSA.FindKey(j);
    const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aASx=aMSA.FindFromIndex(j);
    InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift);
  }
  // myShapeIndexMap
  myShapeIndexMap.Clear();
  //
  //modified by NIZNHY-PKV Mon Dec 12 09:01:53 2011f
  aNbRanges=myRanges.Extent();
  for (i=1; i<=aNbRanges; ++i){
    const NMTDS_IndexRange& aR=myRanges(i);
    iFirst=aR.First();
    iLast =aR.Last();
    for (j=iFirst; j<=iLast; ++j) { 
      const TopoDS_Shape& aS=Shape(j);
      myShapeIndexMap.Bind(aS, j);
    }
  }
  //modified by NIZNHY-PKV Mon Dec 12 09:02:00 2011t
  //
  // myRefEdges
  iLast=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool;
  myRefEdges.Resize(iLast);

  for (i=1; i<=iLast; ++i) {
    const TopoDS_Shape& aS=Shape(i);
    myRefEdges(i)=0;
    if (aS.ShapeType()==TopAbs_EDGE) {
      myNbEdges++;
      myRefEdges(i)=myNbEdges;
    }
  }
}
Exemplo n.º 6
0
void MapEditor()
{
	int key;
	clear();
	ShowEditorWindow();

	editing_terrain=FALSE;
	FillMap();
	editing_terrain=TRUE;
	FillMap();

	LoadLevel();
	ShowEditorMap();
	ShowEditorWindow();

	mouse_on(ALL_MOUSE_EVENTS);
	nodelay(stdscr,TRUE);
	cbreak();	

	for(;;)
	{
		key=getch(); 
		request_mouse_pos();
		if (mouse_active && (MOUSE_X_POS!=cursor_x || MOUSE_Y_POS!=cursor_y))
		{
			curs_set(0);
			EditorMoveCursor(MOUSE_X_POS,MOUSE_Y_POS);
			curs_set(2);
		}
		switch(key)
		{

		case KEY_F0+1:
			editing_terrain=TRUE;
			ShowEditorWindow();
			break;
		case KEY_F0+2:
			editing_terrain=FALSE;
			ShowEditorWindow();
			break;
		case KEY_F0+5:
			clear();
			PlayLevel();

			ClearAfterPlaying();
			ShowEditorWindow();

			mouse_on(ALL_MOUSE_EVENTS);
			nodelay(stdscr,TRUE);
			cbreak();	
			break;
		case KEY_F0+8:
			SaveLevel();
			break;
		case KEY_F0+9:
			LoadLevel();
			ShowEditorMap();
			ShowEditorWindow();
			break;
		case KEY_F0+12:
			FillMap();
			break;
		case KEY_MOVE_LEFT:
			EditorMoveCursor(cursor_x-1,cursor_y);
			break;
		case KEY_MOVE_RIGHT:
			EditorMoveCursor(cursor_x+1,cursor_y);
			break;
		case KEY_MOVE_UP:
			EditorMoveCursor(cursor_x,cursor_y-1);
			break;
		case KEY_MOVE_DOWN:
			EditorMoveCursor(cursor_x,cursor_y+1);
			break;
		case KEY_MOUSE:
		case KEY_ACTION:
			curs_set(0);
			EditorAction();
			move(cursor_y,cursor_x);
			curs_set(2);
		}
	}
}