本文整理汇总了C++中Transporter类的典型用法代码示例。如果您正苦于以下问题:C++ Transporter类的具体用法?C++ Transporter怎么用?C++ Transporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Transporter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DEBUG_LOG
void ClusterInterface::HandleTransporterMapChange(WorldPacket & pck)
{
//remove when this is stable, ROFL
DEBUG_LOG("Transport", "Handling clustered map change");
uint32 tentry, mapid;
float x, y, z;
pck >> tentry >> mapid >> x >> y >> z;
Transporter* t = objmgr.GetTransporterByEntry(tentry);
//we need to add to our map
MapMgr* mgr = sInstanceMgr.GetMapMgr(mapid);
LocationVector l;
l.x = x;
l.y = y;
l.z = z;
if (mgr == NULL)
return;
if (t->IsInWorld())
t->RemoveFromWorld(false);
t->SetMapId(mapid);
//don't start instantly, we start after eventclustermapchange is finished :P
sEventMgr.RemoveEvents(t);
//t->m_canmove = false;
t->AddToWorld(mgr);
sEventMgr.AddEvent(t, &Transporter::EventClusterMapChange, mapid, l, EVENT_UNK, 1, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT | EVENT_FLAG_MOVE_TO_WORLD_CONTEXT);
}
开发者ID:,项目名称:,代码行数:30,代码来源:
示例2: GetPlayer
void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & recv_data )
{
GetPlayer()->SetPlayerStatus(NONE);
if(_player->IsInWorld())
{
// get outta here
return;
}
sLog.outDebug( "WORLD: got MSG_MOVE_WORLDPORT_ACK." );
if(_player->m_CurrentTransporter && _player->GetMapId() != _player->m_CurrentTransporter->GetMapId())
{
/* wow, our pc must really suck. */
Transporter * pTrans = _player->m_CurrentTransporter;
float c_tposx = pTrans->GetPositionX() + _player->m_TransporterX;
float c_tposy = pTrans->GetPositionY() + _player->m_TransporterY;
float c_tposz = pTrans->GetPositionZ() + _player->m_TransporterZ;
WorldPacket dataw(SMSG_NEW_WORLD, 20);
dataw << pTrans->GetMapId() << c_tposx << c_tposy << c_tposz << _player->GetOrientation();
SendPacket(&dataw);
}
else
{
_player->m_TeleportState = 2;
_player->AddToWorld();
}
}
开发者ID:wow4all,项目名称:wowtbc,代码行数:28,代码来源:MovementHandler.cpp
示例3: posCallback
void TransporterNode::posCallback(const geometry_msgs::Twist::ConstPtr& msg)
{
ROS_INFO("Move dist [%f] & angle [%f]", msg->linear.x, msg->angular.z);
trobot.moveDistance(msg->linear.x);
trobot.moveAngle(msg->angular.z);
publish_odom();
}
开发者ID:weiin,项目名称:transporter-project,代码行数:7,代码来源:transporter_node.cpp
示例4: switch
void
TransporterRegistry::update_connections()
{
for (int i= 0, n= 0; n < nTransporters; i++){
Transporter * t = theTransporters[i];
if (!t)
continue;
n++;
const NodeId nodeId = t->getRemoteNodeId();
switch(performStates[nodeId]){
case CONNECTED:
case DISCONNECTED:
break;
case CONNECTING:
if(t->isConnected())
report_connect(nodeId);
break;
case DISCONNECTING:
if(!t->isConnected())
report_disconnect(nodeId, 0);
break;
}
}
}
开发者ID:A-eolus,项目名称:mysql,代码行数:25,代码来源:TransporterRegistry.cpp
示例5: velCallback
void TransporterNode::velCallback(const geometry_msgs::Twist::ConstPtr& msg)
{
ROS_INFO("Move at vx [%f] & w [%f]", msg->linear.x, msg->angular.z);
if (estopped)
trobot.moveVelocity(0,0);
else
trobot.moveVelocity(msg->linear.x, msg->angular.z);
publish_odom();
}
开发者ID:weiin,项目名称:transporter-project,代码行数:9,代码来源:transporter_node.cpp
示例6:
Uint32
TransporterRegistry::get_free_buffer(Uint32 node) const
{
Transporter *t;
if(likely((t = theTransporters[node]) != 0))
{
return t->get_free_buffer();
}
return 0;
}
开发者ID:A-eolus,项目名称:mysql,代码行数:10,代码来源:TransporterRegistry.cpp
示例7: Transporter
void ObjectMgr::LoadTransporters()
{
#ifdef CLUSTERING
return;
#endif
//!!!!!!!!!!!!! CATA !!!!!!!!!!!
// this seems to deadlock maps, disabling it until properly implemented
return;
//!!!!!!!!!!!!! CATA !!!!!!!!!!!
Log.Notice("ObjectMgr", "Loading Transports...");
QueryResult * QR = WorldDatabase.Query("SELECT entry FROM gameobject_names WHERE type = %u", GAMEOBJECT_TYPE_MO_TRANSPORT);
if(!QR) return;
int32 total = QR->GetRowCount();
do
{
uint32 entry = QR->Fetch()[0].GetUInt32();
//never do this !
// Transporter * pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER<<32 | entry); //wtf ?
uint32 lowguid = objmgr.GenerateLowGuid( HIGHGUID_TYPE_TRANSPORTER );
Transporter * pTransporter = new Transporter(((uint64)HIGHGUID_TYPE_TRANSPORTER<<32) | lowguid);
if(!pTransporter->CreateAsTransporter(entry, ""))
{
sLog.outDebug("Transporter %d failed creation for some reason.", entry);
delete pTransporter;
pTransporter = NULL;
}else
{
AddTransport(pTransporter);
QueryResult * result2 = WorldDatabase.Query("SELECT * FROM transport_creatures WHERE transport_entry = %u", entry);
if(result2)
{
do
{
pTransporter->AddNPC(result2->Fetch()[1].GetUInt32(), result2->Fetch()[2].GetFloat(),
result2->Fetch()[3].GetFloat(), result2->Fetch()[4].GetFloat(),
result2->Fetch()[5].GetFloat());
} while (result2->NextRow());
delete result2;
result2 = NULL;
}
}
} while(QR->NextRow());
delete QR;
QR = NULL;
}
开发者ID:AtVirus,项目名称:Descent-core,代码行数:51,代码来源:TransporterHandler.cpp
示例8: LOG_ERROR
Transporter* ObjectMgr::LoadTransportInInstance(MapMgr *instance, uint32 goEntry, uint32 period)
{
auto gameobject_info = sMySQLStore.getGameObjectProperties(goEntry);
if (gameobject_info == nullptr)
{
LOG_ERROR("Transport ID:%u, will not be loaded, gameobject_properties missing", goEntry);
return NULL;
}
if (gameobject_info->type != GAMEOBJECT_TYPE_MO_TRANSPORT)
{
LOG_ERROR("Transport ID:%u, Name: %s, will not be loaded, gameobject_properties type wrong", goEntry, gameobject_info->name.c_str());
return NULL;
}
std::set<uint32> mapsUsed;
Transporter* t = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER << 32 | goEntry);
// Generate waypoints
if (!t->GenerateWaypoints(gameobject_info->mo_transport.taxi_path_id))
{
LOG_ERROR("Transport ID:%u, Name: %s, failed to create waypoints", gameobject_info->entry, gameobject_info->name.c_str());
delete t;
return NULL;
}
// Create Transporter
if (!t->Create(goEntry, period))
{
delete t;
return NULL;
}
m_Transporters.insert(t);
m_TransportersByInstanceIdMap[instance->GetInstanceID()].insert(t);
AddTransport(t);
// AddObject To World
t->AddToWorld(instance);
// correct incorrect instance id's
t->SetInstanceID(instance->GetInstanceID());
t->SetMapId(t->GetMapId());
t->BuildStartMovePacket(instance);
t->BuildStopMovePacket(instance);
t->m_WayPoints.clear(); // Make transport stopped at server-side, movement will be handled by scripts
LogDetail("Transport Handler : Spawned Transport Entry %u, map %u, instance id %u", goEntry, t->GetMapId(), t->GetInstanceID());
return t;
}
开发者ID:armm77,项目名称:AscEmu,代码行数:52,代码来源:TransporterHandler.cpp
示例9: test_explorer
void test_explorer()
{
#define TEST_EXPORT
#define TEST_THREADS
enum {
queueBufferSize = 4096*8,
};
char queueBuffer[queueBufferSize];
TransportParams* pParams;
Transporter transporter;
pParams = transporter.TransportDataInit(
#ifdef TEST_EXPORT
TRUE,
#else
FALSE, //importMode
#endif
queueBuffer,
queueBufferSize,
FS_FILE_SWAP,
#ifdef TEST_EXPORT
MULTI_PATHS_ZEXPORT
#else
MULTI_PATHS_ZIMPPORT
#endif
);
transporter.Init(pParams);
#ifdef TEST_THREADS
transporter.Start();
for (;;) {
TransportStatus status;
transporter.GetStatus(&status);
_tprintf(TEXT("status %d expl %I64d xpot %I64d\n"), status.stateFlags, status.exploredSize, status.xportedSize);
if (status.stateFlags & TransportStatus::xportingComplete)
break;
Sleep(500);
}
#else //TEST_THREADS
#ifdef TEST_EXPORT
transporter.ExploreThreadMain();
transporter.XportThreadMain();
#else
transporter.XportThreadMain();
#endif
#endif //TEST_THREADS
transporter.Final();
transporter.TransportDataFinal(pParams);
}
开发者ID:khiemnv,项目名称:algorithms,代码行数:47,代码来源:main.cpp
示例10: Transporter
void ObjectMgr::LoadTransporters()
{
#ifdef CLUSTERING
return;
#endif
Log.Notice("ObjectMgr", "Loading Transports...");
QueryResult * QR = WorldDatabase.Query("SELECT entry FROM gameobject_names WHERE type = %u", GAMEOBJECT_TYPE_MO_TRANSPORT);
if(!QR)
return;
int64 total = QR->GetRowCount();
TransportersCount = total;
uint32 entry = NULL;
Transporter* pTransporter = NULL;
do
{
entry = QR->Fetch()[0].GetUInt32();
pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER<<32 | entry);
pTransporter->Init();
if(!pTransporter->CreateAsTransporter(entry, ""))
{
Log.Warning("ObjectMgr","Skipped invalid transporterid %d.", entry);
pTransporter->Destruct();
pTransporter = NULL;
}
else
{
AddTransport(pTransporter);
QueryResult * result2 = WorldDatabase.Query("SELECT * FROM transport_creatures WHERE transport_entry = %u", entry);
if(result2)
{
do
{
pTransporter->AddNPC(result2->Fetch()[1].GetUInt32(), result2->Fetch()[2].GetFloat(),
result2->Fetch()[3].GetFloat(), result2->Fetch()[4].GetFloat(),
result2->Fetch()[5].GetFloat());
} while (result2->NextRow());
delete result2;
}
}
} while(QR->NextRow());
delete QR;
}
开发者ID:WowDevs,项目名称:sandshroud-1,代码行数:47,代码来源:TransporterHandler.cpp
示例11: Transporter
void ObjectMgr::LoadTransporters()
{
#ifdef CLUSTERING
return;
#endif
Log.Notice("ObjectMgr", "Loading Transports...");
QueryResult * QR = WorldDatabase.Query("SELECT * FROM transport_data");
if (!QR) return;
int64 total = QR->GetRowCount();
TransportersCount = total;
do
{
uint32 entry = QR->Fetch()[0].GetUInt32();
int32 period = QR->Fetch()[2].GetInt32();
Transporter * pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER << 32 | entry);
if (!pTransporter->CreateAsTransporter(entry, "", period))
{
sLog.outError("Transporter %s failed creation for some reason.", QR->Fetch()[1].GetString());
delete pTransporter;
}
else
{
AddTransport(pTransporter);
QueryResult * result2 = WorldDatabase.Query("SELECT * FROM transport_creatures WHERE transport_entry = %u", entry);
if (result2)
{
do
{
pTransporter->AddNPC(result2->Fetch()[1].GetUInt32(), result2->Fetch()[2].GetFloat(),
result2->Fetch()[3].GetFloat(), result2->Fetch()[4].GetFloat(),
result2->Fetch()[5].GetFloat());
}
while (result2->NextRow());
delete result2;
}
}
}
while (QR->NextRow());
delete QR;
}
开发者ID:Nupper,项目名称:AscEmu_Vanilla,代码行数:45,代码来源:TransporterHandler.cpp
示例12: DBUG_ENTER
bool TransporterRegistry::connect_client(NdbMgmHandle *h)
{
DBUG_ENTER("TransporterRegistry::connect_client(NdbMgmHandle)");
Uint32 mgm_nodeid= ndb_mgm_get_mgmd_nodeid(*h);
if(!mgm_nodeid)
{
g_eventLogger.error("%s: %d", __FILE__, __LINE__);
return false;
}
Transporter * t = theTransporters[mgm_nodeid];
if (!t)
{
g_eventLogger.error("%s: %d", __FILE__, __LINE__);
return false;
}
DBUG_RETURN(t->connect_client(connect_ndb_mgmd(h)));
}
开发者ID:A-eolus,项目名称:mysql,代码行数:19,代码来源:TransporterRegistry.cpp
示例13: Transporter
void ObjectMgr::LoadTransporters()
{
Log.Notice("TransporterHandler", "Start loading transport_data");
{
const char* loadAllTransportData = "SELECT entry, name, period FROM transport_data";
QueryResult* result = WorldDatabase.Query(loadAllTransportData);
if (!result)
{
Log.Error("TransporterHandler", "Query failed: %s", loadAllTransportData);
return;
}
uint32 count = 0;
do
{
Field* field = result->Fetch();
TransporterDataQueryResult dbResult;
dbResult.entry = field[0].GetUInt32();
dbResult.name = field[1].GetString();
dbResult.period = field[2].GetUInt32();
GameObjectInfo* goInfo = GameObjectNameStorage.LookupEntry(dbResult.entry);
if (goInfo == nullptr)
{
Log.Error("TransporterHandler", "Transporter gameobject %u not available in GameObjectNameStorage!", dbResult.entry);
continue;
}
Transporter* pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER << 32 | dbResult.entry);
pTransporter->SetInfo(goInfo);
if (!pTransporter->CreateAsTransporter(dbResult.entry, "", dbResult.period))
{
Log.Error("TransporterHandler", "Transporter %s failed creation for some reason.", dbResult.name.c_str());
delete pTransporter;
}
else
{
Log.Debug("TransporterHandler", "%s, Entry: %u, Period: %u loaded", dbResult.name.c_str(), dbResult.entry, dbResult.period);
AddTransport(pTransporter);
++count;
}
}
while (result->NextRow());
delete result;
Log.Success("TransporterHandler", "%u transporters loaded from table transporter_data", count);
}
Log.Notice("TransporterHandler", "Start loading transport_creatures");
{
const char* loadTransportPassengers = "SELECT transport_entry, creature_entry, position_x, position_y, position_z, orientation FROM transport_creatures";
bool success = false;
QueryResult* result = WorldDatabase.Query(&success, loadTransportPassengers);
if (!success)
{
Log.Error("TransporterHandler", "Query failed: %s", loadTransportPassengers);
return;
}
uint32 count = 0;
if (result)
{
do
{
Field* field = result->Fetch();
uint32 transport_entry = field[0].GetUInt32();
uint32 creature_entry = field[1].GetUInt32();
auto transporter = GetTransporterByEntry(transport_entry);
if (transporter == nullptr)
{
Log.Error("TransporterHandler", "Could not find transporter %u for transport_creatures entry %u", transport_entry, creature_entry);
continue;
}
TransporterCreaturesQueryResult dbResult;
dbResult.transport_entry = field[0].GetUInt32();
dbResult.creature_entry = field[1].GetUInt32();
dbResult.position_x = field[2].GetFloat();
dbResult.position_y = field[3].GetFloat();
dbResult.position_z = field[4].GetFloat();
dbResult.orientation = field[5].GetFloat();
transporter->creature_transport_data.push_back(dbResult);
transporter->AddNPC(dbResult.creature_entry, dbResult.position_x, dbResult.position_y, dbResult.position_z, dbResult.orientation);
++count;
}
while (result->NextRow());
delete result;
Log.Success("TransporterHandler", "%u transport passengers from table transport_creatures loaded.", count);
}
}
}
开发者ID:TheGhostGroup,项目名称:AscEmu,代码行数:100,代码来源:TransporterHandler.cpp
示例14: game_loop
void game_loop(void)
{
//load font
ALLEGRO_FONT *font = al_load_ttf_font("RobotoMono-Medium.ttf",12,0);
//create floor array (will eventually make this a function)
srand(time(NULL));
for (int x = 0; x < 16; x++)
{
//for each y value between 2 and 13
for (int y = 0; y < 16; y++)
{
randX = 6 + (rand() % (int)(12 - 6 + 1));
randY = 0 + (rand() % (int)(3 - 0 + 1));
//drawDungeonTile(randX, randY, x, y);
floorArray [x] [y] [0] = randX;
floorArray [x] [y] [1] = randY;
}
}
Player p1;
//(speed, friction, sprint accel, max speed)
//default: p1.setMovement(1.4, .4, 1.8, 4);
p1.setMovement(1.4, .4, 1.8, 3);
p1.setPosition(tileSize * 7, tileSize * 12);
p1.setCurrentRoom(111);
p1.setInitial(tileSize,tileSize,240,240);
p1.setH(tileSize);
p1.setW(tileSize);
p1.setAnimation(tileSize * 0, tileSize * 0,0,0,9,4,0);
p1.canMove = true;
p1.vincible = true;
p1.blinking = false;
p1.blinkTimer = 5;
int tempBlinkTimer = p1.blinkTimer;
p1.knockback = 0;
p1.knockbackTimer = 0;
p1.setBound(19,27,7,3, 14,8,9,24);
//p1.setX(240);
//p1.setY(240);
p1.leavingTransport = 0;
//init player prototypes
void movePlayerUp(Player &p);
void movePlayerDown(Player &p);
void movePlayerLeft(Player &p);
void movePlayerRight(Player &p);
void sprintPlayer(Player &p);
void maxSpeedPlayer(Player &p);
void maxWalkSpeedPlayer(Player &p);
void updatePlayer(Player &p);
void collidePlayerWallX(Player &p, int obstacles [16][16]);
void collidePlayerWallY(Player &p, int obstacles [16][16]);
void collidePlayerMonster(Player &p, Monster m[]);
void drawPlayer(Player &p);
void resetPlayerAnimation(Player &p);
//load current room map
Room currentRoom;
currentRoom.getRoom(p1.getCurrentRoom());
//load all objects
objectArray currentArray;
currentArray.getObjects(p1.getCurrentRoom());
//load current room transporters
Transporter currentTrans;
currentTrans.exitNumber = 0;
//init monsters prototypes
Monster currentMonsters[numMonsters];
getMonsters(currentMonsters, currentArray.array);
void getMonsters (Monster m[], int array[][16]);
void drawMonsters (Monster m[]);
void collideMonsterWallX(Monster m[], int obstacles [16][16]);
void collideMonsterWallY(Monster m[], int obstacles [16][16]);
void updateMonstersX (Monster currentMonsters[]);
void updateMonstersY (Monster currentMonsters[]);
void seekMonsters (Monster m[], Player p);
int monsterDebug = 1;
//load current room's monsters
//currentMonsters.getObjects(p1.getCurrentRoom());
int vincibleTimer = 0;
bool showHitboxes = false;
al_start_timer(timer);
while (!done) {
ALLEGRO_EVENT event;
al_wait_for_event(event_queue, &event);
if (event.type == ALLEGRO_EVENT_TIMER)
{
if(key[keyW])
{
movePlayerUp(p1);
}
else if(key[keyS])
{
movePlayerDown(p1);
}
//.........这里部分代码省略.........
开发者ID:apdisant,项目名称:AllegroGameProgramming,代码行数:101,代码来源:main.cpp
示例15: main
int main(int argc, char ** argv){
//VideoSource vs(false, "./Various.avi");
VideoSource vs(true, "");
vs.enableDisplayWindow();
SupportedImageWidths siw = W512;
// Left to Right is bottom layer to top
//uint centroid_counts[] = {3,3,4,3,3,3,3,5};
uint centroid_counts[] = {4,3,5,3,3,2,3,4};
bool isUniform = true;
DestinNetworkAlt * network = new DestinNetworkAlt(siw, 8, centroid_counts, isUniform);
Transporter t;
vs.grab();//throw away first frame in case its garbage
int frameCount = 0;
while(vs.grab()){
frameCount++;
t.setSource(vs.getOutput());
t.transport(); //move video from host to card
testNan(t.getDest(), 512*512);
network->doDestin(t.getDest());
if(frameCount % 2 != 0 ){ //only print every 2rd so display is not so jumpy
printFPS(false);
continue;
}
// Old clear screen method
//printf("\033[2J");
// New clear screen method (might give less flickering...?)
printf("\033[2J\033[1;1H");
printf("Frame: %i\n", frameCount);
printFPS(true);
int layer = 1;
Node & n = *network->getNode(layer,0,0);
printf("Node %i,0,0 winner: %i\n",layer, n.winner);
printf("Node centroids: %i\n", n.nb);
printf("Node starv:");
printFloatArray(n.starv, n.nb);
printf("Starv coef: %f \n", n.starvCoeff);
printf("\n");
// 2013.4.5
// CZT
//
//printf("layer %i node 0 centroid locations:\n", layer);
//network->printNodeCentroidPositions(layer, 0, 0);
for(int l = 0 ; l < 8 ; l++){
printf("belief graph layer: %i\n",l);
network->printBeliefGraph(l,0,0);
}
}
delete network;
return 0;
}
开发者ID:BK-University,项目名称:destin,代码行数:69,代码来源:WebcamExp1.cpp
示例16: DEBUG_LOG
//.........这里部分代码省略.........
md5hash.UpdateData((const uint8*)acct_data->data, acct_data->sz);
md5hash.Finalize();
}
SendPacket(&data);
}
else
{
WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4);
MD5Hash md5hash;
data << uint32(UNIXTIME) << uint8(1) << uint32(0xEA);
for (int i = 0; i < 8; i++)
{
if(0xEA & (1 << i))
data << uint32(0);
AccountDataEntry* acct_data = GetAccountData(i);
if(acct_data)
{
md5hash.Initialize();
md5hash.UpdateData((const uint8*)acct_data->data, acct_data->sz);
md5hash.Finalize();
}
}
SendPacket(&data);
}
// Set TIME OF LOGIN
CharacterDatabase.Execute("UPDATE characters SET online = 1 WHERE guid = %u" , plr->GetLowGUID());
_player->ResetTitansGrip();
bool enter_world = true;
#ifndef CLUSTERING
// Find our transporter and add us if we're on one.
if(plr->m_TransporterGUID != 0)
{
Transporter* pTrans = objmgr.GetTransporter(GUID_LOPART(plr->m_TransporterGUID));
if(pTrans)
{
if(plr->isDead())
{
plr->RemoteRevive();
}
float c_tposx = pTrans->GetPositionX() + plr->m_transportPosition->x;
float c_tposy = pTrans->GetPositionY() + plr->m_transportPosition->y;
float c_tposz = pTrans->GetPositionZ() + plr->m_transportPosition->z;
if(plr->GetMapId() != pTrans->GetMapId()) // loaded wrong map
{
plr->SetMapId(pTrans->GetMapId());
WorldPacket dataw(SMSG_NEW_WORLD, 20);
dataw << pTrans->GetMapId() << c_tposx << c_tposy << c_tposz << plr->GetOrientation();
SendPacket(&dataw);
// shit is sent in worldport ack.
enter_world = false;
}
plr->SetPosition(c_tposx, c_tposy, c_tposz, plr->GetOrientation(), false);
plr->m_CurrentTransporter = pTrans;
pTrans->AddPlayer(plr);
}
}
#endif
if(plr->m_CurrentVehicle)
plr->m_CurrentVehicle->RemovePassenger(plr);
开发者ID:Refuge89,项目名称:Arc_Mind,代码行数:67,代码来源:CharacterHandler.cpp
示例17: LogNotice
void ObjectMgr::LoadTransports()
{
LogNotice("TransportHandler : Start creating transports...");
{
uint32_t createCount = 0;
for (auto it : sMySQLStore._transportDataStore)
{
GameObjectProperties const* gameobject_info = sMySQLStore.getGameObjectProperties(it.first);
std::set<uint32> mapsUsed;
Transporter* pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER << 32 | it.first);
if (pTransporter->GenerateWaypoints(gameobject_info->mo_transport.taxi_path_id) == false)
{
LOG_ERROR("Transport entry: %u, failed to create waypoints", it.first);
delete pTransporter;
continue;
}
if (pTransporter->Create(it.first, it.second.period) == false)
{
delete pTransporter;
continue;
}
pTransporter->AddToWorld();
m_Transporters.insert(pTransporter);
AddTransport(pTransporter);
for (std::set<uint32>::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i)
{
m_TransportersByMap[*i].insert(pTransporter);
}
++createCount;
}
LogDetail("Transporter Handler : Created %u transports", createCount);
}
LogNotice("TransportHandler : Start populating transports with creatures...");
{
for (auto it : sMySQLStore._transportCreaturesStore)
{
for (ObjectMgr::TransporterSet::iterator itr = m_Transporters.begin(); itr != m_Transporters.end(); ++itr)
{
if ((*itr)->getEntry() == it.second.transportEntry)
{
TransportSpawn spawn{ it.second.guid, it.second.entry, it.second.transportEntry, it.second.transportOffsetX, it.second.transportOffsetY, it.second.transportOffsetZ, it.second.transportOffsetO, it.second.animation };
(*itr)->AddCreature(spawn);
break;
}
}
}
for (auto transport : m_Transporters)
{
transport->RespawnCreaturePassengers();
}
}
}
开发者ID:armm77,项目名称:AscEmu,代码行数:64,代码来源:TransporterHandler.cpp
示例18: cos
void TransporterNode::publish_odom()
{
// store the current pose
prevPose.x = cur_x;
prevPose.y = cur_y;
prevPose.theta = cur_theta;
// calculate the new pose
double distance, angle;
trobot.getDisplacement(&distance, &angle);
cur_theta += angle;
cur_x += distance * cos(cur_theta);
cur_y += distance * sin(cur_theta);
ROS_DEBUG("PREVIOUS x = [%f], y = [%f], theta = [%f]\n", prevPose.x, prevPose.y, prevPose.theta);
ROS_DEBUG("CURRENT x = [%f], y = [%f], theta = [%f]\n", cur_x, cur_y, cur_theta);
current_time = ros::Time::now();
double dt = (current_time - last_time).toSec();
// convert rotation about z into quaternion
geometry_msgs::Quaternion odom_quat;
odom_quat.z = sin(cur_theta/2.0);
odom_quat.w = cos(cur_theta/2.0);
//next, we'll publish the odometry message over ROS
nav_msgs::Odometry odom;
odom.header.stamp = current_time;
odom.header.frame_id = "odom";
odom.child_frame_id = "base_footprint";
//set the position (with respect to header.frame)
odom.pose.pose.position.x = cur_x;
odom.pose.pose.position.y = cur_y;
odom.pose.pose.position.z = 0.0;
odom.pose.pose.orientation = odom_quat;
odom.pose.covariance =
boost::array<double, 36>{{1e-3, 0, 0, 0, 0, 0,
0, 1e-3, 0, 0, 0, 0,
0, 0, 1e6, 0, 0, 0,
0, 0, 0, 1e6, 0, 0,
0, 0, 0, 0, 1e6, 0,
0, 0, 0, 0, 0, 1e-3}};
//set the velocity (with respect to child_frame)
odom.twist.twist.linear.x = distance/dt;
odom.twist.twist.angular.z = angle/dt;
odom.twist.covariance =
boost::array<double, 36>{{1e-3, 0, 0, 0, 0, 0,
0, 1e-3, 0, 0, 0, 0,
0, 0, 1e6, 0, 0, 0,
0, 0, 0, 1e6, 0, 0,
0, 0, 0, 0, 1e6, 0,
0, 0, 0, 0, 0, 1e-3}};
//publish the message
odom_pub.publish(odom);
// publish joint state in order to show the continuous joints (wheels) in tf
sensor_msgs::JointState js;
js.header.stamp=current_time;
js.name.resize(2);
js.position.resize(2);
js.name[0]="left_wheel_joint";
js.name[1]="right_wheel_joint";
js.position[0]=0;
js.position[1]=0;
js_pub.publish(js);
last_time = current_time;
} //void TransporterNode::publish_odom()
开发者ID:weiin,项目名称:transporter-project,代码行数:70,代码来源:transporter_node.cpp
示例19: SetPlayer
//.........这里部分代码省略.........
WorldPacket data(SMSG_ACCOUNT_DATA_MD5, 128);
#endif
MD5Hash md5hash;
for (int i = 0; i < 8; i++)
{
AccountDataEntry* acct_data = GetAccountData(i);
if (!acct_data->data)
{
data << uint64(0) << uint64(0); // Nothing.
continue;
}
md5hash.Initialize();
md5hash.UpdateData((const uint8*)acct_data->data, acct_data->sz);
md5hash.Finalize();
#ifndef USING_BIG_ENDIAN
data.Write(md5hash.GetDigest(), MD5_DIGEST_LENGTH);
#else
data.append(md5hash.GetDigest(), MD5_DIGEST_LENGTH);
#endif
}
SendPacket(&data);
// Set TIME OF LOGIN
CharacterDatabase.Execute (
"UPDATE characters SET online = 1 WHERE guid = %u" , plr->GetLowGUID());
bool enter_world = true;
#ifndef CLUSTERING
// Find our transporter and add us if we're on one.
if(plr->m_TransporterGUID != 0)
{
Transporter * pTrans = objmgr.GetTransporter(GUID_LOPART(plr->m_TransporterGUID));
if(pTrans)
{
if(plr->isDead())
{
plr->ResurrectPlayer();
plr->SetUInt32Value(UNIT_FIELD_HEALTH, plr->GetUInt32Value(UNIT_FIELD_MAXHEALTH));
plr->SetUInt32Value(UNIT_FIELD_POWER1, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
}
float c_tposx = pTrans->GetPositionX() + plr->m_TransporterX;
float c_tposy = pTrans->GetPositionY() + plr->m_TransporterY;
float c_tposz = pTrans->GetPositionZ() + plr->m_TransporterZ;
if(plr->GetMapId() != pTrans->GetMapId()) // loaded wrong map
{
plr->SetMapId(pTrans->GetMapId());
#ifndef USING_BIG_ENDIAN
StackWorldPacket<20> dataw(SMSG_NEW_WORLD);
#else
WorldPacket dataw(SMSG_NEW_WORLD, 20);
#endif
dataw << pTrans->GetMapId() << c_tposx << c_tposy << c_tposz << plr->GetOrientation();
SendPacket(&dataw);
// shit is sent in worldport ack.
enter_world = false;
}
plr->SetPosition(c_tposx, c_tposy, c_tposz, plr->GetOrientation(), false);
plr->m_CurrentTransporter = pTrans;
pTrans->AddPlayer(plr);
开发者ID:AwkwardDev,项目名称:ascent_classic,代码行数:67,代码来源:CharacterHandler.cpp
示例20: snprintf
bool ChatHandler::HandleSummonCommand(const char* args, WorldSession *m_session)
{
if(!*args)
return false;
sGMLog.writefromsession(m_session, "summoned %s on map %u, %f %f %f", args, m_session->GetPlayer()->GetMapId(),m_session->GetPlayer()->GetPositionX(),m_session->GetPlayer()->GetPositionY(),m_session->GetPlayer()->GetPositionZ());
Player * plr = m_session->GetPlayer();
Player *chr = objmgr.GetPlayer(args, false);
if( chr && chr->m_isGmInvisible < 2 )
{
// send message to user
char buf[256];
char buf0[256];
if( chr->IsBeingTeleported() == true )
{
snprintf((char*)buf,256, "%s is already being teleported.", chr->GetName());
SystemMessage(m_session, buf);
return true;
}
if(!chr->RemoveTransporterStatus())
{
char buff[256];
snprintf((char*)buf,256, "%s already being teleported.", chr->GetName());
SystemMessage(m_session, buff);
return true;
}
if( plr->RS_getAccess() < chr->RS_getAccess() || chr->m_isGmInvisible > INVIS_NONE )
{
snprintf((char*)buf,256, "%s is attempting to summon you!", plr->GetName());
SystemMessageToPlr(chr, buf);
chr->SummonRequest(plr->GetLowGUID(), plr->GetZoneId(), plr->GetMapId(), plr->GetInstanceID(), plr->GetPosition());
snprintf((char*)buf0,256, "Summon request sent.", chr->GetName());
SystemMessage(m_session, buf0);
return true;
}
snprintf((char*)buf,256, "You are summoning %s.", chr->GetName());
SystemMessage(m_session, buf);
if(!(plr->m_isGmInvisible && chr->RS_getAccess() >= RS_SCRIPTER))
{
// send message to player
snprintf((char*)buf0,256, "You are being summoned by %s.", m_session->GetPlayer()->GetName());
SystemMessageToPlr(chr, buf0);
}
if(chr->GetTaxiState())
{
sEventMgr.RemoveEvents(chr, EVENT_PLAYER_TAXI_DISMOUNT);
sEventMgr.RemoveEvents(chr, EVENT_PLAYER_TAXI_INTERPOLATE);
chr->SetTaxiState(false);
chr->SetTaxiPath(NULL);
chr->UnSetTaxiPos();
chr->m_taxi_ride_time = 0;
chr->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID , 0);
chr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNTED_TAXI);
chr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOCK_PLAYER);
chr->SetPlayerSpeed(RUN, chr->m_runSpeed);
}
if(chr->m_TransporterGUID)
{
Transporter * pTrans = objmgr.GetTransporter(GUID_LOPART(chr->m_TransporterGUID));
if(pTrans)
{
if(chr->m_lockTransportVariables == true)
{
char buff[256];
snprintf((char*)buf,256, "%s is already being teleported.", chr->GetName());
SystemMessage(m_session, buff);
return true;
}
pTrans->RemovePlayer(chr);
chr->m_CurrentTransporter = NULL;
chr->m_TransporterGUID = 0;
}
}
if( plr->GetMapMgr() == chr->GetMapMgr() )
{
chr->_Relocate(plr->GetMapId(),plr->GetPosition(),false,false,plr->GetInstanceID());
}
else
{
sEventMgr.AddEvent(chr,&Player::EventPortToGM,plr,0,1,1,0);
}
}
else
{
PlayerInfo * pinfo = objmgr.GetPlayerInfoByName(args);
if(!pinfo)
{
char buf[256];
snprintf((char*)buf,256,"Player (%s) does not exist.", args);
SystemMessage(m_session, buf);
}
else
{
Player * pPlayer = m_session->GetPlayer();
char query[512];
snprintf((char*) &query,512, "UPDATE characters SET mapId = %u, positionX = %f, positionY = %f, positionZ = %f, zoneId = %u WHERE guid = %u;", pPlayer->GetMapId(), pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetZoneId(), pinfo->guid);
//.........这里部分代码省略.........
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:101,代码来源:Level1.cpp
注:本文中的Transporter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论