CharMap::~CharMap() { for (std::list<CodePage *>::iterator it = Begin(); it != End(); ++it) { delete *it; } }
// Called when another command which requires one or more of the same // subsystems is scheduled to run void CollectorFeedWithTimeoutCommand::Interrupted() { End(); }
GameStateShop::~GameStateShop() { SAFE_DELETE( cycleCardsButton ); SAFE_DELETE( showCardListButton ); End(); }
// Called when another command which requires one or more of the same // subsystems is scheduled to run void DriveStraight::Interrupted() { End(); }
CTimeMeasuring::~CTimeMeasuring(){ End(); }
T * End (T * end, std::optional<std::vector<T>> & opt) noexcept { return opt ? End(*opt) : opt; }
void OnBigWillDied() { GetUnit()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "The Affray is over!"); End(); }
void Increment (string text) { Set_Periods (Dtime (text), Start (), End (), Wrap_Flag ()); }
// Called when another command which requires one or more of the same // subsystems is scheduled to run void BSetHaut::Interrupted() { End(); }
// Called when another command which requires one or more of the same // subsystems is scheduled to run void Shoot::Interrupted() { End(); }
void Increment (Dtime value) { Set_Periods (value, Start (), End (), Wrap_Flag ()); }
void ChevalAuton::Interrupted() { End(); }
/*! @fn int GColor(int ArgC, char * ArgV[]) */ int GColor(int ArgC, char * ArgV[]) { if (ArgC <= 2) { cerr << endl << endl; cerr << "Graph Coloring Problem" << endl << endl; cerr << "Usage:" << endl; cerr << ArgV[0] << " " << ArgV[1] << " -i MaxIter [-t TabuLength -s RandomSeed]" << endl << endl; cerr << "Input:" << endl; cerr << "NumColor EdgeProbability NumVertex, NumEdge EdgeVertexPairs" << endl << endl; cerr << "Output:" << endl; cerr << "BestViolation Iteration Time" << endl; cerr << "MemoryUsedByTheProgram" << endl; cerr << "TabuLength NumColor EdgeProbability NumVertex, NumEdge EdgeVertexPairs" "[VertexColors] RandomSeed" << endl; cerr << endl << endl; return ExitOnFailure; } Dim T = 0; // Tabu size Itn I = 0; // Max iteration Rnd theRnd; for(Idx tIdx = 2; tIdx < castIdx(ArgC); ++tIdx) { if (ArgV[tIdx][0] == '-' && ArgV[tIdx][1] == 't') T = parseN(ArgV[tIdx+1]); else if (ArgV[tIdx][0] == '-' && ArgV[tIdx][1] == 'i') I = parseN(ArgV[tIdx+1]); else if (ArgV[tIdx][0] == '-' && ArgV[tIdx][1] == 's') theRnd.seed(parseN(ArgV[tIdx+1])); } if(!I) { cerr << endl; cerr << "Error in commandline parameter/value. Run only with parameter " << ArgV[1] << " to see usage." << endl; cerr << endl; return ExitOnFailure; } Dim L; cin >> L; // Num color Flt P; cin >> P; // Edge probability Dim V; cin >> V; // Num vertex Dim E; cin >> E; // Num edges b1<Int, kmm> Start(E), End(E); // Edges for(Idx tIdx = 0; tIdx < E; ++tIdx) { Int tInt; cin >> tInt; Start[tIdx] = tInt - 1; // zero based numbering cin >> tInt; End[tIdx] = tInt - 1; // zero based numbering } if (!L || eq<Flt>::iof(P,0) || !V || !E) { cerr << endl; cerr << "Error in input values." << endl; cerr << endl; return ExitOnFailure; } Sys & tSys = Sys::refm(Sys::def()); EvalTi::def(tSys.SysHdl); HintTi::def(tSys.SysHdl); QcSv2Tabu::def(tSys.SysHdl, T); b1<Prm, kmm> tColors(V), tNotEquals(E); for(Idx tIdx = 0; tIdx < V; ++tIdx) tColors[tIdx] = Prm(Tv, StatRangeVarVi::def(tSys.SysHdl , 1, L)); for(Idx tIdx = 0; tIdx < E; ++tIdx) tNotEquals[tIdx] = Prm(Tf, BneuXiFcMi::def(Xv, tSys.SysHdl, tColors[Start[tIdx]], tColors[End[tIdx]]), MasM | MasEn); Prm TopSum = Prm(Tf, SumXiEFcMiHn::def(Xm | En, tSys.SysHdl, tNotEquals.items(), tNotEquals.itemCount())); Prm HintHeap = Prm(Tf, Sv2TabuMaxHeapHiFrHi::def(tSys.SysHdl, TopSum)); Hdl const VarSelcHdl = RankedHintVar1Sp::def( tSys.SysHdl, HintHeap); Hdl const ValSelcHdl = MinVal1StatRangeSdViZi::def( Zm, tSys.SysHdl, TopSum); MinVal1StatRangeSdViZi::refm(tSys.SysHdl, ValSelcHdl).includeCurrValue(false); Refc(tTopSum, SumXiEFcMiHn, tSys.SysHdl, TopSum.TermHdl); tSys.initialiseVarsStatRand(theRnd); #if CompLazyHalf Selc::refm(tSys.SysHdl, VarSelcHdl).activate(true); Selc::refm(tSys.SysHdl, ValSelcHdl).activate(true); #endif Int BestMetric = tTopSum.MetricRec().CurrData(); while(tSys.ExecClk() < I && BestMetric > 0) { Selc::selectExecuteSelc2(tSys.SysHdl, VarSelcHdl, ValSelcHdl, theRnd); #if CompLazyFull Term::performExecIncr(Func::ptrm(tSys.SysHdl, TopSum.TermHdl)); #endif if (tTopSum.MetricRec().CurrData() < BestMetric) BestMetric = tTopSum.MetricRec().CurrData(); } cout << BestMetric << " " << tSys.ExecClk() << " " << getTime() << " " << getMemory() << endl; cout << T << " " << L << " " << P << " " << V << " "<< E; for(Idx tIdx = 0; tIdx < E; ++tIdx) cout << " " << Start[tIdx] + 1 << " " << End[tIdx] + 1; if (!BestMetric) { for(Idx tIdx = 0; tIdx < V; ++tIdx) cout << " " << StatRangeVarVi::refc(tSys.SysHdl, tColors[tIdx].TermHdl).CurrValue(); } cout << " " << theRnd.Seed() << endl; return ExitOnSuccess; }
// Called when another command which requires one or more of the same // subsystems is scheduled to run void MoveForward::Interrupted() { End(); }
// Called when another command which requires one or more of the same // subsystems is scheduled to run void DrivingWithJoystick::Interrupted() { End(); }
MsgResult RenderDemoDlg::Message(Msg* Message) { // See if it is for us if (IS_OUR_DIALOG_MSG(Message)) { // it is DialogMsg* Msg = (DialogMsg*)Message; // decide what to do switch (Msg->DlgMsg) { // Create message case DIM_CREATE : break; // Close and destroy the dialog case DIM_COMMIT : case DIM_CANCEL : { Close(); End(); break; } case DIM_LFT_BN_CLICKED : { // See which button was pressed if (Msg->GadgetID == _R(IDC_REDRAWBTN)) { // Toggle the colour ShowFirst = ShowFirst ? FALSE : TRUE; // invalidate the gadget with the picture in it InvalidateGadget(_R(IDC_REDRAW_ME)); } break; } case DIM_REDRAW : { // This is where all the redrawing is done // Which control in the window is sending the redraw message (if there are many // grdraw controls you can tell which is which from the Gadget ID if (Msg->GadgetID == _R(IDC_REDRAW_ME)) { // Draw the redraw_me control in here // Render this control RenderControl((ReDrawInfoType*) Msg->DlgMsgParam); } else // there are no other controls that should get a redraw message ever { // give out an error in debug builds, ignore in retail builds ERROR3("Got a redraw message for a control I don't know about"); break; } break; } default: break; } // Return return (DLG_EAT_IF_HUNGRY(Msg)); } return OK; }
const T * End (const T * end, const std::optional<std::vector<T>> & opt) noexcept { return opt ? End(*opt) : end; }
void AngleIntake::Interrupted() { log->write(Log::TRACE_LEVEL, "AngleIntake Interrupted"); End(); interrupted = true; }
void OnChallengerSurvived() { GetUnit()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Challenger Survived!"); End(); }
CMemLeakDetect::~CMemLeakDetect() { End(); }
void OnBigWillSurvived() { GetUnit()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Big Will Survived!"); End(); }
void OpAlign::DoWithParam(OpDescriptor* pOp, OpParam* pAlignParam) { // DMc alterations so that this works with compound nodes SelRange Selection(*(GetApplication()->FindSelection())); RangeControl rg = Selection.GetRangeControlFlags(); rg.PromoteToParent = TRUE; Selection.Range::SetRangeControl(rg); DocRect SelRect = Selection.GetBoundingRect(); DocRect TargetRect; TargetRect.MakeEmpty(); INT32 NumObjs = Selection.Count(); AlignParam* pAlign =(AlignParam*)pAlignParam; BOOL moved=FALSE; // set to TRUE if any object is moved BeginSlowJob(-1,FALSE); BOOL OK=DoStartTransOp(FALSE); // find parent spread of first object in selection Node* pFirstNode=NULL; Spread* pSpread =NULL; if (OK) { pFirstNode=Selection.FindFirst(); if (pFirstNode!=NULL) pSpread=pFirstNode->FindParentSpread(); OK=(pSpread!=NULL); if (!OK) ERROR2RAW("OpAlign::DoWithParam() - could not find parent spread"); } // Find the size of the target rectangle if (pAlign->target==ToSelection) TargetRect=SelRect; else { Page* pPage=pSpread->FindFirstPageInSpread(); while (pPage) { DocRect PageRect=pPage->GetPageRect(); if (pAlign->target==ToSpread || SelRect.IsIntersectedWith(PageRect)) TargetRect=TargetRect.Union(PageRect); pPage=pPage->FindNextPage(); } } // allocate all dynamic memory required Node** pObj=NULL; ObjInfo* x =NULL; ObjInfo* y =NULL; INT32* dx =NULL; INT32* dy =NULL; if (OK) ALLOC_WITH_FAIL(pObj,(Node**) CCMalloc(NumObjs*sizeof(Node*)), this); if (pObj!=NULL) ALLOC_WITH_FAIL(x, (ObjInfo*)CCMalloc(NumObjs*sizeof(ObjInfo)),this); if ( x!=NULL) ALLOC_WITH_FAIL(y, (ObjInfo*)CCMalloc(NumObjs*sizeof(ObjInfo)),this); if ( y!=NULL) ALLOC_WITH_FAIL(dx, (INT32*) CCMalloc(NumObjs*sizeof(INT32)), this); if ( dx!=NULL) ALLOC_WITH_FAIL(dy, (INT32*) CCMalloc(NumObjs*sizeof(INT32)), this); OK=(dy!=NULL); // if memory claimed OK and target rect not empty proceed with op // (ie. do nothing if 'within page(s)' when no object on a page) DocRect EmptyRect; if (OK && TargetRect!=EmptyRect) { // create an array of pointers to objects (nodes) to be affected Node* pNode=Selection.FindFirst(); INT32 i=0; while (pNode!=NULL) { if (pNode->IsBounded() && !((NodeRenderableBounded*)pNode)->GetBoundingRect(TRUE).IsEmpty()) pObj[i++]=pNode; pNode=Selection.FindNext(pNode); } NumObjs=i; // cache x & y info in separate arrays so they can be sorted separately XLONG SumObjWidths =0; XLONG SumObjHeights=0; for (i=0; i<NumObjs; i++) { DocRect ObjRect=((NodeRenderableBounded*)pObj[i])->GetBoundingRect(); x[i].i=i; x[i].lo=ObjRect.lo.x; x[i].hi=ObjRect.hi.x; SumObjWidths+=ObjRect.hi.x-ObjRect.lo.x; y[i].i=i; y[i].lo=ObjRect.lo.y; y[i].hi=ObjRect.hi.y; SumObjHeights+=ObjRect.hi.y-ObjRect.lo.y; } // for each object, calculate the x and y displacements independently AlignOneAxis(pAlign->h,NumObjs,SumObjWidths, TargetRect.lo.x,TargetRect.hi.x,x,dx); AlignOneAxis(pAlign->v,NumObjs,SumObjHeights,TargetRect.lo.y,TargetRect.hi.y,y,dy); // apply the x and y displacements simultaneously to each object for (i=0; i<NumObjs; i++) if (dx[i]!=0 || dy[i]!=0) { moved=TRUE; Trans2DMatrix* pMatrix=new Trans2DMatrix(dx[i],dy[i]); DoTransformNode((NodeRenderableInk*)pObj[i],pMatrix); } } // free up any memory which was allocated CCFree(dx); CCFree(dy); CCFree(x); CCFree(y); CCFree(pObj); if (moved) { Document::GetSelected()->ForceRedraw(pSpread, TargetRect); GetApplication()->UpdateSelection(); } else FailAndExecute(); End(); EndSlowJob(); }
void PrevChar() { if ( !m_xCaret-- ) { End(); PrevLine(); } }
void Slap::Interrupted() { End(); }
GameStateStory::~GameStateStory() { End(); }
CMatStubHandler::~CMatStubHandler() { End(); }
void ArcadeDriveWithJoystick::Interrupted() { End(); }
// Called when another command which requires one or more of the same // subsystems is scheduled to run void DriveUntilClose::Interrupted() { End(); }
void Graphics_Mesh(bool isOpenGLMode) { StartGraphicsTest(); SetGLEnable(isOpenGLMode); ace::Log* log = ace::Log_Imp::Create(L"graphics.html", L"メッシュ"); auto window = ace::Window_Imp::Create(640, 480, ace::ToAString(L"メッシュ").c_str()); ASSERT_TRUE(window != nullptr); auto graphics = ace::Graphics_Imp::Create(window, isOpenGLMode, log, false); ASSERT_TRUE(graphics != nullptr); auto renderer3d = new ace::Renderer3D(graphics); ASSERT_TRUE(renderer3d != nullptr); renderer3d->SetWindowSize(ace::Vector2DI(640, 480)); auto mesh1 = CreateMesh(graphics); auto mesh2 = CreateMesh(graphics); auto deformer = CreateDeformer(graphics); auto animation = CreateAnimation(); auto cameraObject = new ace::RenderedCameraObject3D(graphics); cameraObject->SetPosition(ace::Vector3DF(0, 0, 10)); cameraObject->SetFocus(ace::Vector3DF(0, 0, 0)); cameraObject->SetFieldOfView(20.0f); cameraObject->SetZNear(1.0f); cameraObject->SetZFar(20.0f); cameraObject->SetWindowSize(ace::Vector2DI(800, 600)); auto meshObject1 = new ace::RenderedModelObject3D(graphics); meshObject1->AddMeshGroup(); meshObject1->AddMesh(0, mesh1); meshObject1->SetPosition(ace::Vector3DF(1, 0, 0)); meshObject1->SetRotation(ace::Vector3DF(20.0f, 20.0f, 0.0f)); auto meshObject2 = new ace::RenderedModelObject3D(graphics); meshObject2->AddMeshGroup(); meshObject2->AddMesh(0, mesh2); meshObject2->SetDeformer(0, deformer.get()); meshObject2->SetPosition(ace::Vector3DF(-1, 0, 0)); meshObject2->SetRotation(ace::Vector3DF(20.0f, 20.0f, 0.0f)); meshObject2->AddAnimationClip(ace::ToAString("anime1").c_str(), animation.get()); meshObject2->PlayAnimation(ace::ToAString("anime1").c_str()); auto lightObject = new ace::RenderedDirectionalLightObject3D(graphics); lightObject->SetRotation(ace::Vector3DF(30, 160, 0)); renderer3d->AddObject(cameraObject); renderer3d->AddObject(meshObject1); renderer3d->AddObject(meshObject2); renderer3d->AddObject(lightObject); auto renderer2d = new ace::Renderer2D_Imp(graphics, log, window->GetSize()); int32_t time = 0; while (window->DoEvent()) { graphics->Begin(); graphics->Clear(true, false, ace::Color(0, 0, 0, 255)); renderer3d->Flip(); renderer3d->BeginRendering(); ace::Sleep(100); renderer3d->EndRendering(); graphics->SetRenderTarget(nullptr, nullptr); ace::Vector2DF positions[4]; ace::Color colors[4]; ace::Vector2DF uvs[4]; colors[0] = ace::Color(255, 255, 255, 255); colors[1] = ace::Color(255, 255, 255, 255); colors[2] = ace::Color(255, 255, 255, 255); colors[3] = ace::Color(255, 255, 255, 255); positions[0].X = 0; positions[0].Y = 0; positions[1].X = 640; positions[1].Y = 0; positions[2].X = 640; positions[2].Y = 480; positions[3].X = 0; positions[3].Y = 480; uvs[0].X = 0; uvs[0].Y = 0; uvs[1].X = 1; uvs[1].Y = 0; uvs[2].X = 1; uvs[2].Y = 1; uvs[3].X = 0; uvs[3].Y = 1; renderer2d->AddSprite(positions, colors, uvs, renderer3d->GetRenderTarget(), ace::eAlphaBlend::ALPHA_BLEND_BLEND, 0); renderer2d->DrawCache(); renderer2d->ClearCache(); graphics->Present(); graphics->End(); if (time == 10) { SAVE_SCREEN_SHOT(graphics, 0); } if (time == 11) { window->Close(); } time++; } meshObject1->Release(); meshObject2->Release(); cameraObject->Release(); lightObject->Release(); delete renderer2d; delete renderer3d; graphics->Release(); window->Release(); delete log; }
// Called when another command which requires one or more of the same // subsystems is scheduled to run void ElevatorStop::Interrupted() { End(); }