ReportGridPage::ReportGridPage(wxWizard *parent, wxWizardPage *prev)
	: wxWizardPage(parent)
{
	wparent = (ddGenerationWizard *) parent;
	m_prev = prev;
	m_next = NULL;

	// A top-level sizer
	wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL );
	this->SetSizer(topSizer);

	// Add a message
	message = new wxStaticText(this, wxID_STATIC, _("Please check the choice for each table:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
	topSizer->Add(message);
	topSizer->AddSpacer(10);

	reportGrid = new wxDDGrid(this, DDTABSGRID);
	reportGrid->SetRowLabelSize(25);
	reportGrid->CreateGrid(wparent->page2->countSelTables(), 2);
	populateGrid();
	topSizer->Add(reportGrid, 1, wxEXPAND);

	// Add Event
	this->Connect(DDTABSGRID, wxEVT_GRID_CELL_LEFT_CLICK, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &ReportGridPage::OnCellLeftClick);
}
//--------------------------------------------------------------------------------
void DialogResourceGroups::OnCancelClick( wxCommandEvent& event )
{
    // Restore the internal state to what it was before we started playing
    m_resourceGroups = m_backupResourceGroups;

    // sync the grid ready for next time
    clearGroupsGrid();
    populateGrid();

    setDefaultGroup( m_backupDefaultGroupName );

    // wipe out backup info incase some strangeness happens
    m_backupResourceGroups.clear();
    m_backupDefaultGroupName.clear();

    event.Skip();
}
Example #3
0
int generateDungeon(gridCell_t*** gridPtr, room_t** roomsPtr) {
    int roomCount;
    unsigned int seed;
    seed = (unsigned int)time(NULL); //1453848819;
    srand(seed);
    printf("Seed: %d\n", seed);

    roomCount = MIN_ROOMS + (rand() % (MAX_ROOMS - MIN_ROOMS + 1));
    printf("Room count: %d\n", roomCount);

    if (!(*roomsPtr = malloc(sizeof(room_t) * roomCount))) {
        return -1;
    }

    for (int i = 0; i < roomCount; i++) {
        generateRoom(&(*roomsPtr)[i], *roomsPtr, i);
    }

    *gridPtr = populateGrid(*roomsPtr, roomCount);
    connectRooms(*gridPtr, *roomsPtr, roomCount);
    return roomCount;
}
Example #4
0
int generateDungeon(dungeon_t* dungeonPtr) {
    dungeonPtr->roomCount = MIN_ROOMS + (rand() % (MAX_ROOMS - MIN_ROOMS + 1));
    printf("Room count: %d\n", dungeonPtr->roomCount);

    if (!(dungeonPtr->rooms = malloc(sizeof(room_t) * dungeonPtr->roomCount))) {
        return -1;
    }

    for (int i = 0; i < dungeonPtr->roomCount; i++) {
        generateRoom(&dungeonPtr->rooms[i], dungeonPtr->rooms, i);
    }

    if (populateGrid(dungeonPtr)) {
        return -2;
    }
    connectRooms(dungeonPtr->grid, dungeonPtr->rooms, dungeonPtr->roomCount);

    initMonsters(dungeonPtr);
    turnInit(dungeonPtr);

    return 0;
}
Example #5
0
void Game::startGame()
{
   //Demarrer les threads
   for(int i = 0; i < nbPlayers_; i++)
      players_[i]->startPlayingAsync();

   populateGrid(10);
   //Condition pour continuer a jouer (genre s'il reste des cases cachees)
   while(remaining_ > 0)
      loop();

#ifndef NO_OUT
   system("cls");
   printGrille(*mirroir_);
#endif

   writeResults();


   //Liberer les joueurs, leur dire de rentrer au vestiaire prendre une douche
   for(int i = 0; i < nbPlayers_; i++)
   {
      //Dabord laisser une chance au thread de se terminer normalement
      SetEvent(events_[i]);
   }

   Sleep(1000); //Donner un delais max pour que les threads se terminent
   for(int i = 0; i < nbPlayers_; i++)
   {
      DWORD result = WaitForSingleObject( players_[i]->getThread(), 0);
      // Si le thread est encore actif, le tuer de maniere violente.
      if (result != WAIT_OBJECT_0) 
         players_[i]->stopPlaying();
   }

}