当前位置: 首页>>代码示例>>C++>>正文


C++ DoCommand函数代码示例

本文整理汇总了C++中DoCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ DoCommand函数的具体用法?C++ DoCommand怎么用?C++ DoCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DoCommand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CmdBuildCanal

/**
 * Build a piece of canal.
 * @param tile end tile of stretch-dragging
 * @param flags type of operation
 * @param p1 start tile of stretch-dragging
 * @param p2 waterclass to build. sea and river can only be built in scenario editor
 * @param text unused
 * @return the cost of this operation or an error
 */
CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
	WaterClass wc = Extract<WaterClass, 0, 2>(p2);
	if (p1 >= MapSize() || wc == WATER_CLASS_INVALID) return CMD_ERROR;

	/* Outside of the editor you can only build canals, not oceans */
	if (wc != WATER_CLASS_CANAL && _game_mode != GM_EDITOR) return CMD_ERROR;

	TileArea ta(tile, p1);

	/* Outside the editor you can only drag canals, and not areas */
	if (_game_mode != GM_EDITOR && ta.w != 1 && ta.h != 1) return CMD_ERROR;

	CommandCost cost(EXPENSES_CONSTRUCTION);
	TILE_AREA_LOOP(tile, ta) {
		CommandCost ret;

		Slope slope = GetTileSlope(tile, NULL);
		if (slope != SLOPE_FLAT && (wc != WATER_CLASS_RIVER || !IsInclinedSlope(slope))) {
			return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
		}

		/* can't make water of water! */
		if (IsTileType(tile, MP_WATER) && (!IsTileOwner(tile, OWNER_WATER) || wc == WATER_CLASS_SEA)) continue;

		ret = DoCommand(tile, 0, 0, flags | DC_FORCE_CLEAR_TILE, CMD_LANDSCAPE_CLEAR);
		if (ret.Failed()) return ret;
		cost.AddCost(ret);

		if (flags & DC_EXEC) {
			switch (wc) {
				case WATER_CLASS_RIVER:
					MakeRiver(tile, Random());
					break;

				case WATER_CLASS_SEA:
					if (TileHeight(tile) == 0) {
						MakeSea(tile);
						break;
					}
					/* FALL THROUGH */

				default:
					MakeCanal(tile, _current_company, Random());
					break;
			}
			MarkTileDirtyByTile(tile);
			MarkCanalsAndRiversAroundDirty(tile);
		}

		cost.AddCost(_price[PR_BUILD_CANAL]);
	}
开发者ID:ShaunOfTheLive,项目名称:OpenCoasterTycoon,代码行数:61,代码来源:water_cmd.cpp

示例2: DoCommand

 void DepthVideoApp::ImportPointCloud(bool isSubThread)
 {
     if (IsCommandAvaliable() == false)
     {
         return;
     }
     if (isSubThread)
     {
         mCommandType = CT_IMPORT_POINTCLOUD;
         DoCommand(true);
     }
     else
     {
         std::vector<std::string> fileNames;
         char filterName[] = "ASC Files(*.asc)\0*.asc\0OBJ Files(*.obj)\0*.obj\0PLY Files(*.ply)\0*.ply\0Geometry++ Point Cloud(*.gpc)\0*.gpc\0";
         if (MagicCore::ToolKit::MultiFileOpenDlg(fileNames, filterName))
         {
             if (fileNames.size() == 0)
             {
                 return;
             }
             mIsCommandInProgress = true;
             mSelectCloudIndex = 0;
             ClearPointCloudList();
             mPointCloudList.reserve(fileNames.size());
             for (int fileId = 0; fileId < fileNames.size(); fileId++)
             {
                 GPP::PointCloud* pointCloud = GPP::Parser::ImportPointCloud(fileNames.at(fileId));
                 if (pointCloud == NULL)
                 { 
                     continue;
                 }
                 if (mPointCloudList.empty())
                 {
                     pointCloud->UnifyCoords(2.0, &mScaleValue, &mObjCenterCoord);
                 }
                 else
                 {
                     pointCloud->UnifyCoords(mScaleValue, mObjCenterCoord);
                 }
                 mPointCloudList.push_back(pointCloud);
                 if (mPointCloudList.size() == 1)
                 {
                     mUpdatePointCloudListRendering = true;
                 }
                 mUpdateUIScrollBar = true;
                 mProgressValue = int(fileId * 100.0 / fileNames.size());
             }
             mIsCommandInProgress = false;
         }
     }
 }
开发者ID:threepark,项目名称:Magic3D,代码行数:52,代码来源:DepthVideoApp.cpp

示例3: CheckRadioButton

