コード例 #1
0
ファイル: Animal.cpp プロジェクト: ken4500/zoo
Animal* Animal::CreateWithSpeceis(Species* species)
{
    Animal* animal = new(std::nothrow) Animal();
    float mm = species->getRandomHeight().getMmLength();
    if (animal && animal->initWithSpeceis(species, mm))
    {
        animal->autorelease();
        return animal;
    }

    CC_SAFE_DELETE(animal);
    return nullptr;
}
コード例 #2
0
ファイル: Animal.cpp プロジェクト: ken4500/zoo
Animal* Animal::CreateWithSpeceis(std::string specesName, float size)
{
    Animal* animal = new(std::nothrow) Animal();
    Species* species = new Species(specesName);
    if (animal && animal->initWithSpeceis(species, size))
    {
        animal->autorelease();
        return animal;
    }

    CC_SAFE_DELETE(animal);
    return nullptr;
}