Prop* PropFactory::createWall(int health){ Prop* wall = new Prop(false); wall->setName("Wall"); wall->getHealth()->init(wall->getHealth()->getName(), health, health); vector<Item*> debris; debris.push_back(ItemFactory::createWoodPlank()); debris.push_back(ItemFactory::createWoodPlank()); wall->setDebris(debris); return wall; }
// used only as part of a storing operation MediaAnalyticsItem::Prop *MediaAnalyticsItem::allocateProp(const char *name) { size_t len = strlen(name); size_t i = findPropIndex(name, len); Prop *prop; if (i < mPropCount) { prop = &mProps[i]; } else { if (i == mPropSize) { growProps(); // XXX: verify success } i = mPropCount++; prop = &mProps[i]; prop->setName(name, len); } return prop; }