Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

function execution time

Name: Anonymous 2012-03-05 13:26

if a function is taking longer to execute every time it is called, what could that imply?

Name: OP 2012-03-05 14:31

alright I'm not getting anywhere. Heres the offending code, for some reason when it hits the return it takes about twice as long as the previous time to execute. I don't think it is a memory leak as this code and the function that calls it aren't concerned with memory allocation (but what do I know)

std::vector<std::vector<Segment> > Environment::_AIScopeSubArray(int yPos, int xPos, int AIScope)
{
    std::vector<std::vector<Segment> > subScope;
    int scopeRad = AIScope/2;

    subScope.resize(AIScope);
    for(int idx = 0; idx < AIScope; idx++)
        subScope[idx].resize(AIScope);

    for(int idx = 0; idx < AIScope; idx++)
        for(int jdx = 0; jdx < AIScope; jdx++)
        {
            if((idx+(yPos-scopeRad) >= 0) && (idx+(yPos-scopeRad) < GRIDSIZE) && (jdx+(xPos-scopeRad) >= 0) && (jdx+(xPos-scopeRad) < GRIDSIZE))
            {
                subScope[idx][jdx] = grid_[idx+(yPos-scopeRad)][jdx+(xPos-scopeRad)];
            }
            else
            {
                subScope[idx][jdx].setOOB(true);
            }
        }
        return subScope;
}

This is supposed to return a small portion of a larger grid, to act as a field of vision for some monsters

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List