Example #1
0
/* Display current player and refresh dice/display */
void
DisplayCurrentPlayerRefreshDice(void) {
  DisplayCurrentPlayer();
  UpdateAllDicePixmaps ();
  DeselectAllDice ();
  UpdateRollLabel();
}
Example #2
0
File: yahtzee.c Project: GNOME/tali
void
RollSelectedDice (void)
{
  int i, cnt = 0;

  if (NumberOfRolls >= NUM_ROLLS) {
    return;
  }

  for (i = 0; i < NUMBER_OF_DICE; i++) {
    if (DiceValues[i].sel) {
      DiceValues[i].val = RollDie ();
      DiceValues[i].sel = 0;
      cnt++;
      lastRoll.DiceValues[i] = DiceValues[i].val;
    }
  }

  /* If no dice is selcted roll them all */
  if (cnt == 0) {
    for (i = 0; i < NUMBER_OF_DICE; i++) {
      DiceValues[i].val = RollDie ();
      lastRoll.DiceValues[i] = DiceValues[i].val;
    }
  }

  UpdateAllDicePixmaps ();
  DeselectAllDice ();

  NumberOfRolls++;

  if (NumberOfRolls >= NUM_ROLLS) {
    say (_("Choose a score slot."));
  }

  lastRoll.roll = NumberOfRolls;
  lastRoll.player = CurrentPlayer;
}