Skip to content

Commit

Permalink
Code format - (Clang-format)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 22, 2024
1 parent 732d19d commit 147ae62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions source/sprite_appearances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ SpritePtr SpriteAppearances::getSprite(int spriteId) {
}

// Retrieve sprite sheet
const auto& sheet = getSheetBySpriteId(spriteId);
const auto &sheet = getSheetBySpriteId(spriteId);
if (!sheet || !sheet->loaded) {
spdlog::warn("Sprite sheet for sprite {} is not loaded or null.", spriteId);
return nullptr;
Expand Down Expand Up @@ -319,8 +319,7 @@ SpritePtr SpriteAppearances::getSprite(int spriteId) {
// Validate pixel buffer size
size_t pixelBufferSize = sprite->pixels.size();
if (pixelBufferSize < static_cast<size_t>(spriteWidth * spriteHeight * 4)) {
spdlog::error("Insufficient pixel buffer size for sprite {}: pixelBufferSize = {}, expected = {}",
spriteId, pixelBufferSize, spriteWidth * spriteHeight * 4);
spdlog::error("Insufficient pixel buffer size for sprite {}: pixelBufferSize = {}, expected = {}", spriteId, pixelBufferSize, spriteWidth * spriteHeight * 4);
return nullptr;
}

Expand All @@ -332,8 +331,7 @@ SpritePtr SpriteAppearances::getSprite(int spriteId) {

// Validate access
if (bufferDataStart + spriteWidthBytes > bufferSize) {
spdlog::error("Out-of-bounds access during copy: spriteId = {}, height = {}, offset = {}, bufferDataStart = {}, bufferSize = {}",
spriteId, height, offset, bufferDataStart, bufferSize);
spdlog::error("Out-of-bounds access during copy: spriteId = {}, height = {}, offset = {}, bufferDataStart = {}, bufferSize = {}", spriteId, height, offset, bufferDataStart, bufferSize);
return nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion source/sprite_appearances.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GameSprite;

#define SPRITE_SHEET_WIDTH 384
#define SPRITE_SHEET_HEIGHT 384
#define BYTES_IN_SPRITE_SHEET SPRITE_SHEET_WIDTH * SPRITE_SHEET_WIDTH * 4
#define BYTES_IN_SPRITE_SHEET SPRITE_SHEET_WIDTH* SPRITE_SHEET_WIDTH * 4
#define SPRITE_SHEET_WIDTH_BYTES SPRITE_SHEET_WIDTH * 4

enum class SpriteLayout {
Expand Down

0 comments on commit 147ae62

Please sign in to comment.