本文整理汇总了C++中ItemType类的典型用法代码示例。如果您正苦于以下问题:C++ ItemType类的具体用法?C++ ItemType怎么用?C++ ItemType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ItemType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
ItemType::ItemType(const ItemType &other)
{
id = other.getId();
name = other.getName();
priority = other.getPriority();
position = other.getPosition();
}
示例2: addItemToPlace
void Start::addItemToPlace(Coord c, Zone* z, Item item) {
z->getLocationAt(c)->addItem(item);
ItemType* itemType = item.getType();
int light = itemType->getStatValue(Stat::LIGHT);
if (light > 0) {
myFovCirclePerm(z, c, light, 1);
if (z == player->getZone()) {
playerFieldOfView(false);
}
}
}
示例3: removeItemFromPlace
Item Start::removeItemFromPlace(Coord c, Zone* z, int index) {
Item item = z->getLocationAt(c)->removeItem(index);
ItemType* itemType = item.getType();
int light = itemType->getStatValue(Stat::LIGHT);
if (light > 0) {
myFovCirclePerm(z, c, light, -1);
if (z == player->getZone()) {
playerFieldOfView(false);
}
}
return item;
}
示例4: main
int main()
{
ifstream inFile; // file containing operations
ofstream outFile; // file containing output
string inFileName; // input file external name
string outFileName; // output file external name
string outputLabel;
string command; // operation to be executed
int number;
ItemType item;
UnsortedType list;
bool found;
int numCommands;
// Prompt for file names, read file names, and prepare files
cout << "Enter name of input command file; press return." << endl;
cin >> inFileName;
inFile.open(inFileName.c_str());
cout << "Enter name of output file; press return." << endl;
cin >> outFileName;
outFile.open(outFileName.c_str());
cout << "Enter name of test run; press return." << endl;
cin >> outputLabel;
outFile << outputLabel << endl;
if (!inFile)
{
cout << "file not found" << endl;
exit(2);
}
inFile >> command;
numCommands = 0;
while (command != "Quit")
{
if (command == "PutItem")
{
inFile >> number;
item.Initialize(number);
list.PutItem(item);
item.Print(outFile);
outFile << " is in list" << endl;
}
else if (command == "DeleteItem")
示例5: CelestialObjectRef
RefPtr<_Ty> CelestialObject::_LoadCelestialObject(ItemFactory &factory, uint32 celestialID,
// InventoryItem stuff:
const ItemType &type, const ItemData &data,
// CelestialObject stuff:
const CelestialObjectData &cData)
{
// Our category is celestial; what to do next:
switch( type.groupID() ) {
///////////////////////////////////////
// Solar system:
///////////////////////////////////////
case EVEDB::invGroups::Solar_System: {
return SolarSystem::_LoadCelestialObject<SolarSystem>( factory, celestialID, type, data, cData );
}
///////////////////////////////////////
// Station:
///////////////////////////////////////
case EVEDB::invGroups::Station: {
return Station::_LoadCelestialObject<Station>( factory, celestialID, type, data, cData );
}
}
// Create a generic one:
return CelestialObjectRef( new CelestialObject( factory, celestialID, type, data, cData ) );
}
示例6: ItemType
/*
* BlueprintType
*/
BlueprintType::BlueprintType(
uint32 _id,
const ItemGroup &_group,
const TypeData &_data,
const BlueprintType *_parentBlueprintType,
const ItemType &_productType,
const BlueprintTypeData &_bpData)
: ItemType(_id, _group, _data),
m_parentBlueprintType(_parentBlueprintType),
m_productType(_productType),
m_productionTime(_bpData.productionTime),
m_techLevel(_bpData.techLevel),
m_researchProductivityTime(_bpData.researchProductivityTime),
m_researchMaterialTime(_bpData.researchMaterialTime),
m_researchCopyTime(_bpData.researchCopyTime),
m_researchTechTime(_bpData.researchTechTime),
m_productivityModifier(_bpData.productivityModifier),
m_wasteFactor(_bpData.wasteFactor),
m_chanceOfReverseEngineering(_bpData.chanceOfReverseEngineering),
m_maxProductionLimit(_bpData.maxProductionLimit)
{
// asserts for data consistency
assert(_bpData.productTypeID == _productType.id());
if(_parentBlueprintType != NULL)
assert(_bpData.parentBlueprintTypeID == _parentBlueprintType->id());
}
示例7: CelestialObject
/*
* SolarSystem
*/
SolarSystem::SolarSystem(
ItemFactory &_factory,
uint32 _solarSystemID,
// InventoryItem stuff:
const ItemType &_type,
const ItemData &_data,
// CelestialObject stuff:
const CelestialObjectData &_cData,
// SolarSystem stuff:
const ItemType &_sunType,
const SolarSystemData &_ssData)
: CelestialObject(_factory, _solarSystemID, _type, _data, _cData),
m_minPosition(_ssData.minPosition),
m_maxPosition(_ssData.maxPosition),
m_luminosity(_ssData.luminosity),
m_border(_ssData.border),
m_fringe(_ssData.fringe),
m_corridor(_ssData.corridor),
m_hub(_ssData.hub),
m_international(_ssData.international),
m_regional(_ssData.regional),
m_constellation(_ssData.constellation),
m_security(_ssData.security),
m_factionID(_ssData.factionID),
m_radius(_ssData.radius),
m_sunType(_sunType),
m_securityClass(_ssData.securityClass)
{
// consistency check
assert(_sunType.id() == _ssData.sunTypeID);
}
示例8: getNameDescription
std::string Item::getNameDescription(const ItemType& it, const Item* item /*= NULL*/, int32_t subType /*= -1*/, bool addArticle /*= true*/)
{
if (item) {
subType = item->getSubType();
}
std::ostringstream s;
if (it.name.length()) {
if (it.stackable && subType > 1) {
if (it.showCount) {
s << subType << " ";
}
s << it.getPluralName();
} else {
if (addArticle && !it.article.empty()) {
s << it.article << " ";
}
s << it.name;
}
} else {
s << "an item of type " << it.id;
}
return s.str();
}
示例9: ItemType
/*
* CharacterType
*/
CharacterType::CharacterType(
uint32 _id,
uint8 _bloodlineID,
// ItemType stuff:
const ItemGroup &_group,
const TypeData &_data,
// CharacterType stuff:
const ItemType &_shipType,
const CharacterTypeData &_charData)
: ItemType(_id, _group, _data),
m_bloodlineID(_bloodlineID),
m_bloodlineName(_charData.bloodlineName),
m_description(_charData.description),
m_maleDescription(_charData.maleDescription),
m_femaleDescription(_charData.femaleDescription),
m_shipType(_shipType),
m_corporationID(_charData.corporationID),
m_perception(_charData.perception),
m_willpower(_charData.willpower),
m_charisma(_charData.charisma),
m_memory(_charData.memory),
m_intelligence(_charData.intelligence),
m_shortDescription(_charData.shortDescription),
m_shortMaleDescription(_charData.shortMaleDescription),
m_shortFemaleDescription(_charData.shortFemaleDescription)
{
// check for consistency
assert(_data.race == _charData.race);
assert(_charData.shipTypeID == _shipType.id());
}
示例10: RetreiveItem
void SortedType::RetreiveItem(ItemType& item, bool& found)
{
int midPoint, first = 0, last = length - 1;
bool moreToSearch = (first <= last);
found = false;
while(moreToSearch && !found)
{
midPoint = (first + last) / 2;
switch(item.ComparedTo(info[midPoint]))
{
case LESS:
last = midPoint - 1;
moreToSearch = (first <= last);
break;
case GREATER:
first = midPoint + 1;
moreToSearch = (first <= last);
break;
case EQUAL:
found = true;
item = info[midPoint];
break;
}
}
}
示例11: GetItem
ItemType SortedType::GetItem(ItemType item, bool& found)
{
bool moreToSearch;
NodeType* location;
location = listData;
found = false;
moreToSearch = (location != NULL);
while (moreToSearch && !found)
{
switch (item.ComparedTo(location->info))
{
case LESS : moreToSearch = false;
break;
case GREATER : location = location->next;
moreToSearch = (location != NULL);
break;
case EQUAL : found = true;
item = location->info;
break;
}
}
return item;
}
示例12: RefObject
/*
* InventoryItem
*/
InventoryItem::InventoryItem(
ItemFactory &_factory,
uint32 _itemID,
const ItemType &_type,
const ItemData &_data)
: RefObject( 0 ),
//attributes(_factory, *this, true, true),
mAttributeMap(*this),
mDefaultAttributeMap(*this,true),
m_saveTimer(0,true),
m_factory(_factory),
m_itemID(_itemID),
m_itemName(_data.name),
m_type(_type),
m_ownerID(_data.ownerID),
m_locationID(_data.locationID),
m_flag(_data.flag),
m_contraband(_data.contraband),
m_singleton(_data.singleton),
m_quantity(_data.quantity),
m_position(_data.position),
m_customInfo(_data.customInfo)
{
// assert for data consistency
assert(_data.typeID == _type.id());
//m_saveTimerExpiryTime = ITEM_DB_SAVE_TIMER_EXPIRY * 60 * 1000; // 10 minutes in milliseconds
//m_saveTimer.SetTimer(m_saveTimerExpiryTime); // set timer in milliseconds
m_saveTimer.Disable(); // disable timer by default
_log(ITEM__TRACE, "Created object %p for item %s (%u).", this, itemName().c_str(), itemID());
}
示例13: InsertItem
void SortedType::InsertItem(ItemType item)
{
int location = 0;
bool moreToSearch = (location < length);
while(moreToSearch)
{
switch(item.ComparedTo(info[location]))
{
case LESS:
moreToSearch = false;
break;
case GREATER:
location++;
moreToSearch = (location < length);
break;
}
}
for(int index = length; index > location; index--)
{
info[index] = info[index - 1];
}
info[location] = item;
length++;
}
示例14: CreateItem
Item* Item::CreateItem(PropStream& propStream)
{
unsigned short _id;
if(!propStream.GET_USHORT(_id)){
return NULL;
}
ItemType iType = Item::items[_id];
unsigned char _count = 1;
if(iType.stackable || iType.isSplash() || iType.isFluidContainer()){
if(!propStream.GET_UCHAR(_count)){
return NULL;
}
}
return Item::CreateItem(_id, _count);
}
示例15: GetItemType
bool ItemManager::AddItemType(FCULONG id, const string& name, const string& dbTable)
{
ItemType* pIT = GetItemType(id);
bool bResult = false;
if ( !pIT )
{
pIT = new ItemType;
pIT->SetID(id);
pIT->SetName(name);
pIT->SetDBTable(dbTable);
m_lockItemTypes.LockForWrite();
m_mapItemTypes[id] = pIT;
m_lockItemTypes.Unlock();
bResult = true;
}
return bResult;
}