本文整理汇总了C++中Zone::init方法的典型用法代码示例。如果您正苦于以下问题:C++ Zone::init方法的具体用法?C++ Zone::init怎么用?C++ Zone::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zone
的用法示例。
在下文中一共展示了Zone::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeDynamicZone
void DynamicZone::makeDynamicZone()
{
ZoneInfo* pTemplateZoneInfo = g_pZoneInfoManager->getZoneInfo(m_TemplateZoneID);
Assert(pTemplateZoneInfo != NULL);
char temp[128];
// make zone info
ZoneInfo* pZoneInfo = new ZoneInfo();
pZoneInfo->setZoneID(m_ZoneID);
pZoneInfo->setZoneGroupID(pTemplateZoneInfo->getZoneGroupID());
pZoneInfo->setZoneType(pTemplateZoneInfo->getZoneType());
pZoneInfo->setZoneLevel(pTemplateZoneInfo->getZoneLevel());
pZoneInfo->setZoneAccessMode(pTemplateZoneInfo->getZoneAccessMode());
pZoneInfo->setZoneOwnerID(pTemplateZoneInfo->getZoneOwnerID());
pZoneInfo->setPayPlay(pTemplateZoneInfo->isPayPlay());
pZoneInfo->setPremiumZone(pTemplateZoneInfo->isPremiumZone());
pZoneInfo->setPKZone(pTemplateZoneInfo->isPKZone());
pZoneInfo->setNoPortalZone(pTemplateZoneInfo->isNoPortalZone());
pZoneInfo->setHolyLand(pTemplateZoneInfo->isHolyLand());
pZoneInfo->setAvailable(pTemplateZoneInfo->isAvailable());
pZoneInfo->setOpenLevel(pTemplateZoneInfo->getOpenLevel());
pZoneInfo->setSMPFilename(pTemplateZoneInfo->getSMPFilename());
pZoneInfo->setSSIFilename(pTemplateZoneInfo->getSSIFilename());
sprintf(temp, "%s%u", pTemplateZoneInfo->getFullName().c_str(), m_ZoneID);
pZoneInfo->setFullName(temp);
sprintf(temp, "%s%u", pTemplateZoneInfo->getShortName().c_str(), m_ZoneID);
pZoneInfo->setShortName(temp);
// add zone info to g_pZoneInfoManager
g_pZoneInfoManager->addZoneInfo(pZoneInfo);
// make zone and add to ZoneGroup
Zone* pZone = new Zone(pZoneInfo->getZoneID());
Assert(pZone != NULL);
// DynamicZone set to Zone
pZone->setDynamicZone(this);
// m_pZone setting
m_pZone = pZone;
// init zone
pZone->init();
// init DynamicZone
init();
// set ZoneGroup
ZoneGroup* pZoneGroup = g_pZoneGroupManager->getZoneGroup(pZoneInfo->getZoneGroupID());
Assert(pZoneGroup != NULL);
pZone->setZoneGroup(pZoneGroup);
pZoneGroup->addZone(pZone);
}
示例2: loadmap
void loadmap(Zone& area, Map& level, Player& player1, Surface& images)
{
int mapnum, floornum;
bool stairs;
int playx,playy;
//load world and set initial values the first time through
if (player1.get_map() == -1) {
srand(time(NULL));
mapnum = area.get_id();
floornum = 0;
area.init();
level = area.zones[mapnum].floors[floornum];
playx = level.get_begin_x() * TILEW;
playy = level.get_begin_y() * TILEH;
player1.put_stairs(1);
}
//load a new map if the player has changed maps midplay
if (player1.get_map() >= 0) {
mapnum = player1.get_destmap();
floornum = player1.get_destfloor();
if (floornum < 0) {
floornum = 0;
player1.put_stairs(1);
mapnum = area.get_id();
playx = area.zones[player1.get_map()].get_x() * TILEW;
playy = (area.zones[player1.get_map()].get_y() + 1) * TILEH;
}
area.zones[player1.get_map()].floors[player1.get_floor()] = level;
}
level = area.zones[mapnum].floors[floornum];
level.set_rendered(0); //area is not yet rendered for graphics
if (area.zones[mapnum].floors[floornum].get_type() == TOWN){
playx = MAPW / 2 * TILEW;
playy = (MAPH - 2) * TILEH;
}
if (area.zones[mapnum].floors[floornum].get_type() == DUNGEON){
stairs = player1.get_stairs();
if (stairs == 0) {
playx = level.get_end_x() * TILEW;
playy = level.get_end_y() * TILEH;
}
if (stairs == 1) {
playx = level.get_begin_x() * TILEW;
playy = level.get_begin_y() * TILEH;
}
}
player1.put_coor(playx, playy);
player1.put_map(mapnum);
player1.put_floor(floornum);
//load appropriate spritesheet for this kind of level
switch(level.get_type())
{
case DUNGEON:
images.tilesheet = load_bitmaps("data/images/dungeon.jpg");
break;
case TOWN:
images.tilesheet = load_bitmaps("data/images/town.jpg");
break;
case FOREST:
images.tilesheet = load_bitmaps("data/images/forest.jpg");
break;
}
};
示例3: load
//--------------------------------------------------------------------------------
//
// load data from database
//
// 데이타베이스에 연결해서 ZoneGroup 을 로드해온다.
//
//--------------------------------------------------------------------------------
void ZoneGroupManager::load ()
throw(Error)
{
__BEGIN_TRY
__BEGIN_DEBUG
cout << "[ZoneGroupManager] Loading..." << endl;
Statement* pStmt = NULL;
list<ZoneGroupID_t> ZoneGroupIDList;
// 먼저 존 그룹 아이디들을 읽는다.
BEGIN_DB
{
pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();
Result* pResult = pStmt->executeQuery("SELECT ZoneGroupID FROM ZoneGroupInfo ORDER BY ZoneGroupID");
while (pResult->next())
{
ZoneGroupID_t ID = pResult->getInt(1);
ZoneGroupIDList.push_back(ID);
}
SAFE_DELETE(pStmt);
}
END_DB(pStmt)
list<ZoneGroupID_t>::iterator itr = ZoneGroupIDList.begin();
for (; itr != ZoneGroupIDList.end(); itr++)
{
ZoneGroupID_t ID = (*itr);
// 해당하는 ID의 존 그룹을 생성하고, 매니저에다 더한다.
ZoneGroup* pZoneGroup = new ZoneGroup(ID);
ZonePlayerManager* pZonePlayerManager = new ZonePlayerManager();
pZonePlayerManager->setZGID(ID);
pZoneGroup->setZonePlayerManager(pZonePlayerManager);
addZoneGroup(pZoneGroup);
// 이 존 그룹에 속하는 존의 정보를 읽어들이고, 초기화해야 한다.
BEGIN_DB
{
pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();
//Result* pResult = pStmt->executeQuery("SELECT ZoneID FROM ZoneInfo WHERE ZoneGroupID = %d", ID);
Result* pResult = pStmt->executeQuery(
"SELECT ZoneID FROM ZoneInfo WHERE ZoneGroupID = %d ORDER BY ZoneID", (int)ID);
while (pResult->next())
{
ZoneID_t zoneID = pResult->getInt(1);
// 존 객체를 생성, 초기화한 후, 존그룹에 추가한다.
Zone* pZone = new Zone(zoneID);
Assert(pZone != NULL);
pZone->setZoneGroup(pZoneGroup);
pZoneGroup->addZone(pZone);
//--------------------------------------------------------------------------------
// 순서에 유의할 것.
// 내부에서 NPC 를 로딩하게 되는데.. AtFirst-SetPosition 컨디션-액션을 수행할때
// ZoneGroupManager 에 접근하게 된다. 따라서, 먼저 ZGM에 추가한 후 초기화를 해야 한다.
//--------------------------------------------------------------------------------
//printf("\[email protected]@@@@@@@@@@@@@@ [%d]th ZONE INITIALIZATION START @@@@@@@@@@@@@@@\n", zoneID);
pZone->init();
//printf("\[email protected]@@@@@@@@@@@@@@ [%d]th ZONE INITIALIZATION SUCCESS @@@@@@@@@@@@@@@\n", zoneID);
}
SAFE_DELETE(pStmt);
}
END_DB(pStmt)
}
ZoneGroupIDList.clear();
/*
Statement* pStmt1 = NULL;
try
{
pStmt1 = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();
// ZoneGroupID 를 읽어온다.
//Result* pResult1 = pStmt1->executeQuery("SELECT ZoneGroupID FROM ZoneGroupInfo ORDER BY ZoneGroupID");
Result* pResult1 = pStmt1->executeQuery("SELECT ZoneGroupID FROM ZoneGroupInfo");
while (pResult1->next())
{
//.........这里部分代码省略.........