本文整理汇总了C++中Reference::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::clear方法的具体用法?C++ Reference::clear怎么用?C++ Reference::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: experiment
void CraftingSessionImplementation::experiment(int rowsAttempted, const String& expAttempt, int clientCounter) {
ManagedReference<CraftingTool*> craftingTool = this->craftingTool.get();
ManagedReference<CreatureObject*> crafter = this->crafter.get();
ManagedReference<PlayerObject*> crafterGhost = this->crafterGhost.get();
ManagedReference<CraftingStation*> craftingStation = this->craftingStation.get();
ManagedReference<ManufactureSchematic*> manufactureSchematic = this->manufactureSchematic.get();
ManagedReference<TangibleObject*> prototype = this->prototype.get();
ManagedReference<CraftingManager*> craftingManager = this->craftingManager.get();
if (manufactureSchematic == NULL) {
sendSlotMessage(0, IngredientSlot::NOSCHEMATIC);
return;
}
if (prototype == NULL) {
sendSlotMessage(0, IngredientSlot::PROTOTYPENOTFOUND);
return;
}
Locker locker(craftingTool);
Locker locker2(manufactureSchematic);
Locker locker3(_this.get());
StringTokenizer tokenizer(expAttempt);
int rowEffected, pointsAttempted, failure;
int lowestExpSuccess = 0;
//lastExperimentationTimestamp = Time::currentNanoTime();
Reference<CraftingValues*> craftingValues = manufactureSchematic->getCraftingValues();
craftingValues->clear();
// Loop through all the lines of experimentation
for (int i = 0; i < rowsAttempted; ++i) {
rowEffected = tokenizer.getIntToken();
pointsAttempted = tokenizer.getIntToken();
experimentationPointsUsed += pointsAttempted;
// Each line gets it's own rolls
// Calcualte a new failure rate for each line of experimentation
failure = craftingManager->calculateExperimentationFailureRate(crafter,
manufactureSchematic, pointsAttempted);
if (experimentationPointsUsed <= experimentationPointsTotal) {
// Set the experimentation result ie: Amazing Success
experimentationResult = craftingManager->calculateExperimentationSuccess(
crafter, manufactureSchematic->getDraftSchematic(), failure);
} else {
// If this code is reached, they have likely tried to hack to
// get more experimenting points, so lets just give them a failure
experimentationResult = CraftingManager::CRITICALFAILURE;
}
// Make sure to store the lowest roll to display (Effect the multiline rolls
if (lowestExpSuccess < experimentationResult)
lowestExpSuccess = experimentationResult;
manufactureSchematic->increaseComplexity();
prototype->setComplexity(manufactureSchematic->getComplexity());
// Do the experimenting - sets new percentages
craftingManager->experimentRow(manufactureSchematic, craftingValues, rowEffected,
pointsAttempted, failure, experimentationResult);
}
manufactureSchematic->setExperimentingCounter(
manufactureSchematic->getExperimentingCounter() + rowsAttempted);
// Use percentages to recalculate the values
craftingValues->recalculateValues(false);
// Update the Tano with new values
prototype->updateCraftingValues(manufactureSchematic->getCraftingValues(), false);
// Sets the result for display
experimentationResult = lowestExpSuccess;
// Start Player Object Delta **************************************
PlayerObjectDeltaMessage9* dplay9 = new PlayerObjectDeltaMessage9(
crafter->getPlayerObject());
dplay9->setExperimentationPoints(experimentationPointsTotal
- experimentationPointsUsed);
dplay9->close();
crafter->sendMessage(dplay9);
// End Player Object Delta **************************************
ManufactureSchematicObjectDeltaMessage3* dMsco3 =
new ManufactureSchematicObjectDeltaMessage3(
manufactureSchematic);
dMsco3->updateComplexity(manufactureSchematic->getComplexity());
dMsco3->updateCraftingValues(manufactureSchematic);
dMsco3->close();
crafter->sendMessage(dMsco3);
//.........这里部分代码省略.........