Exemplo n.º 1
0
void createLevelClocks()	{
		addClock(singleEnemyCreated);
		addClock(lastCmdAction);
		addClock(groupDelay);
		addClock(killAll);
		addClock(killSingle);
}
void testClocks()	{
    sput_fail_unless(addClock(testClock) == 1,"Valid: Adding Dummy Test Clock");
    sput_fail_unless(checkUniqueClockType(testClock) == 0,"Invalid: Unique clock checker.  Clocck should already exist");
    sput_fail_unless(addClock(testClock) == 0,"Invalid: Adding non unique Dummy clock");
    sput_fail_unless(checkClock(testClock,10) == 0,"Invalid: Cooldown of 10 has not passed");
    delayGame(10);
    sput_fail_unless(checkClock(testClock,10) == 1,"Valid: Cooldown of 10 has passed");
    sput_fail_unless(checkClock(testClock,10) == 0,"Invalid: Cooldown of 10 hasn't passed after reset of cooldown");
    delayGame(10);
    sput_fail_unless(checkClock(testClock,10) == 1,"Valid: Cooldown of 10 has passed after reset of cooldown");

}
Exemplo n.º 3
0
void ZoneClockPanel::load(TDEConfig *config)
{
  _clocks.clear();

  int num = config->readNumEntry("Clocks", 0);

  for (int i=0; i<num; ++i)
    {
      addClock(config->readEntry(TQString("Clock_%1_Zone").arg(i)), config->readEntry(TQString("Clock_%1_Name").arg(i)));
    }
}
Exemplo n.º 4
0
void ZoneClockPanel::addClock(const TQString &zone)
{
  createDialog();

  _dlg->ClockCaption->setText(i18n(zone.utf8()).section('/', -1));
  for (int i=0; i<_dlg->ClockZone->count(); ++i)
    if (_dlg->ClockZone->text(i) == i18n(zone.utf8()))
      {
        _dlg->ClockZone->setCurrentItem(i);
        break;
      }

  if (_dlg->exec() == TQDialog::Accepted)
    {
      CityList cities;
      TQStringList timezones = cities.timezones();
      TQString newzone = timezones[_dlg->ClockZone->currentItem()];
      addClock(newzone, _dlg->ClockCaption->text());
      update();
    }
}
Exemplo n.º 5
0
void ZoneClock::slotAddClock()
{
  emit addClock(_zone);
}
void createLevelClocks()	{
		addClock(singleEnemyCreated);
		printf("first clock\n");
		addClock(lastCmdAction);
		addClock(groupDelay);
}
/***********************************************************
synopsis: do all of the initialisation for a new game:
          build the screen
	  get a random word and generate anagrams
	  (must get less than 66 anagrams to display on screen)
	  initialise all the game control flags

inputs: head - first node in the answers list (in/out)
        dblHead - first node in the dictionary list
	screen - the SDL_Surface to display the image
	letters - first node in the letter sprites (in/out)

outputs: n/a
***********************************************************/
static void
newGame(struct node** head, struct dlb_node* dlbHead, 
        SDL_Surface* screen, struct sprite** letters)
{
    char guess[9];
    char remain[9];
    int happy = 0;   /* we don't want any more than ones with 66 answers */
                     /* - that's all we can show... */
    int i;

	/* show background */
	strcpy(txt, language);
	ShowBMP(strcat(txt,"images/background.bmp"),screen, 0,0);

	destroyLetters(letters);
    assert(*letters == NULL);

	while (!happy) {
        char buffer[9];
        getRandomWord(buffer, sizeof(buffer));
		strcpy(guess,"");
		strcpy(rootWord, buffer);
		bigWordLen = strlen(rootWord)-1;
		strcpy(remain, rootWord);

		rootWord[bigWordLen] = '\0';

		/* destroy answers list */
		destroyAnswers(head);

		/* generate anagrams from random word */
		ag(head, dlbHead, guess, remain);

		answersSought = Length(*head);
		happy = ((answersSought <= 77) && (answersSought >= 6));

#ifdef DEBUG
		if (!happy) {
			Debug("Too Many Answers!  word: %s, answers: %i",
                   rootWord, answersSought);
		}
#endif
	}

#ifdef DEBUG
    Debug("Selected word: %s, answers: %i", rootWord, answersSought);
#endif

    /* now we have a good set of words - sort them alphabetically */
    sort(head);

	for (i = bigWordLen; i < 7; i++){
		remain[i] = SPACE_CHAR;
	}
	remain[7] = '\0';
	remain[bigWordLen]='\0';

	shuffleWord(remain);
	strcpy(shuffle, remain);

	strcpy(answer, SPACE_FILLED_STRING);

	/* build up the letter sprites */
    assert(*letters == NULL && screen != NULL);
	buildLetters(letters, screen);
	addClock(letters, screen);
	addScore(letters, screen);

	/* display all answer boxes */
	displayAnswerBoxes(*head, screen);

	gotBigWord = 0;
	score = 0;
	updateTheScore = 1;
	gamePaused = 0;
	winGame = 0;
	answersGot = 0;

	gameStart = time(0);
	gameTime = 0;
	stopTheClock = 0;
}