projects
/
laserbrain_demo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d4d7f73
)
fixed regression in the texture resource management
author
John Tsiombikas
<nuclear@mutantstargoat.com>
Thu, 1 Dec 2016 02:03:58 +0000
(
04:03
+0200)
committer
John Tsiombikas
<nuclear@mutantstargoat.com>
Thu, 1 Dec 2016 02:03:58 +0000
(
04:03
+0200)
src/texture.cc
patch
|
blob
|
history
diff --git
a/src/texture.cc
b/src/texture.cc
index
c556d27
..
b3c17fe
100644
(file)
--- a/
src/texture.cc
+++ b/
src/texture.cc
@@
-470,15
+470,24
@@
TextureSet::TextureSet()
Texture *TextureSet::get_texture(const char *name, TextureType type) const
{
Texture *TextureSet::get_texture(const char *name, TextureType type) const
{
- std::map<std::string, Texture*>::const_iterator iter = data.find(name);
+ char *fname;
+ int nsize = datamap_path_size(name);
+ if(nsize) {
+ fname = (char*)alloca(nsize);
+ datamap_lookup(name, fname, nsize);
+ } else {
+ fname = (char*)name;
+ }
+
+ std::map<std::string, Texture*>::const_iterator iter = data.find(fname);
if(iter != data.end()) {
return iter->second;
}
Texture *res = create();
if(iter != data.end()) {
return iter->second;
}
Texture *res = create();
- data[name] = res;
+ data[fname] = res;
res->create_default(type);
res->create_default(type);
- resman_lookup(rman, name, res);
+ resman_lookup(rman, fname, res);
return res;
}
return res;
}
@@
-491,17
+500,8
@@
Texture *TextureSet::create_tex()
bool TextureSet::load_tex(Texture *tex, const char *fname)
{
bool TextureSet::load_tex(Texture *tex, const char *fname)
{
- char *pathbuf;
- int nsize = datamap_path_size(fname);
- if(nsize) {
- pathbuf = (char*)alloca(nsize);
- datamap_lookup(fname, pathbuf, nsize);
- } else {
- pathbuf = (char*)fname;
- }
-
Image *img = new Image;
Image *img = new Image;
- if(!img->load(pathbuf)) {
+ if(!img->load(fname)) {
delete img;
return false;
}
delete img;
return false;
}