forked from Mirrors/openclonk
Fix mape build
parent
1f303ac331
commit
2ced63de25
|
@ -133,16 +133,13 @@ C4MapgenHandle* c4_mapgen_handle_new_script(const char* filename, const char* so
|
||||||
|
|
||||||
// Generate map, fail if return error occurs
|
// Generate map, fail if return error occurs
|
||||||
c4_log_handle_clear();
|
c4_log_handle_clear();
|
||||||
CSurface8* out_ptr_fg = NULL;
|
std::unique_ptr<CSurface8> out_ptr_fg, out_ptr_bg;
|
||||||
CSurface8* out_ptr_bg = NULL;
|
|
||||||
const bool result = ::MapScript.InitializeMap(
|
const bool result = ::MapScript.InitializeMap(
|
||||||
&landscape,
|
&landscape,
|
||||||
HANDLE_TO_TEXTURE_MAP(texture_map),
|
HANDLE_TO_TEXTURE_MAP(texture_map),
|
||||||
HANDLE_TO_MATERIAL_MAP(material_map),
|
HANDLE_TO_MATERIAL_MAP(material_map),
|
||||||
1,
|
1,
|
||||||
&out_ptr_fg, &out_ptr_bg);
|
&out_ptr_fg, &out_ptr_bg);
|
||||||
std::auto_ptr<CSurface8> out(out_ptr_fg);
|
|
||||||
delete out_ptr_bg; // We don't show the background map... maybe should include a toggle to switch between fg and bg...
|
|
||||||
|
|
||||||
// Don't show any map if there was a script runtime error
|
// Don't show any map if there was a script runtime error
|
||||||
const char* runtime_error = c4_log_handle_get_first_log_message();
|
const char* runtime_error = c4_log_handle_get_first_log_message();
|
||||||
|
@ -153,12 +150,12 @@ C4MapgenHandle* c4_mapgen_handle_new_script(const char* filename, const char* so
|
||||||
throw std::runtime_error("No InitializeMap() function present in the script, or it returns false");
|
throw std::runtime_error("No InitializeMap() function present in the script, or it returns false");
|
||||||
|
|
||||||
C4MapgenHandle* handle = new C4MapgenHandle;
|
C4MapgenHandle* handle = new C4MapgenHandle;
|
||||||
handle->width = out->Wdt;
|
handle->width = out_ptr_fg->Wdt;
|
||||||
handle->height = out->Hgt;
|
handle->height = out_ptr_fg->Hgt;
|
||||||
handle->rowstride = out->Wdt;
|
handle->rowstride = out_ptr_fg->Wdt;
|
||||||
handle->error_message = NULL;
|
handle->error_message = NULL;
|
||||||
handle->data = out->Bits;
|
handle->data = out_ptr_fg->Bits;
|
||||||
out->ReleaseBuffer();
|
out_ptr_fg->ReleaseBuffer();
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue