本文整理汇总了C++中Quest::setOwner方法的典型用法代码示例。如果您正苦于以下问题:C++ Quest::setOwner方法的具体用法?C++ Quest::setOwner怎么用?C++ Quest::setOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quest
的用法示例。
在下文中一共展示了Quest::setOwner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file
QList<Pony> Player::loadPonies(Player* player)
{
QList<Pony> ponies;
QFile file(QDir::currentPath()+"/data/players/"+player->name.toLatin1()+"/ponies.dat");
if (!file.open(QIODevice::ReadOnly))
return ponies;
QByteArray data = file.readAll();
int i=0;
while (i<data.size())
{
Pony pony{player};
// Read the ponyData
unsigned strlen;
unsigned lensize=0;
{
unsigned char num3; int num=0, num2=0;
do {
num3 = data[i+lensize]; lensize++;
num |= (num3 & 0x7f) << num2;
num2 += 7;
} while ((num3 & 0x80) != 0);
strlen = (uint) num;
}
int ponyDataSize = strlen+lensize+43;
pony.ponyData = data.mid(i,ponyDataSize);
pony.name = dataToString(pony.ponyData); // The name is the first elem
//win.logMessage("Found pony : "+pony.name);
i+=ponyDataSize;
// Read pos
UVector pos = dataToVector(data.mid(i,12));
pony.pos = pos;
i+=12;
// Read sceneName
unsigned strlen2;
unsigned lensize2=0;
{
unsigned char num3; int num=0, num2=0;
do {
num3 = data[i+lensize2]; lensize2++;
num |= (num3 & 0x7f) << num2;
num2 += 7;
} while ((num3 & 0x80) != 0);
strlen2 = (uint) num;
}
pony.sceneName = data.mid(i+lensize2, strlen2).toLower();
i+=strlen2+lensize2;
// Create quests
for (int i=0; i<win.quests.size(); i++)
{
Quest quest = win.quests[i];
quest.setOwner(player);
pony.quests << quest;
}
ponies << pony;
}
return ponies;
}