您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DoCommand函数代码示例

51自学网 2021-06-01 20:28:52
  C++
这篇教程C++ DoCommand函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例4: DoCommand

NS_IMETHODIMPnsXULTreeItemAccessibleBase::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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例14: content

NS_IMETHODIMPnsHTMLLinkAccessible::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,


示例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,


示例16: DoCommand

NS_IMETHODIMPnsHTMLLinkAccessible::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;  DoCommand();  return NS_OK;}
开发者ID:nikhilm,项目名称:v8monkey,代码行数:16,


示例17: switch

LRESULT CFindBar::DlgFunc(HWND /*hwndDlg*/, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/){	switch (uMsg)	{	case WM_INITDIALOG:		{			m_hIcon = (HICON)::LoadImage(hResource, MAKEINTRESOURCE(IDI_CANCELNORMAL), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);			SendMessage(GetDlgItem(*this, IDC_FINDEXIT), BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_hIcon);		}		return TRUE;	case WM_COMMAND:		return DoCommand(LOWORD(wParam), HIWORD(wParam));	default:		return FALSE;	}}
开发者ID:stahta01,项目名称:wxTortoiseGit,代码行数:16,


示例18: InputLevel

int InputLevel(int arg) {char *cp;   arg++;   DoCommand('L',0,NULL);   if (ParseIbuf(',')) {      cp = items[0];      printf("Level Input1:%c%c Input2:%c%c/n",cp[2],cp[3],cp[4],cp[5]);      printf("Level Otput1:%c%c Otput2:%c%c V-meters/n",cp[6],cp[7],cp[8],cp[9]);   } else {      printf("Illegal string or checksum error/n");      printf("%s/n",ibuf);   }   return arg;}
开发者ID:GSI-CS-CO,项目名称:kernel_modules,代码行数:17,


示例19: PINDialogProc

staticINT_PTR CALLBACK PINDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){   switch (message)   {   case WM_COMMAND:      return DoCommand(hDlg, wParam, lParam);      break;   case WM_INITDIALOG:      return DoInitDialog(hDlg, lParam);      break;   default:      break;   }   return FALSE;}
开发者ID:Vanuan,项目名称:coolkey,代码行数:17,


示例20: UNREFERENCED_PARAMETER

LRESULT CCleanVerifyDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){    UNREFERENCED_PARAMETER(lParam);    switch (uMsg)    {    case WM_INITDIALOG:        {            InitDialog(hwndDlg, IDI_FILETOOL);            SetDlgItemText(*this, IDC_PATH, m_path.c_str());        }        return TRUE;    case WM_COMMAND:        return DoCommand(LOWORD(wParam));    default:        return FALSE;    }}
开发者ID:SpivEgin,项目名称:stexbar,代码行数:17,


示例21: vd80StopAcquisition

Vd80Err vd80StopAcquisition(int fd, unsigned int mods, unsigned int chns) {int i, mod;unsigned int mski;Vd80Err err;   for (i=0; i<Vd80MODULES; i++) {      mski = 1 << i;      if (mods & mski) {	 mod = i+1;	 err = DoCommand(fd,mod,0,Vd80DrvrCommandSTOP);	 if (err != Vd80ErrSUCCESS) return err;      }   }   return Vd80ErrSUCCESS;}
开发者ID:bradomyn,项目名称:coht,代码行数:17,


示例22: cmd_call

