Logo Search packages:      
Sourcecode: mathwar version File versions  Download package

gint update_player_stats ( player_object player,
gint  score,
gboolean  is_bonus 

Update the player's stats. This function should be called any time the player makes a guess, or gets bonus points.

update_player_stats (player_object *player, gint score, gboolean is_bonus)

player The player whose stats need to be adjusted.
score The amount to change the player's score by. If this value is non-zero, and is_bonus is FALSE, this function will assume that the user made a correct guess.
is_bonus This value should be FALSE if the call is due to the result of a player guess, and TRUE if the call is the result of adding bonus points.
The new score for the player.

Definition at line 97 of file player.c.

References COMPUTER, and HUMAN.

   g_return_val_if_fail (player != NULL, 0);
   g_return_val_if_fail (player->name != NULL, 0);
      (player->type == HUMAN || player->type == COMPUTER, 0);

   player->score += score;

   if (is_bonus)
      player->bonus += score;
      if (score > 0)

   return player->score;

Generated by  Doxygen 1.6.0   Back to index