本文整理汇总了C++中TCODList::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ TCODList::isEmpty方法的具体用法?C++ TCODList::isEmpty怎么用?C++ TCODList::isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCODList
的用法示例。
在下文中一共展示了TCODList::isEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: traverseLevelOrder
bool TCODBsp::traverseLevelOrder(ITCODBspCallback *listener, void *userData) {
TCODList<TCODBsp *> stack;
stack.push(this);
while ( ! stack.isEmpty() ) {
TCODBsp *node=stack.get(0);
stack.remove(node);
if ( node->getLeft() ) stack.push(node->getLeft());
if ( node->getRight() ) stack.push(node->getRight());
if (!listener->visitNode(node,userData)) return false;
}
return true;
}
示例2: apply
void DamagingAura::apply(Actor *target){
TCODRandom *rng = TCODRandom::getInstance();
int realDamage = rng->getInt(bonus*0.8,bonus*1.25);
TCODList<Actor *> inRadius;
if (!smart){
engine.getAllActorsInRadius(inRadius,target->x, target->y, radius);
} else {
engine.getAllActorsInRadius(inRadius,target->x, target->y, radius, SpellCastingConstants::ENEMY, target->hostile);
}
if (!inRadius.isEmpty()){
for (Actor **iter = inRadius.begin();
iter != inRadius.end(); iter++) {
Actor *act1 = *iter;
if (act1->destructible) act1->destructible->takeDamage(act1, target, realDamage);
}
}
inRadius.clearAndDelete();
}
示例3: buildTree
//.........这里部分代码省略.........
sprintf(tmp,"%d",(*it)->order);
(*it)->pageNum=strdup(tmp);
sprintf(tmp,"doc/html2/%s.html",(*it)->name);
(*it)->url=strdup(tmp);
sprintf(tmp,"<a onclick=\"link('../index2.html')\">Index</a> > <a onclick=\"link('%s.html')\">%s. %s</a>",
(*it)->name,(*it)->pageNum,(*it)->title);
(*it)->breadCrumb=strdup(tmp);
rootPages.remove(*it);
}
}
categId++;
}
// pages with unknown categories
for ( PageData **it=rootPages.begin(); it != rootPages.end(); it++) {
printf ("ERROR : unknown category '%s' in page '%s'\n",(*it)->categoryName,(*it)->name);
pages.remove(*it);
}
// build the subpages tree
for (PageData **it=pages.begin();it!=pages.end();it++) {
if ( (*it)->fatherName != NULL ) {
// sub-page. find its daddy and order
(*it)->father=getPage((*it)->fatherName);
if ( ! (*it)->father ) {
printf ("ERROR : unknown father '%s' for page '%s'\n",
(*it)->fatherName,(*it)->name);
it=pages.remove(it);
continue;
}
(*it)->father->numKids++;
(*it)->order=(*it)->father->numKids;
}
}
// now compute sub-page numbers
TCODList<PageData *> hierarchy;
bool missing=true;
while ( missing ) {
missing=false;
for (PageData **it=pages.begin();it!=pages.end();it++) {
if ((*it)->pageNum == NULL ) {
PageData *page=*it;
if ( page->father->pageNum == NULL ) {
missing=true;
} else {
char tmp[256];
sprintf(tmp,"%s.%d", page->father->pageNum,page->order);
page->pageNum = strdup(tmp);
sprintf(tmp,"doc/html2/%s.html",page->name);
page->url=strdup(tmp);
}
}
}
}
// now compute prev/next links and breadcrumbs for sub pages
for (PageData **it=pages.begin();it!=pages.end();it++) {
PageData *page=*it;
page->prev=getPrev(page);
// prev link
if ( page->prev ) {
char tmp[1024];
sprintf (tmp,
"<a class=\"prev\" onclick=\"link('%s.html')\">%s. %s</a>",
page->prev->name,page->prev->pageNum,page->prev->title);
page->prevLink=strdup(tmp);
}
// next link
page->next=getNext(page);
if ( page->next ) {
char tmp[1024];
sprintf (tmp,
"%s<a class=\"next\" onclick=\"link('%s.html')\">%s. %s</a>",
page->prev ? "| " : "",
page->next->name,page->next->pageNum,page->next->title);
page->nextLink=strdup(tmp);
}
// breadCrumb
if (! page->breadCrumb ) {
char tmp[1024];
TCODList<PageData *> hierarchy;
PageData *curPage=page;
while ( curPage ) {
hierarchy.push(curPage);
curPage=curPage->father;
}
char *ptr=tmp;
ptr[0]=0;
while ( ! hierarchy.isEmpty() ) {
curPage=hierarchy.pop();
if ( curPage == root ) {
sprintf(ptr, "<a onclick=\"link('../%s.html')\">%s</a>",
curPage->name,curPage->title);
} else {
sprintf(ptr, " > <a onclick=\"link('%s.html')\">%s. %s</a>",
curPage->name,curPage->pageNum,curPage->title);
}
ptr += strlen(ptr);
}
page->breadCrumb =strdup(tmp);
}
}
}
示例4: selectTargets
void TargetSelector::selectTargets(Actor *wearer, TCODList<Actor *> &list) {
switch (type) {
case SELF:
{
list.push(wearer);
}
break;
case CLOSEST_MONSTER:
{
Actor *closestMonster = engine.getClosestMonster(wearer->x, wearer->y, range);
if (closestMonster) {
list.push(closestMonster);
}
}
break;
case SELECTED_MONSTER:
{
int x, y;
engine.gui->message(TCODColor::cyan, "Left-click to select an enemy,\nor right-click to cancel ");
if (engine.pickATile(&x, &y, range)) {
Actor *actor = engine.getActor(x, y);
if (actor) {
list.push(actor);
}
}
}
break;
case WEARER_RANGE:
{
for (Actor **iterator = engine.actors.begin();
iterator != engine.actors.end(); iterator++) {
Actor *actor = *iterator;
if (actor != wearer && actor->destructible && !actor->destructible->isDead() &&
actor->getDistance(wearer->x, wearer->y) <= range) {
list.push(actor);
}
}
}
break;
case SELECTED_RANGE:
{
int x, y;
engine.gui->message(TCODColor::cyan, "Left-click to select an enemy,\nor right-click to cancel ");
if (engine.pickATile(&x, &y)) {
for (Actor **iterator = engine.actors.begin();
iterator != engine.actors.end(); iterator++) {
Actor *actor = *iterator;
if (actor->destructible && !actor->destructible->isDead() &&
actor->getDistance(x, y) <= range) {
list.push(actor);
}
}
}
}
break;
}
if (list.isEmpty()) {
engine.gui->message(TCODColor::lightGrey, "No enemy is close enough");
}
}