INT cmd_call (LPTSTR param){    TCHAR line[CMDLINE_LENGTH + 1];    TCHAR *first;    BOOL bInQuote = FALSE;    TRACE ("cmd_call: (/'%s/')/n", debugstr_aw(param));    if (!_tcsncmp (param, _T("/?"), 2))    {        ConOutResPaging(TRUE,STRING_CALL_HELP);        return 0;    }    /* Do a second round of %-variable substitutions */    if (!SubstituteVars(param, line, _T('%')))        return nErrorLevel = 1;    /* Find start and end of first word */    first = line;    while (_istspace(*first))        first++;    for (param = first; *param; param++)    {        if (!bInQuote && (_istspace(*param) || _tcschr(_T(",;="), *param)))            break;        bInQuote ^= (*param == _T('"'));    }    /* Separate first word from rest of line */    memmove(param + 1, param, (_tcslen(param) + 1) * sizeof(TCHAR));    *param++ = _T('/0');    if (*first == _T(':') && (bc))    {        /* CALL :label - call a subroutine of the current batch file */        while (*param == _T(' '))            param++;        nErrorLevel = Batch(bc->BatchFilePath, first, param, NULL);        return nErrorLevel;    }    nErrorLevel = DoCommand(first, param, NULL);    return nErrorLevel;}
开发者ID:reactos,项目名称:reactos,代码行数:45,


示例23: process_tabtypes

/* Note that tab, return, linefeed, ^n, all do the same thing   except when it comes to matching a command button hotkey.   Return 1 to redraw, 0 for no redraw */static int process_tabtypes(unsigned char * buf) {  Item *item, *old_item;  /* Note: the input field ring used with ^P above	     could probably make this a lot simpler. dje 12/20/98 */	  /* Code tracks cursor. */  item = root_item_ptr;         /* init item ptr */  if (CF.cur_input != 0) {          /* if in text */    item = CF.cur_input->header.next; /* move to next item */  }  for ( ; item != 0;	item = item->header.next) {/* find next input item */    if (item->type == I_INPUT) {      old_item = CF.cur_input;      CF.cur_input = item;      RedrawItem(old_item, 1, NULL);      CF.rel_cursor = CF.abs_cursor = 0; /* home cursor in new input field */      return (1);                       /* cause redraw */    }  }  /* end of all text input fields, check for buttons */  for (item = root_item_ptr; item != 0;       item = item->header.next) {/* all items */    myfprintf((stderr, "Button: keypress==%d vs buf %d/n",	       item->button.keypress, buf[0]));    if (item->type == I_BUTTON && item->button.keypress == buf[0]) {      RedrawItem(item, 1, NULL);      usleep(MICRO_S_FOR_10MS);      RedrawItem(item, 0, NULL);      DoCommand(item);      return (0);                       /* cause no_redraw */    }  }  /* goto the first text input field */  for (item = root_item_ptr; item != 0;       item = item->header.next) {/* all items */    if (item->type == I_INPUT) {      old_item = CF.cur_input;      CF.cur_input = item;      RedrawItem(old_item, 1, NULL);      CF.abs_cursor = CF.rel_cursor - item->input.left;      return (1);                       /* goto redraw */    }  }  return (-1);}
开发者ID:ThomasAdam,项目名称:fvwm,代码行数:49,


示例24: CmdBuildBuoy

/** * Build a buoy. * @param tile tile where to place the buoy * @param flags operation to perform * @param p1 unused * @param p2 unused * @param text unused * @return the cost of this operation or an error */CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text){	if (tile == 0 || !HasTileWaterGround(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);	if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);	if (GetTileSlope(tile) != SLOPE_FLAT) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);	/* Check if there is an already existing, deleted, waypoint close to us that we can reuse. */	Waypoint *wp = FindDeletedWaypointCloseTo(tile, STR_SV_STNAME_BUOY, OWNER_NONE);	if (wp == NULL && !Waypoint::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_STATIONS_LOADING);	CommandCost cost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_WAYPOINT_BUOY]);	if (!IsWaterTile(tile)) {		CommandCost ret = DoCommand(tile, 0, 0, flags | DC_AUTO, CMD_LANDSCAPE_CLEAR);		if (ret.Failed()) return ret;		cost.AddCost(ret);	}	if (flags & DC_EXEC) {		if (wp == NULL) {			wp = new Waypoint(tile);		} else {			/* Move existing (recently deleted) buoy to the new location */			wp->xy = tile;			InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index);		}		wp->rect.BeforeAddTile(tile, StationRect::ADD_TRY);		wp->string_id = STR_SV_STNAME_BUOY;		wp->facilities |= FACIL_DOCK;		wp->owner = OWNER_NONE;		wp->build_date = _date;		if (wp->town == NULL) MakeDefaultName(wp);		MakeBuoy(tile, wp->index, GetWaterClass(tile));		wp->UpdateVirtCoord();		InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index);	}	return cost;}
开发者ID:Ayutac,项目名称:OpenTTD,代码行数:54,


