当前位置: 首页>>代码示例>>C++>>正文


C++ erase函数代码示例

本文整理汇总了C++中erase函数的典型用法代码示例。如果您正苦于以下问题:C++ erase函数的具体用法?C++ erase怎么用?C++ erase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了erase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: erase

void Queue::remove(DLink<VariableWithTimeStamp> *elt) {
    elt->content.timeStamp = -1;
    elt->content.incdec = NOTHING_EVENT;
    erase(elt, false);
}
开发者ID:AbdullahMohammad,项目名称:Numberjack,代码行数:5,代码来源:tb2queue.cpp

示例2: assert

void
NBNodeCont::joinNodeClusters(NodeClusters clusters,
                             NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tlc) {
    for (NodeClusters::iterator i = clusters.begin(); i != clusters.end(); ++i) {
        std::set<NBNode*> cluster = *i;
        assert(cluster.size() > 1);
        Position pos;
        bool setTL;
        std::string id;
        TrafficLightType type;
        analyzeCluster(cluster, id, pos, setTL, type);
        if (!insert(id, pos)) {
            // should not fail
            WRITE_WARNING("Could not join junctions " + id);
            continue;
        }
        NBNode* newNode = retrieve(id);
        if (setTL) {
            NBTrafficLightDefinition* tlDef = new NBOwnTLDef(id, newNode, 0, type);
            if (!tlc.insert(tlDef)) {
                // actually, nothing should fail here
                delete tlDef;
                throw ProcessError("Could not allocate tls '" + id + "'.");
            }
        }
        // collect edges
        std::set<NBEdge*> allEdges;
        for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); ++j) {
            const EdgeVector& edges = (*j)->getEdges();
            allEdges.insert(edges.begin(), edges.end());
        }

        // remap and remove edges which are completely within the new intersection
        for (std::set<NBEdge*>::iterator j = allEdges.begin(); j != allEdges.end();) {
            NBEdge* e = (*j);
            NBNode* from = e->getFromNode();
            NBNode* to = e->getToNode();
            if (cluster.count(from) > 0 && cluster.count(to) > 0) {
                for (std::set<NBEdge*>::iterator l = allEdges.begin(); l != allEdges.end(); ++l) {
                    if (e != *l) {
                        (*l)->replaceInConnections(e, e->getConnections());
                    }
                }
                ec.erase(dc, e);
                allEdges.erase(j++); // erase does not invalidate the other iterators
            } else {
                ++j;
            }
        }

        // remap edges which are incoming / outgoing
        for (std::set<NBEdge*>::iterator j = allEdges.begin(); j != allEdges.end(); ++j) {
            NBEdge* e = (*j);
            std::vector<NBEdge::Connection> conns = e->getConnections();
            const bool outgoing = cluster.count(e->getFromNode()) > 0;
            NBNode* from = outgoing ? newNode : e->getFromNode();
            NBNode* to   = outgoing ? e->getToNode() : newNode;
            e->reinitNodes(from, to);
            // re-add connections which previously existed and may still valid.
            // connections to removed edges will be ignored
            for (std::vector<NBEdge::Connection>::iterator k = conns.begin(); k != conns.end(); ++k) {
                e->addLane2LaneConnection((*k).fromLane, (*k).toEdge, (*k).toLane, NBEdge::L2L_USER, false, (*k).mayDefinitelyPass);
            }
        }
        // remove original nodes
        registerJoinedCluster(cluster);
        for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); ++j) {
            erase(*j);
        }
    }
}
开发者ID:rudhir-upretee,项目名称:Sumo17_With_Netsim,代码行数:71,代码来源:NBNodeCont.cpp

示例3: erase

CellLinkedList::ReverseIterator CellLinkedList::erase(CellLinkedList::ReverseIterator pos)
{
    Iterator it = (++pos).base();
    it = erase(it);
    return ReverseIterator(it);
}
开发者ID:gitter-badger,项目名称:vpaint,代码行数:6,代码来源:CellLinkedList.cpp

示例4: activate_sleeper

