Commit cabd9e0e authored by Jan Lepper's avatar Jan Lepper

fix crash and wrong terrain elevation in fmb

parent 0ae2cb0e
Pipeline #57877839 passed with stage
in 5 minutes and 15 seconds
......@@ -166,6 +166,8 @@ void loadMap(const char *path, void *env_)
{
FORCE_CHECK_GL_ERROR();
unloadMap();
ProgressReporter progress((JNIEnv*)env_);
GameState game_state((JNIEnv*)env_);
......
......@@ -53,6 +53,7 @@ namespace core
render_util::ImageGreyScale::ConstPtr getPixelMapH()
{
assert(map);
return map->getPixelMapH();
}
......
......@@ -78,7 +78,13 @@ jint JNICALL cLoadMap(JNIEnv *env, jobject obj,
core::loadMap(buf, env);
if (import.cLoadMap(env, obj, arg0, arg1, arg2, arg3))
bool loaded = import.cLoadMap(env, obj, arg0, arg1, arg2, arg3);
if (!loaded)
{
core::unloadMap();
}
else if (core::isMapLoaded())
{
auto pixel_map_h = core::getPixelMapH();
assert(pixel_map_h);
......@@ -92,11 +98,9 @@ jint JNICALL cLoadMap(JNIEnv *env, jobject obj,
import.setPixelMapH(env, obj, x, y, pixel);
}
}
return true;
}
else
return false;
return loaded;
}
jint JNICALL cUnloadMap(JNIEnv *env, jobject obj)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment