本文整理汇总了C++中TemplateManager类的典型用法代码示例。如果您正苦于以下问题:C++ TemplateManager类的具体用法?C++ TemplateManager怎么用?C++ TemplateManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TemplateManager类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: loadTravelFares
void PlanetManagerImplementation::loadTravelFares() {
TemplateManager* templateManager = TemplateManager::instance();
IffStream* iffStream = templateManager->openIffFile("datatables/travel/travel.iff");
if (iffStream == NULL) {
warning("Travel fares could not be found.");
return;
}
DataTableIff dtiff;
dtiff.readObject(iffStream);
//Initialize the rows so we can do a symmetric insert
for(int i = 0; i < dtiff.getTotalRows(); i++) {
VectorMap<String, int> planetFares;
DataTableRow* row = dtiff.getRow(i);
String departurePlanet = "";
row->getCell(0)->getValue(departurePlanet);
travelFares.put(departurePlanet, planetFares);
}
//Insert values
for(int i = 0; i < dtiff.getTotalRows(); i++) {
DataTableRow* row = dtiff.getRow(i);
String departurePlanet = "";
row->getCell(0)->getValue(departurePlanet);
for(int j=i+1; j<dtiff.getTotalColumns(); j++) {
String arrivalPlanet = dtiff.getColumnNameByIndex(j);
int fare = 0;
row->getCell(j)->getValue(fare);
travelFares.get(departurePlanet).put(arrivalPlanet, fare);
if(arrivalPlanet != departurePlanet)
travelFares.get(arrivalPlanet).put(departurePlanet, fare);
}
}
info("Loaded travel fares to " + String::valueOf(travelFares.size()) + " planets.");
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:40,代码来源:PlanetManagerImplementation.cpp
示例2: loadSnapshotObjects
void PlanetManagerImplementation::loadSnapshotObjects() {
TemplateManager* templateManager = TemplateManager::instance();
IffStream* iffStream = templateManager->openIffFile("snapshot/" + zone->getZoneName() + ".ws");
if (iffStream == NULL) {
info("Snapshot wasn't found.", true);
return;
}
WorldSnapshotIff wsiff;
wsiff.readObject(iffStream);
int totalObjects = 0;
Vector<SceneObject*> objects(1000, 1000);
for (int i = 0; i < wsiff.getNodeCount(); ++i) {
WorldSnapshotNode* node = wsiff.getNode(i);
if (node == NULL)
continue;
SceneObject* object = loadSnapshotObject(node, &wsiff, totalObjects);
if (object != NULL)
objects.add(object);
}
for (int i = 0; i < objects.size(); ++i)
objects.get(i)->createChildObjects();
delete iffStream;
printf("\n");
info("Loaded " + String::valueOf(totalObjects) + " client objects from world snapshot.", true);
}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:37,代码来源:PlanetManagerImplementation.cpp
示例3: constructStructure
int PlaceStructureSessionImplementation::constructStructure(float x, float y, int angle) {
positionX = x;
positionY = y;
directionAngle = angle;
TemplateManager* templateManager = TemplateManager::instance();
String serverTemplatePath = deedObject->getGeneratedObjectTemplate();
Reference<SharedStructureObjectTemplate*> serverTemplate = dynamic_cast<SharedStructureObjectTemplate*>(templateManager->getTemplate(serverTemplatePath.hashCode()));
if (serverTemplate == NULL || temporaryNoBuildZone != NULL)
return cancelSession(); //Something happened, the server template is not a structure template or temporaryNoBuildZone already set.
placeTemporaryNoBuildZone(serverTemplate);
String barricadeServerTemplatePath = serverTemplate->getConstructionMarkerTemplate();
int constructionDuration = 100; //Set the duration for 100ms as a fall back if it doesn't have a barricade template.
if (!barricadeServerTemplatePath.isEmpty()) {
constructionBarricade = ObjectManager::instance()->createObject(barricadeServerTemplatePath.hashCode(), 0, "");
if (constructionBarricade != NULL) {
constructionBarricade->initializePosition(x, 0, y); //The construction barricades are always at the terrain height.
StructureFootprint* structureFootprint = serverTemplate->getStructureFootprint();
if (structureFootprint != NULL && (structureFootprint->getRowSize() > structureFootprint->getColSize())) {
angle = angle + 180;
}
constructionBarricade->rotate(angle); //All construction barricades need to be rotated 180 degrees for some reason.
//constructionBarricade->insertToZone(zone);
zone->transferObject(constructionBarricade, -1, true);
constructionDuration = serverTemplate->getLotSize() * 3000; //3 seconds per lot.
}
}
Reference<Task*> task = new StructureConstructionCompleteTask(creatureObject);
task->schedule(constructionDuration);
return 0;
}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:43,代码来源:PlaceStructureSessionImplementation.cpp
示例4: fillAttributeList
void StructureDeedImplementation::fillAttributeList(AttributeListMessage* alm, CreatureObject* object) {
DeedImplementation::fillAttributeList(alm, object);
TemplateManager* templateManager = TemplateManager::instance();
uint32 structureCRC = generatedObjectTemplate.hashCode();
SharedStructureObjectTemplate* structureTemplate = dynamic_cast<SharedStructureObjectTemplate*>(templateManager->getTemplate(structureCRC));
if (structureTemplate == NULL)
return;
//Base Maintenance Rate
int baseMaintenanceRate = structureTemplate->getBaseMaintenanceRate();
int basePowerRate = structureTemplate->getBasePowerRate();
if (baseMaintenanceRate > 0)
alm->insertAttribute("examine_maintenance_rate", String::valueOf(baseMaintenanceRate) + " / hour"); //Base Maintenance Rate
if (surplusMaintenance > 0)
alm->insertAttribute("examine_maintenance", String::valueOf(surplusMaintenance)); //Surplus Maintenance
if (surplusPower > 0)
alm->insertAttribute("examine_power", String::valueOf(surplusPower)); //Surplus Power
if (hopperSizeMax > 0)
alm->insertAttribute("examine_hoppersize", String::valueOf((int)hopperSizeMax));
if (extractionRate > 0)
alm->insertAttribute("examine_extractionrate", String::valueOf(Math::getPrecision(extractionRate, 2)));
for (int i = 0; i < structureTemplate->getTotalAllowedZones(); ++i) {
String zoneName = structureTemplate->getAllowedZone(i);
if (zoneName.isEmpty())
continue;
alm->insertAttribute("examine_scene", "@planet_n:" + zoneName); //Can Be Built On
}
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:40,代码来源:StructureDeedImplementation.cpp
示例5: compose
void Template::compose( const TemplateManager & tm )
{
QMapConstIterator <QString, QString> i =
const_cast<QMap<QString, QString> &>(
d->requestedNestedTemplates).begin();
for( ; i != const_cast<QMap<QString, QString> &>(
d->requestedNestedTemplates).end(); ++i ) {
//try to acquire template of a given type
Template * t = tm.instantiate( i.data(), getLoggerPtr(),
d->requestedNestedTemplateLibs[ i.key() ] );
if( t != NULL ) {
// recursively compose even our nested templates
t->compose( tm );
// and put our template to our internal hash
registerNestedTemplate( i.key(), t );
}
}
}
开发者ID:acassis,项目名称:lintouch,代码行数:22,代码来源:Template.cpp
示例6: loadClientRegions
void PlanetManagerImplementation::loadClientRegions() {
TemplateManager* templateManager = TemplateManager::instance();
IffStream* iffStream = templateManager->openIffFile("datatables/clientregion/" + zone->getZoneName() + ".iff");
Reference<PlanetMapCategory*> cityCat = TemplateManager::instance()->getPlanetMapCategoryByName("city");
if (iffStream == NULL) {
info("No client regions found.");
return;
}
DataTableIff dtiff;
dtiff.readObject(iffStream);
for (int i = 0; i < dtiff.getTotalRows(); ++i) {
String regionName;
float x, y, radius;
DataTableRow* row = dtiff.getRow(i);
row->getValue(0, regionName);
row->getValue(1, x);
row->getValue(2, y);
row->getValue(3, radius);
ManagedReference<CityRegion*> cityRegion = regionMap.getRegion(regionName);
if (cityRegion == NULL) {
cityRegion = new CityRegion();
Locker locker(cityRegion);
cityRegion->deploy();
cityRegion->setRegionName(regionName);
cityRegion->setZone(zone);
regionMap.addRegion(cityRegion);
}
Locker locker(cityRegion);
ManagedReference<Region*> region = cityRegion->addRegion(x, y, radius, false);
locker.release();
if (region != NULL) {
Locker rlocker(region);
if (cityRegion->getRegionsCount() == 1) {//Register the first region only.
region->setPlanetMapCategory(cityCat);
zone->registerObjectWithPlanetaryMap(region);
}
region->setMunicipalZone(true);
ManagedReference<SceneObject*> scenery = NULL;
if (gcwManager != NULL) {
int strongholdFaction = gcwManager->isStrongholdCity(regionName);
if (strongholdFaction == GCWManager::IMPERIALHASH || regionName.contains("imperial")) {
scenery = zone->getZoneServer()->createObject(STRING_HASHCODE("object/static/particle/particle_distant_ships_imperial.iff"), 0);
} else if (strongholdFaction == GCWManager::REBELHASH || regionName.contains("rebel")) {
scenery = zone->getZoneServer()->createObject(STRING_HASHCODE("object/static/particle/particle_distant_ships_rebel.iff"), 0);
} else {
scenery = zone->getZoneServer()->createObject(STRING_HASHCODE("object/static/particle/particle_distant_ships.iff"), 0);
}
} else {
scenery = zone->getZoneServer()->createObject(STRING_HASHCODE("object/static/particle/particle_distant_ships.iff"), 0);
}
Locker slocker(scenery, region);
scenery->initializePosition(x, zone->getHeight(x, y) + 100, y);
region->attachScenery(scenery);
}
ManagedReference<ActiveArea*> noBuild = zone->getZoneServer()->createObject(STRING_HASHCODE("object/active_area.iff"), 0).castTo<ActiveArea*>();
Locker areaLocker(noBuild);
noBuild->initializePosition(x, 0, y);
ManagedReference<CircularAreaShape*> areaShape = new CircularAreaShape();
Locker shapeLocker(areaShape);
areaShape->setRadius(radius * 2);
areaShape->setAreaCenter(x, y);
noBuild->setAreaShape(areaShape);
noBuild->setRadius(radius * 2);
noBuild->setNoBuildArea(true);
// Cities already have "Municipal" protection so the structure no-build should not apply to camps
noBuild->setCampingPermitted(true);
Locker zoneLocker(zone);
zone->transferObject(noBuild, -1, true);
}
info("Added " + String::valueOf(regionMap.getTotalRegions()) + " client regions.");
//.........这里部分代码省略.........
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:101,代码来源:PlanetManagerImplementation.cpp
示例7: createCharacter
bool PlayerCreationManager::createCharacter(MessageCallback* data) {
TemplateManager* templateManager = TemplateManager::instance();
ClientCreateCharacterCallback* callback = cast<
ClientCreateCharacterCallback*>(data);
ZoneClientSession* client = data->getClient();
if (client->getCharacterCount(zoneServer.get()->getGalaxyID()) >= 10) {
ErrorMessage* errMsg = new ErrorMessage("Create Error", "You are limited to 10 characters per galaxy.", 0x0);
client->sendMessage(errMsg);
return false;
}
PlayerManager* playerManager = zoneServer.get()->getPlayerManager();
SkillManager* skillManager = SkillManager::instance();
//Get all the data and validate it.
UnicodeString characterName;
callback->getCharacterName(characterName);
//TODO: Replace this at some point?
if (!playerManager->checkPlayerName(callback))
return false;
String raceFile;
callback->getRaceFile(raceFile);
uint32 serverObjectCRC = raceFile.hashCode();
PlayerCreatureTemplate* playerTemplate =
dynamic_cast<PlayerCreatureTemplate*>(templateManager->getTemplate(
serverObjectCRC));
if (playerTemplate == NULL) {
error("Unknown player template selected: " + raceFile);
return false;
}
int raceID = playerTemplate->getRace();
String fileName = playerTemplate->getTemplateFileName();
String clientTemplate = templateManager->getTemplateFile(
playerTemplate->getClientObjectCRC());
RacialCreationData* raceData = racialCreationData.get(fileName);
if (raceData == NULL)
raceData = racialCreationData.get(0); //Just get the first race, since they tried to create a race that doesn't exist.
String profession, customization, hairTemplate, hairCustomization;
callback->getSkill(profession);
if (profession.contains("jedi"))
profession = "crafting_artisan";
callback->getCustomizationString(customization);
callback->getHairObject(hairTemplate);
callback->getHairCustomization(hairCustomization);
float height = callback->getHeight();
height = MAX(MIN(height, playerTemplate->getMaxScale()),
playerTemplate->getMinScale());
//validate biography
UnicodeString bio;
callback->getBiography(bio);
bool doTutorial = callback->getTutorialFlag();
//bool doTutorial = false;
ManagedReference<CreatureObject*> playerCreature =
zoneServer.get()->createObject(
serverObjectCRC, 2).castTo<CreatureObject*>();
if (playerCreature == NULL) {
error("Could not create player with template: " + raceFile);
return false;
}
Locker playerLocker(playerCreature);
playerCreature->createChildObjects();
playerCreature->setHeight(height);
playerCreature->setCustomObjectName(characterName, false); //TODO: Validate with Name Manager.
client->setPlayer(playerCreature);
playerCreature->setClient(client);
// Set starting cash and starting bank
playerCreature->setCashCredits(startingCash, false);
playerCreature->setBankCredits(startingBank, false);
ManagedReference<PlayerObject*> ghost = playerCreature->getPlayerObject();
if (ghost != NULL) {
//Set skillpoints before adding any skills.
ghost->setSkillPoints(skillPoints);
//.........这里部分代码省略.........
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:101,代码来源:PlayerCreationManager.cpp
示例8: loadProfessionDefaultsInfo
void PlayerCreationManager::loadProfessionDefaultsInfo() {
TemplateManager* templateManager = TemplateManager::instance();
IffStream* iffStream = templateManager->openIffFile(
"creation/profession_defaults.iff");
if (iffStream == NULL) {
error("Could not open creation profession data.");
return;
}
SkillDataForm pfdt;
pfdt.readObject(iffStream);
delete iffStream;
//Load the data into useful structs and store them in a map.
for (int i = 0; i < pfdt.getTotalPaths(); ++i) {
String name = pfdt.getSkillNameAt(i);
String path = pfdt.getPathBySkillName(name);
iffStream = templateManager->openIffFile(path);
if (iffStream == NULL)
continue;
Reference<ProfessionDefaultsInfo*> pdi = new ProfessionDefaultsInfo();
pdi->readObject(iffStream);
delete iffStream;
professionDefaultsInfo.put(name, pdi);
//info("Loading: " + pfdt.getSkillNameAt(i) + " Path: " + pfdt.getPathBySkillName(pfdt.getSkillNameAt(i)), true);
}
//Now we want to load the profession mods.
iffStream = templateManager->openIffFile(
"datatables/creation/profession_mods.iff");
DataTableIff dtiff;
dtiff.readObject(iffStream);
delete iffStream;
for (int i = 0; i < dtiff.getTotalRows(); ++i) {
DataTableRow* row = dtiff.getRow(i);
String key;
row->getValue(0, key);
//Check if the professionInfo for this exists.
Reference<ProfessionDefaultsInfo*> pdi = professionDefaultsInfo.get(
key);
if (pdi == NULL)
continue;
for (int i = 1; i < 10; ++i) {
int value = 0;
row->getValue(i, value);
pdi->setAttributeMod(i - 1, value);
}
}
info(
"Loaded " + String::valueOf(professionDefaultsInfo.size())
+ " creation professions.");
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:66,代码来源:PlayerCreationManager.cpp
示例9: switch
//.........这里部分代码省略.........
else if (JPEGUtils::isJpegImage(tempURL.toLocalFile()))
{
// Possible modification operations. Only apply it to JPEG for the moment.
kDebug() << "Set metadata from: " << file << " using (" << tempURL << ")";
DMetadata metadata(tempURL.toLocalFile());
metadata.setExifTagString("Exif.Image.DocumentName", QFileInfo(dest).fileName());
if (fixDateTime)
{
metadata.setImageDateTime(newDateTime, true);
}
//TODO: Set image tags using DMetadata.
if (colorLabel > NoColorLabel)
{
metadata.setImageColorLabel(colorLabel);
}
if (pickLabel > NoPickLabel)
{
metadata.setImagePickLabel(pickLabel);
}
if (rating > RatingMin)
{
metadata.setImageRating(rating);
}
if (!templateTitle.isNull() && !templateTitle.isEmpty())
{
TemplateManager* tm = TemplateManager::defaultManager();
kDebug() << "Metadata template title : " << templateTitle;
if (tm && templateTitle == Template::removeTemplateTitle())
{
metadata.removeMetadataTemplate();
}
else if (tm)
{
metadata.removeMetadataTemplate();
metadata.setMetadataTemplate(tm->findByTitle(templateTitle));
}
}
metadata.applyChanges();
// Convert JPEG file to lossless format if wanted,
// and move converted image to destination.
if (convertJpeg)
{
KUrl tempURL2(dest);
tempURL2 = tempURL2.upUrl();
tempURL2.addPath(QString(".digikam-camera-tmp2-%1").arg(getpid()).append(file));
temp = tempURL2.toLocalFile();
// when convertnig a file, we need to set the new format extension..
// The new extension is already set in importui.cpp.
kDebug() << "Convert to LossLess: " << file << " using (" << tempURL << ") destination: " << dest;
if (!JPEGUtils::jpegConvert(tempURL.toLocalFile(), tempURL2.toLocalFile(), file, losslessFormat))
{
开发者ID:rickysarraf,项目名称:digikam,代码行数:67,代码来源:cameracontroller.cpp
示例10: loadClientRegions
void PlanetManagerImplementation::loadClientRegions() {
TemplateManager* templateManager = TemplateManager::instance();
IffStream* iffStream = templateManager->openIffFile("datatables/clientregion/" + zone->getZoneName() + ".iff");
Reference<PlanetMapCategory*> cityCat = TemplateManager::instance()->getPlanetMapCategoryByName("city");
if (iffStream == NULL) {
info("No client regions found.");
return;
}
DataTableIff dtiff;
dtiff.readObject(iffStream);
for (int i = 0; i < dtiff.getTotalRows(); ++i) {
String regionName;
float x, y, radius;
DataTableRow* row = dtiff.getRow(i);
row->getValue(0, regionName);
row->getValue(1, x);
row->getValue(2, y);
row->getValue(3, radius);
ManagedReference<CityRegion*> cityRegion = regionMap.getRegion(regionName);
if (cityRegion == NULL) {
cityRegion = new CityRegion();
cityRegion->deploy();
cityRegion->setRegionName(regionName);
cityRegion->setZone(zone);
regionMap.addRegion(cityRegion);
}
ManagedReference<Region*> region = cityRegion->addRegion(x, y, radius, false);
if (region != NULL) {
if (cityRegion->getRegionsCount() == 1) {//Register the first region only.
region->setPlanetMapCategory(cityCat);
zone->registerObjectWithPlanetaryMap(region);
}
region->setMunicipalZone(true);
}
ManagedReference<ActiveArea*> noBuild = zone->getZoneServer()->createObject(String("object/active_area.iff").hashCode(), 0).castTo<ActiveArea*>();
noBuild->initializePosition(x, 0, y);
ManagedReference<CircularAreaShape*> areaShape = new CircularAreaShape();
areaShape->setRadius(radius * 2);
areaShape->setAreaCenter(x, y);
noBuild->setAreaShape(areaShape);
noBuild->setRadius(radius * 2);
noBuild->setNoBuildArea(true);
// Cities already have "Municipal" protection so the structure no-build should not apply to camps
noBuild->setCampingPermitted(true);
zone->transferObject(noBuild, -1, true);
}
info("Added " + String::valueOf(regionMap.getTotalRegions()) + " client regions.");
}
开发者ID:Skyyyr,项目名称:GR-Core-TC1,代码行数:61,代码来源:PlanetManagerImplementation.cpp
示例11: parseVariableData
void SharedTangibleObjectTemplate::parseVariableData(const String& varName, LuaObject* data) {
lua_State* state = data->getLuaState();
TemplateManager* templateManager = TemplateManager::instance();
if (varName == "certificationsRequired") {
LuaObject certifications(state);
certificationsRequired.removeAll();
for (int i = 1; i <= certifications.getTableSize(); ++i) {
certificationsRequired.add(certifications.getStringAt(i));
}
certifications.pop();
} else if (varName == "structureFootprintFileName") {
structureFootprint = templateManager->loadStructureFootprint(Lua::getStringParameter(state));
} else if (varName == "targetable") {
targetable = Lua::getByteParameter(state);
} else if (varName == "playerUseMask") {
playerUseMask = Lua::getShortParameter(state);
} else if (varName == "useCount") {
useCount = Lua::getIntParameter(state);
} else if (varName == "factoryCrateSize") {
factoryCrateSize = Lua::getIntParameter(state);
} else if (varName == "maxCondition") {
maxCondition = Lua::getIntParameter(state);
} else if (varName == "level") {
level = Lua::getIntParameter(state);
} else if (varName == "optionsBitmask") {
optionsBitmask = Lua::getIntParameter(state);
} else if (varName == "pvpStatusBitmask") {
pvpStatusBitmask = Lua::getIntParameter(state);
} else if (varName == "sliceable") {
sliceable = Lua::getIntParameter(state);
} else if (varName == "faction") {
String factionString = Lua::getStringParameter(state);
faction = factionString.toLowerCase().hashCode();
} else if (varName == "playerRaces") {
LuaObject races(state);
// Inherited lists need to be tossed if a new list is about to be created
if (playerRaces->size() != 0) {
playerRaces->removeAll();
}
for (int i = 1; i <= races.getTableSize(); ++i) {
String race = races.getStringAt(i);
if (!playerRaces->contains(race.hashCode())) {
playerRaces->add(race.hashCode());
}
}
races.pop();
} else if (varName == "skillMods") {
skillMods.removeAll();
LuaObject smods(state);
for (int i = 1; i <= smods.getTableSize(); ++i) {
lua_rawgeti(state, -1, i);
LuaObject mod(state);
String modName = mod.getStringAt(1);
int modValue = mod.getIntAt(2);
skillMods.put(modName, modValue);
mod.pop();
}
smods.pop();
} else if (varName == "numberExperimentalProperties") {
LuaObject numberExperimentalPropertiesList(state);
numberExperimentalProperties->removeAll();
for (int i = 1; i <= numberExperimentalPropertiesList.getTableSize(); ++i) {
numberExperimentalProperties->add(numberExperimentalPropertiesList.getIntAt(i));
}
numberExperimentalPropertiesList.pop();
} else if (varName == "experimentalProperties") {
LuaObject experimentalPropertiesList(state);
experimentalProperties->removeAll();
for (int i = 1; i <= experimentalPropertiesList.getTableSize(); ++i) {
experimentalProperties->add(experimentalPropertiesList.getStringAt(i));
}
experimentalPropertiesList.pop();
} else if (varName == "experimentalWeights") {
LuaObject experimentalWeightsList(state);
experimentalWeights->removeAll();
for (int i = 1; i <= experimentalWeightsList.getTableSize(); ++i) {
experimentalWeights->add(experimentalWeightsList.getIntAt(i));
}
experimentalWeightsList.pop();
} else if (varName == "experimentalGroupTitles") {
LuaObject experimentalGroupTitlesList(state);
experimentalGroupTitles->removeAll();
for (int i = 1; i <= experimentalGroupTitlesList.getTableSize(); ++i) {
experimentalGroupTitles->add(experimentalGroupTitlesList.getStringAt(i));
}
//.........这里部分代码省略.........
开发者ID:Stee7l,项目名称:legend-of-hondo,代码行数:101,代码来源:SharedTangibleObjectTemplate.cpp
示例12: buildTreeFromClient
bool ResourceTree::buildTreeFromClient() {
TemplateManager* templateManager = TemplateManager::instance();
IffStream* iffStream = templateManager->openIffFile("datatables/resource/resource_tree.iff");
if (iffStream == NULL) {
info("The Resource Tree could not be found.", true);
return false;
}
DataTableIff dtiff;
dtiff.readObject(iffStream);
Vector<String> currentClasses;
Vector<String> currentStfClasses;
baseNode = new ResourceTreeNode("resource", "Resources", 0);
String stringvalue, randomname, resourcecontainer;
int intvalue;
bool boolValue;
for (int i = 1; i < dtiff.getTotalRows(); ++i) {
DataTableRow* row = dtiff.getRow(i);
row->getValue(1, stringvalue);
ResourceTreeEntry* entry = new ResourceTreeEntry(stringvalue);
for (int j = 3; j <= 9; ++j) {
String resourceclass;
row->getValue(j, resourceclass);
if (resourceclass.isEmpty())
continue;
while (currentStfClasses.size() > j - 3) {
currentStfClasses.removeElementAt(j - 3);
currentClasses.removeElementAt(j - 3);
}
currentStfClasses.add(stringvalue);
currentClasses.add(resourceclass);
}
for (int j = 0; j < currentStfClasses.size(); ++j) {
entry->addClass(currentClasses.get(j));
entry->addStfClass(currentStfClasses.get(j));
}
row->getValue(10, intvalue);
entry->setMaxtype(intvalue);
row->getValue(11, intvalue);
entry->setMintype(intvalue);
row->getValue(12, intvalue);
entry->setMinpool(intvalue);
row->getValue(13, intvalue);
entry->setMaxpool(intvalue);
row->getValue(14, boolValue);
entry->setRecycled(boolValue);
for (int j = 16; j <= 26; ++j) {
row->getValue(j, stringvalue);
if (stringvalue == "")
break;
int min;
row->getCell(j + 11 + (j - 16))->getValue(min);
int max;
row->getCell(j + 12 + (j - 16))->getValue(max);
entry->addAttribute(new ResourceAttribute(stringvalue, min, max));
}
row->getCell(49)->getValue(stringvalue);
if(stringvalue != "")
resourcecontainer = stringvalue;
entry->setResourceContainerType(resourcecontainer);
row->getCell(50)->getValue(stringvalue);
if(stringvalue != "")
randomname = stringvalue;
entry->setRandomNameClass(randomname);
setZoneRestriction(entry);
setJtl(entry);
setSurveyToolType(entry);
setRecycleToolType(entry);
/// Add entry to the tree
baseNode->add(entry);
}
/// Update the Stf Entries now that the tree is built
//baseNode->updateEntries();
//.........这里部分代码省略.........
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:101,代码来源:ResourceTree.cpp
示例13: SetUp
void SetUp() {
// Perform setup of common constructs here.
lootGroupMap->initialize();
ASSERT_TRUE( templateManager != NULL );
if( templateManager->loadedTemplatesCount == 0 ) {
templateManager->loadLuaTemplates();
}
commandConfigManager->registerSpecialCommands(list);
commandConfigManager->loadSlashCommandsFile();
Vector<String> files;
files.add("string/en/mob/creature_names.stf");
files.add("string/en/npc_name.stf");
files.add("string/en/monster_name.stf");
files.add("string/en/droid_name.stf");
files.add("string/en/npc_spawner_n.stf");
files.add("string/en/theme_park_name.stf");
files.add("string/en/event_perk.stf");
files.add("string/en/bestine.stf");
files.add("string/en/theme_park/warren/warren_system_messages.stf");
files.add("string/en/newbie_tutorial/system_messages.stf");
files.add("string/en/chassis_npc.stf");
int count = 0;
for (int i = 0; i < files.size(); i++) {
String file = files.get(i);
ObjectInputStream* stream = templateManager->openTreFile(file);
if (stream != NULL) {
if (stream->size() > 4) {
StringFile stringFile;
if (stringFile.load(stream)) {
file = file.replaceFirst("string/en/","");
file = file.replaceFirst(".stf","");
HashTable<String, UnicodeString>* hashTable = stringFile.getStringMap();
HashTableIterator<String, UnicodeString> iterator = hashTable->iterator();
while (iterator.hasNext()) {
String name;
UnicodeString value;
iterator.getNextKeyAndValue(name, value);
String full = "@" + file + ":" + name;
mobNames.add(full);
count++;
}
}
}
delete stream;
}
}
ASSERT_TRUE( count > 0 ) << "Could not load creature names.";
}
开发者ID:Marott1,项目名称:Core3,代码行数:66,代码来源:LuaMobileTest.cpp
注:本文中的TemplateManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论