void Reset() { pOwner = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(NPC_DEATHBRINGER_SAURFANG)); resetTimers(); doCast(SPELL_BLOOD_LINK_BEAST); scentcasted = false; }
Renderer::Renderer(Context *context, Conventions conventions, bool exactColorRounding) : VertexProcessor(context), PixelProcessor(context), SetupProcessor(context), context(context), viewport() { setGlobalRenderingSettings(conventions, exactColorRounding); setRenderTarget(0, nullptr); clipper = new Clipper; blitter = new Blitter; #if PERF_HUD resetTimers(); #endif for(int i = 0; i < 16; i++) { vertexTask[i] = nullptr; worker[i] = nullptr; resume[i] = nullptr; suspend[i] = nullptr; } threadsAwake = 0; resumeApp = new Event(); currentDraw = 0; nextDraw = 0; qHead = 0; qSize = 0; for(int i = 0; i < 16; i++) { triangleBatch[i] = nullptr; primitiveBatch[i] = nullptr; } for(int draw = 0; draw < DRAW_COUNT; draw++) { drawCall[draw] = new DrawCall(); drawList[draw] = drawCall[draw]; } for(int unit = 0; unit < 16; unit++) { primitiveProgress[unit].init(); } for(int cluster = 0; cluster < 16; cluster++) { pixelProgress[cluster].init(); } clipFlags = 0; swiftConfig = new SwiftConfig(disableServer); updateConfiguration(true); sync = new Resource(0); }
void Init() { CCTimer = rand()%10000; ThreatTimer = 5000; resetTimers(); m_creature->SetInCombatWithZone(); m_creature->SetRespawnDelay(DAY); }
void Reset() { if (!pInstance) return; pInstance->SetData(TYPE_SAURFANG, NOT_STARTED); stage = 0; beasts = 0; resetTimers(); }
void BSWScriptedAI::doReset() { memset(&m_uiSpell_Timer, 0, sizeof(m_uiSpell_Timer)); memset(&m_BossSpell,0,sizeof(m_BossSpell)); _bossSpellCount = 0; _loadSpellTable(); resetTimers(); };
BuildContext::BuildContext() : m_messageCount(0), m_textPoolSize(0) { memset(m_messages, 0, sizeof(char*) * MAX_MESSAGES); resetTimers(); }
void BossSpellWorker::Reset() { memset(&m_uiSpell_Timer, 0, sizeof(m_uiSpell_Timer)); memset(&m_BossSpell,0,sizeof(m_BossSpell)); _bossSpellCount = 0; LoadSpellTable(); resetTimers(); };
void Reset() { if (!pInstance) return; t_phase = 0; pInstance->SetData(TYPE_HALION, NOT_STARTED); resetTimers(); }
void Reset() { if (!pInstance) return; pInstance->SetData(TYPE_RAGEFIRE, NOT_STARTED); resetTimers(); phase = 0; }
void JustReachedHome() { if (pInstance) pInstance->SetData(TYPE_RAGEFIRE, FAIL); resetTimers(); m_uiFlyTimer = 50000; m_uiEnrageTimer = urand(20000,30000); m_uiWaitTimer = 5000; conflagated = false; }
void BSWScriptedAI::doReset() { Map* pMap = m_creature->GetMap(); if (pMap) currentDifficulty = pMap->GetDifficulty(); else currentDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; m_BSWRecords.clear(); setStage(0); _loadFromDB(); _fillEmptyDataField(); resetTimers(); };
int main(){ cout << "This experiment check for different values of parameters, how much time it takes to encrypt and decrypt a \"full\" matrix (nslots*nslots), and multply 2 encrypted matrices\nAlso check for what size of matrices, the multiplication in the server on the encrypted data is faster than for the user than do all the work on his machine. Using this formula: N > n(P)*(2*Enc(P)+Dec(P)) when:\nP is the parameters\nn(P) is the nslots value for these values\nEnc(P) and Dec(P) is the time it takes to encrypt and decrypt the matrics in size nslots*nslots\nNOTE: this formula don't take into account the time it takes to send and recieve the data to and from the server, and the time it took to the server to do the actual multiplication\n" << endl; /* long m=0, r=1; // Native plaintext space int p = 65539; // Computations will be 'modulo p' long L=16; // Levels long c=3; // Columns in key switching matrix long w=64; // Hamming weight of secret key long d=0; long s = 0; //minimum number of slots [ default=0 ] long security = 128;*/ long m, r, p, L, c, w, s, d, security, enc1, enc2, dec, encMul, ptMul, recommended; char tempChar; bool toEncMult = false, toPrint = false, debugMul = false, toSave = false; //Scan parameters cout << "Enter HElib's keys paramter. Enter zero for the recommended values" << endl; while(true){ cout << "Enter the field of the computations (a prime number): "; cin >> p; if(isPrime(p)) break; cout << "Error! p must be a prime number! " << endl; } while(true){ recommended = 1; cout << "Enter r (recommended " << recommended <<"): "; cin >> r; if(r == 0) r = recommended; if(r > 0) break; cout << "Error! r must be a positive number!" << endl; } while(true){ recommended = 16; cout << "Enter L (recommended " << recommended <<"): "; cin >> L; if(L == 0) L = recommended; if(L > 1) break; cout << "Error! L must be a positive number!" << endl; } while(true){ recommended = 3; cout << "Enter c (recommended " << recommended <<"): "; cin >> c; if(c == 0) c = recommended; if(c > 1) break; cout << "Error! c must be a positive number!" << endl; } while(true){ recommended = 64; cout << "Enter w (recommended " << recommended <<"): "; cin >> w; if(w == 0) w = recommended; if(w > 1) break; cout << "Error! w must be a positive number!" << endl; } while(true){ recommended = 0; cout << "Enter d (recommended " << recommended <<"): "; cin >> d; if(d >= 0) break; cout << "Error! d must be a positive or zero!" << endl; } while(true){ recommended = 0; cout << "Enter s (recommended " << recommended <<"): "; cin >> s; if(s >= 0) break; cout << "Error! s must be a positive or zero!" << endl; } while(true){ recommended = 128; cout << "Enter security (recommended " << recommended << "): "; cin >> security; if(security == 0) security = recommended; if(security >= 1) break; cout << "Error! security must be a positive number " << endl; } ZZX G; m = FindM(security,L,c,p, d, s, 0); FHEcontext context(m, p, r); // initialize context buildModChain(context, L, c); // modify the context, adding primes to the modulus chain FHESecKey secretKey(context); // construct a secret key structure const FHEPubKey& publicKey = secretKey; // an "upcast": FHESecKey is a subclass of FHEPubKey //if(0 == d) G = context.alMod.getFactorsOverZZ()[0]; secretKey.GenSecKey(w); // actually generate a secret key with Hamming weight w addSome1DMatrices(secretKey); EncryptedArray ea(context, G); // constuct an Encrypted array object ea that is // associated with the given context and the polynomial G long nslots = ea.size(), field = power(p,r); cout << "nslots: " << nslots << endl ; cout << "Computations will be modulo " << field << endl; cout << "m: " << m << endl; unsigned int sz1, sz2, sz3; while(true){ cout << "Enter number of rows in the first matrix: "; cin >> sz1; if(sz1 > 1 && sz1 <= nslots) break; cout << "Error! the value must be between 1 to " << nslots << "!" << endl; } while(true){ cout << "Enter number of rows in the first matrix: "; cin >> sz2; if(sz1 > 2 && sz2 <= nslots) break; cout << "Error! the value must be between 1 to " << nslots << "!" << endl; } while(true){ cout << "Enter number of rows in the first matrix: "; cin >> sz3; if(sz1 > 3 && sz3 <= nslots) break; cout << "Error! the value must be between 1 to " << nslots << "!" << endl; } PTMatrix PTmat1(MatSize(sz1, sz2),field), PTmat2(MatSize(sz2, sz3), field); //random matrix in size origSize1 while(true){ cout << "To multiply the encrypted matrices? Not affecting the formula, just for statistic" << endl; cout << "Y for yes, N for no: "; cin >> tempChar; if(tempChar == 'Y' || tempChar == 'y'){ toEncMult = true; break; } if(tempChar == 'N' || tempChar == 'n'){ toEncMult = false; break; } cout << "Error! invalid input!" << endl; } while(toEncMult){ cout << "Debug the multiplication steps?\nY for yesm N for no :"; cin >> tempChar; if(tempChar == 'Y' || tempChar == 'y'){ debugMul = true; break; } if(tempChar == 'N' || tempChar == 'n'){ debugMul = false; break; } cout << "Error! invalid input!" << endl; } while(true){ cout << "Print the matrices?" << endl; cout << "Y for yes, N for no: "; cin >> tempChar; if(tempChar == 'Y' || tempChar == 'y'){ toPrint = true; break; } if(tempChar == 'N' || tempChar == 'n'){ toPrint = false; break; } cout << "Error! invalid input!" << endl; } while(true){ cout << "Save the matrices?" << endl; cout << "Y for yes, N for no: "; cin >> tempChar; if(tempChar == 'Y' || tempChar == 'y'){ toSave = true; break; } if(tempChar == 'N' || tempChar == 'n'){ toSave = false; break; } cout << "Error! invalid input!" << endl; } if(toPrint){ PTmat1.print(); PTmat2.print(); } if(toSave){ ofstream out_mat1("mat1.txt"), out_mat2("mat2.txt"); PTmat1.save(out_mat1); PTmat2.save(out_mat2); out_mat1.close(); out_mat2.close(); } //encryptions cout << "Encrypting the first matrices..." << endl; resetTimers(); EncryptedMatrix encMat1 = PTmat1.encrypt(ea, publicKey); enc1 = stopTimers("to encrypt the first matrix"); cout << "Encrypting the second matrices..." << endl; resetTimers(); EncryptedMatrix encMat2 = PTmat2.encrypt(ea, publicKey); enc2 = stopTimers("to encrypt the second matrix"); //multiplication if(toEncMult){ cout << "Multiplying the matrices..." << endl; resetTimers(); if(debugMul) encMat1 = encMat1.debugMul(encMat2); //same as encMat1 *= encMat2 but print progress update else encMat1 *= encMat2; encMul = stopTimers("to multiply the matrices"); } cout << "Decrypting the result..." << endl; resetTimers(); PTMatrix res = encMat1.decrypt(ea, secretKey); dec = stopTimers("to decrypt the result"); if(toPrint) res.print("Solution: "); resetTimers(); PTMatrix PTres = PTmat1.mulWithMod(PTmat2,field); //like (PTmat1*PTmat2)%p but do modulu after each multiplication to avoid overflow ptMul = stopTimers("to multiply the regular matrices"); if(toSave){ ofstream out_res("mat_res.txt"), out_ptRes("mat_pt_res.txt"); res.save(out_res); PTres.save(out_ptRes); out_res.close(); out_ptRes.close(); } //PTres.print("pt result: "); cout << "\n\n----------------------------------------Summary------------------------------ " << endl; cout << "p: " << p << ", r: " << r << ", L: " << L << ", c: " << c << ", w: " << w << ", d: " << d << ", s: " << s << ", security: " << security << endl; cout << "nslots: " << nslots << "\nm: " << m << endl; cout << "It took " << enc1 << " clock ticks to encrypt the first matrix" << endl; cout << "It took " << enc2 << " clock ticks to encrypt the second matrix" << endl; cout << "It took " << dec << " clock ticks to decrypt the result" << endl; cout << "It took " << ptMul << " clock ticks to multiply the regular matrices" << endl; if(toEncMult){ cout << "It took " << encMul << " clock ticks to multiply the encrypted matrices" << endl; cout << "is correct? " << (res==PTres) << endl; } long N = nslots*(enc1+enc2+dec)/ptMul; cout << "N should be greater than " << N << endl; return 0; }
void BossSpellWorker::Reset(uint8 _Difficulty) { currentDifficulty = setDifficulty(_Difficulty); resetTimers(); };
BuildContext::BuildContext() : m_messageCount(0), m_textPoolSize(0) { resetTimers(); }
BuildContext() { resetTimers(); }
int main(){ long m, r, p, L, c, w, s, d, security, enc, dec, encMul, recommended; char tempChar; bool toPrint = false, toSave = false; //Scan parameters cout << "Enter HElib's keys paramter. Enter zero for the recommended values" << endl; while(true){ cout << "Enter the field of the computations (a prime number): "; cin >> p; if(isPrime(p)) break; cout << "Error! p must be a prime number! " << endl; } while(true){ recommended = 1; cout << "Enter r (recommended " << recommended <<"): "; cin >> r; if(r == 0) r = recommended; if(r > 0) break; cout << "Error! r must be a positive number!" << endl; } while(true){ recommended = 16; cout << "Enter L (recommended " << recommended <<"): "; cin >> L; if(L == 0) L = recommended; if(L > 1) break; cout << "Error! L must be a positive number!" << endl; } while(true){ recommended = 3; cout << "Enter c (recommended " << recommended <<"): "; cin >> c; if(c == 0) c = recommended; if(c > 1) break; cout << "Error! c must be a positive number!" << endl; } while(true){ recommended = 64; cout << "Enter w (recommended " << recommended <<"): "; cin >> w; if(w == 0) w = recommended; if(w > 1) break; cout << "Error! w must be a positive number!" << endl; } while(true){ recommended = 0; cout << "Enter d (recommended " << recommended <<"): "; cin >> d; if(d >= 0) break; cout << "Error! d must be a positive or zero!" << endl; } while(true){ recommended = 0; cout << "Enter s (recommended " << recommended <<"): "; cin >> s; if(s >= 0) break; cout << "Error! s must be a positive or zero!" << endl; } while(true){ recommended = 128; cout << "Enter security (recommended " << recommended << "): "; cin >> security; if(security == 0) security = recommended; if(security >= 1) break; cout << "Error! security must be a positive number " << endl; } ZZX G; m = FindM(security,L,c,p, d, s, 0); FHEcontext context(m, p, r); // initialize context buildModChain(context, L, c); // modify the context, adding primes to the modulus chain FHESecKey secretKey(context); // construct a secret key structure const FHEPubKey& publicKey = secretKey; // an "upcast": FHESecKey is a subclass of FHEPubKey //if(0 == d) G = context.alMod.getFactorsOverZZ()[0]; secretKey.GenSecKey(w); // actually generate a secret key with Hamming weight w addSome1DMatrices(secretKey); EncryptedArray ea(context, G); // constuct an Encrypted array object ea that is // associated with the given context and the polynomial G long nslots = ea.size(), field = power(p,r); cout << "nslots: " << nslots << endl ; cout << "Computations will be modulo " << field << endl; cout << "m: " << m << endl; unsigned int sz1, sz2, num; while(true){ cout << "Enter number of rows in the matrix: "; cin >> sz1; if(sz1 > 1 && sz1 <= nslots) break; cout << "Error! the value must be between 1 to " << nslots << "!" << endl; } while(true){ cout << "Enter number of columns in the matrix: "; cin >> sz2; if(sz1 > 2 && sz2 <= nslots) break; cout << "Error! the value must be between 1 to " << nslots << "!" << endl; } cout << "Enter the number you want to multiply the matrix by: "; cin >> num; MatSize sz(sz1, sz2); PTMatrix PTmat(sz,field); //random matrix in size origSize1 while(true){ cout << "Print the matrices?" << endl; cout << "Y for yes, N for no: "; cin >> tempChar; if(tempChar == 'Y' || tempChar == 'y'){ toPrint = true; break; } if(tempChar == 'N' || tempChar == 'n'){ toPrint = false; break; } cout << "Error! invalid input!" << endl; } while(true){ cout << "Save the matrices?" << endl; cout << "Y for yes, N for no: "; cin >> tempChar; if(tempChar == 'Y' || tempChar == 'y'){ toSave = true; break; } if(tempChar == 'N' || tempChar == 'n'){ toSave = false; break; } cout << "Error! invalid input!" << endl; } if(toPrint) PTmat.print(); if(toSave){ ofstream out_mat("mat.txt"); PTmat.save(out_mat); out_mat.close(); } //encryptions cout << "Encrypting the matrix..." << endl; resetTimers(); EncryptedMatrix encMat = PTmat.encrypt(ea, publicKey); enc = stopTimers("to encrypt the first matrix"); //Multiply by constant cout << "Multiplying the matricex by constant..." << endl; resetTimers(); encMat *= num; encMul = stopTimers("to multiply the matrix"); cout << "Decrypting the result..." << endl; resetTimers(); PTMatrix res = encMat.decrypt(ea, secretKey); dec = stopTimers("to decrypt the result"); if(toPrint) res.print("Solution: "); PTMatrix PTres = PTmat; for(unsigned int i=1; i < num; i++){ PTres += PTmat; } PTres %= field; if(toPrint) PTres.print("pt Solution: "); if(toSave){ ofstream out_res("mat_res.txt"), out_ptRes("mat_pt_res.txt"); res.save(out_res); PTres.save(out_ptRes); out_res.close(); out_ptRes.close(); } //PTres.print("pt result: "); cout << "\n\n----------------------------------------Summary------------------------------ " << endl; cout << "p: " << p << ", r: " << r << ", L: " << L << ", c: " << c << ", w: " << w << ", d: " << d << ", s: " << s << ", security: " << security << endl; cout << "nslots: " << nslots << "\nm: " << m << endl; cout << "It took " << enc << " clock ticks to encrypt the matrix" << endl; cout << "It took " << dec << " clock ticks to decrypt the result" << endl; cout << "It took " << encMul << " clock ticks to add the encrypted matrices" << endl; cout << "is correct? " << (res==PTres) << endl; return 0; }
/** * execute_fopen() * * refactor the fopen code for execute into this routine */ URL_FILE * url_execute_fopen(char *url, bool forwrite, extvar_t *ev, CopyState pstate) { URL_EXECUTE_FILE *file; int save_errno; struct itimers savetimers; pqsigfunc save_SIGPIPE; char *cmd; /* Execute command */ Assert(strncmp(url, EXEC_URL_PREFIX, strlen(EXEC_URL_PREFIX)) == 0); cmd = url + strlen(EXEC_URL_PREFIX); file = palloc0(sizeof(URL_EXECUTE_FILE)); file->common.type = CFTYPE_EXEC; /* marked as a EXEC */ file->common.url = pstrdup(url); file->shexec = make_command(cmd, ev); /* Execute command */ /* Clear process interval timers */ resetTimers(&savetimers); if (!execute_resowner_callback_registered) { RegisterResourceReleaseCallback(execute_abort_callback, NULL); execute_resowner_callback_registered = true; } file->handle = create_execute_handle(); /* * Preserve the SIGPIPE handler and set to default handling. This * allows "normal" SIGPIPE handling in the command pipeline. Normal * for PG is to *ignore* SIGPIPE. */ save_SIGPIPE = pqsignal(SIGPIPE, SIG_DFL); /* execute the user command */ file->handle->pid = popen_with_stderr(file->handle->pipes, file->shexec, forwrite); save_errno = errno; /* Restore the SIGPIPE handler */ pqsignal(SIGPIPE, save_SIGPIPE); /* Restore process interval timers */ restoreTimers(&savetimers); if (file->handle->pid == -1) { errno = save_errno; pfree(file->common.url); pfree(file); ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), errmsg("cannot start external table command: %m"), errdetail("Command: %s", cmd))); } return (URL_FILE *) file; }
RecastBuildContext::RecastBuildContext() { resetTimers(); }
void Reset() override { m_creature->SetRespawnDelay(DAY); m_uiStage = 0; resetTimers(); }
DayScreen::DayScreen(QWidget *parent) : QFrame(parent) { formalBellEffect.setSource(QUrl("qrc:/sounds/FormalTimerBell.wav")); formalBellEffect.setVolume(0.80f); dayBellEffect.setSource(QUrl("qrc:/sounds/DayTimerBell.wav")); dayBellEffect.setVolume(0.80f); // Label showing day number with button to restart (send to character screen) in same row dayLabel = new QLabel; restartButton = new QPushButton("Restart"); restartButton->setFocusPolicy(Qt::NoFocus); // Sends user to info screen infoButton = new InfoButton; QHBoxLayout *dayLayout = new QHBoxLayout; dayLayout->addWidget(dayLabel); dayLayout->addStretch(); dayLayout->addWidget(restartButton); dayLayout->addWidget(infoButton); // Labels displaying day timer dayTimerButton = new QPushButton("Timer"); dayTimerButton->setCheckable(true); dayTimerButton->setFocusPolicy(Qt::NoFocus); dayTimerLabel = new QLabel; dayTimerLabel->setObjectName("dayTimerLabel"); dayTimer = new QTimer(this); /* QHBoxLayout *dayTimerLayout = new QHBoxLayout; dayTimerLayout->addWidget(dayTimerButton); dayTimerLayout->addStretch(); dayTimerLayout->addWidget(dayTimerLabel); dayTimerLayout->addStretch(); */ // Button which when pushed, starts the formal timer formalTimerButton = new QPushButton("Formal"); formalTimerButton->setCheckable(true); formalTimerButton->setFocusPolicy(Qt::NoFocus); formalTimerLabel = new QLabel; formalTimerLabel->setObjectName("formalTimerLabel"); formalTimer = new QTimer(this); resetTimers(); /* QHBoxLayout *formalTimerLayout = new QHBoxLayout; formalTimerLayout->addWidget(formalTimerButton); formalTimerLayout->addStretch(); formalTimerLayout->addWidget(formalTimerLabel); formalTimerLayout->addStretch(); */ QGridLayout *timersLayout = new QGridLayout; timersLayout->addWidget(dayTimerButton, 0, 0); timersLayout->addWidget(dayTimerLabel, 0, 2); timersLayout->addWidget(formalTimerButton, 2, 0); timersLayout->addWidget(formalTimerLabel, 2, 2); //timersLayout->setContentsMargins(30, 30, 30, 30); timersLayout->setColumnMinimumWidth(1, 40); timersLayout->setRowMinimumHeight(1, 40); // Buttons for navigating to the morning phase, or start a new night phase prevButton = new QPushButton("Previous"); prevButton->setFocusPolicy(Qt::NoFocus); nightButton = new QPushButton("Night"); nightButton->setFocusPolicy(Qt::NoFocus); QHBoxLayout *navigBtnLayout = new QHBoxLayout; navigBtnLayout->addWidget(prevButton); navigBtnLayout->addStretch(); navigBtnLayout->addWidget(nightButton); QVBoxLayout *dayScreenLayout = new QVBoxLayout; dayScreenLayout->addLayout(dayLayout); dayScreenLayout->addStretch(); dayScreenLayout->addLayout(timersLayout); //dayScreenLayout->addLayout(dayTimerLayout); //dayScreenLayout->addLayout(formalTimerLayout); dayScreenLayout->addStretch(); dayScreenLayout->addLayout(navigBtnLayout); setLayout(dayScreenLayout); connect(dayTimer, &QTimer::timeout, this, &DayScreen::updateDayTimer); connect(dayTimerButton, &QPushButton::clicked, this, &DayScreen::startDayTimer); connect(formalTimer, &QTimer::timeout, this, &DayScreen::updateFormalTimer); connect(formalTimerButton, &QPushButton::clicked, this, &DayScreen::startFormalTimer); }