void activate_sleeper(Creature *cr)
{
   int state=0;
   int choice=0;
   char havedead=0;

   do
   {
      erase();

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      printfunds(0,1,"Money: ");
      
      move(0,0);
      addstr("Taking Undercover Action:   What will ");
      addstr(cr->name);
      addstr(" focus on?");

      printcreatureinfo(cr);

      makedelimiter(8,0);

      set_color(COLOR_WHITE,COLOR_BLACK,state=='a');
      move(10,1);
      addstr("A - Communication and Advocacy");

      set_color(COLOR_WHITE,COLOR_BLACK,state=='b');
      move(11,1);
      addstr("B - Espionage");

      set_color(COLOR_WHITE,COLOR_BLACK,state=='d');
      move(12,1);
      addstr("C - Join the Active LCS");

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(20,40);
      addstr("Enter - Confirm Selection");

      switch(state)
      {
      case 'a':
         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_NONE);
         move(10,40);
         addstr("1 - Lay Low");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_LIBERAL);
         move(11,40);
         addstr("2 - Advocate Liberalism");

         move(12,40);
         if(subordinatesleft(*cr))
         {
            set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_RECRUIT);
            addstr("3 - Expand Sleeper Network");
         }
         else
         {
            set_color(COLOR_BLACK,COLOR_BLACK,1);
            if(cr->flag & CREATUREFLAG_BRAINWASHED)
               addstr("3 - [Enlightened Can't Recruit]");
            else
               addstr("3 - [Need More Juice to Recruit]");
         }
         break;
      case 'b':
         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_SPY);
         move(10,40);
         addstr("1 - Uncover Secrets");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_EMBEZZLE);
         move(11,40);
         addstr("2 - Embezzle Funds");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_STEAL);
         move(12,40);
         addstr("3 - Steal Equipment");
         break;
      }

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      switch(cr->activity.type)
      {
      case ACTIVITY_NONE:
         move(22,3);
         addstr(cr->name);
         addstr(" will stay out of trouble.");
         break;
      case ACTIVITY_SLEEPER_LIBERAL:
         move(22,3);
         addstr(cr->name);
         addstr(" will build support for Liberal causes.");
         break;
      case ACTIVITY_SLEEPER_RECRUIT:
         if(subordinatesleft(*cr))
         {
            move(22,3);
            addstr(cr->name);
            addstr(" will try to recruit additional sleeper agents.");
         }
         break;
//.........这里部分代码省略.........
开发者ID:gauffa,项目名称:liberalcrimesquad-gmod,代码行数:101,代码来源:activate_sleepers.cpp

示例5: main

int main(int argc, char **argv)
{
    int i, start, end, row, diff, flag, direction;
    const unsigned seed = (unsigned)time((time_t *)0);

#ifdef XCURSES
    Xinitscr(argc, argv);
#else
    initscr();
#endif
    nodelay(stdscr, TRUE);
    noecho();

    if (has_colors())
        start_color();

    for (i = 0; i < 8; i++)
        init_pair((short)i, color_table[i], COLOR_BLACK);

    srand(seed);
    flag = 0;

    while (getch() == ERR)      /* loop until a key is hit */
    {
        do {
            start = rand() % (COLS - 3);
            end = rand() % (COLS - 3);
            start = (start < 2) ? 2 : start;
            end = (end < 2) ? 2 : end;
            direction = (start > end) ? -1 : 1;
            diff = abs(start - end);

        } while (diff < 2 || diff >= LINES - 2);

        attrset(A_NORMAL);

        for (row = 0; row < diff; row++)
        {
            mvaddstr(LINES - row, row * direction + start,
                (direction < 0) ? "\\" : "/");

            if (flag++)
            {
                myrefresh();
                erase();
                flag = 0;
            }
        }

        if (flag++)
        {
            myrefresh();
            flag = 0;
        }

        explode(LINES - row, diff * direction + start);
        erase();
        myrefresh();
    }

    endwin();

    return 0;
}
开发者ID:Noiwex,项目名称:luajit-curses,代码行数:64,代码来源:firework.c

示例6: engine_exit

/** This stops ncurses on a sweet, gentle way. */
void engine_exit()
{
	erase();
	refresh();
	endwin();
}
开发者ID:liushizhe,项目名称:yetris,代码行数:7,代码来源:engine.c

示例7: open


//.........这里部分代码省略.........
	if (stat(filename, &st) != 0) {
		log("Failed to stat %s - %d\n", filename, (int)errno);
		tcsetattr(_io_fd, TCSANOW, &t_original);
		close(_io_fd);
		_io_fd = -1;
		return -errno;
	}
	fw_size = st.st_size;

	if (_fw_fd == -1) {
		tcsetattr(_io_fd, TCSANOW, &t_original);
		close(_io_fd);
		_io_fd = -1;
		return -ENOENT;
	}

	/* do the usual program thing - allow for failure */
	for (unsigned retries = 0; retries < 1; retries++) {
		if (retries > 0) {
			log("retrying update...");
			ret = sync();

			if (ret != OK) {
				/* this is immediately fatal */
				log("bootloader not responding");
				tcsetattr(_io_fd, TCSANOW, &t_original);
				close(_io_fd);
				_io_fd = -1;
				return -EIO;
			}
		}

		ret = get_info(INFO_BL_REV, bl_rev);

		if (ret == OK) {
			if (bl_rev <= BL_REV) {
				log("found bootloader revision: %d", bl_rev);
			} else {
				log("found unsupported bootloader revision %d, exiting", bl_rev);
				tcsetattr(_io_fd, TCSANOW, &t_original);
				close(_io_fd);
				_io_fd = -1;
				return OK;
			}
		}

		ret = erase();

		if (ret != OK) {
			log("erase failed");
			continue;
		}

		ret = program(fw_size);

		if (ret != OK) {
			log("program failed");
			continue;
		}

		if (bl_rev <= 2)
			ret = verify_rev2(fw_size);
		else if(bl_rev == 3) {
			ret = verify_rev3(fw_size);
		}

		if (ret != OK) {
			log("verify failed");
			continue;
		}

		ret = reboot();

		if (ret != OK) {
			log("reboot failed");
			tcsetattr(_io_fd, TCSANOW, &t_original);
			close(_io_fd);
			_io_fd = -1;
			return ret;
		}

		log("update complete");

		ret = OK;
		break;
	}

	/* reset uart to previous/default baudrate */
	tcsetattr(_io_fd, TCSANOW, &t_original);

	close(_fw_fd);
	close(_io_fd);
	_io_fd = -1;

        // sleep for enough time for the IO chip to boot. This makes
        // forceupdate more reliably startup IO again after update
        up_udelay(100*1000);

	return ret;
}
开发者ID:30rasheed,项目名称:x-VTOLdrone,代码行数:101,代码来源:px4io_uploader.cpp

