From f1b8fa305bedfc3b9909cc3f8b39d352a443f7e3 Mon Sep 17 00:00:00 2001 From: Japa Date: Thu, 25 Jan 2018 11:55:46 +0530 Subject: [PATCH] try using the new function pointer. --- library/xml | 2 +- plugins/remotefortressreader/item_reader.cpp | 21 ++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/library/xml b/library/xml index f0c609211..618db6349 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit f0c609211fbfd354b576cae75e9e64f8c6c80b06 +Subproject commit 618db6349ece5827d371a60b0fac1066b1d7989b diff --git a/plugins/remotefortressreader/item_reader.cpp b/plugins/remotefortressreader/item_reader.cpp index 36cbbb96e..36d8f6ec9 100644 --- a/plugins/remotefortressreader/item_reader.cpp +++ b/plugins/remotefortressreader/item_reader.cpp @@ -104,13 +104,22 @@ void CopyImage(const df::art_image * image, ArtImage * netImage) void CopyImage(df::art_image_ref imageRef, ArtImage * netImage) { - for (int i = 0; i < world->art_image_chunks.size(); i++) + if (df::global::getArtImage) { - auto chunk = world->art_image_chunks[i]; - if (chunk->id != imageRef.id) - continue; - auto image = chunk->images[imageRef.subid]; - CopyImage(image, netImage); + df::art_image * (*getImage)(df::art_image_ref *, int *) = (df::art_image * (*)(df::art_image_ref *, int *))df::global::getArtImage; + int subid = -1; + CopyImage(getImage(&imageRef, &subid), netImage); + } + else + { + for (int i = 0; i < world->art_image_chunks.size(); i++) + { + auto chunk = world->art_image_chunks[i]; + if (chunk->id != imageRef.id) + continue; + auto image = chunk->images[imageRef.subid]; + CopyImage(image, netImage); + } } }