예제 #1
0
파일: ogamhall.cpp 프로젝트: 112212/7k2
//------ Begin of function GameFileArray::add_hall_of_fame -----//
//
// Add current game into the hall of hame
//
// <int> totalScore of the player.
//
// <int> type = 0 when human
//				  = 1 when frythan	
//
// return : <int> 1-hall of fame updated
//                0-not updated
//
int GameFileArray::add_hall_of_fame(int totalScore, int type)
{
   //-------- insert the record -----------//

   int i;

   for( i=0 ; i<HALL_FAME_NUM ; i++ )
   {
      if( totalScore > hall_fame_array[type][i].score )
      {
         //---------- move and insert the data --------//

         if( i < HALL_FAME_NUM-1 )      // it is not the last record
         {
				// ###### begin Gilbert 13/4 ########//
				memmove( &hall_fame_array[type][i+1], &hall_fame_array[type][i],
					sizeof(HallFame) * (HALL_FAME_NUM-i-1) );
				// ###### end Gilbert 13/4 ########//
         }

         //-------- record the hall of fame rcord ------//

         hall_fame_array[type][i].record_data(totalScore);

         //--------- display the hall of fame ----------//

		   write_hall_of_fame();        // must write hall of fame, because it also write the last saved game slot no.

         disp_hall_of_fame(type);
         return 1;
      }
   }

   return 0;
}
예제 #2
0
파일: OGFILEA.cpp 프로젝트: cleeus/7kaa
void GameFileArray::deinit()
{
	//-- Need to save hall of fame, because it contains last loaded/saved game --//
	write_hall_of_fame();
}