summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/graphic/image.h15
-rw-r--r--src/log.cpp2
2 files changed, 8 insertions, 9 deletions
diff --git a/src/graphic/image.h b/src/graphic/image.h
index f4e5fc5d..bd3545e3 100644
--- a/src/graphic/image.h
+++ b/src/graphic/image.h
@@ -63,6 +63,7 @@ class SPRITESET {
int i = 0;
while(datafile[i].type!=DAT_END) {
IMAGE *temp_image;
+
if(gfx_capabilities & GFX_HW_VRAM_BLIT) {
BITMAP *temp_video_bitmap = create_video_bitmap(((RLE_SPRITE *)datafile[i].dat)->w, ((RLE_SPRITE *)datafile[i].dat)->h);
if(temp_video_bitmap) {
@@ -70,20 +71,18 @@ class SPRITESET {
draw_rle_sprite(temp_video_bitmap, (RLE_SPRITE *)datafile[i].dat, 0, 0);
temp_image = new VIDEO_IMAGE(temp_video_bitmap, get_property(&datafile[i], DAT_ID('X','C','R','P')), get_property(&datafile[i], DAT_ID('Y','C','R','P')));
} else {
- warning("You run out of video memory");
- RLE_SPRITE *temp_rle_sprite = (RLE_SPRITE *)malloc(datafile[i].size);
- memcpy(temp_rle_sprite, datafile[i].dat, datafile[i].size);
- temp_image = new RLE_IMAGE(temp_rle_sprite, get_property(&datafile[i], DAT_ID('X','C','R','P')), get_property(&datafile[i], DAT_ID('Y','C','R','P')));
+ warning("You ran out of video memory!");
+ temp_image = new RLE_IMAGE((RLE_SPRITE*)datafile[i].dat, get_property(&datafile[i], DAT_ID('X','C','R','P')), get_property(&datafile[i], DAT_ID('Y','C','R','P')));
}
} else {
- RLE_SPRITE *temp_rle_sprite = (RLE_SPRITE *)malloc(datafile[i].size);
- memcpy(temp_rle_sprite, datafile[i].dat, datafile[i].size);
- temp_image = new RLE_IMAGE(temp_rle_sprite, get_property(&datafile[i], DAT_ID('X','C','R','P')), get_property(&datafile[i], DAT_ID('Y','C','R','P')));
+ temp_image = new RLE_IMAGE((RLE_SPRITE*)datafile[i].dat, get_property(&datafile[i], DAT_ID('X','C','R','P')), get_property(&datafile[i], DAT_ID('Y','C','R','P')));
}
spriteset.push_back(temp_image);
i++;
}
- unload_datafile(datafile);
+ // Do not unload the datafile, instead just use the allocated memory
+ // directly without making copies.
+ //unload_datafile(datafile);
}
};
diff --git a/src/log.cpp b/src/log.cpp
index 578fa957..ecc54aea 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -85,7 +85,7 @@ void error(const string error_text) {
#ifdef WIN32
MessageBox(NULL, error_text.c_str(), "Error", MB_ICONERROR|MB_OK);
#else
- fprintf(stderr, "Error: %s\n", error_text);
+ fprintf(stderr, "Error: %s\n", error_text.c_str());
#endif
exit(1);
}