本文整理汇总了C++中Map::AddActor方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::AddActor方法的具体用法?C++ Map::AddActor怎么用?C++ Map::AddActor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::AddActor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadMap
/* Loads an area */
int Game::LoadMap(const char* ResRef, bool loadscreen)
{
unsigned int i;
Map *newMap;
PluginHolder<MapMgr> mM(IE_ARE_CLASS_ID);
ScriptEngine *sE = core->GetGUIScriptEngine();
//this shouldn't happen
if (!mM) {
return -1;
}
int index = FindMap(ResRef);
if (index>=0) {
return index;
}
bool hide = false;
if (loadscreen && sE) {
hide = core->HideGCWindow();
sE->RunFunction("LoadScreen", "StartLoadScreen");
sE->RunFunction("LoadScreen", "SetLoadScreen");
}
DataStream* ds = gamedata->GetResource( ResRef, IE_ARE_CLASS_ID );
if (!ds) {
goto failedload;
}
if(!mM->Open(ds)) {
goto failedload;
}
newMap = mM->GetMap(ResRef, IsDay());
if (!newMap) {
goto failedload;
}
core->LoadProgress(100);
for (i = 0; i < PCs.size(); i++) {
if (stricmp( PCs[i]->Area, ResRef ) == 0) {
newMap->AddActor( PCs[i] );
}
}
for (i = 0; i < NPCs.size(); i++) {
if (stricmp( NPCs[i]->Area, ResRef ) == 0) {
newMap->AddActor( NPCs[i] );
}
}
if (hide) {
core->UnhideGCWindow();
}
return AddMap( newMap );
failedload:
if (hide)
core->UnhideGCWindow();
core->LoadProgress(100);
return -1;
}
示例2: LoadMap
/* Loads an area */
int Game::LoadMap(const char* ResRef, bool loadscreen)
{
unsigned int i, ret;
Map *newMap;
PluginHolder<MapMgr> mM(IE_ARE_CLASS_ID);
ScriptEngine *sE = core->GetGUIScriptEngine();
//this shouldn't happen
if (!mM) {
return -1;
}
int index = FindMap(ResRef);
if (index>=0) {
return index;
}
bool hide = false;
if (loadscreen && sE) {
hide = core->HideGCWindow();
sE->RunFunction("LoadScreen", "StartLoadScreen");
sE->RunFunction("LoadScreen", "SetLoadScreen");
}
DataStream* ds = gamedata->GetResource( ResRef, IE_ARE_CLASS_ID );
if (!ds) {
goto failedload;
}
if(!mM->Open(ds)) {
goto failedload;
}
newMap = mM->GetMap(ResRef, IsDay());
if (!newMap) {
goto failedload;
}
core->LoadProgress(100);
ret = AddMap( newMap );
//spawn creatures on a map already in the game
//this feature exists in all blackisle games but not in bioware games
if (core->HasFeature(GF_SPAWN_INI)) {
newMap->LoadIniSpawn();
}
for (i = 0; i < PCs.size(); i++) {
if (stricmp( PCs[i]->Area, ResRef ) == 0) {
newMap->AddActor( PCs[i], false );
}
}
PlacePersistents(newMap, ResRef);
if (hide) {
core->UnhideGCWindow();
}
newMap->InitActors();
return ret;
failedload:
if (hide) {
core->UnhideGCWindow();
}
core->LoadProgress(100);
return -1;
}