本文整理汇总了C++中getStats函数的典型用法代码示例。如果您正苦于以下问题:C++ getStats函数的具体用法?C++ getStats怎么用?C++ getStats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getStats函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getStats
void PlayerTroop::ResolveBattle(PlayerTroop* enemy){
if (getStats()->getAttack() > enemy->getStats()->getDefence()){
float damage = getStats()->getAttack();
damage /= enemy->getStats()->getArmour() + 1;
enemy->DealDamage(damage * Game->TIME.delta);
}
}
开发者ID:Vorskabobble,项目名称:Project-Lotus,代码行数:7,代码来源:PlayerTroop.cpp
示例2: getStringField
/*
* Example obtainting client stats from an E_CONNECT or E_STOP event
*/
void FmsAuthAdaptor::processStats(IFmsAuthEvent* pAev)
{
I64 statsHandle;
FmsClientStats baseStats;
if (!getI64Field(pAev, IFmsAuthEvent::F_CLIENT_STATS_HANDLE, statsHandle))
return;
char* pAppName = getStringField(pAev, IFmsAuthEvent::F_APP_NAME);
if (pAev->getType() == IFmsAuthEvent::E_CONNECT)
{
getStats(statsHandle, baseStats);
// log data
char buf[1024];
char hashKey[9];
memset(hashKey, 0, 9);
memcpy(hashKey, &statsHandle, sizeof(statsHandle));
sprintf(buf, "client Stats Handle= %s, bytes_in= %f, bytes_out= %f\n", hashKey,
static_cast<double>(baseStats.bytes_in), static_cast<double>(baseStats.bytes_out));
m_pFmsAuthServerContext->log(buf, IFmsServerContext::kInformation, false);
}
else if (pAev->getType() == IFmsAuthEvent::E_STOP)
{
getStats(statsHandle, baseStats);
}
}
开发者ID:dgdn,项目名称:videoo-server,代码行数:28,代码来源:AuthModule.cpp
示例3: Object
PlayerTroop::PlayerTroop(int health, int attack, int armour, int defence, int range, float speed, std::string name) : Object(name){
getStats()->setHealth(health);
getStats()->setAttack(attack);
getStats()->setArmour(armour);
getStats()->setDefence(defence);
getStats()->setRange(range);
getStats()->setSpeed(speed);
getStats()->setMaxHealth(health);
getStats()->setMaxAttack(attack);
getStats()->setMaxArmour(armour);
getStats()->setMaxDefence(defence);
m_target = NULL;
}
开发者ID:Vorskabobble,项目名称:Project-Lotus,代码行数:15,代码来源:PlayerTroop.cpp
示例4: getFiringAccuracy
/**
* Calculate firing accuracy.
* Formula = accuracyStat * weaponAccuracy * kneelingbonus(1.15) * one-handPenalty(0.8) * woundsPenalty(% health) * critWoundsPenalty (-10%/wound)
* @param actionType
* @param item
* @return firing Accuracy
*/
double BattleUnit::getFiringAccuracy(BattleActionType actionType, BattleItem *item)
{
double result = (double)(getStats()->firing / 100.0);
double weaponAcc = item->getRules()->getAccuracySnap();
if (actionType == BA_AIMEDSHOT || actionType == BA_LAUNCH)
weaponAcc = item->getRules()->getAccuracyAimed();
else if (actionType == BA_AUTOSHOT)
weaponAcc = item->getRules()->getAccuracyAuto();
else if (actionType == BA_HIT)
weaponAcc = item->getRules()->getAccuracyMelee();
result *= (double)(weaponAcc/100.0);
if (_kneeled)
result *= 1.15;
if (item->getRules()->isTwoHanded())
{
// two handed weapon, means one hand should be empty
if (getItem("STR_RIGHT_HAND") != 0 && getItem("STR_LEFT_HAND") != 0)
{
result *= 0.80;
}
}
return result * getAccuracyModifier();
}
开发者ID:Munkeylord,项目名称:OpenXcom,代码行数:35,代码来源:BattleUnit.cpp
示例5: getStats
bool Entity::humanCanWieldItem(const Item& item) const
{
Stat* myStats = getStats();
if ( !myStats )
{
return false;
}
if ( monsterAllyIndex >= 0 && (monsterAllyClass != ALLY_CLASS_MIXED || item.interactNPCUid == getUID()) )
{
return monsterAllyEquipmentInClass(item);
}
switch ( itemCategory(&item) )
{
case WEAPON:
return true;
case ARMOR:
return true;
case MAGICSTAFF:
return false;
case THROWN:
return false;
default:
return false;
}
return false;
}
开发者ID:ganthore,项目名称:Barony,代码行数:29,代码来源:monster_human.cpp
示例6: TEST_F
TEST_F(PacksTests, test_discovery_zero_state) {
auto pack = Pack("foobar", getPackWithDiscovery());
auto stats = pack.getStats();
EXPECT_EQ(stats.total, 0);
EXPECT_EQ(stats.hits, 0);
EXPECT_EQ(stats.misses, 0);
}
开发者ID:hungld,项目名称:osquery,代码行数:7,代码来源:packs_tests.cpp
示例7: query13
int query13() {
char filename[40];
char *linha=NULL;
Stats stats=NULL;
int ano, npublics,publics;
double percentagem=0.0;
CatalogoPtr c=NULL;
ano = npublics = publics=0;
printf("Nome do autor: ");
if (fgets(filename, 40, stdin) != NULL) {
linha = newline(filename);
}
ano = 0;
printf("Ano: ");
if(scanf("%d", &ano)>0) {
c=getCatalogo();
stats=getStats();
npublics = npublicsem(c,linha, ano);
publics=getPublics(ano,stats);
percentagem=(double)npublics/publics;
percentagem=percentagem*100;
printf("Percentagem relativa ao nr publicações de %d: %f\n",ano,percentagem);
}
return 1;
}
开发者ID:sabimbi,项目名称:LI3,代码行数:28,代码来源:queries.c
示例8: query10
int query10() {
int year = 0;
FILE *fp;
char filename[40];
Stats stats=NULL;
int i;
printf("Ano: ");
if(scanf("%d", &year)>0) {
getchar();
printf("Nome do ficheiro em qual quer gravar: ");
if (fgets(filename, 40, stdin) != NULL) {
fp = NULL;
fp = fopen(filename, "w");
fprintf(fp, "#Ano;#Autores;#Publicações\n");
stats = getStats();
while (stats->ano != year) {
if (year < stats->ano) {
stats = stats->left;
} else {
stats = stats->right;
}
}
printf("#Ano;#Autores;#Publicações\n");
for (i = 0; i <= 2; i++) {
printf("%d;%d;%d\n", stats->ano, i + 1, stats->coautores[i]);
fprintf(fp, "%d;%d;%d\n", stats->ano, i + 1, stats->coautores[i]);
}
fclose(fp);
}
}
return 1;
}
开发者ID:sabimbi,项目名称:LI3,代码行数:34,代码来源:queries.c
示例9: LogRelFlow
STDMETHODIMP MachineDebuggerWrap::GetStats(IN_BSTR aPattern,
BOOL aWithDescriptions,
BSTR *aStats)
{
LogRelFlow(("{%p} %s:enter aPattern=%ls aWithDescriptions=%RTbool aStats=%p\n", this, "MachineDebugger::getStats", aPattern, aWithDescriptions, aStats));
VirtualBoxBase::clearError();
HRESULT hrc;
try
{
CheckComArgOutPointerValidThrow(aStats);
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc()))
throw autoCaller.rc();
hrc = getStats(BSTRInConverter(aPattern).str(),
aWithDescriptions,
BSTROutConverter(aStats).str());
}
catch (HRESULT hrc2)
{
hrc = hrc2;
}
catch (...)
{
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
}
LogRelFlow(("{%p} %s: leave aStats=%ls hrc=%Rhrc\n", this, "MachineDebugger::getStats", *aStats, hrc));
return hrc;
}
开发者ID:bayasist,项目名称:vbox,代码行数:34,代码来源:MachineDebuggerWrap.cpp
示例10: run
void run() {
//Instance inst1 = InstanceGenerator::generate("./src/instances/test", 25, 3, 0, 0);
//generateInstances();
int numAnts = 100;
std::string path = "./src/instances/weakly_correlated/10k25i.dat";
//Instance inst = InstanceGenerator::generate(path, 25, 10, 1, 1);
Instance inst(path);
Colony col(inst, numAnts, 0.95, 2.0, 1.0);
getStats(col, 10, inst.getOptimal());
//ColonyTuner cT(inst1, numAnts);
//Colony col = cT.test();
//Solution best = col.run();
//printResults(col.getSolutionValues());
//std::cout << "Best solution found: " << best.getValue() << "\n";
//std::cout << "Optimal value: " << inst.getOptimal() << "\n";
//std::cout << best.toString() << "\n";
}
开发者ID:ronaldosvieira,项目名称:ant-colony,代码行数:25,代码来源:Runner.cpp
示例11: tr_statsFileCreated
void
tr_statsFileCreated (tr_session * session)
{
struct tr_stats_handle * s;
if ((s = getStats (session)))
s->single.filesAdded++;
}
开发者ID:cfpp2p,项目名称:Transmission-basin,代码行数:8,代码来源:stats.c
示例12: switch
/**
* Get the number of time units a certain action takes.
* @param actionType
* @param item
* @return TUs
*/
int BattleUnit::getActionTUs(BattleActionType actionType, BattleItem *item)
{
if (item == 0)
{
return 0;
}
switch (actionType)
{
case BA_PRIME:
return (int)floor(getStats()->tu * 0.50);
case BA_THROW:
return (int)floor(getStats()->tu * 0.25);
case BA_AUTOSHOT:
return (int)(getStats()->tu * item->getRules()->getTUAuto() / 100);
case BA_SNAPSHOT:
return (int)(getStats()->tu * item->getRules()->getTUSnap() / 100);
case BA_HIT:
return (int)(getStats()->tu * item->getRules()->getTUMelee() / 100);
case BA_LAUNCH:
case BA_AIMEDSHOT:
return (int)(getStats()->tu * item->getRules()->getTUAimed() / 100);
case BA_USE:
return (int)(getStats()->tu * item->getRules()->getTUUse() / 100);
case BA_MINDCONTROL:
case BA_PANIC:
return item->getRules()->getTUUse();
default:
return 0;
}
}
开发者ID:Munkeylord,项目名称:OpenXcom,代码行数:37,代码来源:BattleUnit.cpp
示例13: die
void CInimigo::die()
{
if(getStats()->getPV() <= 0)
{
divisorxp->giveXP();
estado = E_MORTO;
respawn = ENEMYRESPAWNTIME;
}
}
开发者ID:phabh,项目名称:warbugs,代码行数:9,代码来源:CInimigo.cpp
示例14: tr_statsAddDownloaded
void tr_statsAddDownloaded(tr_session* session, uint32_t bytes)
{
struct tr_stats_handle* s;
if ((s = getStats(session)) != NULL)
{
s->single.downloadedBytes += bytes;
s->isDirty = true;
}
}
开发者ID:transmission,项目名称:transmission,代码行数:10,代码来源:stats.c
示例15: getFittest
Individual<N> * Population<N>::iterate (int iterations) {
for (int i = 0; i < iterations; i++) {
Individual<N> * fittest = getFittest ();
if (fittest) {
return fittest;
}
else {
// print ();
if (OUTPUT) {
std::cout << std::endl
<< "WHOLE POPULATION:" << std::endl;
}
getStats (individuals, size);
// if (OUTPUT) print ();
if (OUTPUT) std::cout << "WINNERS:" << std::endl;
Individual<N> * winners = tournament ();
getStats (winners, size/2);
// if (OUTPUT) print (winners);
mutation (winners);
if (OUTPUT) std::cout << "WINNERS AFTER MUTATION:" << std::endl;
getStats (winners, size/2);
// if (OUTPUT) print (winners);
if (OUTPUT) std::cout << "CHILDREN:" << std::endl;
Individual<N> * children = crossOver (winners);
getStats (children, size/2);
// if (OUTPUT) print (children);
merge (winners, children);
return fittest;
}
}
return nullptr;
}
开发者ID:isaidhiptohop,项目名称:ops_2015,代码行数:43,代码来源:allinone.cpp
示例16: TEST_F
TEST_F(PacksTests, test_discovery_cache) {
auto pack = Pack("foobar", getPackWithDiscovery());
for (int i = 0; i < 5; i++) {
pack.checkDiscovery();
}
auto stats = pack.getStats();
EXPECT_EQ(stats.total, 5);
EXPECT_EQ(stats.hits, 4);
EXPECT_EQ(stats.misses, 1);
}
开发者ID:kk9599,项目名称:osquery,代码行数:10,代码来源:packs_tests.cpp
示例17: getStats
/**
* Restore soldier morale
*/
void BattleUnit::painKillers ()
{
if (!getFatalWounds() || !_needPainKiller)
{
return ;
}
_needPainKiller = false;
int lostHealth = getStats()->health - _health;
_morale += lostHealth;
}
开发者ID:Munkeylord,项目名称:OpenXcom,代码行数:13,代码来源:BattleUnit.cpp
示例18: tr_sessionGetCumulativeStats
void tr_sessionGetCumulativeStats(tr_session const* session, tr_session_stats* setme)
{
struct tr_stats_handle const* stats = getStats(session);
tr_session_stats current = TR_SESSION_STATS_INIT;
if (stats != NULL)
{
tr_sessionGetStats(session, ¤t);
addStats(setme, &stats->old, ¤t);
}
}
开发者ID:transmission,项目名称:transmission,代码行数:11,代码来源:stats.c
示例19: tr_sessionGetStats
void tr_sessionGetStats(tr_session const* session, tr_session_stats* setme)
{
struct tr_stats_handle const* stats = getStats(session);
if (stats != NULL)
{
*setme = stats->single;
setme->secondsActive = tr_time() - stats->startTime;
updateRatio(setme);
}
}
开发者ID:transmission,项目名称:transmission,代码行数:11,代码来源:stats.c
示例20: getAccuracyModifier
/**
* To calculate firing accuracy. Takes health and fatal wounds into account.
* Formula = accuracyStat * woundsPenalty(% health) * critWoundsPenalty (-10%/wound)
* @return modifier
*/
double BattleUnit::getAccuracyModifier()
{
double result = ((double)_health/(double)getStats()->health);
int wounds = _fatalWounds[BODYPART_HEAD] + _fatalWounds[BODYPART_RIGHTARM];
if (wounds > 9)
wounds = 9;
result *= 1 + (-0.1*wounds);
return result;
}
开发者ID:Munkeylord,项目名称:OpenXcom,代码行数:17,代码来源:BattleUnit.cpp
注:本文中的getStats函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论