示例8: slk_test

static void slk_test(void)
/* exercise the soft keys */
{
    int	c, fmt = 1;
    char buf[9];

    c = CTRL('l');
    do {
	switch(c)
	{
	case CTRL('l'):
	    erase();
	    attron(A_BOLD);
	    mvaddstr(0, 20, "Soft Key Exerciser");
	    attroff(A_BOLD);

	    move(2, 0);
	    P("Available commands are:");
	    P("");
	    P("^L         -- refresh screen");
	    P("a          -- activate or restore soft keys");
	    P("d          -- disable soft keys");
	    P("c          -- set centered format for labels");
	    P("l          -- set left-justified format for labels");
	    P("r          -- set right-justified format for labels");
	    P("[12345678] -- set label; labels are numbered 1 through 8");
	    P("e          -- erase stdscr (should not erase labels)");
	    P("s          -- test scrolling of shortened screen");
	    P("x, q       -- return to main menu");
	    P("");
	    P("Note: if activating the soft keys causes your terminal to");
	    P("scroll up one line, your terminal auto-scrolls when anything");
	    P("is written to the last screen position.  The ncurses code");
	    P("does not yet handle this gracefully.");
	    refresh();
	    /* fall through */

	case 'a':
	    slk_restore();
	    break;

	case 'e':
	    wclear(stdscr);
	    break;

	case 's':
	    move(20, 0);
	    while ((c = getch()) != 'Q')
		addch(c);
	    break;

	case 'd':
	    slk_clear();
	    break;

	case 'l':
	    fmt = 0;
	    break;

	case 'c':
	    fmt = 1;
	    break;

	case 'r':
	    fmt = 2;
	    break;

	case '1': case '2': case '3': case '4':
	case '5': case '6': case '7': case '8':
	    (void) mvaddstr(20, 0, "Please enter the label value: ");
	    wgetnstr(stdscr, buf, 8);
	    slk_set((c - '0'), buf, fmt);
	    slk_refresh();
	    break;

	case 'x':
	case 'q':
	    goto done;

	default:
	    beep();
	}
    } while
	((c = getch()) != EOF);

 done:
    erase();
    endwin();
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:89,代码来源:ncurses.c

示例9: getFactors

 vector<vector<int>> getFactors(int n) {
     auto ans = f(n);
     ans.erase(ans.begin());
     return ans;
 }
开发者ID:andmej,项目名称:competitive_programming,代码行数:5,代码来源:factor.cpp

示例10: color_edit


//.........这里部分代码省略.........

	mvaddstr(COLORS + 3, 0,
	    "Use up/down to select a color, left/right to change fields.");
	mvaddstr(COLORS + 4, 0,
	    "Modify field by typing nnn=, nnn-, or nnn+.  ? for help.");

	move(2 + current, 0);

	switch (c = getch())
	{
	case KEY_UP:
	    current = (current == 0 ? (COLORS - 1) : current - 1);
	    value = 0;
	    break;

	case KEY_DOWN:
	    current = (current == (COLORS - 1) ? 0 : current + 1);
	    value = 0;
	    break;

	case KEY_RIGHT:
	    field = (field == 2 ? 0 : field + 1);
	    value = 0;
	    break;

	case KEY_LEFT:
	    field = (field == 0 ? 2 : field - 1);
	    value = 0;
	    break;

	case '0': case '1': case '2': case '3': case '4':
	case '5': case '6': case '7': case '8': case '9':
	    do {
		value = value * 10 + (c - '0');
		c = getch();
	    } while
		(isdigit(c));
	    if (c != '+' && c != '-' && c != '=')
		beep();
	    else
		ungetch(c);
	    break;

	case '+':
	    usebase = 1;
	    goto changeit;

	case '-':
	    value = -value;
	    usebase = 1;
	    goto changeit;

	case '=':
	    usebase = 0;
	changeit:
	    color_content(current, &red, &green, &blue);
	    if (field == 0)
		red = red * usebase + value;
	    else if (field == 1)
		green = green * usebase + value;
	    else if (field == 2)
		blue = blue * usebase + value;
	    init_color(current, red, green, blue);
	    break;

	case '?':
	    erase();
    P("                      RGB Value Editing Help");
    P("");
    P("You are in the RGB value editor.  Use the arrow keys to select one of");
    P("the fields in one of the RGB triples of the current colors; the one");
    P("currently selected will be reverse-video highlighted.");
    P("");
    P("To change a field, enter the digits of the new value; they won't be");
    P("echoed.  Finish by typing `='; the change will take effect instantly.");
    P("To increment or decrement a value, use the same procedure, but finish");
    P("with a `+' or `-'.");
    P("");
    P("To quit, do `x' or 'q'");

	    move(LINES - 1, 0);
	    addstr("Press any key to continue... ");
	    (void) getch();
	    erase();
	    break;

	case 'x':
	case 'q':
	    break;

	default:
	    beep();
	    break;
	}
    } while
	(c != 'x' && c != 'q');

    erase();
    endwin();
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:101,代码来源:ncurses.c

