diff options
Diffstat (limited to 'macros/latex/contrib/wargame/source/chit/oob.dtx')
-rw-r--r-- | macros/latex/contrib/wargame/source/chit/oob.dtx | 196 |
1 files changed, 98 insertions, 98 deletions
diff --git a/macros/latex/contrib/wargame/source/chit/oob.dtx b/macros/latex/contrib/wargame/source/chit/oob.dtx index 9e5f0c4f93..d1da3fee7f 100644 --- a/macros/latex/contrib/wargame/source/chit/oob.dtx +++ b/macros/latex/contrib/wargame/source/chit/oob.dtx @@ -79,7 +79,7 @@ \@ifstar{\wg@star@oob% }{\wg@nostar@oob% }% -} +}% % \end{macrocode} % % The inner macro of \cs{oob}. The arguments are @@ -91,27 +91,27 @@ % \end{enumerate} % % \begin{macrocode} -\def\wg@oob#1#2#3#4{ - \def\r{0} +\def\wg@oob#1#2#3#4{% + \def\r{0}% \pgfmathparse{#3*(#2-1)}% - \edef\a{\pgfmathresult} - \chit@dbg{2}{OOB: `#1'} - \foreach[count=\ti from 0] \t/\y in #1{ - \xdef\o{\r} - \def\c{0} - \ifx\t\y\def\y{0}\fi - \chit@dbg{2}{Turn \ti\space(\r,\t,y=\y):'} + \edef\a{\pgfmathresult}% + \chit@dbg{2}{OOB: `#1'}% + \foreach[count=\ti from 0] \t/\y in #1{% + \xdef\o{\r}% + \def\c{0}% + \ifx\t\y\def\y{0}\fi% + \chit@dbg{2}{Turn \ti\space(\r,\t,y=\y):'}% \ifwg@oob@inv% \pic[transform shape] at ( .5*#3,\r) {chit/oob turn=\ti};% was dx=0.5 - \else + \else% \pic[transform shape] at (-.5*#3,\r) {chit/oob turn=\ti};% was dx=-0.5 \fi% \ifx\t\empty\else% - \foreach \u/\m in \t{ + \foreach \u/\m in \t{% %% \chit@dbg{2}{ `\u'=`\m'} - \ifx\u\empty\else - \ifx\m\@empty\def\m{1}\fi - \ifx\u\m\def\m{1}\fi + \ifx\u\empty\else% + \ifx\m\@empty\def\m{1}\fi% + \ifx\u\m\def\m{1}\fi% \foreach \n in {1,...,\m}{% \chit@dbg{2}{OOB Chit is `\u' `\chit@oob@spacer'}% \ifx\u\chit@oob@spacer% @@ -120,33 +120,33 @@ \xdef\c{\pgfmathresult}% \else% \ifx\u\chit@oob@vspacer% - \chit@dbg{3}{Chit `\u' is vspacer `\chit@oob@vspacer'} - \pgfmathparse{ifthenelse(abs(\c)<0.0001,0,#3)} - \xdef\ll{\pgfmathresult} - \chit@dbg{2}{\string\ll=`\ll'} - \chit@oob@rowupdate(\c,\r){\ll}{#4} + \chit@dbg{3}{Chit `\u' is vspacer `\chit@oob@vspacer'}% + \pgfmathparse{ifthenelse(abs(\c)<0.0001,0,#3)}% + \xdef\ll{\pgfmathresult}% + \chit@dbg{2}{\string\ll=`\ll'}% + \chit@oob@rowupdate(\c,\r){\ll}{#4}% \else \ifnum\chitdbglvl>2% \node[minimum width=#3cm,minimum height=#3cm, - draw,transform shape] at (\c,\r) {}; + draw,transform shape] at (\c,\r) {};% \fi \ifx\u\chit@blank\else% \chit[\u=\ti,zone oob point={\u}{\c}{\r}](\c,\r);% \fi% - \chit@oob@cellupdate(\c,\r){#2}{#3}{\y} - \fi - \fi - } - \fi - } - \fi + \chit@oob@cellupdate(\c,\r){#2}{#3}{\y}% + \fi% + \fi% + }% + \fi% + }% + \fi% \chit@dbg{1}{ End of chits in turn - \ti\space(c=`\c',r=`\r',o='\o',y='\y')} + \ti\space(c=`\c',r=`\r',o='\o',y='\y')}% % IF no units where given, then we force \c to be non-zero so that % \chit@oob@turnupdate increments the row - \ifx\t\@empty - \def\c{#3} - \chit@dbg{2}{ Turn is empty, set c=`\c'} + \ifx\t\@empty% + \def\c{#3}% + \chit@dbg{2}{ Turn is empty, set c=`\c'}% \fi %\ifnum\y<0% No explicit number of rows given % \def\c{#3} @@ -160,22 +160,22 @@ % rows. \ifnum\y>0% \chit@dbg{2}{ Looping rows from 2 to \y, break when row > \y}% - \foreach \rr in {2,...,\y}{ + \foreach \rr in {2,...,\y}{% %\ifnum\rr>\y% A little funny, but \y can be negative! % \chit@dbg{2}{ \space Breaking loop \rr\space > \y}% % \breakforeach% %\else% \chit@oob@rowupdate(\c,\r){#3}{0}% Extra spacing? %\fi - } - \fi + }% + \fi% % This will zero \c. However, if on entry |\c|>0, then we also % increment the row - \chit@oob@turnupdate(\c,\r){#3}{#4} - \chit@dbg{2}{End of turn \ti\space(c=`\c',r=`\r',o='\o',y='\y')} + \chit@oob@turnupdate(\c,\r){#3}{#4}% + \chit@dbg{2}{End of turn \ti\space(c=`\c',r=`\r',o='\o',y='\y')}% } - \chit@dbg{3}{End of OOB (c=`\c',r=`\r',y=`\y')} - \@ifnextchar;{\@gobble}{}} + \chit@dbg{3}{End of OOB (c=`\c',r=`\r',y=`\y')}% + \@ifnextchar;{\@gobble}{}}% % \end{macrocode} % % Horizontal flow OOB @@ -199,49 +199,49 @@ % \end{enumerate} % % \begin{macrocode} -\def\wg@hoob#1#2#3#4{ - \def\r{0} - \def\c{0} +\def\wg@hoob#1#2#3#4{% + \def\r{0}% + \def\c{0}% \pgfmathparse{#3*(#2-1)}% - \edef\a{\pgfmathresult} - \chit@dbg{2}{OOB: `#1'} - \foreach[count=\ti from 0] \t/\y in #1{ - \xdef\o{\r} + \edef\a{\pgfmathresult}% + \chit@dbg{2}{OOB: `#1'}% + \foreach[count=\ti from 0] \t/\y in #1{% + \xdef\o{\r}% % \def\c{0} - \ifx\t\y\def\y{0}\fi + \ifx\t\y\def\y{0}\fi% \chit@dbg{2}{Turn \ti\space(\r,\t,y=\y):'} - \ifx\t\empty\else + \ifx\t\empty\else% % Count how many are left for this turn - \chit@dbg{2}{At start of turn \t\space\string\c=\c} + \chit@dbg{2}{At start of turn \t\space\string\c=\c}% \def\l{\c}% - \let\ig\empty - \foreach \u/\m in \t{ - \ifx\ig\empty - \ifx\u\empty\else - \ifx\u\m\def\m{1}\fi + \let\ig\empty% + \foreach \u/\m in \t{% + \ifx\ig\empty% + \ifx\u\empty\else% + \ifx\u\m\def\m{1}\fi% \ifx\u\chit@oob@spacer% - \pgfmathparse{\l+\m*#4}\xdef\l{\pgfmathresult} - \chit@dbg{2}{Got \m\space hspace (#4) -> \l} - \else + \pgfmathparse{\l+\m*#4}\xdef\l{\pgfmathresult}% + \chit@dbg{2}{Got \m\space hspace (#4) -> \l}% + \else% \ifx\u\chit@oob@vspace% - \xdef\ig{1} - \chit@dbg{2}{Got vspace -> \l (\ig)} - \else - \pgfmathparse{\l+\m*#3} - \xdef\l{\pgfmathresult} - \chit@dbg{2}{Got \m\space units -> \l} - \fi - \fi - \fi - \fi} + \xdef\ig{1}% + \chit@dbg{2}{Got vspace -> \l (\ig)}% + \else% + \pgfmathparse{\l+\m*#3}% + \xdef\l{\pgfmathresult}% + \chit@dbg{2}{Got \m\space units -> \l}% + \fi% + \fi% + \fi% + \fi}% % Check if there's enough room \chit@dbg{2}{To fill the rest of turn needs `\l' compared to - `\a' (#3*(#2-1))} + `\a' (#3*(#2-1))}% \pgfmathparse{ifthenelse(abs(\l)>=#3*(#2-1),0,1}% \xdef\l{\pgfmathresult}% - \chit@dbg{2}{Break or not `\l'} - \ifnum\l=0\chit@oob@turnupdate(\c,\r){#3}{#4}\fi - \fi + \chit@dbg{2}{Break or not `\l'}% + \ifnum\l=0\chit@oob@turnupdate(\c,\r){#3}{#4}\fi% + \fi% \ifwg@oob@inv% \pic[transform shape] at (\c+.5*#3,\r) {chit/oob turn=\ti};% was dx=0.5 \else @@ -249,43 +249,43 @@ \fi% %\chit@oob@cellupdate(\c,\r){#2}{#3}{\y} \ifx\t\empty\else% - \def\lv{0} - \foreach \u/\m in \t{ + \def\lv{0}% + \foreach \u/\m in \t{% %% \chit@dbg{2}{ `\u'=`\m'} - \ifx\u\empty\else - \ifx\m\@empty\def\m{1}\fi - \ifx\u\m\def\m{1}\fi + \ifx\u\empty\else% + \ifx\m\@empty\def\m{1}\fi% + \ifx\u\m\def\m{1}\fi% \foreach \n in {1,...,\m}{% \chit@dbg{2}{OOB Chit is `\u' `\chit@oob@spacer'}% \ifx\u\chit@oob@spacer% - \chit@dbg{3}{Chit `\u' is spacer `\chit@oob@spacer'} + \chit@dbg{3}{Chit `\u' is spacer `\chit@oob@spacer'}% \pgfmathparse{\c+#4}% \xdef\c{\pgfmathresult}% \else% \ifx\u\chit@oob@vspacer% - \chit@dbg{3}{Chit `\u' is vspacer `\chit@oob@vspacer'} - \pgfmathparse{ifthenelse(abs(\c)<0.0001,0,#3)} - \xdef\ll{\pgfmathresult} - \chit@dbg{2}{\string\ll=`\ll'} - \chit@oob@rowupdate(\c,\r){\ll}{#4} - \xdef\lv{1} + \chit@dbg{3}{Chit `\u' is vspacer `\chit@oob@vspacer'}% + \pgfmathparse{ifthenelse(abs(\c)<0.0001,0,#3)}% + \xdef\ll{\pgfmathresult}% + \chit@dbg{2}{\string\ll=`\ll'}% + \chit@oob@rowupdate(\c,\r){\ll}{#4}% + \xdef\lv{1}% \else \ifnum\chitdbglvl>2% \node[minimum width=#3cm,minimum height=#3cm, - draw,transform shape] at (\c,\r) {}; - \fi + draw,transform shape] at (\c,\r) {};% + \fi% \ifx\u\chit@blank\else% \chit[\u=\ti,zone oob point={\u}{\c}{\r}](\c,\r);% \fi% \chit@oob@cellupdate(\c,\r){#2}{#3}{\y} - \fi - \fi - } - \fi - } - \fi + \fi% + \fi% + }% + \fi% + }% + \fi% \chit@dbg{2}{ End of chits in turn - \ti\space(c=`\c',r=`\r',o='\o',y='\y')} + \ti\space(c=`\c',r=`\r',o='\o',y='\y')}% % --- Not relevant, I think % IF no units where given, then we force \c to be non-zero so that % \chit@oob@turnupdate increments the row @@ -306,7 +306,7 @@ % rows. \ifnum\y>0% \chit@dbg{2}{ Looping rows from 2 to \y, break when row > \y}% - \foreach \rr in {2,...,\y}{ + \foreach \rr in {2,...,\y}{% %\ifnum\rr>\y% A little funny, but \y can be negative! % \chit@dbg{2}{ \space Breaking loop \rr\space > \y}% % \breakforeach% @@ -314,7 +314,7 @@ \chit@oob@rowupdate(\c,\r){#3}{0}% Extra spacing? %\fi } - \fi + \fi% % --- Not relevant I think % This will zero \c. However, if on entry |\c|>0, then we also % increment the row @@ -336,10 +336,10 @@ \fi \fi % \xdef\y{0} - \chit@dbg{2}{End of turn \ti\space(c=`\c',r=`\r',o='\o',y='\y')} - } - \chit@dbg{3}{End of OOB (c=`\c',r=`\r',y=`\y')} - \@ifnextchar;{\@gobble}{}} + \chit@dbg{2}{End of turn \ti\space(c=`\c',r=`\r',o='\o',y='\y')}% + }% + \chit@dbg{3}{End of OOB (c=`\c',r=`\r',y=`\y')}% + \@ifnextchar;{\@gobble}{}}% % \end{macrocode} % \iffalse % </chit> |