void CBordersTab::OnBorderImage()
{
	CheckRadioButton(IDC_BORDER_NONE, IDC_BORDER_FADE, IDC_BORDER_IMAGE);

//j	m_btnChoose.EnableWindow(true);
	m_editBorderImageFileName.EnableWindow(true);
	m_comboFadedEdgeShape.EnableWindow(false);
	m_comboFadedEdgeDirection.EnableWindow(false);
	m_editFadedEdgeWidth.EnableWindow(false);
	m_editFadedEdgeOpacity.EnableWindow(false);

	DoCommand(_T("ActivateBorderImage"), _T(""));
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:13,代码来源:BordersTab.cpp

示例4: DoCommand

NS_IMETHODIMP
nsXULTreeItemAccessibleBase::DoAction(PRUint8 aIndex)
{
  if (IsDefunct())
    return NS_ERROR_FAILURE;

  if (aIndex != eAction_Click &&
      (aIndex != eAction_Expand || !IsExpandable()))
    return NS_ERROR_INVALID_ARG;

  DoCommand(nsnull, aIndex);
  return NS_OK;
}
开发者ID:gorakhargosh,项目名称:mozilla-central,代码行数:13,代码来源:nsXULTreeAccessible.cpp

示例5: switch

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CMessageDialog::OnKeyCodePressed( vgui::KeyCode code )
{
	if ( m_ButtonPressed != BTN_INVALID || GetAlpha() != 255 )
	{
		// inhibit any further key activity or during transitions
		return;
	}

	switch ( GetBaseButtonCode( code ) )
	{
	case KEY_XBUTTON_A:
		DoCommand( BTN_A );
		break;

	case KEY_XBUTTON_B:
		DoCommand( BTN_B );
		break;

	default:
		break;
	}
}
开发者ID:hekar,项目名称:luminousforts-2013,代码行数:25,代码来源:MessageDialog.cpp

示例6: main

void main()
{
    /* Configure the oscillator for the device */
    ConfigureOscillator();

    /* Initialize I/O and Peripherals for application */
    InitApp();

    SendMessage("READY");

    while(1)
    {
        if (RCIF)
        {
            if (FERR)
            {
                rxchar = RCREG;
                ClearRXBuffer();
                SendMessage(UART_FRAMING_ERROR);                    // Framing Error - clear with a read
            }
            else
            {
                rxchar = RCREG;                                     // recive char
                if(rxpos < RXBUFFERSIZE)
                {
                    rxbuffer[rxpos++] = rxchar;
                    if ((rxpos == CMD_SIZE) & (rxchar == 0x0D))      // CR recived - do command
                    {
                        rxchar = DoCommand();
                        ClearRXBuffer();
                        SendMessage(rxchar ? CMD_ACK : CMD_ERROR);  // command acknowledge
                    }
                }
                else
                {
                    ClearRXBuffer();
                    SendMessage(BUFFER_FULL_ERROR);                 // buffer full error
                }
            }
        }
        if (OERR)
        {
            CREN = 0;
            rxchar = RCREG;
            rxchar = RCREG;
            ClearRXBuffer();
            SendMessage(UART_OVERFLOW_ERROR);                       // rx overrun error
            CREN = 1;
        }
    }
}
开发者ID:najafzadeh1055,项目名称:robocup2012,代码行数:51,代码来源:main.c

示例7: CopyHeadSpecificThings

/**
 * Copy head specific things to the new vehicle chain after it was successfully constructed
 * @param old_head The old front vehicle (no wagons attached anymore)
 * @param new_head The new head of the completely replaced vehicle chain
 * @param flags the command flags to use
 */
static CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head, DoCommandFlag flags)
{
	CommandCost cost = CommandCost();

	/* Share orders */
	if (cost.Succeeded() && old_head != new_head) cost.AddCost(DoCommand(0, new_head->index | CO_SHARE << 30, old_head->index, DC_EXEC, CMD_CLONE_ORDER));

	/* Copy group membership */
	if (cost.Succeeded() && old_head != new_head) cost.AddCost(DoCommand(0, old_head->group_id, new_head->index, DC_EXEC, CMD_ADD_VEHICLE_GROUP));

	/* Perform start/stop check whether the new vehicle suits newgrf restrictions etc. */
	if (cost.Succeeded()) {
		/* Start the vehicle, might be denied by certain things */
		assert((new_head->vehstatus & VS_STOPPED) != 0);
		cost.AddCost(CmdStartStopVehicle(new_head, true));

		/* Stop the vehicle again, but do not care about evil newgrfs allowing starting but not stopping :p */
		if (cost.Succeeded()) cost.AddCost(CmdStartStopVehicle(new_head, false));
	}

	/* Last do those things which do never fail (resp. we do not care about), but which are not undo-able */
	if (cost.Succeeded() && old_head != new_head && (flags & DC_EXEC) != 0) {
		/* Copy vehicle name */
		if (old_head->name != NULL) {
			DoCommand(0, new_head->index, 0, DC_EXEC | DC_AUTOREPLACE, CMD_RENAME_VEHICLE, old_head->name);
		}

		/* Copy other things which cannot be copied by a command and which shall not stay resetted from the build vehicle command */
		new_head->CopyVehicleConfigAndStatistics(old_head);

		/* Switch vehicle windows/news to the new vehicle, so they are not closed/deleted when the old vehicle is sold */
		ChangeVehicleViewports(old_head->index, new_head->index);
		ChangeVehicleViewWindow(old_head->index, new_head->index);
		ChangeVehicleNews(old_head->index, new_head->index);
	}

	return cost;
}
开发者ID:benjeffery,项目名称:openttd,代码行数:44,代码来源:autoreplace_cmd.cpp

