本文整理汇总了C++中BString::initRawBSTR方法的典型用法代码示例。如果您正苦于以下问题:C++ BString::initRawBSTR方法的具体用法?C++ BString::initRawBSTR怎么用?C++ BString::initRawBSTR使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BString
的用法示例。
在下文中一共展示了BString::initRawBSTR方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Call
void VehicleController::Call() {
if(body_) {
assert(false && "void Vehicle::call() body already exists");
return;
}
PlayerObject* owner = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(owner_));
if(owner->checkIfMountCalled()) {
LOG(info) << "VehicleController::Call : body already in world " << this->getId();
return;
}
if(!owner->isConnected() || owner->GetCreature()->isDead() || owner->GetCreature()->isIncapacitated()) {
LOG(info) << "VehicleController::Call : owner statecheck fail for " << this->getId();
return;
}
body_ = new MountObject();
BString cust;
cust.initRawBSTR((int8*)Swoop_Customization, BSTRType_ANSI);
body_->setCustomizationStr("");//cust.getAnsi());
body_->setCreoGroup(CreoGroup_Vehicle);
body_->setTypeOptions(0x1080);
body_->setMoodId(0);
body_->setCL(0);
body_->setId(mId + 1); // Vehicles are created by the VehicleControllerFactory with +2 step for IDs
body_->set_controller(this->getId());
body_->set_owner(owner->getId());
body_->setParentId(0);
body_->SetTemplate(mPhysicalModel);
body_->setSpeciesGroup(mNameFile.getAnsi());
body_->setSpeciesString(mName.getAnsi());
body_->SetPosture(0);
body_->setScale(1.0f);
std::string con = this->getAttribute<std::string>("condition");
uint32 health_current = atoi(con.substr(0,con.find_first_of("/")).c_str());
uint32 health_max = atoi(con.substr(con.find_first_of("/")+1,con.find_first_of("/")).c_str());
for(int8 i = 0; i<9;i++) {
body_->InitStatBase(0);
body_->InitStatCurrent(0);
body_->InitStatMax(0);
body_->InitStatWound(0);
}
body_->InitStatCurrent(HamBar_Health, health_current);
body_->InitStatMax(HamBar_Health, health_max);
owner->setMount(body_);
owner->setMounted(false);
owner->setMountCalled(false);
// Set default direction and position for the body.
body_->mDirection = owner->GetCreature()->mDirection;
body_->mPosition = owner->GetCreature()->mPosition;
// Move it forward 2 meters
body_->moveForward(2);
auto terrain = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::terrain::TerrainService>("TerrainService");
gObjectManager->LoadSlotsForObject(body_);
body_->mPosition.y = terrain->GetHeight(gWorldManager->getZoneId(), body_->mPosition.x,body_->mPosition.z) + 0.3;
// Finally rotate it perpendicular to the player.
body_->rotateRight(90.0f);
// add to world
if(!gWorldManager->addObject(body_)) {
DLOG(info) << "void Vehicle::call() creating vehicle with id "<<body_->getId()<<" failed : couldnt add to world";
SAFE_DELETE(body_);
return;
}
auto permissions_objects_ = gObjectManager->GetPermissionsMap();
body_->SetPermissions(permissions_objects_.find(swganh::object::RIDEABLE_PERMISSION)->second.get());//CREATURE_PERMISSION
//currently done by gWorldManager->addObject(body_)
//gSpatialIndexManager->createInWorld(body_);
gMessageLib->sendUpdateTransformMessage(body_);
owner->setMountCalled(true);
return;
}
示例2: Call
void VehicleController::Call() {
if(body_) {
assert(false && "void Vehicle::call() body already exists");
return;
}
if(owner_->checkIfMountCalled()) {
return;
}
if(!owner_->isConnected() || owner_->isDead() || owner_->isIncapacitated()) {
return;
}
body_ = new MountObject();
BString cust;
cust.initRawBSTR((int8*)Swoop_Customization, BSTRType_ANSI);
body_->setCustomizationStr(cust.getAnsi());
body_->setCreoGroup(CreoGroup_Vehicle);
body_->setTypeOptions(0x1080);
body_->setMoodId(0);
body_->setCL(0);
body_->setId(mId + 1); // Vehicles are created by the VehicleControllerFactory with +2 step for IDs
body_->set_controller(this->getId());
body_->set_owner(owner_->getId());
body_->setParentId(0);
body_->setModelString(mPhysicalModel);
body_->setSpeciesGroup(mNameFile.getAnsi());
body_->setSpeciesString(mName.getAnsi());
body_->states.setPosture(0);
body_->setScale(1.0f);
std::string con = this->getAttribute<std::string>("condition");
body_->getHam()->setPropertyValue(HamBar_Health, HamProperty_CurrentHitpoints,atoi(con.substr(0,con.find_first_of("/")).c_str()));
body_->getHam()->setPropertyValue(HamBar_Health, HamProperty_MaxHitpoints,atoi(con.substr(con.find_first_of("/")+1,con.find_first_of("/")).c_str()));
owner_->setMount(body_);
owner_->setMounted(false);
owner_->setMountCalled(false);
// Set default direction and position for the body.
body_->mDirection = owner_->mDirection;
body_->mPosition = owner_->mPosition;
// Move it forward 2 meters
body_->moveForward(2);
// And drop it a little below the terrain to allow the client to normalize it.
//body_->mPosition.y = Heightmap::getSingletonPtr()->getHeight(body_->mPosition.x, body_->mPosition.z) - 0.3f;
//TODO: Remove this patch when heightmaps are corrected!
if(owner_) {
float hmapHighest = Heightmap::getSingletonPtr()->getHeight(body_->mPosition.x, body_->mPosition.z) - 0.3f;
body_->mPosition.y = gHeightmap->compensateForInvalidHeightmap(hmapHighest, body_->mPosition.y, (float)10.0);
if(hmapHighest != body_->mPosition.y) {
DLOG(INFO) << " VehicleController::Call: PlayerID("<<owner_->getId() << ") calling vehicle... Heightmap found inconsistent, compensated height.";
}
}//end TODO
// Finally rotate it perpendicular to the player.
body_->rotateRight(90.0f);
// add to world
if(!gWorldManager->addObject(body_)) {
DLOG(INFO) << "void Vehicle::call() creating vehicle with id "<<body_->getId()<<" failed : couldnt add to world";
SAFE_DELETE(body_);
return;
}
//currently done by gWorldManager->addObject(body_)
//gSpatialIndexManager->createInWorld(body_);
gMessageLib->sendUpdateTransformMessage(body_);
owner_->setMountCalled(true);
return;
}