<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.wesnoth.org/index.php?action=history&amp;feed=atom&amp;title=User%3ACeltic_Minstrel%2FFormulaTests</id>
	<title>User:Celtic Minstrel/FormulaTests - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.wesnoth.org/index.php?action=history&amp;feed=atom&amp;title=User%3ACeltic_Minstrel%2FFormulaTests"/>
	<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=User:Celtic_Minstrel/FormulaTests&amp;action=history"/>
	<updated>2026-05-24T14:30:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.16</generator>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=User:Celtic_Minstrel/FormulaTests&amp;diff=57606&amp;oldid=prev</id>
		<title>Celtic Minstrel: Pastebin whee</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=User:Celtic_Minstrel/FormulaTests&amp;diff=57606&amp;oldid=prev"/>
		<updated>2016-03-15T21:16:21Z</updated>

		<summary type="html">&lt;p&gt;Pastebin whee&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
Comments explaining the algorithm:&lt;br /&gt;
&lt;br /&gt;
 ### The formula language doesn't support variables so macros are used to&lt;br /&gt;
 ### emulate them. This makes the code what harder to read, so the algorithm for&lt;br /&gt;
 ### __GUI_IMAGE_WIDTH is described here:&lt;br /&gt;
 ###&lt;br /&gt;
 ### if gamemap_width &amp;lt;= TEXT_WIDTH_SATURATION&lt;br /&gt;
 ###     __GUI_IMAGE_WIDTH = gamemap_width / 3&lt;br /&gt;
 ### else&lt;br /&gt;
 ###     # Text reached it maximum width, take all space.&lt;br /&gt;
 ###     __GUI_IMAGE_WIDTH = gamemap_width - MAX_TEXT_WIDTH&lt;br /&gt;
 ### fi&lt;br /&gt;
 ###&lt;br /&gt;
 ### if __GUI_IMAGE_WIDTH &amp;lt; 250&lt;br /&gt;
 ###     __GUI_IMAGE_WIDTH = 250&lt;br /&gt;
 ### fi&lt;br /&gt;
 ###&lt;br /&gt;
 ### if __GUI_IMAGE_WIDTH &amp;gt; 500&lt;br /&gt;
 ###     __GUI_IMAGE_WIDTH = 500&lt;br /&gt;
 ### fi&lt;br /&gt;
&lt;br /&gt;
Merged WFL version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang='wfl'&amp;gt;&lt;br /&gt;
	if(best_size &amp;lt; 250, 250,&lt;br /&gt;
		if(best_size &amp;gt; 500, 500, best_size)&lt;br /&gt;
	)&lt;br /&gt;
where&lt;br /&gt;
	best_size = (&lt;br /&gt;
		if((best_width * aspect_ratio) &amp;gt; max_height,&lt;br /&gt;
			floor(max_height / aspect_ratio),&lt;br /&gt;
			best_width&lt;br /&gt;
		)&lt;br /&gt;
	where&lt;br /&gt;
		best_width = (&lt;br /&gt;
			if(gamemap_width &amp;gt; text_width_saturation,&lt;br /&gt;
				gamemap_width - max_text_width,&lt;br /&gt;
				(gamemap_width / size_factor)&lt;br /&gt;
			)&lt;br /&gt;
		where&lt;br /&gt;
			# gamemap_width width needed to reach the MAX_TEXT_WIDTH #&lt;br /&gt;
			text_width_saturation = (&lt;br /&gt;
				(3 * height_offset) / 2&lt;br /&gt;
			where&lt;br /&gt;
				# This might become global have to evaluate later. #&lt;br /&gt;
				height_offset = 25&lt;br /&gt;
			),&lt;br /&gt;
			# The maximum width of the text #&lt;br /&gt;
			max_text_width = 675,&lt;br /&gt;
			# helper convert the scale factor, since we use it in two places define it as&lt;br /&gt;
			helper value. (Two the not working and working version, but want to avoid&lt;br /&gt;
			surprises when the not working version is fixed). #&lt;br /&gt;
			size_factor = 3&lt;br /&gt;
		),&lt;br /&gt;
		aspect_ratio = (&lt;br /&gt;
			if(image_original_width &amp;gt; 0,&lt;br /&gt;
				(as_decimal(image_original_height) / image_original_width),&lt;br /&gt;
				0&lt;br /&gt;
			)&lt;br /&gt;
		),&lt;br /&gt;
		max_height = game_map_height - 4&lt;br /&gt;
	)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Celtic Minstrel</name></author>
		
	</entry>
</feed>