Hello again, Meridian. I spoke with Yankes and he told me to get touch in you, since the part of the code I altered is most likely related to you (since UI coding is within your domain).
The idea for this suggestion has popped up for me after I've player XPZ and seen 3x3 facilities there, which have incomplete Ufopaedia preview. Basically, all code is already implemented in this commit:
https://github.com/WarStalkeR/OpenXcomExMore/commit/7ebed321cddf51dfde67414bd52514175317fbbcI've replaced original part of code:
if (facility->getSize()==1)
{
x_offset = y_offset = tile_size/2;
}
else
{
x_offset = y_offset = 0;
}
With universal formula that is applicable for any size:
x_offset = (tile_size * std::max(0, Options::oxcePediaFacilityMaxWidth - facility->getSize())) / 2;
y_offset = (tile_size * std::max(0, Options::oxcePediaFacilityMaxHeight - facility->getSize())) / 2;
(I even prepared it for it, when I will be doing rebase for the version with independent Width/Height parameters).
Original '_image' definition:
_image = new Surface(tile_size*2, tile_size*2, 232, 16);
Was also replaced with universal code:
_image = new Surface(
tile_size * std::max(1, Options::oxcePediaFacilityMaxWidth),
tile_size * std::max(1, Options::oxcePediaFacilityMaxHeight),
232 + Options::oxcePediaFacilityOffsetX,
16 + Options::oxcePediaFacilityOffsetY);
Default parameters are 2, 2, 0, 0 - thus all mods that don't care about that feature won't see any change, nor will need to add/remove something.
Please take a look at commit and tell me what should I improve in this code (what to rewrite, maybe use something else instead of option variables and what to use as reference), so it will be worthy of creating pull, where you won't need to spend time fixing my code like last time
![Cheesy :D](https://openxcom.org/forum/Smileys/default/cheesy.gif)