clang-format LoadZoneObjects

This commit is contained in:
Michael Cook (mackal) 2016-08-27 22:26:44 -04:00
parent aaa116d97c
commit 89183cf8b7

View File

@ -157,26 +157,25 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
}
//this really loads the objects into entity_list
bool Zone::LoadZoneObjects() {
std::string query = StringFormat("SELECT id, zoneid, xpos, ypos, zpos, heading, "
"itemid, charges, objectname, type, icon, unknown08, "
"unknown10, unknown20, unknown24, unknown76, size, tilt_x, "
"tilt_y, display_name FROM object "
"WHERE zoneid = %i AND (version = %u OR version = -1)",
bool Zone::LoadZoneObjects()
{
std::string query =
StringFormat("SELECT id, zoneid, xpos, ypos, zpos, heading, itemid, charges, objectname, type, icon, "
"unknown08, unknown10, unknown20, unknown24, unknown76, size, tilt_x, tilt_y, display_name "
"FROM object WHERE zoneid = %i AND (version = %u OR version = -1)",
zoneid, instanceversion);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str());
Log.Out(Logs::General, Logs::Error, "Error Loading Objects from DB: %s",
results.ErrorMessage().c_str());
return false;
}
Log.Out(Logs::General, Logs::Status, "Loading Objects from DB...");
for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[9]) == 0)
{
if (atoi(row[9]) == 0) {
// Type == 0 - Static Object
const char* shortname = database.GetZoneName(atoi(row[1]), false); // zoneid -> zone_shortname
const char *shortname = database.GetZoneName(atoi(row[1]), false); // zoneid -> zone_shortname
if (!shortname)
continue;
@ -214,7 +213,7 @@ bool Zone::LoadZoneObjects() {
}
d.incline = atoi(row[13]); // unknown20 = optional model incline value
d.client_version_mask = 0xFFFFFFFF; //We should load the mask from the zone.
d.client_version_mask = 0xFFFFFFFF; // We should load the mask from the zone.
auto door = new Doors(&d);
entity_list.AddDoor(door);
@ -252,20 +251,19 @@ bool Zone::LoadZoneObjects() {
data.tilt_y = atof(row[18]);
data.unknown084 = 0;
ItemInst* inst = nullptr;
//FatherNitwit: this dosent seem to work...
//tradeskill containers do not have an itemid of 0... at least what I am seeing
ItemInst *inst = nullptr;
// FatherNitwit: this dosent seem to work...
// tradeskill containers do not have an itemid of 0... at least what I am seeing
if (itemid == 0) {
// Generic tradeskill container
inst = new ItemInst(ItemInstWorldContainer);
}
else {
} else {
// Groundspawn object
inst = database.CreateItem(itemid);
}
//Father Nitwit's fix... not perfect...
if(inst == nullptr && type != OT_DROPPEDITEM) {
// Father Nitwit's fix... not perfect...
if (inst == nullptr && type != OT_DROPPEDITEM) {
inst = new ItemInst(ItemInstWorldContainer);
}