ZealOS/docs/Apps/ToTheFront/TTFVis.ZC.html
2021-12-11 06:10:58 -05:00

278 lines
27 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.07">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> VR_ONE_FRIENDLY_UNIT </span><span class=cFE>0</span><span class=cF0>
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> VR_UPDATE_FRIENDLY_UNIT </span><span class=cFE>1</span><span class=cF0>
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> VR_FRIENDLY_UNIT_DIED </span><span class=cFE>3</span><span class=cF0>
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> VR_ONE_ENEMY_UNIT </span><span class=cFE>4</span><span class=cF0>
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> VR_ALL_UNITS </span><span class=cFE>5</span><span class=cF0>
<a name="l6"></a>
<a name="l7"></a></span><span class=cF1>class</span><span class=cF0> MPCtrl1
<a name="l8"></a>{
<a name="l9"></a> </span><span class=cF9>I64</span><span class=cF0> mode, lo, hi;
<a name="l10"></a> Unit *tmpu;
<a name="l11"></a>};
<a name="l12"></a>
<a name="l13"></a></span><span class=cF1>class</span><span class=cF0> MPCtrl2
<a name="l14"></a>{
<a name="l15"></a> </span><span class=cF9>I64</span><span class=cF0> lo, hi, row, col;
<a name="l16"></a>};
<a name="l17"></a>
<a name="l18"></a>
<a name="l19"></a></span><span class=cF1>U0</span><span class=cF0> VRSetUp(</span><span class=cF9>I64</span><span class=cF0> player)
<a name="l20"></a>{
<a name="l21"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l22"></a> Unit *ut0, *ut1;
<a name="l23"></a>
<a name="l24"></a> ut0 = &amp;units[player][</span><span class=cFE>0</span><span class=cF0>];
<a name="l25"></a> ut1 = &amp;units[player ^ </span><span class=cFE>1</span><span class=cF0>][</span><span class=cFE>0</span><span class=cF0>];
<a name="l26"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; UNITS_NUM; i++, ut0++, ut1++)
<a name="l27"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l28"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;ut1-&gt;vis[player], </span><span class=cFE>0</span><span class=cF0>);
<a name="l29"></a> </span><span class=cF5>LBEqual</span><span class=cF0>(&amp;ut0-&gt;vis[player], </span><span class=cFE>0</span><span class=cF0>, ut0-&gt;life &gt; </span><span class=cFE>0</span><span class=cF0>);
<a name="l30"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l31"></a>}
<a name="l32"></a>
<a name="l33"></a></span><span class=cF1>U0</span><span class=cF0> VRMerge(</span><span class=cF9>I64</span><span class=cF0> player)
<a name="l34"></a>{
<a name="l35"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
<a name="l36"></a> Unit *ut1;
<a name="l37"></a> </span><span class=cF1>U8</span><span class=cF0> *dst, *src, *mask = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>UNITS_NUM + </span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>3</span><span class=cF0>);
<a name="l38"></a>
<a name="l39"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; UNITS_NUM; j++) </span><span class=cF7>{</span><span class=cF2>//p0</span><span class=cF0>
<a name="l40"></a> src = &amp;vis_unit_bitmap[player][(</span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>*j) &gt;&gt; </span><span class=cFE>3</span><span class=cF0>];
<a name="l41"></a> dst = mask;
<a name="l42"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cF7>(</span><span class=cF0>UNITS_NUM + </span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>3</span><span class=cF0>; i++) </span><span class=cF2>//player1</span><span class=cF0>
<a name="l43"></a> *dst++ |= *src++;
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l45"></a> ut1 = &amp;units[player ^ </span><span class=cFE>1</span><span class=cF0>][</span><span class=cFE>0</span><span class=cF0>];
<a name="l46"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; UNITS_NUM; j++, ut1++)
<a name="l47"></a> </span><span class=cF5>LBEqual</span><span class=cF0>(&amp;ut1-&gt;vis[player], </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>mask, j</span><span class=cF7>)</span><span class=cF0> &amp;&amp; ut1-&gt;life &gt; </span><span class=cFE>0</span><span class=cF0>);
<a name="l48"></a> </span><span class=cF5>Free</span><span class=cF0>(mask);
<a name="l49"></a>}
<a name="l50"></a>
<a name="l51"></a></span><span class=cF1>Bool</span><span class=cF0> MPVisRecalc(MPCtrl1 *job)
<a name="l52"></a>{
<a name="l53"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>, seen;
<a name="l54"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, row, col;
<a name="l55"></a> </span><span class=cF1>F64</span><span class=cF0> x1, y1, x2, y2, dd, range;
<a name="l56"></a> Unit *ut0, *ut1;
<a name="l57"></a>
<a name="l58"></a> ut0 = &amp;units[cur_player][job-&gt;lo];
<a name="l59"></a> ut1 = &amp;units[enemy_player][job-&gt;lo];
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (job-&gt;tmpu) </span><span class=cF7>{</span><span class=cF0>
<a name="l61"></a> row = job-&gt;tmpu-&gt;row;
<a name="l62"></a> col = job-&gt;tmpu-&gt;col;
<a name="l63"></a> range = job-&gt;tmpu-&gt;range * </span><span class=cFE>2</span><span class=cF0> * HEX_RADIUS;
<a name="l64"></a> range *= range;
<a name="l65"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l66"></a> </span><span class=cF1>switch</span><span class=cF0> (job-&gt;mode)
<a name="l67"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l68"></a> </span><span class=cF1>case</span><span class=cF0> VR_UPDATE_FRIENDLY_UNIT:
<a name="l69"></a> </span><span class=cF1>case</span><span class=cF0> VR_ONE_FRIENDLY_UNIT:
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (job-&gt;mode == VR_UPDATE_FRIENDLY_UNIT)
<a name="l71"></a> range = </span><span class=cF3>F64_MAX</span><span class=cF0>;
<a name="l72"></a> RowCol2XY(&amp;x1, &amp;y1, row, col);
<a name="l73"></a> </span><span class=cF1>for</span><span class=cF0> (i = job-&gt;lo; i &lt; job-&gt;hi; i++, ut1++)
<a name="l74"></a> {
<a name="l75"></a> seen = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l76"></a> </span><span class=cF1>if</span><span class=cF0> (ut1-&gt;life &gt; </span><span class=cFE>0</span><span class=cF0> &amp;&amp; LOS</span><span class=cF7>(</span><span class=cF0>row, col, ut1-&gt;row, ut1-&gt;col</span><span class=cF7>)</span><span class=cF0>)
<a name="l77"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l78"></a> RowCol2XY(&amp;x2, &amp;y2, ut1-&gt;row, ut1-&gt;col);
<a name="l79"></a> dd = </span><span class=cF5>Sqr</span><span class=cF0>(x2 - x1) + </span><span class=cF5>Sqr</span><span class=cF0>(y2 - y1);
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (dd &lt; range)
<a name="l81"></a> {
<a name="l82"></a> seen = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l83"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;ut1-&gt;vis[cur_player], </span><span class=cFE>0</span><span class=cF0>);
<a name="l84"></a> }
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (job-&gt;mode == VR_UPDATE_FRIENDLY_UNIT)
<a name="l87"></a> </span><span class=cF5>LBEqual</span><span class=cF0>(&amp;vis_unit_bitmap[cur_player], i + job-&gt;tmpu-&gt;num * </span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>, seen);
<a name="l88"></a> }
<a name="l89"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l90"></a>
<a name="l91"></a> </span><span class=cF1>case</span><span class=cF0> VR_ONE_ENEMY_UNIT:
<a name="l92"></a> RowCol2XY(&amp;x1, &amp;y1, row, col);
<a name="l93"></a> </span><span class=cF1>for</span><span class=cF0> (i = job-&gt;lo; i &lt; job-&gt;hi; i++, ut1++)
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (ut1-&gt;life &gt; </span><span class=cFE>0</span><span class=cF0> &amp;&amp; LOS</span><span class=cF7>(</span><span class=cF0>row, col, ut1-&gt;row, ut1-&gt;col</span><span class=cF7>)</span><span class=cF0>)
<a name="l95"></a> {
<a name="l96"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;vis_unit_bitmap[enemy_player], job-&gt;tmpu-&gt;num + i * </span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>);
<a name="l97"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l98"></a> }
<a name="l99"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l100"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;vis_unit_bitmap[enemy_player], job-&gt;tmpu-&gt;num + i * </span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>);
<a name="l101"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l102"></a>
<a name="l103"></a> </span><span class=cF1>case</span><span class=cF0> VR_ALL_UNITS:
<a name="l104"></a> ut0 = &amp;units[cur_player][</span><span class=cFE>0</span><span class=cF0>];
<a name="l105"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; UNITS_NUM; i++, ut0++)
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (ut0-&gt;life &gt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l107"></a> {
<a name="l108"></a> RowCol2XY(&amp;x1, &amp;y1, ut0-&gt;row, ut0-&gt;col);
<a name="l109"></a> ut1 = &amp;units[enemy_player][job-&gt;lo];
<a name="l110"></a> </span><span class=cF1>for</span><span class=cF0> (j = job-&gt;lo; j &lt; job-&gt;hi; j++, ut1++)
<a name="l111"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (ut1-&gt;life &gt; </span><span class=cFE>0</span><span class=cF0> &amp;&amp; LOS</span><span class=cF7>(</span><span class=cF0>ut0-&gt;row, ut0-&gt;col, ut1-&gt;row, ut1-&gt;col</span><span class=cF7>)</span><span class=cF0>)
<a name="l113"></a> {
<a name="l114"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;ut1-&gt;vis[cur_player], </span><span class=cFE>0</span><span class=cF0>);
<a name="l115"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;vis_unit_bitmap[cur_player], j + i * </span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>);
<a name="l116"></a> }
<a name="l117"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l118"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;vis_unit_bitmap[cur_player], j + i * </span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>);
<a name="l119"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l120"></a> }
<a name="l121"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l122"></a> </span><span class=cF1>for</span><span class=cF0> (j = job-&gt;lo; j &lt; job-&gt;hi ;j++)
<a name="l123"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;vis_unit_bitmap[cur_player], j + i * </span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>);
<a name="l124"></a> ut0 = &amp;units[enemy_player][</span><span class=cFE>0</span><span class=cF0>];
<a name="l125"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; UNITS_NUM; i++, ut0++)
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (ut0-&gt;life &gt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l127"></a> {
<a name="l128"></a> RowCol2XY(&amp;x1, &amp;y1, ut0-&gt;row, ut0-&gt;col);
<a name="l129"></a> ut1 = &amp;units[cur_player][job-&gt;lo];
<a name="l130"></a> </span><span class=cF1>for</span><span class=cF0> (j = job-&gt;lo; j &lt; job-&gt;hi; j++, ut1++)
<a name="l131"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (ut1-&gt;life &gt; </span><span class=cFE>0</span><span class=cF0> &amp;&amp; LOS</span><span class=cF7>(</span><span class=cF0>ut0-&gt;row, ut0-&gt;col, ut1-&gt;row, ut1-&gt;col</span><span class=cF7>)</span><span class=cF0>)
<a name="l133"></a> {
<a name="l134"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;ut1-&gt;vis[enemy_player], </span><span class=cFE>0</span><span class=cF0>);
<a name="l135"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;vis_unit_bitmap[enemy_player], j + i * </span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>);
<a name="l136"></a> }
<a name="l137"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l138"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;vis_unit_bitmap[enemy_player], j + i * </span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>);
<a name="l139"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l140"></a> }
<a name="l141"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l142"></a> </span><span class=cF1>for</span><span class=cF0> (j = job-&gt;lo; j &lt; job-&gt;hi; j++)
<a name="l143"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;vis_unit_bitmap[enemy_player], j + i * </span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) &amp; ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>);
<a name="l144"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l145"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l146"></a>
<a name="l147"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l148"></a>}
<a name="l149"></a>
<a name="l150"></a></span><span class=cF1>Bool</span><span class=cF0> VisRecalc(</span><span class=cF9>I64</span><span class=cF0> mode, Unit *tmpu=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l151"></a>{
<a name="l152"></a> </span><span class=cF9>I64</span><span class=cF0> i, hi, k, count;
<a name="l153"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l154"></a></span><span class=cF2>/*</span><span class=cF0>
<a name="l155"></a></span><span class=cF2>The compiler doesn't go out of it's way</span><span class=cF0>
<a name="l156"></a></span><span class=cF2>to know if something is const. ;-) This</span><span class=cF0>
<a name="l157"></a></span><span class=cF2>just compiles with the value at compile</span><span class=cF0>
<a name="l158"></a></span><span class=cF2>time, an advantage of just-in-time over</span><span class=cF0>
<a name="l159"></a></span><span class=cF2>AOT binaries. ZealOS has a limited</span><span class=cF0>
<a name="l160"></a></span><span class=cF2>stack size, so don't get in the habit.</span><span class=cF4>
<a name="l161"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.ZC.html#l391"><span class=cF4>MAlloc</span></a><span class=cF2>() would probably be the better choice.</span><span class=cF0>
<a name="l162"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l163"></a> MPCtrl1 job[</span><span class=cFB>mp_count</span><span class=cF0>];
<a name="l164"></a> </span><span class=cF9>CJob</span><span class=cF0> *cmd[</span><span class=cFB>mp_count</span><span class=cF0>];
<a name="l165"></a>
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (mode == VR_FRIENDLY_UNIT_DIED)
<a name="l167"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l168"></a> </span><span class=cF5>MemSet</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>&amp;vis_unit_bitmap[enemy_player]</span><span class=cF7>)(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + </span><span class=cF7>(</span><span class=cF0>tmpu-&gt;num * (</span><span class=cF7>(</span><span class=cF0>UNITS_NUM + </span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0> &amp; ~</span><span class=cFE>7</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>3</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>UNITS_NUM + </span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>3</span><span class=cF0>);
<a name="l169"></a> VRMerge(enemy_player);
<a name="l170"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>//Return any value--don't care</span><span class=cF0>
<a name="l171"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l172"></a>
<a name="l173"></a> count = </span><span class=cFB>mp_count</span><span class=cF0>; </span><span class=cF2>//Cores</span><span class=cF0>
<a name="l174"></a> hi = UNITS_NUM;
<a name="l175"></a> </span><span class=cF1>if</span><span class=cF0> (mode == VR_ONE_ENEMY_UNIT)
<a name="l176"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l177"></a> </span><span class=cF1>for</span><span class=cF0> (hi--; hi &gt;= </span><span class=cFE>0</span><span class=cF0>; hi--)
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (units[enemy_player][hi].life &gt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l179"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l180"></a> hi++;
<a name="l181"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l182"></a> k = hi;
<a name="l183"></a> </span><span class=cF1>if</span><span class=cF0> (hi / </span><span class=cFB>mp_count</span><span class=cF0> &lt; </span><span class=cFE>2</span><span class=cF0>)
<a name="l184"></a> count = </span><span class=cFE>1</span><span class=cF0>;
<a name="l185"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; count; i++)
<a name="l186"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l187"></a> job[i].mode = mode;
<a name="l188"></a> job[i].tmpu = tmpu;
<a name="l189"></a> job[i].hi = k;
<a name="l190"></a> k -= hi / count;
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (k &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l192"></a> k = </span><span class=cFE>0</span><span class=cF0>;
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (i == count - </span><span class=cFE>1</span><span class=cF0>)
<a name="l194"></a> k = </span><span class=cFE>0</span><span class=cF0>;
<a name="l195"></a> job[i].lo = k;
<a name="l196"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l197"></a>
<a name="l198"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l199"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; count; i++)
<a name="l200"></a> cmd[i] = </span><span class=cF5>JobQueue</span><span class=cF0>(&amp;MPVisRecalc, &amp;job[i], i, </span><span class=cFE>0</span><span class=cF0>);
<a name="l201"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; count; i++)
<a name="l202"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>JobResGet</span><span class=cF7>(</span><span class=cF0>cmd[i]</span><span class=cF7>)</span><span class=cF0>)
<a name="l203"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (mode == VR_UPDATE_FRIENDLY_UNIT)
<a name="l205"></a> VRMerge(cur_player);
<a name="l206"></a>
<a name="l207"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l208"></a>}
<a name="l209"></a>
<a name="l210"></a></span><span class=cF1>U0</span><span class=cF0> MPVisRecalcMap(MPCtrl2 *job)
<a name="l211"></a>{
<a name="l212"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
<a name="l213"></a>
<a name="l214"></a> </span><span class=cF1>for</span><span class=cF0> (j = job-&gt;lo; j &lt; job-&gt;hi; j++)
<a name="l215"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; map_cols; i++)
<a name="l216"></a> </span><span class=cF1>if</span><span class=cF0> (LOS</span><span class=cF7>(</span><span class=cF0>job-&gt;row, job-&gt;col, j, i</span><span class=cF7>)</span><span class=cF0>)
<a name="l217"></a> vis_map[j][i] = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l218"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l219"></a> vis_map[j][i] = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l220"></a>}
<a name="l221"></a>
<a name="l222"></a></span><span class=cF1>U0</span><span class=cF0> VisRecalcMap(</span><span class=cF9>I64</span><span class=cF0> row, </span><span class=cF9>I64</span><span class=cF0> col)
<a name="l223"></a>{
<a name="l224"></a> </span><span class=cF9>I64</span><span class=cF0> i, hi, k, count;
<a name="l225"></a> MPCtrl2 job[</span><span class=cFB>mp_count</span><span class=cF0>];
<a name="l226"></a> </span><span class=cF9>CJob</span><span class=cF0> *cmd[</span><span class=cFB>mp_count</span><span class=cF0>];
<a name="l227"></a>
<a name="l228"></a> count = </span><span class=cFB>mp_count</span><span class=cF0>; </span><span class=cF2>//Cores</span><span class=cF0>
<a name="l229"></a> hi = map_rows;
<a name="l230"></a> k = hi;
<a name="l231"></a> </span><span class=cF1>if</span><span class=cF0> (hi / </span><span class=cFB>mp_count</span><span class=cF0> &lt; </span><span class=cFE>2</span><span class=cF0>)
<a name="l232"></a> count = </span><span class=cFE>1</span><span class=cF0>;
<a name="l233"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; count; i++)
<a name="l234"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l235"></a> job[i].row = row;
<a name="l236"></a> job[i].col = col;
<a name="l237"></a> job[i].hi = k;
<a name="l238"></a> k -= hi/count;
<a name="l239"></a> </span><span class=cF1>if</span><span class=cF0> (k &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l240"></a> k = </span><span class=cFE>0</span><span class=cF0>;
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (i == count - </span><span class=cFE>1</span><span class=cF0>)
<a name="l242"></a> k = </span><span class=cFE>0</span><span class=cF0>;
<a name="l243"></a> job[i].lo=k;
<a name="l244"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l245"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; count; i++)
<a name="l246"></a> cmd[i] = </span><span class=cF5>JobQueue</span><span class=cF0>(&amp;MPVisRecalcMap, &amp;job[i], i, </span><span class=cFE>0</span><span class=cF0>);
<a name="l247"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; count; i++)
<a name="l248"></a> </span><span class=cF5>JobResGet</span><span class=cF0>(cmd[i]);
<a name="l249"></a>}
</span></pre></body>
</html>