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