Make logger automatically put a newline (#675)

at the end of the line
remove all the newlines in log calls
This commit is contained in:
Aaron Kimbrell
2022-07-24 21:26:51 -05:00
committed by GitHub
parent a7fb6eb3f3
commit e97ae92624
86 changed files with 1249 additions and 1252 deletions

View File

@@ -81,7 +81,7 @@ uint32_t Inventory::GetLotCount(const LOT lot) const
void Inventory::SetSize(const uint32_t value)
{
free += static_cast<int32_t>(value) - static_cast<int32_t>(size);
size = value;
GameMessages::SendSetInventorySize(component->GetParent(), type, static_cast<int>(size));
@@ -107,7 +107,7 @@ int32_t Inventory::FindEmptySlot()
{
newSize += 10u;
}
if (newSize > GetSize())
{
SetSize(newSize);
@@ -121,7 +121,7 @@ int32_t Inventory::FindEmptySlot()
}
const auto slots = GetSlots();
for (auto i = 0u; i < size; ++i)
{
if (slots.find(i) == slots.end())
@@ -133,15 +133,15 @@ int32_t Inventory::FindEmptySlot()
return -1;
}
int32_t Inventory::GetEmptySlots()
int32_t Inventory::GetEmptySlots()
{
return free;
}
bool Inventory::IsSlotEmpty(int32_t slot)
bool Inventory::IsSlotEmpty(int32_t slot)
{
const auto slots = GetSlots();
const auto& index = slots.find(slot);
return index == slots.end();
@@ -201,7 +201,7 @@ Item* Inventory::FindItemByLot(const LOT lot, const bool ignoreEquipped, const b
Item* Inventory::FindItemBySlot(const uint32_t slot) const
{
const auto slots = GetSlots();
const auto index = slots.find(slot);
if (index == slots.end())
@@ -228,21 +228,21 @@ Item* Inventory::FindItemBySubKey(LWOOBJID id) const
void Inventory::AddManagedItem(Item* item)
{
const auto id = item->GetId();
if (items.find(id) != items.end())
{
Game::logger->Log("Inventory", "Attempting to add an item with an already present id (%llu)!\n", id);
Game::logger->Log("Inventory", "Attempting to add an item with an already present id (%llu)!", id);
return;
}
const auto slots = GetSlots();
const auto slot = item->GetSlot();
if (slots.find(slot) != slots.end())
{
Game::logger->Log("Inventory", "Attempting to add an item with an already present slot (%i)!\n", slot);
Game::logger->Log("Inventory", "Attempting to add an item with an already present slot (%i)!", slot);
return;
}
@@ -258,7 +258,7 @@ void Inventory::RemoveManagedItem(Item* item)
if (items.find(id) == items.end())
{
Game::logger->Log("Inventory", "Attempting to remove an item with an invalid id (%llu), lot (%i)!\n", id, item->GetLot());
Game::logger->Log("Inventory", "Attempting to remove an item with an invalid id (%llu), lot (%i)!", id, item->GetLot());
return;
}
@@ -277,7 +277,7 @@ eInventoryType Inventory::FindInventoryTypeForLot(const LOT lot)
switch (itemType) {
case eItemType::ITEM_TYPE_BRICK:
return BRICKS;
case eItemType::ITEM_TYPE_BEHAVIOR:
return BEHAVIORS;
@@ -289,7 +289,7 @@ eInventoryType Inventory::FindInventoryTypeForLot(const LOT lot)
case eItemType::ITEM_TYPE_LOOT_MODEL:
case eItemType::ITEM_TYPE_MOUNT:
return MODELS;
case eItemType::ITEM_TYPE_HAT:
case eItemType::ITEM_TYPE_HAIR:
case eItemType::ITEM_TYPE_NECK:
@@ -307,7 +307,7 @@ eInventoryType Inventory::FindInventoryTypeForLot(const LOT lot)
case eItemType::ITEM_TYPE_PACKAGE:
case eItemType::ITEM_TYPE_CURRENCY:
return ITEMS;
case eItemType::ITEM_TYPE_QUEST_OBJECT:
case eItemType::ITEM_TYPE_UNKNOWN:
default:
@@ -325,11 +325,11 @@ const CDItemComponent& Inventory::FindItemComponent(const LOT lot)
if (componentId == 0)
{
Game::logger->Log("Inventory", "Failed to find item component for (%i)!\n", lot);
Game::logger->Log("Inventory", "Failed to find item component for (%i)!", lot);
return CDItemComponentTable::Default;
}
const auto& itemComponent = itemComponents->GetItemComponentByID(componentId);
return itemComponent;
@@ -344,7 +344,7 @@ bool Inventory::IsValidItem(const LOT lot)
return componentId != 0;
}
const std::vector<LOT>& Inventory::GetAllGMItems()
const std::vector<LOT>& Inventory::GetAllGMItems()
{
return m_GameMasterRestrictedItems;
}

View File

@@ -20,7 +20,7 @@ Item::Item(const LWOOBJID id, const LOT lot, Inventory* inventory, const uint32_
{
return;
}
this->id = id;
this->lot = lot;
this->inventory = inventory;
@@ -32,7 +32,7 @@ Item::Item(const LWOOBJID id, const LOT lot, Inventory* inventory, const uint32_
this->info = &Inventory::FindItemComponent(lot);
this->preconditions = new PreconditionExpression(this->info->reqPrecondition);
this->subKey = subKey;
inventory->AddManagedItem(this);
}
@@ -48,7 +48,7 @@ Item::Item(
LWOOBJID subKey,
bool bound,
eLootSourceType lootSourceType)
{
{
if (!Inventory::IsValidItem(lot))
{
return;
@@ -87,7 +87,7 @@ Item::Item(
{
Equip();
Game::logger->Log("Item", "Move and equipped (%i) from (%i)\n", this->lot, this->inventory->GetType());
Game::logger->Log("Item", "Move and equipped (%i) from (%i)", this->lot, this->inventory->GetType());
EntityManager::Instance()->SerializeEntity(inventory->GetComponent()->GetParent());
}
@@ -154,7 +154,7 @@ void Item::SetCount(const uint32_t value, const bool silent, const bool disassem
{
return;
}
const auto delta = std::abs(static_cast<int32_t>(value) - static_cast<int32_t>(count));
const auto type = static_cast<eItemType>(info->itemType);
@@ -169,11 +169,11 @@ void Item::SetCount(const uint32_t value, const bool silent, const bool disassem
}
}
}
if (!silent)
{
auto* entity = inventory->GetComponent()->GetParent();
if (value > count)
{
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, delta, LWOOBJID_EMPTY, lootSourceType);
@@ -217,7 +217,7 @@ void Item::SetBound(const bool value)
bound = value;
}
void Item::SetSubKey(LWOOBJID value)
void Item::SetSubKey(LWOOBJID value)
{
subKey = value;
}
@@ -271,14 +271,14 @@ bool Item::IsEquipped() const
bool Item::Consume()
{
auto* skillsTable = CDClientManager::Instance()->GetTable<CDObjectSkillsTable>("ObjectSkills");
auto skills = skillsTable->Query([=](const CDObjectSkills entry)
{
return entry.objectTemplate == static_cast<uint32_t>(lot);
});
auto success = false;
for (auto& skill : skills)
{
if (skill.castOnType == 3) // Consumable type
@@ -287,7 +287,7 @@ bool Item::Consume()
}
}
Game::logger->Log("Item", "Consumed (%i) / (%llu) with (%d)\n", lot, id, success);
Game::logger->Log("Item", "Consumed (%i) / (%llu) with (%d)", lot, id, success);
GameMessages::SendUseItemResult(inventory->GetComponent()->GetParent(), lot, success);
@@ -343,7 +343,7 @@ bool Item::UseNonEquip()
LootGenerator::Instance().GiveLoot(inventory->GetComponent()->GetParent(), result, eLootSourceType::LOOT_SOURCE_CONSUMPTION);
}
Game::logger->Log("Item", "Used (%i)\n", lot);
Game::logger->Log("Item", "Used (%i)", lot);
inventory->GetComponent()->RemoveItem(lot, 1);
}
@@ -357,11 +357,11 @@ void Item::Disassemble(const eInventoryType inventoryType)
if (data->GetKey() == u"assemblyPartLOTs")
{
auto modStr = data->GetValueAsString();
std::vector<LOT> modArray;
std::stringstream ssData(modStr);
std::string token;
const auto deliminator = '+';
@@ -369,7 +369,7 @@ void Item::Disassemble(const eInventoryType inventoryType)
while (std::getline(ssData, token, deliminator))
{
const auto modLot = std::stoi(token.substr(2, token.size() - 1));
modArray.push_back(modLot);
}
@@ -397,7 +397,7 @@ void Item::DisassembleModel()
{
return;
}
std::string renderAsset = result.fieldIsNull(0) ? "" : std::string(result.getStringField(0));
std::vector<std::string> renderAssetSplit = GeneralUtils::SplitString(renderAsset, '\\');
@@ -410,7 +410,7 @@ void Item::DisassembleModel()
{
return;
}
std::stringstream data;
data << file.rdbuf();
@@ -420,7 +420,7 @@ void Item::DisassembleModel()
}
auto* doc = new tinyxml2::XMLDocument();
if (!doc)
{
return;
@@ -436,26 +436,26 @@ void Item::DisassembleModel()
auto* lxfml = doc->FirstChildElement("LXFML");
auto* bricks = lxfml->FirstChildElement("Bricks");
std::string searchTerm = "Brick";
if (!bricks)
{
searchTerm = "Part";
bricks = lxfml->FirstChildElement("Scene")->FirstChildElement("Model")->FirstChildElement("Group");
if (!bricks)
{
return;
}
}
auto* currentBrick = bricks->FirstChildElement(searchTerm.c_str());
while (currentBrick)
{
if (currentBrick->Attribute("designID") != nullptr)
if (currentBrick->Attribute("designID") != nullptr)
{
parts.push_back(std::stoi(currentBrick->Attribute("designID")));
}
currentBrick = currentBrick->NextSiblingElement(searchTerm.c_str());
}
@@ -472,7 +472,7 @@ void Item::DisassembleModel()
{
continue;
}
GetInventory()->GetComponent()->AddItem(brickID[0].NDObjectID, 1, eLootSourceType::LOOT_SOURCE_DELETION);
}
}
@@ -480,7 +480,7 @@ void Item::DisassembleModel()
void Item::RemoveFromInventory()
{
UnEquip();
count = 0;
inventory->RemoveManagedItem(this);