示例11: getch_test

static void getch_test(void)
/* test the keypad feature */
{
char buf[BUFSIZ];
unsigned int c;
int incount = 0, firsttime = 0;
bool blocking = TRUE;

      refresh();

     (void) printw("Delay in 10ths of a second (<CR> for blocking input)? ");
     echo();
     getstr(buf);
     noecho();

     if (isdigit(buf[0]))
     {
 	timeout(atoi(buf) * 100);
 	blocking = FALSE;
     }

      c = '?';
     for (;;)
     {
	if (firsttime++)
	{
	    printw("Key pressed: %04o ", c);
	    if (c >= KEY_MIN)
	    {
		(void) addstr(keyname(c));
		addch('\n');
	    }
	    else if (c > 0x80)
	    {
		if (isprint(c & ~0x80))
		    (void) printw("M-%c", c);
		else
		    (void) printw("M-%s", unctrl(c));
		addstr(" (high-half character)\n");
	    }
	    else
	    {
		if (isprint(c))
		    (void) printw("%c (ASCII printable character)\n", c);
		else
		    (void) printw("%s (ASCII control character)\n", unctrl(c));
	    }
	}
	if (c == 'x' || c == 'q')
	    break;
	if (c == '?')
	    addstr("Type any key to see its keypad value, `q' to quit, `?' for help.\n");

	while ((c = getch()) == ERR)
	    if (!blocking)
		(void) printw("%05d: input timed out\n", incount++);
    }

    timeout(-1);
    erase();
    endwin();
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:62,代码来源:ncurses.c

示例12: erase

void TimeSigMap::del(int tick)
      {
      erase(tick);
      normalize();
      }
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:5,代码来源:sig.cpp

示例13: entry

bool
OfferStream::step ()
{
    // Modifying the order or logic of these
    // operations causes a protocol breaking change.

    for(;;)
    {
        // BookTip::step deletes the current offer from the view before
        // advancing to the next (unless the ledger entry is missing).
        if (! m_tip.step())
            return false;

        SLE::pointer const& entry (m_tip.entry());

        // Remove if missing
        if (! entry)
        {
            erase (view());
            erase (view_cancel());
            continue;
        }

        // Remove if expired
        if (entry->isFieldPresent (sfExpiration) &&
                entry->getFieldU32 (sfExpiration) <= m_when)
        {
            view_cancel().offerDelete (entry->getIndex());
            if (m_journal.trace) m_journal.trace <<
                                                     "Removing expired offer " << entry->getIndex();
            continue;
        }

        m_offer = Offer (entry, m_tip.quality());

        Amounts const amount (m_offer.amount());

        // Remove if either amount is zero
        if (amount.empty())
        {
            view_cancel().offerDelete (entry->getIndex());
            if (m_journal.warning) m_journal.warning <<
                        "Removing bad offer " << entry->getIndex();
            m_offer = Offer{};
            continue;
        }

        // Calculate owner funds
        // NIKB NOTE The calling code also checks the funds, how expensive is
        //           looking up the funds twice?
        Amount const owner_funds (view().accountFunds (
                                      m_offer.account(), m_offer.amount().out, fhZERO_IF_FROZEN));

        // Check for unfunded offer
        if (owner_funds <= zero)
        {
            // If the owner's balance in the pristine view is the same,
            // we haven't modified the balance and therefore the
            // offer is "found unfunded" versus "became unfunded"
            if (view_cancel().accountFunds (m_offer.account(),
                                            m_offer.amount().out, fhZERO_IF_FROZEN) == owner_funds)
            {
                view_cancel().offerDelete (entry->getIndex());
                if (m_journal.trace) m_journal.trace <<
                                                         "Removing unfunded offer " << entry->getIndex();
            }
            else
            {
                if (m_journal.trace) m_journal.trace <<
                                                         "Removing became unfunded offer " << entry->getIndex();
            }
            m_offer = Offer{};
            continue;
        }

        break;
    }

    return true;
}
开发者ID:jjuran,项目名称:rippled,代码行数:80,代码来源:OfferStream.cpp

示例14: main


//.........这里部分代码省略.........

            if( auto_mode ) {
                mvprintw(LINES / 2 + 3, COLS / 2 - 6, "Restarting..");
                refresh();

                /* reset the game */
                killworm(&worm);
                newnode(&worm, 1 + rand() % (COLS - 2), 6 + rand() % (LINES - 7));
                erow = 6 + rand() % (LINES - 7);
                ecol = 1 + rand() % (COLS - 2);
                score = level = eating = tricks = moves = 0;
                n = 1;

                sleep(2); /* leave that the user tastes the messsage :-) */
                continue;
            }
            else {
                mvprintw(LINES / 2 + 2, COLS / 2 - 10, "Press a key to exit..");

                nodelay(stdscr, FALSE);
                getch(); /* wait for input */

                break;
            }
        }

        eating = n; /* needed for the wormshow() call */

        /* If it's eating */
        while( iseat(worm, erow, ecol) ) {
            /* Add a node on the top of worm (new head) */
            current = worm;
            while( current->next != NULL )
                current = current->next;
            newnode(&current->next, worm->y, worm->x);

            /* Change the eat's position */
            erow = 6 + rand() % (LINES - 7);
            ecol = 1 + rand() % (COLS - 2);
            ++n; /* Change the eat's number */

            score += level + 1; /* increment the points */

            /* Increase the level */
            if( !(n % LEVEAT) ) {
                ++level;
            }
        }

        erase(); /* clear the screen */
        box(stdscr, ACS_VLINE, ACS_HLINE); /* create the borders */
        mvprintw(erow, ecol, "%d", n); /* draw the eat */

        /* Show the status window (and its elemets) */
        mvwprintw(stdscr, 1, COLS / 2 - 37 / 2, /* Copy */
                  "The Hermit worm - (C) 2006 Claudio M."); /* left */
        box(wstat, ACS_VLINE, ACS_HLINE); /* status box */
        mvwhline(stdscr, 5, 1, ACS_HLINE, COLS - 2); /* new top limit */

        /* Show the worm position */
        box(wepos, ACS_VLINE, ACS_HLINE); /* status box */
        mvwprintw(stdscr, 1, 3, "Worm Curs");
        mvwprintw(wepos, 1, 2, "%.2dx%.2d", erow, ecol);

        /* Show the eat position */
        box(wpos, ACS_VLINE, ACS_HLINE); /* status box */
        mvwprintw(stdscr, 1, COLS - 12, "Eat Curs");
        mvwprintw(wpos, 1, 2, "%.2dx%.2d", worm->x, worm->y);

        /* Show the informations */
        mvwprintw(wstat, 1, 3,
                  "TS:%.2dx%.2d | " /* Terminal size */
                  "SL:%.2d | "      /* Speed level */
                  "EM:%.2d | "      /* Eats missing */
                  "UM:%.3d | "      /* User moves */
                  "UT:%.2d | "      /* User tricks */
                  "Ss:%.3d",        /* Scores */
                  LINES, COLS, level + 1, LEVEAT - (n % LEVEAT),
                  moves, tricks, score);

        /*
         * Show the whole "new" worm
         * NOTE: this statement is not optimized - trash statement :-)
        */
        if( iseat(worm, erow + 1, ecol) || iseat(worm, erow - 1, ecol) ||
                iseat(worm, erow, ecol + 1) || iseat(worm, erow, ecol - 1) ) {
            wormshow(worm, WORM, EATH);
        }
        else
            wormshow(worm, WORM, HEAD);

        usleep( 100000 - level * 10000 );
    }

    endwin(); /* end of session */

    puts("\nEnd of game.");

    return 0;
} /* E0F main */
开发者ID:faruzzy,项目名称:misc,代码行数:101,代码来源:worm.c

