templeos-info/public/Wb/Apps/ToTheFront/TTFVis.HC.HTML

255 lines
21 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> VR_ONE_FRIENDLY_UNIT 0
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> VR_UPDATE_FRIENDLY_UNIT 1
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> VR_FRIENDLY_UNIT_DIED 3
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> VR_ONE_ENEMY_UNIT 4
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> VR_ALL_UNITS 5
<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> ut0=&amp;units[player][0];
<a name="l24"></a> ut1=&amp;units[player^1][0];
<a name="l25"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;UNITS_NUM;i++,ut0++,ut1++) </span><span class=cF7>{</span><span class=cF0>
<a name="l26"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;ut1-&gt;vis[player],0);
<a name="l27"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;ut0-&gt;vis[player],0,ut0-&gt;life&gt;0);
<a name="l28"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l29"></a>}
<a name="l30"></a>
<a name="l31"></a></span><span class=cF1>U0</span><span class=cF0> VRMerge(</span><span class=cF9>I64</span><span class=cF0> player)
<a name="l32"></a>{
<a name="l33"></a> </span><span class=cF9>I64</span><span class=cF0> i,j;
<a name="l34"></a> Unit *ut1;
<a name="l35"></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+7</span><span class=cF7>)</span><span class=cF0>&gt;&gt;3);
<a name="l36"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;UNITS_NUM;j++) </span><span class=cF7>{</span><span class=cF2>//p0</span><span class=cF0>
<a name="l37"></a> src=&amp;vis_unit_bitmap[player][(</span><span class=cF7>(</span><span class=cF0>(UNITS_NUM+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>*j)&gt;&gt;3];
<a name="l38"></a> dst=mask;
<a name="l39"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;</span><span class=cF7>(</span><span class=cF0>UNITS_NUM+7</span><span class=cF7>)</span><span class=cF0>&gt;&gt;3;i++) </span><span class=cF2>//player1</span><span class=cF0>
<a name="l40"></a> *dst++|=*src++;
<a name="l41"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l42"></a> ut1=&amp;units[player^1][0];
<a name="l43"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;UNITS_NUM;j++,ut1++)
<a name="l44"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;ut1-&gt;vis[player],0,</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;0);
<a name="l45"></a> </span><span class=cF5>Free</span><span class=cF0>(mask);
<a name="l46"></a>}
<a name="l47"></a>
<a name="l48"></a></span><span class=cF1>Bool</span><span class=cF0> MPVisRecalc(MPCtrl1 *job)
<a name="l49"></a>{
<a name="l50"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>,seen;
<a name="l51"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,row,col;
<a name="l52"></a> </span><span class=cF1>F64</span><span class=cF0> x1,y1,x2,y2,dd,range;
<a name="l53"></a> Unit *ut0,*ut1;
<a name="l54"></a> ut0=&amp;units[cur_player][job-&gt;lo];
<a name="l55"></a> ut1=&amp;units[enemy_player][job-&gt;lo];
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (job-&gt;tmpu) </span><span class=cF7>{</span><span class=cF0>
<a name="l57"></a> row=job-&gt;tmpu-&gt;row;
<a name="l58"></a> col=job-&gt;tmpu-&gt;col;
<a name="l59"></a> range=job-&gt;tmpu-&gt;range*2*HEX_RADIUS;
<a name="l60"></a> range*=range;
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l62"></a> </span><span class=cF1>switch</span><span class=cF0> (job-&gt;mode) </span><span class=cF7>{</span><span class=cF0>
<a name="l63"></a> </span><span class=cF1>case</span><span class=cF0> VR_UPDATE_FRIENDLY_UNIT:
<a name="l64"></a> </span><span class=cF1>case</span><span class=cF0> VR_ONE_FRIENDLY_UNIT:
<a name="l65"></a> </span><span class=cF1>if</span><span class=cF0> (job-&gt;mode==VR_UPDATE_FRIENDLY_UNIT)
<a name="l66"></a> range=</span><span class=cF3>F64_MAX</span><span class=cF0>;
<a name="l67"></a> RowCol2XY(&amp;x1,&amp;y1,row,col);
<a name="l68"></a> </span><span class=cF1>for</span><span class=cF0> (i=job-&gt;lo;i&lt;job-&gt;hi;i++,ut1++) {
<a name="l69"></a> seen=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (ut1-&gt;life&gt;0 &amp;&amp;
<a name="l71"></a> 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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l72"></a> RowCol2XY(&amp;x2,&amp;y2,ut1-&gt;row,ut1-&gt;col);
<a name="l73"></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="l74"></a> </span><span class=cF1>if</span><span class=cF0> (dd&lt;range) {
<a name="l75"></a> seen=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l76"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;ut1-&gt;vis[cur_player],0);
<a name="l77"></a> }
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (job-&gt;mode==VR_UPDATE_FRIENDLY_UNIT)
<a name="l80"></a> </span><span class=cF5>LBEqu</span><span class=cF0>(&amp;vis_unit_bitmap[cur_player],
<a name="l81"></a> i+job-&gt;tmpu-&gt;num*</span><span class=cF7>(</span><span class=cF0>(UNITS_NUM+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>,seen);
<a name="l82"></a> }
<a name="l83"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l84"></a> </span><span class=cF1>case</span><span class=cF0> VR_ONE_ENEMY_UNIT:
<a name="l85"></a> RowCol2XY(&amp;x1,&amp;y1,row,col);
<a name="l86"></a> </span><span class=cF1>for</span><span class=cF0> (i=job-&gt;lo;i&lt;job-&gt;hi;i++,ut1++)
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (ut1-&gt;life&gt;0 &amp;&amp;
<a name="l88"></a> 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="l89"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;vis_unit_bitmap[enemy_player],
<a name="l90"></a> job-&gt;tmpu-&gt;num+i*</span><span class=cF7>(</span><span class=cF0>(UNITS_NUM+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>);
<a name="l91"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l92"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l93"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;vis_unit_bitmap[enemy_player],
<a name="l94"></a> job-&gt;tmpu-&gt;num+i*</span><span class=cF7>(</span><span class=cF0>(UNITS_NUM+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>);
<a name="l95"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l96"></a> </span><span class=cF1>case</span><span class=cF0> VR_ALL_UNITS:
<a name="l97"></a> ut0=&amp;units[cur_player][0];
<a name="l98"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;UNITS_NUM;i++,ut0++)
<a name="l99"></a> </span><span class=cF1>if</span><span class=cF0> (ut0-&gt;life&gt;0) {
<a name="l100"></a> RowCol2XY(&amp;x1,&amp;y1,ut0-&gt;row,ut0-&gt;col);
<a name="l101"></a> ut1=&amp;units[enemy_player][job-&gt;lo];
<a name="l102"></a> </span><span class=cF1>for</span><span class=cF0> (j=job-&gt;lo;j&lt;job-&gt;hi;j++,ut1++) </span><span class=cF7>{</span><span class=cF0>
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (ut1-&gt;life&gt;0 &amp;&amp;
<a name="l104"></a> 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="l105"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;ut1-&gt;vis[cur_player],0);
<a name="l106"></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+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>);
<a name="l107"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l108"></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+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>);
<a name="l109"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l110"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l111"></a> </span><span class=cF1>for</span><span class=cF0> (j=job-&gt;lo;j&lt;job-&gt;hi;j++)
<a name="l112"></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+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>);
<a name="l113"></a> ut0=&amp;units[enemy_player][0];
<a name="l114"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;UNITS_NUM;i++,ut0++)
<a name="l115"></a> </span><span class=cF1>if</span><span class=cF0> (ut0-&gt;life&gt;0) {
<a name="l116"></a> RowCol2XY(&amp;x1,&amp;y1,ut0-&gt;row,ut0-&gt;col);
<a name="l117"></a> ut1=&amp;units[cur_player][job-&gt;lo];
<a name="l118"></a> </span><span class=cF1>for</span><span class=cF0> (j=job-&gt;lo;j&lt;job-&gt;hi;j++,ut1++) </span><span class=cF7>{</span><span class=cF0>
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (ut1-&gt;life&gt;0 &amp;&amp;
<a name="l120"></a> 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="l121"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;ut1-&gt;vis[enemy_player],0);
<a name="l122"></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+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>);
<a name="l123"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l124"></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+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>);
<a name="l125"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l126"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l127"></a> </span><span class=cF1>for</span><span class=cF0> (j=job-&gt;lo;j&lt;job-&gt;hi;j++)
<a name="l128"></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+7)&amp;~7</span><span class=cF7>)</span><span class=cF0>);
<a name="l129"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l130"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l131"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l132"></a>}
<a name="l133"></a>
<a name="l134"></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="l135"></a>{
<a name="l136"></a> </span><span class=cF9>I64</span><span class=cF0> i,hi,k,cnt;
<a name="l137"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l138"></a></span><span class=cF2>/*The compiler doesn't go out of it's way</span><span class=cF0>
<a name="l139"></a></span><span class=cF2>to know if something is const.;-) This</span><span class=cF0>
<a name="l140"></a></span><span class=cF2>just compiles with the val at compile</span><span class=cF0>
<a name="l141"></a></span><span class=cF2>time, an advantage of just-in-time over</span><span class=cF0>
<a name="l142"></a></span><span class=cF2>AOT binaries. TempleOS has a limited</span><span class=cF0>
<a name="l143"></a></span><span class=cF2>stk size, so don't get in the habit.</span><span class=cF4>
<a name="l144"></a></span><a href="/Wb/Kernel/Mem/MAllocFree.HC.HTML#l387"><span class=cF4>MAlloc</span></a><span class=cF2>() would probably be the better choice.</span><span class=cF0>
<a name="l145"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l146"></a> MPCtrl1 job[</span><span class=cFB>mp_cnt</span><span class=cF0>];
<a name="l147"></a> </span><span class=cF9>CJob</span><span class=cF0> *cmd[</span><span class=cFB>mp_cnt</span><span class=cF0>];
<a name="l148"></a>
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (mode==VR_FRIENDLY_UNIT_DIED) </span><span class=cF7>{</span><span class=cF0>
<a name="l150"></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>+
<a name="l151"></a> </span><span class=cF7>(</span><span class=cF0>tmpu-&gt;num*(</span><span class=cF7>(</span><span class=cF0>UNITS_NUM+7</span><span class=cF7>)</span><span class=cF0>&amp;~7)</span><span class=cF7>)</span><span class=cF0>&gt;&gt;3,0,</span><span class=cF7>(</span><span class=cF0>UNITS_NUM+7</span><span class=cF7>)</span><span class=cF0>&gt;&gt;3);
<a name="l152"></a> VRMerge(enemy_player);
<a name="l153"></a> </span><span class=cF1>return</span><span class=cF0> 0; </span><span class=cF2>//Return any value--don't care</span><span class=cF0>
<a name="l154"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l155"></a>
<a name="l156"></a> cnt=</span><span class=cFB>mp_cnt</span><span class=cF0>; </span><span class=cF2>//Cores</span><span class=cF0>
<a name="l157"></a> hi=UNITS_NUM;
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (mode==VR_ONE_ENEMY_UNIT) </span><span class=cF7>{</span><span class=cF0>
<a name="l159"></a> </span><span class=cF1>for</span><span class=cF0> (hi--;hi&gt;=0;hi--)
<a name="l160"></a> </span><span class=cF1>if</span><span class=cF0> (units[enemy_player][hi].life&gt;0)
<a name="l161"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l162"></a> hi++;
<a name="l163"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l164"></a> k=hi;
<a name="l165"></a> </span><span class=cF1>if</span><span class=cF0> (hi/</span><span class=cFB>mp_cnt</span><span class=cF0>&lt;2)
<a name="l166"></a> cnt=1;
<a name="l167"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l168"></a> job[i].mode=mode;
<a name="l169"></a> job[i].tmpu=tmpu;
<a name="l170"></a> job[i].hi=k;
<a name="l171"></a> k-=hi/cnt;
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (k&lt;0) k=0;
<a name="l173"></a> </span><span class=cF1>if</span><span class=cF0> (i==cnt-1) k=0;
<a name="l174"></a> job[i].lo=k;
<a name="l175"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l176"></a>
<a name="l177"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l178"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++)
<a name="l179"></a> cmd[i]=</span><span class=cF5>JobQue</span><span class=cF0>(&amp;MPVisRecalc,&amp;job[i],i,0);
<a name="l180"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++)
<a name="l181"></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="l182"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l183"></a> </span><span class=cF1>if</span><span class=cF0> (mode==VR_UPDATE_FRIENDLY_UNIT)
<a name="l184"></a> VRMerge(cur_player);
<a name="l185"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l186"></a>}
<a name="l187"></a>
<a name="l188"></a></span><span class=cF1>U0</span><span class=cF0> MPVisRecalcMap(MPCtrl2 *job)
<a name="l189"></a>{
<a name="l190"></a> </span><span class=cF9>I64</span><span class=cF0> i,j;
<a name="l191"></a> </span><span class=cF1>for</span><span class=cF0> (j=job-&gt;lo;j&lt;job-&gt;hi;j++)
<a name="l192"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;map_cols;i++)
<a name="l193"></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="l194"></a> vis_map[j][i]=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l195"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l196"></a> vis_map[j][i]=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l197"></a>}
<a name="l198"></a>
<a name="l199"></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="l200"></a>{
<a name="l201"></a> </span><span class=cF9>I64</span><span class=cF0> i,hi,k,cnt;
<a name="l202"></a> MPCtrl2 job[</span><span class=cFB>mp_cnt</span><span class=cF0>];
<a name="l203"></a> </span><span class=cF9>CJob</span><span class=cF0> *cmd[</span><span class=cFB>mp_cnt</span><span class=cF0>];
<a name="l204"></a>
<a name="l205"></a> cnt=</span><span class=cFB>mp_cnt</span><span class=cF0>; </span><span class=cF2>//Cores</span><span class=cF0>
<a name="l206"></a> hi=map_rows;
<a name="l207"></a> k=hi;
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (hi/</span><span class=cFB>mp_cnt</span><span class=cF0>&lt;2)
<a name="l209"></a> cnt=1;
<a name="l210"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l211"></a> job[i].row=row;
<a name="l212"></a> job[i].col=col;
<a name="l213"></a> job[i].hi=k;
<a name="l214"></a> k-=hi/cnt;
<a name="l215"></a> </span><span class=cF1>if</span><span class=cF0> (k&lt;0) k=0;
<a name="l216"></a> </span><span class=cF1>if</span><span class=cF0> (i==cnt-1) k=0;
<a name="l217"></a> job[i].lo=k;
<a name="l218"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l219"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++)
<a name="l220"></a> cmd[i]=</span><span class=cF5>JobQue</span><span class=cF0>(&amp;MPVisRecalcMap,&amp;job[i],i,0);
<a name="l221"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++)
<a name="l222"></a> </span><span class=cF5>JobResGet</span><span class=cF0>(cmd[i]);
<a name="l223"></a>}
</span></pre></body>
</html>