void FConsoleDevice::Serialise(const char* V, EName Event) { dprintf("%s: %s\n", VName::SafeString(Event), *VStr(V).RemoveColours()); if (Event == NAME_Dev && !developer) { return; } DoPrint(V); DoPrint("\n"); }
void Log::Print(const char* format, ...) { va_list valist; va_start(valist, format); DoPrint(LEVEL_DEFAULT, format, valist); va_end(valist); }
bool Command::Execute( void ) { switch( mCmdID ) { case kCmdAssign : return DoAssign(); case kCmdClose : return DoCloseCursor(); case kCmdExec : return DoExec(); case kCmdFetch : return DoFetch(); case kCmdGoIf : return DoGoIf(); case kCmdGoIfNot : return DoGoIfNot(); case kCmdOpen : return DoOpenCursor(); case kCmdParam : return DoReadParam(); case kCmdPrint : return DoPrint(); case kCmdReset : return mpVM->mVariables[ mObject ]->mIsNULL = true; case kCmdReturn : return DoReturn(); case kCmdSelect : return DoSelect(); case kCmdGo : mpVM->mPos = mParam.ToInt(); case kCmdNope : return true; default:; } return false; }
void CPrintAttachment::ExecuteSelf(MessageT inMessage, void *ioParam) { mExecuteHost = true; if (inMessage == msg_CommandStatus) { SCommandStatus *status = (SCommandStatus *)ioParam; if (status->command == cmd_Print) { *status->enabled = true; *status->usesMark = false; mExecuteHost = false; // we handled it } else if (status->command == cmd_PageSetup) { *status->enabled = true; *status->usesMark = false; mExecuteHost = false; // we handled it } } else if (inMessage == cmd_Print) { DoPrint(); mExecuteHost = false; // we handled it } else if (inMessage == cmd_PageSetup) { DoPageSetup(); mExecuteHost = false; // we handled it } }
bool wxHtmlEasyPrinting::PrintText(const wxString &htmltext, const wxString &basepath) { wxHtmlPrintout *p = CreatePrintout(); p->SetHtmlText(htmltext, basepath, true); bool ret = DoPrint(p); delete p; return ret; }
bool wxHtmlEasyPrinting::PrintFile(const wxString &htmlfile) { wxHtmlPrintout *p = CreatePrintout(); p->SetHtmlFile(htmlfile); bool ret = DoPrint(p); delete p; return ret; }
void MCPrinter::Render(MCCard *p_card, const MCRectangle& p_src, const MCRectangle& p_dst) { Open(); DoPrint(p_card, p_src, p_dst); Close(); }
void FConsoleLog::Serialise(const char* Text, EName Event) { if (Event == NAME_Dev && !developer) { return; } DoPrint(Text); }
void Log::Print(Level level, const char* format, ...) { if (level < _level) return; va_list valist; va_start(valist, format); DoPrint(level, format, valist); va_end(valist); }
bool wxRichTextPrinting::PrintBuffer(const wxRichTextBuffer& buffer) { SetRichTextBufferPrinting(new wxRichTextBuffer(buffer)); wxRichTextPrintout *p = CreatePrintout(); p->SetRichTextBuffer(m_richTextBufferPrinting); bool ret = DoPrint(p); delete p; return ret; }
void MCPrinter::DoLayout(MCCard *p_first_card, uint32_t p_number_of_cards, const MCRectangle& p_src_rect, bool p_marked) { if (m_loop_nesting > 0 && m_loop_status == STATUS_READY) { MCStack *t_card_owner; t_card_owner = p_first_card -> getstack(); // MW-2010-10-04: We should back up the *current* card of the stack, to restore after layout. MCCard *t_old_card; t_old_card = t_card_owner -> getcard(0); Boolean t_old_lock; t_old_lock = MClockmessages; // Lock messages, as we do not want any opencard messages etc. to be sent when cycling cards. MClockmessages = True; uint32_t t_number_cards_left; t_number_cards_left = p_number_of_cards; MCCard *t_current_card; t_current_card = p_first_card; while(t_number_cards_left > 0 && m_loop_status == STATUS_READY) { // Set the card of the stack. t_card_owner -> setcard(t_current_card, False, False); /// Calculate the layout for this card, and do a page break if required MCRectangle t_dst_rect; if (CalculateLayout(p_src_rect, t_dst_rect)) DoPageBreak(); // Print the card DoPrint(t_current_card, p_src_rect, t_dst_rect); UpdateLayout(t_dst_rect); // Advance card do { t_current_card = t_current_card -> next(); } while(!t_current_card -> countme(0, p_marked)); // Skip marked cards if p_marked is true t_number_cards_left -= 1; } // Reset old state. t_card_owner -> setcard(t_old_card, False, False); MClockmessages = t_old_lock; } }
bool wxRichTextPrinting::PrintFile(const wxString& richTextFile) { SetRichTextBufferPrinting(new wxRichTextBuffer); if (!m_richTextBufferPrinting->LoadFile(richTextFile)) { SetRichTextBufferPrinting(NULL); return false; } wxRichTextPrintout *p = CreatePrintout(); p->SetRichTextBuffer(m_richTextBufferPrinting); bool ret = DoPrint(p); delete p; return ret; }
void wxVideoTerminal::TryStream(wxChar chr) { switch (chr) { case 0x07: // BELL DoBell(); break; case 0x08: // BS DoBackspace(); break; case 0x09: // HT DoTab(); break; case 0x0a: // LF DoFormfeed(); break; case 0x0b: // VT DoVerticalTab(); break; case 0x0c: // FF DoLinefeed(); break; case 0x0d: // CR DoCarriageReturn(); break; case 0x0f: // SI DoShiftIn(); break; case 0x0e: // SO DoShiftOut(); break; case 0x1b: // ESC m_stream_state = STATE_ESCAPE; break; case 0x00: // NUL break; default: DoPrint(chr); } }
void CAPrintingAttachment::ExecuteSelf( MessageT inMessage, void* ioParam) { // Validate pointers. ValidateThis_(); // Common initialization & sanity check. SetExecuteHost(true); // Dispatch event. switch (inMessage) { case msg_CommandStatus: FindCommandStatus((SCommandStatus*) ioParam); break; case cmd_PageSetup: DoPageSetup(); SetExecuteHost(false); break; case cmd_Print: DoPrint(); SetExecuteHost(false); break; case cmd_PrintOne: DoPrintOne(); SetExecuteHost(false); break; } }
bool _HYChartWindow::_ProcessMenuSelection (long msel) { switch (msel) { case HY_CHART_WIN32_MENU_BASE: { // chart menu HandleChartOptions (); return true; } case HY_WINDOW_MENU_ID_FILE+1: // save menu case HY_WINDOW_MENU_ID_FILE+3: // save menu case HY_WINDOW_MENU_ID_FILE+4: { // save menu DoSave ((msel==HY_WINDOW_MENU_ID_FILE-1)?0:msel-HY_WINDOW_MENU_ID_FILE-2); return true; } case HY_WINDOW_MENU_ID_FILE+2: // print menu case HY_WINDOW_MENU_ID_FILE+5: { // print menu DoPrint ((msel==HY_WINDOW_MENU_ID_FILE+2)?0:-1); return true; } case HY_CHART_WIN32_MENU_BASE+1: // font menu case HY_CHART_WIN32_MENU_BASE+2: // font menu case HY_CHART_WIN32_MENU_BASE+3: { // font menu DoChangeFont (msel-HY_CHART_WIN32_MENU_BASE-1); return true; } case HY_CHART_WIN32_MENU_BASE+4: { // chart name RenameChartWindow (); return true; } default: { // proc menu if (msel>=HY_CHART_WIN32_MENU_BASE+5) { ExecuteProcessor (msel-HY_CHART_WIN32_MENU_BASE-5); return true; } } } return _HYTWindow::_ProcessMenuSelection(msel); }
void Logger::Print(const str& account, const str& message, LogLevel level) { if (level >= level_ && level < kLevelTypeCount) { DoPrint(this, account, message, level); } }
/*** zPrint - <print> editor function * * Prints file(s) or designated area * * Input: * NOARG Print current file * TEXTARG List of files to print * STREAMARG Print designated area * BOXARG Print designated area * LINEARG Print designated area * * Output: * Returns TRUE if the printing has been successful, FALSE otherwise * *************************************************************************/ flagType zPrint ( CMDDATA argData, ARG * pArg, flagType fMeta ) { flagType fOK; /* Holds the return value */ PFILE pFile; /* general file pointer */ /* * The following is used only when we scan a list of files (TEXTARG) */ flagType fNewFile; /* Did we open a new file ? */ buffer pNameList; /* Holds the list of file names */ char *pName, *pEndName; /* Begining and end of file names */ flagType fDone = FALSE; /* Did we finish with the list ? */ /* * If we can flush the files, that's the moment */ AutoSave (); switch (pArg->argType) { case NOARG: return (DoPrint (pFileHead, FALSE)); case TEXTARG: /* * Get the list in a buffer */ strcpy ((char *) pNameList, pArg->arg.textarg.pText); /* * Empty list = no work */ if (!*(pName = whiteskip (pNameList))) { return FALSE; } /* * For each name: * - pName points at the begining * - Make pEndName pointing just past its ends * - If it's already the end of the string * then we're done with the list * else put a zero terminator there * - Do the job with the name we've found : * . Get the file handle (if it doen't exist yet, * create one and switch fNewFile on * . Call DoPrint * - Let pName point to the next name */ fOK = TRUE; do { pEndName = whitescan (pName); if (*pEndName) { *pEndName = 0; } else { fDone = TRUE; } if ((pFile = FileNameToHandle (pName, pName)) == NULL) { pFile = AddFile (pName); FileRead (pName, pFile, FALSE); fNewFile = TRUE; } else { fNewFile = FALSE; } fOK &= DoPrint (pFile, FALSE); if (fNewFile) { RemoveFile (pFile); } pName = whiteskip (++pEndName); } while (!fDone && *pName); /* * Just in case we would change the behaviour to stopping all * things at the first error : * * } while (fOK && !fDone && *pName); */ return (fOK); case STREAMARG: case BOXARG: case LINEARG: /* * If we print an area, we'll put the text in a temporary file, * call DoPrint with this file and then destroy it. */ pFile = GetTmpFile (); switch (pArg->argType) { case STREAMARG: CopyStream (pFileHead, pFile, pArg->arg.streamarg.xStart, pArg->arg.streamarg.yStart, pArg->arg.streamarg.xEnd, pArg->arg.streamarg.yEnd, 0L,0L); break; case BOXARG: CopyBox (pFileHead, pFile, pArg->arg.boxarg.xLeft, pArg->arg.boxarg.yTop, pArg->arg.boxarg.xRight, pArg->arg.boxarg.yBottom, 0L,0L); break; case LINEARG: CopyLine (pFileHead, pFile, pArg->arg.linearg.yStart, pArg->arg.linearg.yEnd, 0L); break; } /* * If we have to spawn a print command, then we need to make a real * disk file */ if (pPrintCmd && (!FileWrite (pFile->pName, pFile))) { fOK = FALSE; } else { fOK = DoPrint (pFile, TRUE); } RemoveFile (pFile); return (fOK); } argData; fMeta; }
void GBStackBrain::ExecutePrimitive(GBSymbolIndex index, GBRobot * robot, GBWorld * world) { GBStackDatum temp, temp2, temp3; long tempInt; switch ( index ) { case opNop: break; // stack manipulation case opDrop: Pop(); break; case op2Drop: Pop(); Pop(); break; case opNip: temp = Pop(); Pop(); Push(temp); break; case opRDrop: PopReturn(); break; case opDropN: { int n = PopInteger(); if ( n > stackHeight ) throw GBBadArgumentError(); stackHeight -= n; } break; case opSwap: temp = Pop(); temp2 = Pop(); Push(temp); Push(temp2); break; case op2Swap: { GBVector v1 = PopVector(); GBVector v2 = PopVector(); PushVector(v1); PushVector(v2); } break; case opRotate: temp = Pop(); temp2 = Pop(); temp3 = Pop(); Push(temp2); Push(temp); Push(temp3); break; case opReverseRotate: temp = Pop(); temp2 = Pop(); temp3 = Pop(); Push(temp); Push(temp3); Push(temp2); break; case opDup: temp = Peek(); Push(temp); break; case op2Dup: temp = Peek(2); temp2 = Peek(); Push(temp); Push(temp2); break; case opTuck: temp = Pop(); temp2 = Pop(); Push(temp); Push(temp2); Push(temp); break; case opOver: temp = Peek(2); Push(temp); break; case op2Over: temp = Peek(4); temp2 = Peek(3); Push(temp); Push(temp2); break; case opStackHeight: Push(stackHeight); break; case opStackLimit: Push(kStackLimit); break; case opPick: Push(Peek(PopInteger())); break; case opToReturn: PushReturn(ToAddress(Pop())); break; case opFromReturn: Push(PopReturn()); break; // branches case opJump: pc = ToAddress(Pop()); break; case opCall: ExecuteCall(ToAddress(Pop())); break; case opReturn: pc = PopReturn(); break; case opIfGo: temp = Pop(); if ( Pop().Nonzero() ) pc = ToAddress(temp); break; case opIfElseGo: temp = Pop(); temp2 = Pop(); if ( Pop().Nonzero() ) pc = ToAddress(temp2); else pc = ToAddress(temp); break; case opIfCall: temp = Pop(); if ( Pop().Nonzero() ) ExecuteCall(ToAddress(temp)); break; case opIfElseCall: temp = Pop(); temp2 = Pop(); if ( Pop().Nonzero() ) ExecuteCall(ToAddress(temp2)); else ExecuteCall(ToAddress(temp)); break; case opIfReturn: if ( Pop().Nonzero() ) pc = PopReturn(); break; case opNotIfGo: temp = Pop(); if ( ! Pop().Nonzero() ) pc = ToAddress(temp); break; case opNotIfReturn: if ( ! Pop().Nonzero() ) pc = PopReturn(); break; case opNotIfCall: temp = Pop(); if ( ! Pop().Nonzero() ) ExecuteCall(ToAddress(temp)); break; // arithmetic case opAdd: TwoNumberToNumberOp(&GBNumber::operator +); break; case opSubtract: TwoNumberToNumberOp(&GBNumber::operator -); break; case opNegate: NumberToNumberOp(&GBNumber::operator -); break; // mult and divide are written out because of MrCpp internal error case opMultiply: temp = Pop(); Push(Pop() * temp); break; case opDivide: temp = Pop(); Push(Pop() / temp); break; case opReciprocal: Push(GBNumber(1) / Pop()); break; case opMod: TwoNumberToNumberOp(&GBNumber::Mod); break; case opRem: TwoNumberToNumberOp(&GBNumber::Rem); break; case opSqrt: NumberToNumberOp(&GBNumber::Sqrt); break; case opExponent: TwoNumberToNumberOp(&GBNumber::Exponent); break; case opIsInteger: PushBoolean(Pop().IsInteger()); break; case opFloor: Push(Pop().Floor()); break; case opCeiling: Push(Pop().Ceiling()); break; case opRound: Push(Pop().Round()); break; case opMin: TwoNumberToNumberOp(&GBNumber::Min); break; case opMax: TwoNumberToNumberOp(&GBNumber::Max); break; case opAbs: NumberToNumberOp(&GBNumber::Abs); break; case opSignum: NumberToNumberOp(&GBNumber::Signum); break; case opReorient: NumberToNumberOp(&GBNumber::Reorient); break; case opSine: NumberToNumberOp(&GBNumber::Sin); break; case opCosine: NumberToNumberOp(&GBNumber::Cos); break; case opTangent: NumberToNumberOp(&GBNumber::Tan); break; case opArcSine: NumberToNumberOp(&GBNumber::ArcSin); break; case opArcCosine: NumberToNumberOp(&GBNumber::ArcCos); break; case opArcTangent: NumberToNumberOp(&GBNumber::ArcTan); break; case opRandom: temp = Pop(); Push(world->Randoms().InRange(Pop(), temp)); break; case opRandomAngle: Push(world->Randoms().Angle()); break; case opRandomInt: temp = Pop(); Push(world->Randoms().LongInRange(Pop().Ceiling(), temp.Floor())); break; case opRandomBoolean: PushBoolean(world->Randoms().Boolean(Pop())); break; // constants case opPi: Push(GBNumber::pi); break; case op2Pi: Push(GBNumber::pi * 2); break; case opPiOver2: Push(GBNumber::pi / 2); break; case opE: Push(GBNumber::e); break; case opEpsilon: Push(GBNumber::epsilon); break; case opInfinity: Push(GBNumber::infinity); break; // vector operations case opRectToPolar: { GBVector v = PopVector(); Push(v.Norm()); Push(v.Angle()); } break; case opPolarToRect: temp = Pop(); temp2 = Pop(); PushVector(GBFinePoint::MakePolar(temp2, temp)); break; case opVectorAdd: TwoVectorToVectorOp(&GBFinePoint::operator +); break; case opVectorSubtract: TwoVectorToVectorOp(&GBFinePoint::operator -); break; case opVectorNegate: VectorToVectorOp(&GBFinePoint::operator -); break; case opVectorScalarMultiply: temp = Pop(); PushVector(PopVector() * temp); break; case opVectorScalarDivide: temp = Pop(); PushVector(PopVector() / temp); break; case opVectorNorm: VectorToScalarOp(&GBFinePoint::Norm); break; case opVectorAngle: VectorToScalarOp(&GBFinePoint::Angle); break; case opDotProduct: TwoVectorToScalarOp(&GBFinePoint::DotProduct); break; case opProject: TwoVectorToVectorOp(&GBFinePoint::Projection); break; case opCross: TwoVectorToScalarOp(&GBFinePoint::Cross); break; case opUnitize: VectorToVectorOp(&GBFinePoint::Unit); break; case opDistance: Push((PopVector() - PopVector()).Norm()); break; case opInRange: temp = Pop(); PushBoolean(PopVector().InRange(PopVector(), temp)); break; case opRestrictPosition: { temp = Pop(); //wall distance GBVector pos = PopVector(); Push(pos.x.Max(temp).Min(world->Size().x - temp)); Push(pos.y.Max(temp).Min(world->Size().y - temp)); } break; case opVectorEqual: PushBoolean(PopVector() == PopVector()); break; case opVectorNotEqual: PushBoolean(PopVector() != PopVector()); break; // comparisons case opEqual: PushBoolean(Pop() == Pop()); break; case opNotEqual: PushBoolean(Pop() != Pop()); break; case opLessThan: temp = Pop(); PushBoolean(Pop() < temp); break; case opLessThanOrEqual: temp = Pop(); PushBoolean(Pop() <= temp); break; case opGreaterThan: temp = Pop(); PushBoolean(Pop() > temp); break; case opGreaterThanOrEqual: temp = Pop(); PushBoolean(Pop() >= temp); break; // booleans case opNot: PushBoolean(! Pop().Nonzero()); break; case opAnd: temp = Pop(); temp2 = Pop(); PushBoolean(temp.Nonzero() && temp2.Nonzero()); break; case opOr: temp = Pop(); temp2 = Pop(); PushBoolean(temp.Nonzero() || temp2.Nonzero()); break; case opXor: temp = Pop(); temp2 = Pop(); PushBoolean(temp.Nonzero() && ! temp2.Nonzero() || ! temp.Nonzero() && temp2.Nonzero()); break; case opNand: temp = Pop(); temp2 = Pop(); PushBoolean(! (temp.Nonzero() && temp2.Nonzero())); break; case opNor: temp = Pop(); temp2 = Pop(); PushBoolean(! (temp.Nonzero() || temp2.Nonzero())); break; case opValueConditional: temp = Pop(); temp2 = Pop(); if ( Pop().Nonzero() ) Push(temp2); else Push(temp); break; // misc external case opPrint: DoPrint(ToString(Pop())); if ( world->reportPrints ) NonfatalError(robot->Description() + " prints: " + *lastPrint); break; case opPrintVector: DoPrint(ToString(PopVector())); if ( world->reportPrints ) NonfatalError(robot->Description() + " prints: " + *lastPrint); break; case opBeep: StartSound(siBeep); break; case opStop: SetStatus(bsStopped); break; case opPause: if ( world->reportErrors ) world->running = false; break; case opSync: remaining = 0; break; // basic hardware case opSeekLocation: robot->EngineSeek(PopVector(), GBVector(0, 0)); break; case opSeekMovingLocation: { GBVector vel = PopVector(); robot->EngineSeek(PopVector(), vel); } break; case opDie: robot->Die(robot->Owner()); SetStatus(bsStopped); break; case opWriteLocalMemory: tempInt = PopInteger(); WriteLocalMemory(tempInt, Pop(), robot); break; case opReadLocalMemory: tempInt = PopInteger(); Push(ReadLocalMemory(tempInt, robot)); break; case opWriteLocalVector: tempInt = PopInteger(); WriteLocalMemory(tempInt + 1, Pop(), robot); WriteLocalMemory(tempInt, Pop(), robot); break; case opReadLocalVector: tempInt = PopInteger(); Push(ReadLocalMemory(tempInt, robot)); Push(ReadLocalMemory(tempInt + 1, robot)); break; case opWriteSharedMemory: tempInt = PopInteger(); robot->hardware.radio.Write(Pop(), tempInt, robot->Owner()); break; case opReadSharedMemory: Push(robot->hardware.radio.Read(PopInteger(), robot->Owner())); break; case opWriteSharedVector: tempInt = PopInteger(); robot->hardware.radio.Write(Pop(), tempInt + 1, robot->Owner()); robot->hardware.radio.Write(Pop(), tempInt, robot->Owner()); break; case opReadSharedVector: tempInt = PopInteger(); Push(robot->hardware.radio.Read(tempInt, robot->Owner())); Push(robot->hardware.radio.Read(tempInt + 1, robot->Owner())); break; case opMessagesWaiting: Push(robot->hardware.radio.MessagesWaiting(PopInteger(), robot->Owner())); break; case opSendMessage: { GBMessage sendee; tempInt = PopInteger(); //channel int numArgs = ToInteger(Pop()); //number of numbers for ( int i = 0; i < numArgs; i++ ) { sendee.AddDatum(Pop()); //higher indices in message correspond with earlier numbers in stack. :( } if ( numArgs <= 0 ) throw GBGenericError("Cannot send message of non-positive length"); robot->hardware.radio.Send(sendee, tempInt, robot->Owner()); } break; case opReceiveMessage: { tempInt = PopInteger(); const GBMessage * received = robot->hardware.radio.Receive(tempInt, robot->Owner()); if ( received == 0 ) { Push(0); } else { if ( received->Length() <= 0 ) { throw GBGenericError("non-positive length message received"); } for ( int i = received->Length() - 1; i >= 0; i-- ) Push(received->Datum(i)); Push(received->Length()); } } break; case opClearMessages: robot->hardware.radio.ClearChannel(PopInteger(), robot->Owner()); break; case opSkipMessages: tempInt = PopInteger(); robot->hardware.radio.SkipMessages(tempInt, PopInteger(), robot->Owner()); break; case opTypePopulation: { GBRobotType * theType = robot->Owner()->GetType(PopInteger()); if (theType) Push(theType->Population()); else Push(-1); } break; case opAutoConstruct: { GBConstructorState & ctor = robot->hardware.constructor; if ( robot->Energy() > robot->hardware.MaxEnergy() * .9 ) { if ( ! ctor.Type() ) ctor.Start(robot->Type()); ctor.SetRate(ctor.MaxRate()); } else ctor.SetRate(ctor.Type() && robot->Energy() > ctor.Remaining() + 10 ? ctor.MaxRate() : GBNumber(0)); } break; case opBalanceTypes: { // frac type -- GBRobotType * theType = robot->Owner()->GetType(PopInteger()); GBNumber fraction = Pop(); if (theType && GBNumber(theType->Population()) < fraction * robot->Owner()->Scores().Population()) robot->hardware.constructor.Start(theType); //FIXME don't abort? } break; // sensors case opFireRobotSensor: robot->hardware.sensor1.Fire(); break; case opFireFoodSensor: robot->hardware.sensor2.Fire(); break; case opFireShotSensor: robot->hardware.sensor3.Fire(); break; case opRobotSensorNext: Push(robot->hardware.sensor1.NextResult() ? 1 : 0); break; case opFoodSensorNext: Push(robot->hardware.sensor2.NextResult() ? 1 : 0); break; case opShotSensorNext: Push(robot->hardware.sensor3.NextResult() ? 1 : 0); break; case opPeriodicRobotSensor: FirePeriodic(robot->hardware.sensor1, world); break; case opPeriodicFoodSensor: FirePeriodic(robot->hardware.sensor2, world); break; case opPeriodicShotSensor: FirePeriodic(robot->hardware.sensor3, world); break; // weapons case opFireBlaster: robot->hardware.blaster.Fire(Pop()); break; case opFireGrenade: temp = Pop(); robot->hardware.grenades.Fire(Pop(), temp); break; case opLeadBlaster: { //pos vel -- GBVelocity vel = PopVector() - robot->Velocity(); GBPosition pos = PopVector() - robot->Position(); GBPosition target = LeadShot(pos, vel, robot->hardware.blaster.Speed(), robot->Radius()); if ( target.Nonzero() && target.Norm() <= robot->hardware.blaster.MaxRange() + robot->Radius() ) robot->hardware.blaster.Fire(target.Angle()); } break; case opLeadGrenade: { //pos vel -- GBVelocity vel = PopVector() - robot->Velocity(); GBPosition pos = PopVector() - robot->Position(); GBPosition target = LeadShot(pos, vel, robot->hardware.grenades.Speed(), robot->Radius()); if ( target.Nonzero() && target.Norm() <= robot->hardware.grenades.MaxRange() + robot->Radius() ) robot->hardware.grenades.Fire(target.Norm(), target.Angle()); //worry about short range? } break; case opSetForceField: { //pos angle -- temp = Pop(); GBPosition pos = PopVector() - robot->Position(); robot->hardware.forceField.SetDistance(pos.Norm()); robot->hardware.forceField.SetDirection(pos.Angle()); robot->hardware.forceField.SetAngle(temp); robot->hardware.forceField.SetPower(robot->hardware.forceField.MaxPower()); } break; // otherwise... default: throw GBUnknownInstructionError(); break; } }
void TPerformanceCounterBase::Finish() const { if (const size_t currentCounter = GetCurrentCounter()) { (*Output) << "(Finished) "; DoPrint(true, currentCounter); } }
void TPerformanceCounterBase::Print(const size_t currentCounter) const { DoPrint(false, currentCounter); }