本文整理汇总了C++中Transporter类的典型用法代码示例。如果您正苦于以下问题:C++ Transporter类的具体用法?C++ Transporter怎么用?C++ Transporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Transporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
}
示例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();
}
示例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;
}
}
}
示例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();
}
示例6:
Uint32
TransporterRegistry::get_free_buffer(Uint32 node) const
{
Transporter *t;
if(likely((t = theTransporters[node]) != 0))
{
return t->get_free_buffer();
}
return 0;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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)));
}
示例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);
}
}
}
示例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);
}
//.........这里部分代码省略.........
示例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;
}