本文整理汇总了C++中Store::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Store::getWidth方法的具体用法?C++ Store::getWidth怎么用?C++ Store::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store::getWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: integrityCheck
bool City::integrityCheck() {
REQUIRE(properlyInitialized(), "Object 'City' was not properly properlyInitializedialized when calling integrityCheck()");
bool integrity = true;
std::vector<Coordinate> coordinates;
for (std::list<House>::iterator ith = houses.begin(); ith != houses.end(); ith++){
Coordinate location;
CityObjects* ptr = &(*ith);
if (getAdjecantStreet(ptr, Coordinate(0, 0)) == Coordinate(-1, -1)){
House* houseptr = dynamic_cast<House*>(ptr);
std::string houselocation = houseptr->getLocation().getString();
o.print("\tERROR: House at location " + houselocation + " doesn't have a street linked to it.\n");
integrity = false;
}
for (int x = 0; x < 2; x++){
for (int y = 0; y < 2; y++){
location = ith->getLocation();
location.setX(location.getX()+x);
location.setY(location.getY()-y);
if (matrix.getObject(location.getX(), location.getY()) != &(*ith)){
std::string houselocation = ith->getLocation().getString();
o.print("\tERROR: House at location " + houselocation + " is supposed to be at " + location.getString() + " but is not.\n");
integrity = false;
}
coordinates.push_back(location);
}
}
}
for (std::list<Fire_Department>::iterator itd = departments.begin(); itd != departments.end(); itd++){
Coordinate location;
CityObjects* ptr = &(*itd);
if (getAdjecantStreet(ptr, Coordinate(0, 0)) == Coordinate(-1, -1)){
Fire_Department* depptr = dynamic_cast<Fire_Department*>(ptr);
std::string deplocation = depptr->getLocation().getString();
o.print("\tERROR: Department at location " + deplocation + " doesn't have a street linked to it.\n");
integrity = false;
}
for (int x = 0; x < 4; x++){
for (int y = 0; y < 4; y++){
location = itd->getLocation();
location.setX(location.getX()+x);
location.setY(location.getY()-y);
if (matrix.getObject(location.getX(), location.getY()) != &(*itd)){
std::string deplocation = itd->getLocation().getString();
o.print("\tERROR: Department at location " + deplocation + " is supposed to be at " + location.getString() + " but is not.\n");
integrity = false;
}
coordinates.push_back(location);
}
}
}
for (std::list<Store>::iterator itd = stores.begin(); itd != stores.end(); itd++){
Coordinate location;
CityObjects* ptr = &(*itd);
Store* storeptr = dynamic_cast<Store*>(ptr);
if (getAdjecantStreet(ptr, Coordinate(0, 0)) == Coordinate(-1, -1)){
std::string storeLocation = storeptr->getLocation().getString();
o.print("\tERROR: Store at location " + storeLocation + " doesn't have a street linked to it.\n");
integrity = false;
}
for (int x = 0; x < storeptr->getWidth(); x++){
for (int y = 0; y < storeptr->getLength(); y++){
location = itd->getLocation();
location.setX(location.getX()+x);
location.setY(location.getY()-y);
if (matrix.getObject(location.getX(), location.getY()) != &(*itd)){
std::string storeLocation = itd->getLocation().getString();
o.print("\tERROR: Store at location " + storeLocation + " is supposed to be at " + location.getString() + " but is not.\n");
integrity = false;
}
coordinates.push_back(location);
}
}
}
for (std::list<Hospital>::iterator itd = hospitals.begin(); itd != hospitals.end(); itd++){
Coordinate location;
CityObjects* ptr = &(*itd);
Hospital* hospitalPtr = dynamic_cast<Hospital*>(ptr);
if (getAdjecantStreet(ptr, Coordinate(0, 0)) == Coordinate(-1, -1)){
std::string hospitalLocation = hospitalPtr->getLocation().getString();
o.print("\tERROR: Hospital at location " + hospitalLocation + " doesn't have a street linked to it.\n");
integrity = false;
}
for (int x = 0; x < hospitalPtr->getWidth(); x++){
for (int y = 0; y < hospitalPtr->getLength(); y++){
location = itd->getLocation();
location.setX(location.getX()+x);
location.setY(location.getY()-y);
if (matrix.getObject(location.getX(), location.getY()) != &(*itd)){
std::string storeLocation = itd->getLocation().getString();
o.print("\tERROR: Hospital at location " + storeLocation + " is supposed to be at " + location.getString() + " but is not.\n");
integrity = false;
}
coordinates.push_back(location);
}
}
//.........这里部分代码省略.........