diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/SCsub | 3 | ||||
-rw-r--r-- | main/main.cpp | 61 | ||||
-rw-r--r-- | main/splash_editor.png | bin | 39571 -> 45062 bytes | |||
-rw-r--r-- | main/tests/test_oa_hash_map.cpp | 13 |
4 files changed, 68 insertions, 9 deletions
diff --git a/main/SCsub b/main/SCsub index 62bc155c67..73cec1d250 100644 --- a/main/SCsub +++ b/main/SCsub @@ -28,7 +28,8 @@ env.CommandNoCache("#main/splash_editor.gen.h", "#main/splash_editor.png", run_i env.Depends("#main/app_icon.gen.h", "#main/app_icon.png") env.CommandNoCache("#main/app_icon.gen.h", "#main/app_icon.png", run_in_subprocess(main_builders.make_app_icon)) -SConscript('tests/SCsub') +if env["tools"]: + SConscript('tests/SCsub') lib = env.add_library("main", env.main_sources) env.Prepend(LIBS=[lib]) diff --git a/main/main.cpp b/main/main.cpp index 5de5c52b14..6df02af3a5 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -444,6 +444,32 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (I->next()) { audio_driver = I->next()->get(); + + bool found = false; + for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) { + if (audio_driver == OS::get_singleton()->get_audio_driver_name(i)) { + found = true; + } + } + + if (!found) { + OS::get_singleton()->print("Unknown audio driver '%s', aborting.\nValid options are ", audio_driver.utf8().get_data()); + + for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) { + if (i == OS::get_singleton()->get_audio_driver_count() - 1) { + OS::get_singleton()->print(" and "); + } else if (i != 0) { + OS::get_singleton()->print(", "); + } + + OS::get_singleton()->print("'%s'", OS::get_singleton()->get_audio_driver_name(i)); + } + + OS::get_singleton()->print(".\n"); + + goto error; + } + N = I->next()->next(); } else { OS::get_singleton()->print("Missing audio driver argument, aborting.\n"); @@ -455,6 +481,32 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (I->next()) { video_driver = I->next()->get(); + + bool found = false; + for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) { + if (video_driver == OS::get_singleton()->get_video_driver_name(i)) { + found = true; + } + } + + if (!found) { + OS::get_singleton()->print("Unknown video driver '%s', aborting.\nValid options are ", video_driver.utf8().get_data()); + + for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) { + if (i == OS::get_singleton()->get_video_driver_count() - 1) { + OS::get_singleton()->print(" and "); + } else if (i != 0) { + OS::get_singleton()->print(", "); + } + + OS::get_singleton()->print("'%s'", OS::get_singleton()->get_video_driver_name(i)); + } + + OS::get_singleton()->print(".\n"); + + goto error; + } + N = I->next()->next(); } else { OS::get_singleton()->print("Missing video driver argument, aborting.\n"); @@ -989,10 +1041,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } if (video_driver_idx < 0) { - - //OS::get_singleton()->alert("Invalid Video Driver: " + video_driver); video_driver_idx = 0; - //goto error; } if (audio_driver == "") { // specified in project.godot @@ -1009,10 +1058,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } if (audio_driver_idx < 0) { - - OS::get_singleton()->alert("Invalid Audio Driver: " + audio_driver); audio_driver_idx = 0; - //goto error; } { @@ -1457,12 +1503,11 @@ bool Main::start() { }; if (test != "") { -#ifdef DEBUG_ENABLED +#ifdef TOOLS_ENABLED main_loop = test_main(test, args); if (!main_loop) return false; - #endif } else if (script != "") { diff --git a/main/splash_editor.png b/main/splash_editor.png Binary files differindex d8677f1749..ab10716a2e 100644 --- a/main/splash_editor.png +++ b/main/splash_editor.png diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp index bf5b4588ea..beee52d1de 100644 --- a/main/tests/test_oa_hash_map.cpp +++ b/main/tests/test_oa_hash_map.cpp @@ -140,6 +140,19 @@ MainLoop *test() { OS::get_singleton()->print("test for issue #31402 passed.\n"); } + // test collision resolution, should not crash or run indefinitely + { + OAHashMap<int, int> map(4); + map.set(1, 1); + map.set(5, 1); + map.set(9, 1); + map.set(13, 1); + map.remove(5); + map.remove(9); + map.remove(13); + map.set(5, 1); + } + return NULL; } } // namespace TestOAHashMap |