Prevent crash in the patch inspector when type changes happen but no valid
patch is selected.
This commit is contained in:
parent
81774d40f0
commit
34d21fcc05
6 changed files with 28 additions and 48 deletions
|
@ -442,7 +442,7 @@ void DoAbout()
|
|||
"Developed by Vera Visions LLC.\n"
|
||||
"Programming by Marco Hladik\n"
|
||||
"Licensed by id software\n\n"
|
||||
"Copyright (C) 2015-2020";
|
||||
"Copyright (C) 2015-2021";
|
||||
|
||||
auto label = ui::Label(label_text);
|
||||
|
||||
|
|
|
@ -312,8 +312,6 @@ struct EnginePath {
|
|||
}
|
||||
};
|
||||
|
||||
bool g_disableEnginePath = false;
|
||||
|
||||
void Paths_constructPreferences(PreferencesPage &page)
|
||||
{
|
||||
page.appendPathEntry("Nuclide Path", true, make_property<EnginePath>(g_strEnginePath));
|
||||
|
@ -3088,11 +3086,13 @@ void GlobalGL_sharedContextCreated()
|
|||
GLFont *g_font = NULL;
|
||||
|
||||
// report OpenGL information
|
||||
#if 0
|
||||
globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char *>( glGetString(GL_VENDOR)) << "\n";
|
||||
globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char *>( glGetString(GL_RENDERER)) << "\n";
|
||||
globalOutputStream() << "GL_VERSION: " << reinterpret_cast<const char *>( glGetString(GL_VERSION)) << "\n";
|
||||
const auto extensions = reinterpret_cast<const char *>( glGetString(GL_EXTENSIONS));
|
||||
globalOutputStream() << "GL_EXTENSIONS: " << (extensions ? extensions : "") << "\n";
|
||||
#endif
|
||||
|
||||
QGL_sharedContextCreated(GlobalOpenGL());
|
||||
|
||||
|
@ -3345,8 +3345,6 @@ void MainFrame_Construct()
|
|||
|
||||
GlobalPreferenceSystem().registerPreference("EnginePath", make_property_string(g_strEnginePath));
|
||||
|
||||
GlobalPreferenceSystem().registerPreference("DisableEnginePath", make_property_string(g_disableEnginePath));
|
||||
|
||||
g_Layout_enablePluginToolbar.useLatched();
|
||||
|
||||
Layout_registerPreferencesPage();
|
||||
|
|
|
@ -1647,11 +1647,6 @@ bool Map_ImportFile(const char *filename)
|
|||
output.push_string(EnginePath_get());
|
||||
output.push_string("\"");
|
||||
|
||||
// extra switches
|
||||
if (g_disableEnginePath) {
|
||||
output.push_string(" -fs_nobasepath ");
|
||||
}
|
||||
|
||||
output.push_string(" -fs_game ");
|
||||
output.push_string(gamename_get());
|
||||
output.push_string(" -convert -format ");
|
||||
|
|
10
src/patch.h
10
src/patch.h
|
@ -1204,7 +1204,7 @@ inline bool Patch_importMatrix(Patch &patch, Tokeniser &tokeniser)
|
|||
RETURN_FALSE_IF_FAIL(Tokeniser_getFloat(tokeniser, patch.ctrlAt(r, c).m_texcoord[0]));
|
||||
RETURN_FALSE_IF_FAIL(Tokeniser_getFloat(tokeniser, patch.ctrlAt(r, c).m_texcoord[1]));
|
||||
|
||||
patch.ctrlAt(r, c).m_color = Vector4(1,1,1,1); //assume opaque white.
|
||||
patch.ctrlAt(r, c).m_color = Vector4(1,1,1,1); //assume opaque white.
|
||||
|
||||
if (patch.m_patchDefWS) {
|
||||
//Temp Hack, to handle weird format...
|
||||
|
@ -1303,14 +1303,14 @@ inline void Patch_exportHeader(const Patch &patch, TokenWriter &writer)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (hascolours) {
|
||||
if (hascolours) {
|
||||
writer.writeToken(patch.m_patchDef3 ? "patchDef3WS" : "patchDef2WS");
|
||||
} else {
|
||||
writer.writeToken(patch.m_patchDef3 ? "patchDef3" : "patchDef2");
|
||||
}
|
||||
writer.nextLine();
|
||||
writer.writeToken("{");
|
||||
writer.nextLine();
|
||||
writer.nextLine();
|
||||
writer.writeToken("{");
|
||||
writer.nextLine();
|
||||
}
|
||||
|
||||
inline void Patch_exportShader(const Patch &patch, TokenWriter &writer)
|
||||
|
|
|
@ -426,7 +426,9 @@ static void OnSelchangeComboColRow(ui::Widget widget, gpointer data)
|
|||
g_PatchInspector.UpdateRowColInfo();
|
||||
// now reflect our changes
|
||||
g_PatchInspector.importData();
|
||||
g_PatchInspector.m_Patch->controlPointsChanged();
|
||||
|
||||
if (g_PatchInspector.m_Patch)
|
||||
g_PatchInspector.m_Patch->controlPointsChanged();
|
||||
}
|
||||
|
||||
void Scene_PatchTileTexture_Selected(scene::Graph &graph, float s, float t)
|
||||
|
|
49
src/qe3.cpp
49
src/qe3.cpp
|
@ -74,32 +74,26 @@ QEGlobals_t g_qeglobals;
|
|||
|
||||
void QE_InitVFS()
|
||||
{
|
||||
// VFS initialization -----------------------
|
||||
// we will call GlobalFileSystem().initDirectory, giving the directories to look in (for files in pk3's and for standalone files)
|
||||
// we need to call in order, the mod ones first, then the base ones .. they will be searched in this order
|
||||
// *nix systems have a dual filesystem in ~/.q3a, which is searched first .. so we need to add that too
|
||||
// VFS initialization -----------------------
|
||||
// we will call GlobalFileSystem().initDirectory, giving the directories to look in (for files in pk3's and for standalone files)
|
||||
// we need to call in order, the mod ones first, then the base ones .. they will be searched in this order
|
||||
// *nix systems have a dual filesystem in ~/.q3a, which is searched first .. so we need to add that too
|
||||
|
||||
const char *gamename = gamename_get();
|
||||
const char *basegame = basegame_get();
|
||||
const char *userRoot = g_qeglobals.m_userEnginePath.c_str();
|
||||
const char *globalRoot = EnginePath_get();
|
||||
const char *gamename = gamename_get();
|
||||
const char *basegame = basegame_get();
|
||||
const char *globalRoot = EnginePath_get();
|
||||
|
||||
// if we have a mod dir
|
||||
if (!string_equal(gamename, basegame)) {
|
||||
// <fs_basepath>/<fs_game>
|
||||
if (!g_disableEnginePath) {
|
||||
StringOutputStream globalGamePath(256);
|
||||
globalGamePath << globalRoot << gamename << '/';
|
||||
GlobalFileSystem().initDirectory(globalGamePath.c_str());
|
||||
}
|
||||
}
|
||||
// if we have a mod dir
|
||||
if (!string_equal(gamename, basegame)) {
|
||||
// <fs_basepath>/<fs_game>
|
||||
StringOutputStream globalGamePath(256);
|
||||
globalGamePath << globalRoot << gamename << '/';
|
||||
GlobalFileSystem().initDirectory(globalGamePath.c_str());
|
||||
}
|
||||
|
||||
// <fs_basepath>/<fs_main>
|
||||
if (!g_disableEnginePath) {
|
||||
StringOutputStream globalBasePath(256);
|
||||
globalBasePath << globalRoot << basegame << '/';
|
||||
GlobalFileSystem().initDirectory(globalBasePath.c_str());
|
||||
}
|
||||
StringOutputStream globalBasePath(256);
|
||||
globalBasePath << globalRoot << basegame << '/';
|
||||
GlobalFileSystem().initDirectory(globalBasePath.c_str());
|
||||
}
|
||||
|
||||
int g_numbrushes = 0;
|
||||
|
@ -158,15 +152,6 @@ void bsp_init()
|
|||
build_set_variable("MonitorAddress", (g_WatchBSP_Enabled) ? "127.0.0.1:39000" : "");
|
||||
build_set_variable("GameName", gamename_get());
|
||||
|
||||
StringBuffer ExtraQ3map2Args;
|
||||
|
||||
// extra switches
|
||||
if (g_disableEnginePath) {
|
||||
ExtraQ3map2Args.push_string(" -fs_nobasepath ");
|
||||
}
|
||||
|
||||
build_set_variable("ExtraQ3map2Args", ExtraQ3map2Args.c_str());
|
||||
|
||||
const char *mapname = Map_Name(g_map);
|
||||
StringOutputStream name(256);
|
||||
name << StringRange(mapname, path_get_filename_base_end(mapname)) << ".bsp";
|
||||
|
|
Loading…
Reference in a new issue