mape: use global texture map

Otherwise certain script functions would only access an empty texture map
issue1247
Armin Burgmeier 2014-10-17 13:22:57 -04:00
parent e6ed26cfc4
commit 6d983e5174
1 changed files with 8 additions and 3 deletions

View File

@ -27,15 +27,20 @@ extern "C" {
C4TextureMapHandle* c4_texture_map_handle_new(void)
{
return TEXTURE_MAP_TO_HANDLE(new C4TextureMap);
// Simply return a pointer to the global texture map. This is a bit stupid,
// but some functions in C4Landscape use the global texture map when looking
// up textures. This should be changed to get rid of the global variable,
//but yeah...
C4TextureMap* map = &::TextureMap;
map->Clear();
return TEXTURE_MAP_TO_HANDLE(map); //new C4TextureMap);
}
void c4_texture_map_handle_free(C4TextureMapHandle* texture_map)
{
delete HANDLE_TO_TEXTURE_MAP(texture_map);
//delete HANDLE_TO_TEXTURE_MAP(texture_map);
}
guint c4_texture_map_handle_load_map(C4TextureMapHandle* texture_map, C4GroupHandle* group, const char* entry_name, gboolean* overload_materials, gboolean* overload_textures)
{
bool fOverloadMaterials = false;