示例#1
0
//################################################################################################################################
//--------------------------------------------------------------------------------------------------------------------------------
//函数名称:CLevel21_Sure()
//--------------------------------------------------------------------------------------------------------------------------------
//函数功能:确认键的第二层第二个任务
//--------------------------------------------------------------------------------------------------------------------------------
//输入参数:	tmp为第几个按键的值
//--------------------------------------------------------------------------------------------------------------------------------
//输出参数:	null
//--------------------------------------------------------------------------------------------------------------------------------
//说   明:
//--------------------------------------------------------------------------------------------------------------------------------
//################################################################################################################################
void CLevel22_Sure(uint8 tmp)
{
	uint8 num,address,type,alarmtype,row;
	PCF8563_DATE TimeAndDate;
	switch(tmp)
	{
		case 1:
			SetLocalDepSum(GetSendToF(1));
			if(GetLocalDepSum()>DEPART)
				SetLocalDepSum(0);
			ClearScreen(0);	
			SysCheck_Menu(GetLocalDepSum(),GetCompSum(),GetSysCheckDep(),0);
// 			SysCheck_Menu(GetLocalDepSum(),GetSumRegNum(),GetSysCheckDep(),0);
			break;
		case 2:
			ClearScreen(0);
			CompStat_Menu(GetStatusDep(),GetStatusComp(),0,0,0,1);
			break;
		case 3:
			ClearScreen(0);
			ClrHisCountDown();
			ClrHistCount();
			num=GetHistoryList((GetHistConter()-1),0);//M25P80_Read_1Byte(0x40000);
			address=GetPSNFormFlash(num,7);
			type=GetHistoryList((GetHistConter()-1),1);//M25P80_Read_1Byte(0x40001);
			alarmtype=GetHistoryList((GetHistConter()-1),3);//M25P80_Read_1Byte(0x40003);
			row=GetHistoryList((GetHistConter()-1),11);//M25P80_Read_1Byte(0x40011);
			TimeAndDate.year=(GetHistoryList((GetHistConter()-1),4)<<8)+GetHistoryList((GetHistConter()-1),5);//(M25P80_Read_1Byte(0x40004)<<8)+M25P80_Read_1Byte(0x40005);
			TimeAndDate.month=GetHistoryList((GetHistConter()-1),6);//M25P80_Read_1Byte(0x40006);
			TimeAndDate.day=GetHistoryList((GetHistConter()-1),7);//M25P80_Read_1Byte(0x40007);
			TimeAndDate.hour=GetHistoryList((GetHistConter()-1),8);//M25P80_Read_1Byte(0x40008);
			TimeAndDate.minute=GetHistoryList((GetHistConter()-1),9);//M25P80_Read_1Byte(0x40009);
			TimeAndDate.second=GetHistoryList((GetHistConter()-1),10);//M25P80_Read_1Byte(0x40010);
// 			row =  GetAnnRow(GetPSNFormFlash(row,4),GetPSNFormFlash(row,5));
			History_Menu(num,address,type,alarmtype,row,TimeAndDate);//第一个报警的序号
			break;
		default:break;
	}
}
    //
    // Undo
    //
    // Undo operation
    //
    void Objects::Undo()
    {
      // Process each object
      for (NList<Data>::Iterator i(&dataList); *i; i++)
      {
        Data *d = *i;

        switch (op)
        {
          // Delete objects that were created
          case OP_CREATE:
            if (d->object.Alive())
            {
              GameObjCtrl::MarkForDeletion(d->object);
            }
            break;

          // Create objects that were deleted
          case OP_DELETE:
          {
            MapObj *m = MapObjCtrl::ObjectNewOnMap(d->type, d->matrix, 0, d->zipped);

            // Restore zipping
            if (d->zipped)
            {
              m->ToggleFootPrint(TRUE);
            }
  
            // Is this a unit
            UnitObj *u = Promote::Object<UnitObjType, UnitObj>(m);

            // Restore correct team
            if (u && d->team)
            {
              u->SetTeam(d->team);
            }

            // Save the old id
            U32 oldId = d->object.DirectId();

            // Now replace all references to the old object with the new object
            for (NList<Base>::Iterator items(&GetHistoryList()); *items; items++)
            {
              Objects *item = Promote<Objects>(*items);

              if (item)
              {
                for (NList<Data>::Iterator data(&item->dataList); *data; data++)
                {
                  if ((*data)->object.DirectId() == oldId)
                  {
                    (*data)->object = m;
                  }
                }
              }
            }

            break;
          }

          // Move objects back to original location
          case OP_MOVE:
            if (d->object.Alive())
            {
              d->object->SetSimCurrent(d->matrix);

              // Toggle claiming if necessary
              UnitObj *unitObj = Promote::Object<UnitObjType, UnitObj>(d->object);

              if (unitObj && unitObj->CanEverMove())
              {
                unitObj->GetDriver()->RemoveFromMapHook();
                unitObj->GetDriver()->AddToMapHook();
              }
            }
            break;

          // Restore zipped state
          case OP_ZIP:
            if (d->object.Alive())
            {
              d->object->ToggleFootPrint(d->zipped);
            }
            break;
        }
      }
    }