示例25: UNREFERENCED_PARAMETER

LRESULT CWindowTreeDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){    UNREFERENCED_PARAMETER(lParam);    switch (uMsg)    {    case WM_INITDIALOG:    {        InitDialog(hwndDlg, IDI_SENDMESSAGE);        m_resizer.Init(hwndDlg);        m_resizer.AddControl(hwndDlg, IDC_WINDOWTREE, RESIZER_TOPLEFTBOTTOMRIGHT);        m_resizer.AddControl(hwndDlg, IDC_REFRESH, RESIZER_BOTTOMRIGHT);        m_resizer.AddControl(hwndDlg, IDOK, RESIZER_BOTTOMRIGHT);        m_resizer.AddControl(hwndDlg, IDCANCEL, RESIZER_BOTTOMRIGHT);        ExtendFrameIntoClientArea(IDC_WINDOWTREE, IDC_WINDOWTREE, IDC_WINDOWTREE, IDC_WINDOWTREE);        m_aerocontrols.SubclassControl(GetDlgItem(*this, IDC_REFRESH));        m_aerocontrols.SubclassControl(GetDlgItem(*this, IDOK));        m_aerocontrols.SubclassControl(GetDlgItem(*this, IDCANCEL));        if (m_Dwm.IsDwmCompositionEnabled())            m_resizer.ShowSizeGrip(false);        RefreshTree();    }    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:dbremner,项目名称:sendmessage,代码行数:45,


示例26: CmdDepotMassAutoReplace

/** Autoreplace all vehicles in the depot * Note: this command can make incorrect cost estimations * Luckily the final price can only drop, not increase. This is due to the fact that * estimation can't predict wagon removal so it presumes worst case which is no income from selling wagons. * @param tile Tile of the depot where the vehicles are * @param flags type of operation * @param p1 Type of vehicle * @param p2 If bit 0 is set, then either replace all or nothing (instead of replacing until money runs out) * @param text unused * @return the cost of this operation or an error */CommandCost CmdDepotMassAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text){    VehicleList list;    CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES);    VehicleType vehicle_type = (VehicleType)GB(p1, 0, 8);    bool all_or_nothing = HasBit(p2, 0);    if (!IsDepotTile(tile) || !IsTileOwner(tile, _current_company)) return CMD_ERROR;    /* Get the list of vehicles in the depot */    BuildDepotVehicleList(vehicle_type, tile, &list, &list, true);    bool did_something = false;    for (uint i = 0; i < list.Length(); i++) {        const Vehicle *v = list[i];        /* Ensure that the vehicle completely in the depot */        if (!v->IsInDepot()) continue;        CommandCost ret = DoCommand(0, v->index, 0, flags, CMD_AUTOREPLACE_VEHICLE);        if (CmdSucceeded(ret)) {            did_something = true;            cost.AddCost(ret);        } else {            if (ret.GetErrorMessage() != STR_ERROR_AUTOREPLACE_NOTHING_TO_DO && all_or_nothing) {                /* We failed to replace a vehicle even though we set all or nothing.                 * We should never reach this if DC_EXEC is set since then it should                 * have failed the estimation guess. */                assert(!(flags & DC_EXEC));                /* Now we will have to return an error. */                return CMD_ERROR;            }        }    }    if (!did_something) {        /* Either we didn't replace anything or something went wrong.         * Either way we want to return an error and not execute this command. */        cost = CMD_ERROR;    }    return cost;}
开发者ID:Voxar,项目名称:OpenTTD,代码行数:56,



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


C++ DoCommandP函数代码示例
C++ DoCleanup函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。