diff --git a/lib/ivis_opengl/tex.cpp b/lib/ivis_opengl/tex.cpp index b22b7d05484..d0115fcb366 100644 --- a/lib/ivis_opengl/tex.cpp +++ b/lib/ivis_opengl/tex.cpp @@ -26,7 +26,6 @@ #include "lib/ivis_opengl/piepalette.h" #include "lib/ivis_opengl/png_util.h" -#include #include "screen.h" //************************************************************************* @@ -224,18 +223,18 @@ int iV_GetTexture(const char *filename, bool compression) return pie_AddTexPage(&sSprite, path, compression); } -bool replaceTexture(const QString &oldfile, const QString &newfile) +bool replaceTexture(const WzString &oldfile, const WzString &newfile) { char tmpname[iV_TEXNAME_MAX]; // Load new one to replace it iV_Image image; - if (!iV_loadImage_PNG(QString("texpages/" + newfile).toUtf8().constData(), &image)) + if (!iV_loadImage_PNG(WzString("texpages/" + newfile).toUtf8().c_str(), &image)) { - debug(LOG_ERROR, "Failed to load image: %s", newfile.toUtf8().constData()); + debug(LOG_ERROR, "Failed to load image: %s", newfile.toUtf8().c_str()); return false; } - sstrcpy(tmpname, oldfile.toUtf8().constData()); + sstrcpy(tmpname, oldfile.toUtf8().c_str()); pie_MakeTexPageName(tmpname); // Have we already loaded this one? for (int i = 0; i < _TEX_PAGE.size(); i++) @@ -243,8 +242,8 @@ bool replaceTexture(const QString &oldfile, const QString &newfile) if (strcmp(tmpname, _TEX_PAGE[i].name) == 0) { GL_DEBUG("Replacing texture"); - debug(LOG_TEXTURE, "Replacing texture %s with %s from index %d (tex id %u)", _TEX_PAGE[i].name, newfile.toUtf8().constData(), i, _TEX_PAGE[i].id->id()); - sstrcpy(tmpname, newfile.toUtf8().constData()); + debug(LOG_TEXTURE, "Replacing texture %s with %s from index %d (tex id %u)", _TEX_PAGE[i].name, newfile.toUtf8().c_str(), i, _TEX_PAGE[i].id->id()); + sstrcpy(tmpname, newfile.toUtf8().c_str()); pie_MakeTexPageName(tmpname); pie_AddTexPage(&image, tmpname, true, i); iV_unloadImage(&image); diff --git a/lib/ivis_opengl/tex.h b/lib/ivis_opengl/tex.h index b6f79e2f7c1..31e08009c18 100644 --- a/lib/ivis_opengl/tex.h +++ b/lib/ivis_opengl/tex.h @@ -20,6 +20,7 @@ #ifndef _tex_ #define _tex_ +#include "lib/framework/wzstring.h" #include "gfx_api.h" #include "png_util.h" @@ -41,7 +42,7 @@ int iV_GetTexture(const char *filename, bool compression = true); void iV_unloadImage(iV_Image *image); gfx_api::pixel_format iV_getPixelFormat(const iV_Image *image); -bool replaceTexture(const QString &oldfile, const QString &newfile); +bool replaceTexture(const WzString &oldfile, const WzString &newfile); int pie_AddTexPage(iV_Image *s, const char *filename, bool gameTexture, int page = -1); void pie_TexInit(); diff --git a/src/qtscriptfuncs.cpp b/src/qtscriptfuncs.cpp index 669f42a2338..8f387058727 100644 --- a/src/qtscriptfuncs.cpp +++ b/src/qtscriptfuncs.cpp @@ -4747,7 +4747,7 @@ static QScriptValue js_replaceTexture(QScriptContext *context, QScriptEngine *) { QString oldfile = context->argument(0).toString(); QString newfile = context->argument(1).toString(); - replaceTexture(oldfile, newfile); + replaceTexture(WzString::fromUtf8(oldfile.toUtf8().constData()), WzString::fromUtf8(newfile.toUtf8().constData())); return QScriptValue(); }