summaryrefslogtreecommitdiff
path: root/ZAPD/ZTexture.cpp
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2021-03-19 14:52:04 -0400
committerGitHub <noreply@github.com>2021-03-19 14:52:04 -0400
commit1675f20955dca5f94fdf4b6b1f28532da9c83665 (patch)
treeed80703d09b11b416c0f81cc09708ebcb10d0479 /ZAPD/ZTexture.cpp
parent50122b91242734ebf893af9f64b674127b73d831 (diff)
Fix all warnings output by Clang++ (#94)
* started on basic type errors * Done. For now * remove libgfxd binary * Fix Clang Warnings * Fix2 * Fix rollback of #92 and missed warning in ZCutscene.cpp * ? * add stdexcept to ZResource * Fix make clean * PR fixes * Fix make file stuff * Remove many more errors and remove -Wall * Turns out Globals was used Co-authored-by: Fig02 <fig02srl@gmail.com>
Diffstat (limited to 'ZAPD/ZTexture.cpp')
-rw-r--r--ZAPD/ZTexture.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/ZAPD/ZTexture.cpp b/ZAPD/ZTexture.cpp
index 95afbc0..e96c290 100644
--- a/ZAPD/ZTexture.cpp
+++ b/ZAPD/ZTexture.cpp
@@ -116,6 +116,7 @@ ZTexture* ZTexture::FromPNG(string pngFilePath, TextureType texType)
case TextureType::GrayscaleAlpha16bpp: tex->PrepareRawDataGrayscaleAlpha16(pngFilePath); break;
case TextureType::Palette4bpp: tex->PrepareRawDataPalette4(pngFilePath); break;
case TextureType::Palette8bpp: tex->PrepareRawDataPalette8(pngFilePath); break;
+ default: throw std::runtime_error("Format is not supported!");
}
tex->FixRawData();
@@ -149,7 +150,7 @@ void ZTexture::ParseXML(XMLElement* reader)
type = GetTextureTypeFromString(formatStr);
if (type == TextureType::Error)
- throw "Format " + formatStr + " is not supported!";
+ throw std::runtime_error("Format " + formatStr + " is not supported!");
}
void ZTexture::FixRawData()
@@ -190,6 +191,7 @@ void ZTexture::PrepareBitmap()
case TextureType::GrayscaleAlpha16bpp: PrepareBitmapGrayscaleAlpha16(); break;
case TextureType::Palette4bpp: PrepareBitmapPalette4(); break;
case TextureType::Palette8bpp: PrepareBitmapPalette8(); break;
+ default: throw std::runtime_error("Format is not supported!");
}
}
@@ -388,7 +390,7 @@ void ZTexture::PrepareRawData(string inFolder)
case TextureType::Palette4bpp: PrepareRawDataPalette4(inFolder + "/" + outName + ".ci4.png"); break;
case TextureType::Palette8bpp: PrepareRawDataPalette8(inFolder + "/" + outName + ".ci8.png"); break;
default:
- throw "Build Mode: Format is not supported!";
+ throw std::runtime_error("Build Mode: Format is not supported!");
}
}
@@ -607,9 +609,8 @@ float ZTexture::GetPixelMultiplyer()
case TextureType::Grayscale8bpp: case TextureType::GrayscaleAlpha8bpp: case TextureType::Palette8bpp: return 1;
case TextureType::GrayscaleAlpha16bpp: case TextureType::RGBA16bpp: return 2;
case TextureType::RGBA32bpp: return 4;
+ default: return -1;
}
-
- return -1;
}
vector<uint8_t> ZTexture::GetRawData()
@@ -630,9 +631,8 @@ std::string ZTexture::GetIMFmtFromType()
case TextureType::Grayscale4bpp: case TextureType::Grayscale8bpp: return "G_IM_FMT_I";
case TextureType::Palette4bpp: case TextureType::Palette8bpp: return "G_IM_FMT_CI";
case TextureType::GrayscaleAlpha4bpp: case TextureType::GrayscaleAlpha8bpp: case TextureType::GrayscaleAlpha16bpp: return "G_IM_FMT_IA";
+ default: return "ERROR";
}
-
- return "ERROR";
}
std::string ZTexture::GetIMSizFromType()
@@ -643,9 +643,8 @@ std::string ZTexture::GetIMSizFromType()
case TextureType::Palette8bpp: case TextureType::Grayscale8bpp: return "G_IM_SIZ_8b";
case TextureType::GrayscaleAlpha16bpp: case TextureType::RGBA16bpp: return "G_IM_SIZ_16b";
case TextureType::RGBA32bpp: return "G_IM_SIZ_32b";
+ default: return "ERROR";
}
-
- return "ERROR";
}
int ZTexture::GetWidth()
@@ -761,9 +760,8 @@ std::string ZTexture::GetExternalExtension()
case TextureType::GrayscaleAlpha16bpp: return "ia16";
case TextureType::Palette4bpp: return "ci4";
case TextureType::Palette8bpp: return "ci8";
+ default: return "ERROR";
}
-
- return "";
}
@@ -796,6 +794,6 @@ TextureType ZTexture::GetTextureTypeFromString(string str)
else if (str == "ci8")
texType = TextureType::Palette8bpp;
else
- printf("Encountered Unknown Texture Type %s \n",str.c_str());
+ fprintf(stderr, "Encountered Unknown Texture Type %s \n",str.c_str());
return texType;
}