refactor into function calls to avoid stack overflow

This commit is contained in:
depyraken 2016-04-02 18:11:08 +02:00
parent 7cf2a44404
commit ea0324e716

View file

@ -1757,18 +1757,7 @@
<STRING> ()setNamedEntityProp($BCVar, "param2", ""); // </STRING> <STRING> ()setNamedEntityProp($BCVar, "param2", ""); // </STRING>
<STRING>}</STRING> <STRING>}</STRING>
<STRING></STRING> <STRING></STRING>
<STRING>// $botEid, $playerEid</STRING> <STRING>NoOneIsFishing(){</STRING>
<STRING>BCaddPlayer(){</STRING>
<STRING> BCP = 0;</STRING>
<STRING>$ttt = "v0 = " + v0;</STRING>
<STRING> ()phraseEndSystemMsg(0, "shout", $ttt);</STRING>
<STRING>$ttt = "boteid2 = " + $botEid;</STRING>
<STRING> ()phraseEndSystemMsg(0, "shout", $ttt);</STRING>
<STRING>$ttt = "botFamily2 = " + $botFamily;</STRING>
<STRING> ()phraseEndSystemMsg(0, "shout", $ttt);</STRING>
<STRING></STRING>
<STRING> switch(v0){</STRING>
<STRING> case 0:{ // No one is fishing</STRING>
<STRING> v0 = 1; // P1 is now fishing</STRING> <STRING> v0 = 1; // P1 is now fishing</STRING>
<STRING> v1 = 0; // etat initial &lt; 1000, fishing &gt;= 1000</STRING> <STRING> v1 = 0; // etat initial &lt; 1000, fishing &gt;= 1000</STRING>
<STRING>$ttt = "boteid3 = " + $botEid;</STRING> <STRING>$ttt = "boteid3 = " + $botEid;</STRING>
@ -1778,8 +1767,9 @@
<STRING> ()setNamedEntityProp($botEid, "state", $botFamily); // botFamily requirement</STRING> <STRING> ()setNamedEntityProp($botEid, "state", $botFamily); // botFamily requirement</STRING>
<STRING> BCP = 1;</STRING> <STRING> BCP = 1;</STRING>
<STRING> BuildPlayerSlot();</STRING> <STRING> BuildPlayerSlot();</STRING>
<STRING> }</STRING> <STRING>}</STRING>
<STRING> case 1:{ // P1 is fishing</STRING> <STRING></STRING>
<STRING>P1AlreadyFishing(){</STRING>
<STRING> $BCVar = $botEid + "_P11";</STRING> <STRING> $BCVar = $botEid + "_P11";</STRING>
<STRING> ($BCP)getNamedEntityProp($BCVar, "state");</STRING> <STRING> ($BCP)getNamedEntityProp($BCVar, "state");</STRING>
<STRING> if($BCP != $playerEid){</STRING> <STRING> if($BCP != $playerEid){</STRING>
@ -1788,8 +1778,9 @@
<STRING> v2 = 0; // etat initial &lt; 1000, fishing &gt;= 1000</STRING> <STRING> v2 = 0; // etat initial &lt; 1000, fishing &gt;= 1000</STRING>
<STRING> BuildPlayerSlot();</STRING> <STRING> BuildPlayerSlot();</STRING>
<STRING> }</STRING> <STRING> }</STRING>
<STRING> }</STRING> <STRING>}</STRING>
<STRING> case 2:{ // P2 is fishing</STRING> <STRING></STRING>
<STRING>P2AlreadyFishing(){</STRING>
<STRING> $BCVar = $botEid + "_P21";</STRING> <STRING> $BCVar = $botEid + "_P21";</STRING>
<STRING> ($BCP)getNamedEntityProp($BCVar, "state");</STRING> <STRING> ($BCP)getNamedEntityProp($BCVar, "state");</STRING>
<STRING> if($BCP != $playerEid){</STRING> <STRING> if($BCP != $playerEid){</STRING>
@ -1800,6 +1791,19 @@
<STRING> BuildPlayerSlot();</STRING> <STRING> BuildPlayerSlot();</STRING>
<STRING> ()phraseEndSystemMsg(0, "shout", "2 =&gt; 1 =&gt; apres");</STRING> <STRING> ()phraseEndSystemMsg(0, "shout", "2 =&gt; 1 =&gt; apres");</STRING>
<STRING> }</STRING> <STRING> }</STRING>
<STRING>}</STRING>
<STRING></STRING>
<STRING>// $botEid, $playerEid</STRING>
<STRING>BCaddPlayer(){</STRING>
<STRING> BCP = 0;</STRING>
<STRING> switch(v0){ // No one is fishing</STRING>
<STRING> NoOneIsFishing()</STRING>
<STRING> }</STRING>
<STRING> case 1:{ // P1 is already fishing</STRING>
<STRING> P1AlreadyFishing();</STRING>
<STRING> }</STRING>
<STRING> case 2:{ // P2 is already fishing</STRING>
<STRING> P2AlreadyFishing();</STRING>
<STRING> }</STRING> <STRING> }</STRING>
<STRING> case 3: // P1 and P2 are already fishing</STRING> <STRING> case 3: // P1 and P2 are already fishing</STRING>
<STRING> ()phraseEndSystemMsg(0, "shout", "TOO_MANY_PLAYERS_ARE_FISHING");</STRING> <STRING> ()phraseEndSystemMsg(0, "shout", "TOO_MANY_PLAYERS_ARE_FISHING");</STRING>