本文整理汇总了C++中UserHeapPtr::Malloc方法的典型用法代码示例。如果您正苦于以下问题:C++ UserHeapPtr::Malloc方法的具体用法?C++ UserHeapPtr::Malloc怎么用?C++ UserHeapPtr::Malloc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserHeapPtr
的用法示例。
在下文中一共展示了UserHeapPtr::Malloc方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void GoalManager::setup (long poolSize) {
goalObjectPoolSize = poolSize;
if (goalObjectPoolSize < 10)
Fatal(0, " GoalManager.setup: goalObjectPoolSize must be greater than 10 ");
goalObjectPool = (GoalObjectPtr)missionHeap->Malloc(sizeof(GoalObject) * goalObjectPoolSize);
clear();
}
示例2: readRAW
//---------------------------------------------------------------------------
long File::readRAW (unsigned long * &buffer, UserHeapPtr heap)
{
long result = 0;
if (fastFile && heap && fastFile->isLZCompressed())
{
long lzSizeNeeded = fastFile->lzSizeFast(fastFileHandle);
buffer = (unsigned long *)heap->Malloc(lzSizeNeeded);
result = fastFile->readFastRAW(fastFileHandle,buffer,lzSizeNeeded);
logicalPosition += result;
}
return result;
}
示例3: init
long SensorSystemManager::init (bool debug) {
if (MAX_SENSORS < 2)
Fatal(0, " Way too few sensors in Sensor System Manager! ");
sensorPool = (SensorSystemPtr*)missionHeap->Malloc(MAX_SENSORS * sizeof(SensorSystemPtr));
gosASSERT(sensorPool!=NULL);
for (long i = 0; i < MAX_SENSORS; i++)
sensorPool[i] = new SensorSystem;
//-----------------------------------------------------
// This assumes we have at least 2 sensors in the pool
// when initializing the pool...
sensorPool[0]->id = 0;
sensorPool[0]->prev = NULL;
sensorPool[0]->next = sensorPool[1];
for (i = 1; i < (MAX_SENSORS - 1); i++) {
sensorPool[i]->id = i;
sensorPool[i]->prev = sensorPool[i - 1];
sensorPool[i]->next = sensorPool[i + 1];
}
sensorPool[MAX_SENSORS - 1]->id = MAX_SENSORS - 1;
sensorPool[MAX_SENSORS - 1]->prev = sensorPool[MAX_SENSORS - 2];
sensorPool[MAX_SENSORS - 1]->next = NULL;
//------------------------------
// All start on the free list...
freeList = sensorPool[0];
freeSensors = MAX_SENSORS;
for (i = 0; i < MAX_TEAMS; i++)
teamSensors[i] = NULL;
Assert (!debug || (Team::numTeams > 0), 0, " SensorSystemManager.init: 0 teams ");
for (i = 0; i < Team::numTeams; i++) {
teamSensors[i] = new TeamSensorSystem;
teamSensors[i]->teamId = i;
}
SensorSystem::numSensors = 0;
return(NO_ERR);
}
示例4: new
PVOID GameDebugWindow::operator new(size_t ourSize)
{
PVOID result = systemHeap->Malloc(ourSize);
return(result);
}
示例5: new
void* SensorSystem::operator new (size_t mySize) {
void *result = missionHeap->Malloc(mySize);
return(result);
}
示例6: addLink
void GoalObject::addLink (GoalObjectPtr gobject, GoalLinkType type) {
GoalLinkPtr newLink = (GoalLink*)missionHeap->Malloc(sizeof(GoalLink));
}
示例7: new
void* GoalObject::operator new (size_t ourSize) {
void *result = missionHeap->Malloc(ourSize);
return(result);
}
示例8: InitializeGameEngine
//.........这里部分代码省略.........
gammaLevel = 0;
// store volume settings in global variable since soundsystem
// does not exist yet. These will be set in SoundSystem::init()
result = prefs->readIdLong("DigitalMasterVolume", DigitalMasterVolume);
if(result != NO_ERROR)
DigitalMasterVolume = 255;
result = prefs->readIdLong("MusicVolume", MusicVolume);
if(result != NO_ERROR)
MusicVolume = 64;
result = prefs->readIdLong("RadioVolume", RadioVolume);
if(result != NO_ERROR)
RadioVolume = 64;
result = prefs->readIdLong("SFXVolume", sfxVolume);
if(result != NO_ERROR)
sfxVolume = 64;
result = prefs->readIdFloat("DoubleClickThreshold", doubleClickThreshold);
if(result != NO_ERROR)
doubleClickThreshold = 0.2f;
result = prefs->readIdLong("DragThreshold", dragThreshold);
if(result != NO_ERROR)
dragThreshold = .016667;
result = prefs->readIdULong("BaseVertexColor", BaseVertexColor);
if(result != NO_ERROR)
BaseVertexColor = 0x00000000;
result = prefs->readIdBoolean("FullScreen", fullScreen);
if(result != NO_ERROR)
fullScreen = true;
result = prefs->readIdLong("Rasterizer", renderer);
if(result != NO_ERROR)
renderer = 0;
if((renderer < 0) || (renderer > 3))
renderer = 0;
}
}
prefs->close();
delete prefs;
prefs = nullptr;
//-------------------------------
// Used to output debug stuff!
// Mondo COOL!
// simply do this in the code and stuff goes to the file called mc2.output
// DEBUG_STREAM << thing_you_want_to_output
//
// IMPORTANT NOTE:
Stuff::InitializeClasses();
MidLevelRenderer::InitializeClasses(8192 * 4, 1024, 0, 0, true);
gosFX::InitializeClasses();
gos_PushCurrentHeap(MidLevelRenderer::Heap);
MidLevelRenderer::TGAFilePool* pool = new MidLevelRenderer::TGAFilePool("data\\Effects\\");
MidLevelRenderer::MLRTexturePool::Instance = new MidLevelRenderer::MLRTexturePool(pool);
MidLevelRenderer::MLRSortByOrder* cameraSorter = new MidLevelRenderer::MLRSortByOrder(MidLevelRenderer::MLRTexturePool::Instance);
theClipper = new MidLevelRenderer::MLRClipper(0, cameraSorter);
gos_PopCurrentHeap();
//------------------------------------------------------
// Start the GOS FX.
gos_PushCurrentHeap(gosFX::Heap);
gosFX::EffectLibrary::Instance = new gosFX::EffectLibrary();
Check_Object(gosFX::EffectLibrary::Instance);
FullPathFileName effectsName;
effectsName.init(effectsPath, "mc2.fx", "");
File effectFile;
int32_t result = effectFile.open(effectsName);
if(result != NO_ERROR)
STOP(("Could not find MC2.fx"));
int32_t effectsSize = effectFile.fileSize();
puint8_t effectsData = (puint8_t)systemHeap->Malloc(effectsSize);
effectFile.read(effectsData, effectsSize);
effectFile.close();
effectStream = new Stuff::MemoryStream(effectsData, effectsSize);
gosFX::EffectLibrary::Instance->Load(effectStream);
gosFX::LightManager::Instance = new gosFX::LightManager();
gos_PopCurrentHeap();
systemHeap->Free(effectsData);
//------------------------------------------------
// Fire up the MC Texture Manager.
mcTextureManager = new MC_TextureManager;
mcTextureManager->start();
//Startup the vertex array pool
mcTextureManager->startVertices(500000);
//--------------------------------------------------
// Setup Mouse Parameters from Prefs.CFG
userInput = new UserInput;
userInput->init();
userInput->setMouseDoubleClickThreshold(doubleClickThreshold);
userInput->setMouseDragThreshold(dragThreshold);
userInput->initMouseCursors("cursors");
userInput->setMouseCursor(mState_NORMAL);
userInput->mouseOn();
// now the sound system
soundSystem = new GameSoundSystem;
soundSystem->init();
((SoundSystem*)soundSystem)->init("sound");
sndSystem = soundSystem; // for things in the lib that use sound
soundSystem->playDigitalMusic(LOGISTICS_LOOP);
pLogData = new LogisticsData;
pLogData->init();
pMechlopedia = new Mechlopedia;
pMechlopedia->init();
pMechlopedia->begin();
}
示例9: new
PVOID TeamSensorSystem::operator new(size_t mySize)
{
PVOID result = missionHeap->Malloc(mySize);
return(result);
}
示例10: new
PVOID MultiPlayer::operator new(size_t ourSize)
{
PVOID result = systemHeap->Malloc(ourSize);
return(result);
}