コード例 #1
0
ファイル: Team.cpp プロジェクト: KristoforHorst/School
void Team::touchRoster(int& player, int& tagged, int& location)
{

    int arrayindex = 0; //this was not intialized, casuing segfault

    do { //will find the player with ID matching tagger
        arrayindex++;
        if (arrayindex == arrayBounds())
        {
            return; //if the ID isn't found, we should ignore the entry
        }
    } while (teamRoster[arrayindex]->playerID != player); //will exit when it finds the player

    teamRoster[arrayindex]->setTagged(tagged, location); //tells the player he scored a tag on tagged at location
    return;
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Function: ModelParameterVerilogWriter::createDeclaration()
//-----------------------------------------------------------------------------
QString ModelParameterVerilogWriter::createDeclaration() const
{
    QString parameterDeclaration("parameter <type> <arrayBounds> <name> = <default>");

    parameterDeclaration.replace("<type>", modelParameter_->getDataType().leftJustified(7));
    parameterDeclaration.replace("<arrayBounds>", arrayBounds().leftJustified(20));
    //parameterDeclaration.replace("<vectorBounds>", vectorBounds());
    parameterDeclaration.replace("<name>", modelParameter_->getName().leftJustified(16));
    parameterDeclaration.replace("<default>", formattedValue());

    if (modelParameter_->getValue().isEmpty())
    {
        parameterDeclaration.remove(" = ");
    }

    return parameterDeclaration;
}