示例15: mode_base

void mode_base(void)
{
   short buyer=0;

   char forcewait,canseethings;
   int nonsighttime=0;
   int oldforcemonth=month;

   int length=0;

   int l = 0;

   do
   {
      forcewait=1;
      canseethings=0;
      cantseereason=CANTSEE_OTHER;
      if(!disbanding)
      {
         for(int p=0;p<(int)pool.size();p++)
         {
            if(pool[p]->alive&&
               pool[p]->align==1&&
               pool[p]->dating==0&&
               pool[p]->hiding==0&&
               !(pool[p]->flag & CREATUREFLAG_SLEEPER))
            {
               if(!location[pool[p]->location]->part_of_justice_system())
               {
                  canseethings=1;
                  if(pool[p]->clinic==0){forcewait=0;break;}
               }
            }
            else
            {
               if(pool[p]->dating==1 && cantseereason>CANTSEE_DATING) cantseereason=CANTSEE_DATING;
               else if(pool[p]->hiding!=0 && cantseereason>CANTSEE_HIDING) cantseereason=CANTSEE_HIDING;
            }
         }
      }
      else
      {
         cantseereason=CANTSEE_DISBANDING;
      }

      if(disbanding)
      {
         disbanding = show_disbanding_screen(oldforcemonth);
      }

      if(!forcewait)
      {
         if(nonsighttime>=365*4)
         {
            erase();
            char str[100];
            if(nonsighttime>=365*16) {
               strcpy(str,"How long since you've heard these sounds...  times have changed.");
            } else if(nonsighttime>=365*8) {
               strcpy(str,"It has been a long time.  A lot must have changed...");
            } else {
               strcpy(str,"It sure has been a while.  Things might have changed a bit.");
            }
            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(12,39-((strlen(str)-1)>>1));
            addstr(str, gamelog);
            gamelog.nextMessage(); //Write out buffer to prepare for the next message.

            refresh();
            getch();
         }

         nonsighttime=0;
      }

      int partysize=0;
      int partydead=0;
      if(activesquad!=NULL)
      {
         for(int p=0;p<6;p++)
         {
            if(activesquad->squad[p]!=NULL)partysize++;
            else
            {
               if(p==buyer)buyer=0;
               continue;
            }
            if(!partysize)
            {
               delete activesquad;
               activesquad=NULL;
            }

            if(!activesquad->squad[p]->alive)partydead++;
         }
      }

      int safenumber=0;
      for(l=0;l<(int)location.size();l++)if(location[l]->is_lcs_safehouse())safenumber++;

//.........这里部分代码省略.........
开发者ID:TerminalHunter,项目名称:lunar-crime-squad,代码行数:101,代码来源:basemode.cpp


注:本文中的erase函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。