本文整理汇总了C++中Guest类的典型用法代码示例。如果您正苦于以下问题:C++ Guest类的具体用法?C++ Guest怎么用?C++ Guest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Guest类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Guest
void Hotel::addGuest(const int guestType, const std::string & name)
{
Guest* guest = new Guest(name, guestType);
mGuests.push_back(guest);
attach(guest->Impl(), guestType);
(guest->Impl())->setSbj(this);
}
示例2: DECLCALLBACK
/**
* Update the guest additions capabilities.
* This is called when the guest additions capabilities change. The new capabilities
* are given and the connector should update its internal state.
*
* @param pInterface Pointer to this interface.
* @param newCapabilities New capabilities.
* @thread The emulation thread.
*/
DECLCALLBACK(void) vmmdevUpdateGuestCapabilities(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities)
{
PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
AssertPtr(pDrv);
Console *pConsole = pDrv->pVMMDev->getParent();
/* store that information in IGuest */
Guest* pGuest = pConsole->i_getGuest();
AssertPtrReturnVoid(pGuest);
/*
* Report our current capabilities (and assume none is active yet).
*/
pGuest->i_setSupportedFeatures(newCapabilities);
/*
* Tell the Display, so that it can update the "supports graphics"
* capability if the graphics card has not asserted it.
*/
Display* pDisplay = pConsole->i_getDisplay();
AssertPtrReturnVoid(pDisplay);
pDisplay->i_handleUpdateVMMDevSupportsGraphics(RT_BOOL(newCapabilities & VMMDEV_GUEST_SUPPORTS_GRAPHICS));
/*
* Tell the console interface about the event
* so that it can notify its consumers.
*/
pConsole->i_onAdditionsStateChange();
}
示例3: NotifyRideDeletion
/**
* Notification that the ride is being removed.
* @param ri Ride being removed.
*/
void Guests::NotifyRideDeletion(const RideInstance *ri) {
for (int i = 0; i < GUEST_BLOCK_SIZE; i++) {
Guest *p = this->block.Get(i);
if (!p->IsActive()) continue;
p->NotifyRideDeletion(ri);
}
}
示例4: while
/**
* Update #free_idx to the next free guest (if available).
* @return Whether a free guest was found.
*/
bool Guests::FindNextFreeGuest()
{
while (this->free_idx < GUEST_BLOCK_SIZE) {
Guest *g = this->block.Get(this->free_idx);
if (!g->IsActive()) return true;
this->free_idx++;
}
return false;
}
示例5: CountActiveGuests
/**
* Count the number of active guests.
* @return The number of active guests.
*/
uint Guests::CountActiveGuests()
{
uint count = this->free_idx;
for (uint i = this->free_idx; i < GUEST_BLOCK_SIZE; i++) {
Guest *g = this->block.Get(i);
if (g->IsActive()) count++;
}
return count;
}
示例6: CountGuestsInPark
/**
* Count the number of guests in the park.
* @return The number of guests in the park.
*/
uint Guests::CountGuestsInPark()
{
uint count = 0;
for (uint i = 0; i < GUEST_BLOCK_SIZE; i++) {
Guest *g = this->block.Get(i);
if (g->IsActive() && g->IsInPark()) count++;
}
return count;
}
示例7: AssertReturnVoid
/* static */
void Guest::staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick)
{
AssertReturnVoid(pvUser != NULL);
Guest *guest = static_cast<Guest *>(pvUser);
Assert(guest->mMagic == GUEST_MAGIC);
if (guest->mMagic == GUEST_MAGIC)
guest->updateStats(iTick);
NOREF(hTimerLR);
}
示例8: OnAnimate
/**
* Some time has passed, update the animation.
* @param delay Number of milliseconds time that have past since the last animation update.
*/
void Guests::OnAnimate(int delay)
{
for (int i = 0; i < GUEST_BLOCK_SIZE; i++) {
Guest *p = this->block.Get(i);
if (!p->IsActive()) continue;
AnimateResult ar = p->OnAnimate(delay);
if (ar != OAR_OK) {
p->DeActivate(ar);
this->AddFree(p);
}
}
}
示例9: Uninitialize
/** Deactivate all guests and reset variables. */
void Guests::Uninitialize()
{
for (int i = 0; i < GUEST_BLOCK_SIZE; i++) {
Guest *g = this->block.Get(i);
if (g->IsActive()) {
g->DeActivate(OAR_REMOVE);
this->AddFree(g);
}
}
this->start_voxel.x = -1;
this->start_voxel.y = -1;
this->daily_frac = 0;
this->next_daily_index = 0;
}
示例10: DECLCALLBACK
/**
* @interface_method_impl{PDMIVMMDEVCONNECTOR,pfnUpdateGuestStatus}
*/
DECLCALLBACK(void) vmmdevUpdateGuestStatus(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFacility, uint16_t uStatus,
uint32_t fFlags, PCRTTIMESPEC pTimeSpecTS)
{
PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
Console *pConsole = pDrv->pVMMDev->getParent();
/* Store that information in IGuest */
Guest* guest = pConsole->getGuest();
Assert(guest);
if (!guest)
return;
guest->setAdditionsStatus((VBoxGuestFacilityType)uFacility, (VBoxGuestFacilityStatus)uStatus, fFlags, pTimeSpecTS);
pConsole->onAdditionsStateChange();
}
示例11: FindEdgeRoad
/**
* A new day arrived, handle daily chores of the park.
* @todo Add popularity rating concept.
*/
void Guests::OnNewDay()
{
/* Try adding a new guest to the park. */
if (this->CountActiveGuests() >= _scenario.max_guests) return;
if (!this->rnd.Success1024(_scenario.GetSpawnProbability(512))) return;
if (!IsGoodEdgeRoad(this->start_voxel.x, this->start_voxel.y)) {
/* New guest, but no road. */
this->start_voxel = FindEdgeRoad();
if (!IsGoodEdgeRoad(this->start_voxel.x, this->start_voxel.y)) return;
}
if (!this->HasFreeGuests()) return; // No more quests available.
/* New guest! */
Guest *g = this->GetFree();
g->Activate(this->start_voxel, PERSON_GUEST);
}
示例12: Save
/**
* Save guests to the save game.
* @param svr Output stream to save to.
*/
void Guests::Save(Saver &svr)
{
svr.StartBlock("GSTS", 1);
svr.PutWord(this->start_voxel.x);
svr.PutWord(this->start_voxel.y);
svr.PutWord(this->daily_frac);
svr.PutWord(this->next_daily_index);
svr.PutLong(this->free_idx);
svr.PutLong(this->CountActiveGuests());
for (uint i = 0; i < GUEST_BLOCK_SIZE; i++) {
Guest *g = this->block.Get(i);
if (g->IsActive()) {
svr.PutWord(g->id);
g->Save(svr);
}
}
svr.EndBlock();
}
示例13: Load
/**
* Load guests from the save game.
* @param ldr Input stream to read.
*/
void Guests::Load(Loader &ldr)
{
uint32 version = ldr.OpenBlock("GSTS");
if (version == 1) {
this->start_voxel.x = ldr.GetWord();
this->start_voxel.y = ldr.GetWord();
this->daily_frac = ldr.GetWord();
this->next_daily_index = ldr.GetWord();
this->free_idx = ldr.GetLong();
uint active_guest_count = ldr.GetLong();
for (uint i = 0; i < active_guest_count; i++) {
Guest *g = this->block.Get(ldr.GetWord());
g->Load(ldr);
}
} else {
ldr.SetFailMessage("Incorrect version of Guests block.");
}
ldr.CloseBlock();
}
示例14: hasGuest
bool Seat::hasGuest(const Guest &guest) const
{
return (this->m_guest->getId() == guest.getId());
}