示例8: switch

void CTranscendenceWnd::OnKeyDownIntro (int iVirtKey, DWORD dwKeyData)

//	OnKeyDownIntro
//
//	Handle WM_KEYDOWN

	{
	if (m_bOverwriteGameDlg)
		return;

	if (m_PlayerDisplay.OnKeyDown(iVirtKey))
		return;

	if (m_ButtonBarDisplay.OnKeyDown(iVirtKey))
		return;

	switch (iVirtKey)
		{
		case SDLK_RETURN:
			if (m_bSavedGame)
				DoCommand(CMD_CONTINUE_OLD_GAME);
			else
				DoCommand(CMD_START_NEW_GAME);
			break;

		case SDLK_UP:
			m_HighScoreDisplay.SelectPrevious();
			break;

		case SDLK_DOWN:
			m_HighScoreDisplay.SelectNext();
			break;

		case SDLK_F1:
			StartHelp();
			break;
		}
	}
开发者ID:alanhorizon,项目名称:Transport,代码行数:38,代码来源:IntroScreen.cpp

示例9: strcpy

bool DOS_Shell::CheckConfig(char* cmd_in,char*line) {
	Section* test = control->GetSectionFromProperty(cmd_in);
	if(!test) return false;
	if(line && !line[0]) {
		std::string val = test->GetPropValue(cmd_in);
		if(val != NO_SUCH_PROPERTY) WriteOut("%s\n",val.c_str());
		return true;
	}
	char newcom[1024]; newcom[0] = 0; strcpy(newcom,"z:\\config -set ");
	strcat(newcom,test->GetName());	strcat(newcom," ");
	strcat(newcom,cmd_in);strcat(newcom,line);
	DoCommand(newcom);
	return true;
}
开发者ID:libretro,项目名称:dosbox-libretro,代码行数:14,代码来源:shell_cmds.cpp

示例10: BuildReplacementVehicle

/**
 * Builds and refits a replacement vehicle
 * Important: The old vehicle is still in the original vehicle chain (used for determining the cargo when the old vehicle did not carry anything, but the new one does)
 * @param old_veh A single (articulated/multiheaded) vehicle that shall be replaced.
 * @param new_vehicle Returns the newly build and refittet vehicle
 * @param part_of_chain The vehicle is part of a train
 * @return cost or error
 */
static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehicle, bool part_of_chain)
{
	*new_vehicle = NULL;

	/* Shall the vehicle be replaced? */
	const Company *c = Company::Get(_current_company);
	EngineID e;
	CommandCost cost = GetNewEngineType(old_veh, c, e);
	if (cost.Failed()) return cost;
	if (e == INVALID_ENGINE) return CommandCost(); // neither autoreplace is set, nor autorenew is triggered

	/* Does it need to be refitted */
	CargoID refit_cargo = GetNewCargoTypeForReplace(old_veh, e, part_of_chain);
	if (refit_cargo == CT_INVALID) return CommandCost(); // incompatible cargoes

	/* Build the new vehicle */
	cost = DoCommand(old_veh->tile, e, 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
	if (cost.Failed()) return cost;

	Vehicle *new_veh = Vehicle::Get(_new_vehicle_id);
	*new_vehicle = new_veh;

	/* Refit the vehicle if needed */
	if (refit_cargo != CT_NO_REFIT) {
		byte subtype = GetBestFittingSubType(old_veh, new_veh, refit_cargo);

		cost.AddCost(DoCommand(0, new_veh->index, refit_cargo | (subtype << 8), DC_EXEC, GetCmdRefitVeh(new_veh)));
		assert(cost.Succeeded()); // This should be ensured by GetNewCargoTypeForReplace()
	}

	/* Try to reverse the vehicle, but do not care if it fails as the new type might not be reversible */
	if (new_veh->type == VEH_TRAIN && HasBit(Train::From(old_veh)->flags, VRF_REVERSE_DIRECTION)) {
		DoCommand(0, new_veh->index, true, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
	}

	return cost;
}
开发者ID:benjeffery,项目名称:openttd,代码行数:45,代码来源:autoreplace_cmd.cpp

示例11: UNREFERENCED_PARAMETER

LRESULT CMultiLineEditDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            InitDialog(hwndDlg, IDI_GREPWIN);
            CLanguage::Instance().TranslateWindow(*this);
            // initialize the controls
            SetDlgItemText(hwndDlg, IDC_TEXTCONTENT, m_RegexText.c_str());

            SetFocus(GetDlgItem(hwndDlg, IDC_TEXTCONTENT));

            m_resizer.Init(hwndDlg);
            m_resizer.AddControl(hwndDlg, IDC_TEXTCONTENT, RESIZER_TOPLEFTBOTTOMRIGHT);
            m_resizer.AddControl(hwndDlg, IDOK, RESIZER_BOTTOMRIGHT);
            m_resizer.AddControl(hwndDlg, IDCANCEL, RESIZER_BOTTOMRIGHT);

            SendMessage(GetDlgItem(*this, IDC_TEXTCONTENT), EM_SETEVENTMASK, 0, ENM_CHANGE);
            SendMessage(GetDlgItem(*this, IDC_TEXTCONTENT), EM_EXLIMITTEXT, 0, 200*1024);

            ExtendFrameIntoClientArea(IDC_TEXTCONTENT, IDC_TEXTCONTENT, IDC_TEXTCONTENT, IDC_TEXTCONTENT);
            m_aerocontrols.SubclassControl(GetDlgItem(*this, IDOK));
            m_aerocontrols.SubclassControl(GetDlgItem(*this, IDCANCEL));
            if (m_Dwm.IsDwmCompositionEnabled())
                m_resizer.ShowSizeGrip(false);
        }
        return FALSE;
    case WM_COMMAND:
        return DoCommand(LOWORD(wParam), HIWORD(wParam));
    case WM_SIZE:
        {
            m_resizer.DoResize(LOWORD(lParam), HIWORD(lParam));
        }
        break;
    case WM_GETMINMAXINFO:
        {
            MINMAXINFO * mmi = (MINMAXINFO*)lParam;
            mmi->ptMinTrackSize.x = m_resizer.GetDlgRect()->right;
            mmi->ptMinTrackSize.y = m_resizer.GetDlgRect()->bottom;
            return 0;
        }
        break;
    default:
        return FALSE;
    }
    return FALSE;
}
开发者ID:t00,项目名称:grepwin,代码行数:49,代码来源:MultiLineEditDlg.cpp

示例12: SendCommand

void  SendCommand(cdrom_Device *cd, unsigned char val)
{
   if (cd->CmdPtr < 7)
   {
      cd->Command[cd->CmdPtr] = (unsigned char)val;
      cd->CmdPtr++;
   }

   if((cd->CmdPtr >= 7) || (cd->Command[0] == 0x8))
   {
      //Poll&=~0x80; ???
      DoCommand(cd);
      cd->CmdPtr=0;
   }
}
开发者ID:matthewbauer,项目名称:4do,代码行数:15,代码来源:Iso.cpp

示例13: GetVersion

int GetVersion(int arg) {

   arg++;
   printf("%s Compiled: %s %s\n", "amptest", __DATE__, __TIME__);
   DoCommand('I',0,NULL);

   if (ParseIbuf(',')) {
      printf("FirmwareVersion:%s\n",items[0]);
      printf("DeviceID       :%s\n",items[1]);
      printf("SerialNumber   :%s\n",items[2]);
   } else {
      printf("Illegal string or checksum error\n");
      printf("%s\n",ibuf);
   }
   return arg;
}
开发者ID:GSI-CS-CO,项目名称:kernel_modules,代码行数:16,代码来源:AmpCmds.c

示例14: content

NS_IMETHODIMP
nsHTMLLinkAccessible::DoAction(PRUint8 aIndex)
{
  if (!IsLinked())
    return nsHyperTextAccessible::DoAction(aIndex);

  // Action 0 (default action): Jump to link
  if (aIndex != eAction_Jump)
    return NS_ERROR_INVALID_ARG;

  if (IsDefunct())
    return NS_ERROR_FAILURE;

  nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
  return DoCommand(content);
}
开发者ID:AllenDou,项目名称:firefox,代码行数:16,代码来源:nsHTMLLinkAccessible.cpp

示例15: OpenFileL

void CDummyUsbDevice::DoTestsL()
	{
	iTest.SetLogged(ETrue);
	iTest.Title();
	OpenFileL();
	TInt length = GetNextLine();
	if (length <= 0)
		{
		User::Panic(KUsbChargingTestPanic, EUsbChargingTestPanicBadInputData);
		}
	iLineNumber = 1;
	iTest.Start(_L("test"));
	InterpretLine();
	DoCommand();
	DoAsyncOp();
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:16,代码来源:tbatterycharging.cpp


注:本文中的DoCommand函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。