| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-07-10 22:13:48 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-07-10 22:13:48 +0200 | 
| commit | 7b891ce04190365080fb4ef5d8dac68528a81af1 (patch) | |
| tree | 78f332b074723167bde91b46929e450c8c6049c9 /src | |
| parent | f63602557a2f7320a7e02a3bf7dd9b339efaf4d1 (diff) | |
Still working on it...
Diffstat (limited to 'src')
| -rw-r--r-- | src/asset/www/svg/to-logo.svg | 170 | ||||
| -rw-r--r-- | src/battlemap/src/Struct/UI.elm | 4 | ||||
| -rw-r--r-- | src/map-editor/src/Comm/LoadMap.elm (renamed from src/map-editor/src/Comm/LoadBattlemap.elm) | 6 | ||||
| -rw-r--r-- | src/map-editor/src/Comm/Okay.elm | 22 | ||||
| -rw-r--r-- | src/map-editor/src/Comm/Send.elm | 11 | ||||
| -rw-r--r-- | src/map-editor/src/Constants/Movement.elm | 10 | ||||
| -rw-r--r-- | src/map-editor/src/Struct/Event.elm | 15 | ||||
| -rw-r--r-- | src/map-editor/src/Struct/HelpRequest.elm | 4 | ||||
| -rw-r--r-- | src/map-editor/src/Struct/Map.elm (renamed from src/map-editor/src/Struct/Battlemap.elm) | 66 | ||||
| -rw-r--r-- | src/map-editor/src/Struct/Model.elm | 170 | ||||
| -rw-r--r-- | src/map-editor/src/Struct/ServerReply.elm | 13 | ||||
| -rw-r--r-- | src/map-editor/src/Struct/Toolbox.elm | 15 | ||||
| -rw-r--r-- | src/map-editor/src/Struct/UI.elm | 53 | ||||
| -rw-r--r-- | src/map-editor/src/Update/HandleServerReply.elm | 151 | ||||
| -rw-r--r-- | src/map-editor/src/Update/SelectTile.elm | 147 | 
15 files changed, 232 insertions, 625 deletions
| diff --git a/src/asset/www/svg/to-logo.svg b/src/asset/www/svg/to-logo.svg index fe9ae82..eccdd5a 100644 --- a/src/asset/www/svg/to-logo.svg +++ b/src/asset/www/svg/to-logo.svg @@ -10,13 +10,16 @@     xmlns:xlink="http://www.w3.org/1999/xlink"     xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"     xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" -   width="60.906433mm" -   height="41.731739mm" -   viewBox="0 0 60.906431 41.73174" +   width="61.50248mm" +   height="41.997131mm" +   viewBox="0 0 61.502477 41.997132"     version="1.1"     id="svg8"     inkscape:version="0.92.2 5c3e80d, 2017-08-06" -   sodipodi:docname="to-logo.svg"> +   sodipodi:docname="to-logo.svg" +   inkscape:export-filename="/home/nsensfel/to-logo.png" +   inkscape:export-xdpi="24.5634" +   inkscape:export-ydpi="24.5634">    <defs       id="defs2" />    <sodipodi:namedview @@ -27,8 +30,8 @@       inkscape:pageopacity="0.0"       inkscape:pageshadow="2"       inkscape:zoom="2.8284271" -     inkscape:cx="127.22055" -     inkscape:cy="78.866091" +     inkscape:cx="129.47331" +     inkscape:cy="79.407794"       inkscape:document-units="mm"       inkscape:current-layer="layer1"       showgrid="false" @@ -51,7 +54,7 @@          <dc:format>image/svg+xml</dc:format>          <dc:type             rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> -        <dc:title /> +        <dc:title></dc:title>        </cc:Work>      </rdf:RDF>    </metadata> @@ -59,7 +62,7 @@       inkscape:label="Layer 1"       inkscape:groupmode="layer"       id="layer1" -     transform="translate(-1.3612526,-49.782467)"> +     transform="translate(-0.76520855,-49.660401)">      <rect         style="opacity:1;fill:#6c5d53;fill-opacity:1;stroke:#241f1c;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke"         id="rect1011" @@ -67,12 +70,18 @@         height="23.629793"         x="5.3910203"         y="59.437332" -       ry="3.1058819" /> +       ry="3.1058819" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <g         aria-label="nline"         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:125%;font-family:Bubble_Runes;-inkscape-font-specification:Bubble_Runes;letter-spacing:0px;word-spacing:0px;fill:#e9ddaf;fill-opacity:1;stroke:#483e37;stroke-width:0.60000002;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"         id="text1280" -       transform="translate(0,-1.5875)"> +       transform="translate(0,-1.5875)" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057">        <path           d="m 32.889675,81.781917 h -1.839681 l 0.02067,-0.482313 q 0.564995,-1.040419 0.564995,-2.204861 0,-1.515842 -1.378038,-1.515842 -0.310058,0 -0.72347,0.254937 -0.35829,0.220486 -0.35829,0.37896 v 2.604492 q 0,0.206706 0.130914,0.372071 l 0.392741,0.261827 0.06201,0.330729 H 27.63246 l 0.323839,-0.310058 q 0.144694,-0.165365 0.144694,-0.378961 v -3.369303 q 0,-0.248047 -0.461643,-0.695909 h 1.536512 v 0.37896 q 0.757921,-0.468533 1.743219,-0.468533 1.061089,0 1.736328,1.109321 0.172254,0.461643 0.172254,1.061089 0,0.475423 -0.502983,1.570964 l -0.02067,0.124023 q 0.0069,0.172255 0.454753,0.592556 z"           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:14.11111069px;font-family:'Dumbledor 3';-inkscape-font-specification:'Dumbledor 3, ';fill:#e9ddaf;fill-opacity:1;stroke:#483e37;stroke-width:0.60000002;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" @@ -102,7 +111,10 @@      </g>      <g         id="g1022" -       style="stroke:#483e37;fill:#e9ddaf"> +       style="fill:#e9ddaf;stroke:#483e37" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057">        <path           inkscape:connector-curvature="0"           id="path922" @@ -120,7 +132,7 @@           d="m 11.267005,76.675344 3.601606,8.007007"           style="fill:#e9ddaf;fill-rule:evenodd;stroke:#483e37;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />        <use -         style="stroke-width:0.10036709;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.10036709;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="matrix(0.99877131,-0.00273161,-0.0027316,0.99392716,10.815408,-4.1975421)" @@ -135,7 +147,7 @@           d="m 12.214167,74.472549 1.581326,3.515567"           style="fill:#e9ddaf;fill-rule:evenodd;stroke:#483e37;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(7.3407042,-3.3018987)" @@ -150,7 +162,7 @@           d="m 13.680506,72.792441 5.722133,12.721313"           style="fill:#e9ddaf;fill-rule:evenodd;stroke:#483e37;stroke-width:0.10072506;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(3.6113839,-1.6244246)" @@ -159,7 +171,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.46230963;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.46230963;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="matrix(0.83876347,-0.35621468,-0.35621468,0.20706298,35.516026,74.14673)" @@ -183,7 +195,7 @@           id="use4599"           inkscape:connector-curvature="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(6.3164879,14.042667)" @@ -192,7 +204,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(-6.1853332,0.01509253)" @@ -201,7 +213,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(-4.253919,-9.45721)" @@ -210,7 +222,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(10.335747,-4.6490893)" @@ -219,7 +231,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(4.2528614,9.4548607)" @@ -233,7 +245,7 @@           d="m 19.197688,77.888425 a 0.94976008,0.94976008 0 0 1 -0.476561,1.255778 0.94976008,0.94976008 0 0 1 -1.255778,-0.476561 0.94976008,0.94976008 0 0 1 0.476561,-1.255778 0.94976008,0.94976008 0 0 1 1.255778,0.476561 z"           style="opacity:1;vector-effect:none;fill:#e9ddaf;fill-opacity:1;stroke:#483e37;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(3.381091,7.5167623)" @@ -247,7 +259,7 @@           style="fill:#e9ddaf;fill-opacity:1;stroke:#483e37;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"           inkscape:connector-curvature="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="matrix(-0.66344221,0.74822754,0.74822754,0.66344221,-28.063685,12.623235)" @@ -256,7 +268,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="rotate(90.000003,18.244948,78.249795)" @@ -265,7 +277,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="matrix(0.66344221,-0.74822754,-0.74822754,-0.66344221,64.750099,143.95093)" @@ -274,7 +286,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(-5.6969953,-12.665431)" @@ -283,7 +295,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           id="use5304" @@ -291,7 +303,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           transform="translate(3.381091,7.5167623)" @@ -300,7 +312,7 @@           y="0"           x="0" />        <use -         style="stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none;fill:#e9ddaf;stroke:#483e37" +         style="fill:#e9ddaf;stroke:#483e37;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"           height="100%"           width="100%"           id="use5312" @@ -325,15 +337,21 @@      <path         id="path4526"         style="fill:#e9ddaf;fill-opacity:1;fill-rule:evenodd;stroke:#483e37;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:88.80000305;stroke-dasharray:none;stroke-opacity:1;paint-order:normal" -       d="M 24.217169,91.310568 C 22.777854,81.063399 18.838937,81.485083 13.355752,61.08567 c 1.143982,-1.913891 5.970334,-1.676019 7.722349,-2.014342 -2.434138,-0.210237 -5.086646,-0.261259 -6.103196,-1.507839 -1.141533,0.419744 -2.648436,1.091092 -3.819254,1.923402 C 9.9923988,56.07454 9.3055936,54.258708 7.8389986,52.134506 9.2620572,49.678852 6.5766817,49.695955 5.6575486,50.167435 l -0.093133,0.04201 c -0.9617574,0.376988 -2.7513472,2.378535 0.031365,2.936971 0.6217684,2.505302 1.5284587,4.221945 3.3166523,7.352385 -1.3988279,0.326852 -2.8999261,1.012414 -3.9700934,1.590364 0.261715,1.587085 -1.4555566,3.609309 -2.9089462,5.573205 C 3.4465613,66.572887 6.46248,62.797375 8.6543552,63.206465 20.31784,80.817948 17.394823,83.491678 24.124036,91.35258 Z" +       d="M 24.217169,91.310568 C 22.777854,81.063399 18.838937,81.485083 13.355752,61.08567 c 1.143982,-1.913891 5.970334,-1.676019 7.722349,-2.014342 -2.434138,-0.210237 -5.086646,-0.261259 -6.103196,-1.507839 -1.141533,0.419744 -2.648436,1.091092 -3.819254,1.923402 C 9.9923988,56.07454 9.3055936,54.258708 7.8389986,52.134506 9.2620572,49.678852 6.5766817,49.695955 5.6575486,50.167435 l -0.093133,0.04201 c -0.9617574,0.376988 -2.7513472,2.378535 0.031365,2.936971 0.6217684,2.505302 1.5284587,4.221945 3.3166523,7.352385 C 7.513605,60.825653 6.0125068,61.511215 4.9423395,62.089165 5.2040545,63.67625 3.4867829,65.698474 2.0333933,67.66237 3.4465613,66.572887 6.46248,62.797375 8.6543552,63.206465 20.31784,80.817948 17.394823,83.491678 24.124036,91.35258 Z"         inkscape:connector-curvature="0" -       sodipodi:nodetypes="ccccccccccccccc" /> +       sodipodi:nodetypes="ccccccccccccccc" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <path         style="fill:#e9ddaf;fill-opacity:0;fill-rule:evenodd;stroke:#483e37;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"         d="m 8.866465,60.629712 c 1.0874261,-0.307119 1.795865,-0.735448 2.499434,-1.165339"         id="path4547"         inkscape:connector-curvature="0" -       sodipodi:nodetypes="cc" /> +       sodipodi:nodetypes="cc" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -342,7 +360,10 @@         id="use4564"         transform="translate(-0.28115019,-0.49330547)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -351,7 +372,10 @@         id="use4566"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -360,7 +384,10 @@         id="use4568"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -369,7 +396,10 @@         id="use4570"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -378,7 +408,10 @@         id="use4572"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -387,7 +420,10 @@         id="use4574"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -396,7 +432,10 @@         id="use4576"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -405,7 +444,10 @@         id="use4578"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -414,7 +456,10 @@         id="use4580"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -423,7 +468,10 @@         id="use4582"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -432,7 +480,10 @@         id="use4584"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -441,7 +492,10 @@         id="use4586"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -450,7 +504,10 @@         id="use4588"         transform="translate(-0.23254041,-0.51549772)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -459,7 +516,10 @@         id="use4590"         transform="translate(-0.18853905,-0.41795521)"         width="100%" -       height="100%" /> +       height="100%" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <use         style="fill:#e9ddaf;stroke:#483e37"         x="0" @@ -468,23 +528,35 @@         id="use4592"         width="100%"         height="100%" -       transform="translate(-0.18852308,-0.41791898)" /> +       transform="translate(-0.18852308,-0.41791898)" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <path         style="fill:#e9ddaf;fill-opacity:0;fill-rule:evenodd;stroke:#483e37;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"         d="m 8.6947481,63.170285 c 1.4862079,0.41277 4.1804319,-1.135981 4.5739909,-2.132106"         id="path4547-3"         inkscape:connector-curvature="0" -       sodipodi:nodetypes="cc" /> +       sodipodi:nodetypes="cc" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <path         style="fill:#e9ddaf;fill-rule:evenodd;stroke:#483e37;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"         d="M 11.214398,62.734371 24.13785,91.255448"         id="path4609"         inkscape:connector-curvature="0" -       sodipodi:nodetypes="cc" /> +       sodipodi:nodetypes="cc" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057" />      <g         aria-label="acticians"         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:125%;font-family:Bubble_Runes;-inkscape-font-specification:Bubble_Runes;letter-spacing:0px;word-spacing:0px;fill:#e9ddaf;fill-opacity:1;stroke:#483e37;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" -       id="text1280-3"> +       id="text1280-3" +       inkscape:export-filename="/home/nsensfel/to-logo.png" +       inkscape:export-xdpi="105.84057" +       inkscape:export-ydpi="105.84057">        <path           d="m 21.4223,68.175719 h -1.405599 q -0.172254,0 -0.289388,-0.199815 -0.09646,-0.165365 -0.07579,-0.234267 0.0069,-0.03445 0.03445,-0.110243 -0.813042,0.606337 -1.474501,0.606337 -0.764811,0 -1.247124,-0.344509 -0.551215,-0.385851 -0.551215,-1.123102 0,-1.364257 1.226454,-1.694986 1.09554,-0.296279 1.405599,-0.434082 0.447862,-0.199816 0.647678,-0.571886 -0.571886,-0.33762 -1.316027,-0.33762 -0.620117,0 -1.577854,0.254937 0.847494,-0.785481 2.16352,-0.785481 0.647678,0 1.343587,0.234266 0.461643,0.220486 0.461643,0.744141 V 67.4867 q 0,0.03445 0.0689,0.124024 0.165365,0.454752 0.585667,0.564995 z m -1.729437,-1.295355 v -2.177301 q -0.323839,0.33762 -0.744141,0.482314 -0.847494,0.296278 -0.950846,0.36518 -0.392741,0.268717 -0.392741,0.902615 0,0.930175 0.902615,0.930175 0.558105,0 1.185113,-0.502983 z"           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:14.11111069px;font-family:'Dumbledor 3';-inkscape-font-specification:'Dumbledor 3, ';fill:#e9ddaf;fill-opacity:1;stroke:#483e37;stroke-width:0.5;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" diff --git a/src/battlemap/src/Struct/UI.elm b/src/battlemap/src/Struct/UI.elm index 447cfc4..c8ef91e 100644 --- a/src/battlemap/src/Struct/UI.elm +++ b/src/battlemap/src/Struct/UI.elm @@ -21,7 +21,6 @@ module Struct.UI exposing        -- Manual Controls        has_manual_controls_enabled,        -- Previous Action -      has_focus,        get_previous_action,        set_previous_action     ) @@ -129,9 +128,6 @@ set_enable_manual_controls : Bool -> Type -> Type  set_enable_manual_controls val ui = {ui | show_manual_controls = val}  -- Previous Action ------------------------------------------------------------- -has_focus : Type -> Bool -has_focus ui = True -  set_previous_action : (Maybe Action) -> Type -> Type  set_previous_action act ui = {ui | previous_action = act} diff --git a/src/map-editor/src/Comm/LoadBattlemap.elm b/src/map-editor/src/Comm/LoadMap.elm index cd29acf..2907f3a 100644 --- a/src/map-editor/src/Comm/LoadBattlemap.elm +++ b/src/map-editor/src/Comm/LoadMap.elm @@ -1,4 +1,4 @@ -module Comm.LoadBattlemap exposing (try) +module Comm.LoadMap exposing (try)  -- Elm -------------------------------------------------------------------------  import Json.Encode @@ -25,7 +25,7 @@ try_encoding model =           [              ("stk", (Json.Encode.string model.session_token)),              ("pid", (Json.Encode.string model.player_id)), -            ("bmi", (Json.Encode.string model.battlemap_id)) +            ("mix", (Json.Encode.string model.map_ix))           ]        )     ) @@ -37,6 +37,6 @@ try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type))  try model =     (Comm.Send.try_sending        model -      Constants.IO.battlemap_loading_handler +      Constants.IO.map_loading_handler        try_encoding     ) diff --git a/src/map-editor/src/Comm/Okay.elm b/src/map-editor/src/Comm/Okay.elm new file mode 100644 index 0000000..8ade538 --- /dev/null +++ b/src/map-editor/src/Comm/Okay.elm @@ -0,0 +1,22 @@ +module Comm.Okay exposing (decode) + +-- Elm ------------------------------------------------------------------------- +import Json.Decode + +-- Battlemap ------------------------------------------------------------------- +import Struct.Tile +import Struct.ServerReply + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +decode : (Json.Decode.Decoder Struct.ServerReply.Type) +decode = (Json.Decode.succeed Struct.ServerReply.Okay) diff --git a/src/map-editor/src/Comm/Send.elm b/src/map-editor/src/Comm/Send.elm index a6129cd..cbb6a28 100644 --- a/src/map-editor/src/Comm/Send.elm +++ b/src/map-editor/src/Comm/Send.elm @@ -7,13 +7,8 @@ import Json.Decode  import Json.Encode  -- Battlemap ------------------------------------------------------------------- -import Comm.AddArmor -import Comm.AddChar  import Comm.AddTile -import Comm.AddWeapon  import Comm.SetMap -import Comm.SetTimeline -import Comm.TurnResults  import Struct.Event  import Struct.ServerReply @@ -30,12 +25,8 @@ internal_decoder : String -> (Json.Decode.Decoder Struct.ServerReply.Type)  internal_decoder reply_type =     case reply_type of        "add_tile" -> (Comm.AddTile.decode) -      "add_armor" -> (Comm.AddArmor.decode) -      "add_char" -> (Comm.AddChar.decode) -      "add_weapon" -> (Comm.AddWeapon.decode)        "set_map" -> (Comm.SetMap.decode) -      "turn_results" -> (Comm.TurnResults.decode) -      "set_timeline" -> (Comm.SetTimeline.decode) +      "okay" -> (Comm.Okay.decode)        other ->           (Json.Decode.fail              ( diff --git a/src/map-editor/src/Constants/Movement.elm b/src/map-editor/src/Constants/Movement.elm new file mode 100644 index 0000000..a2a5c1e --- /dev/null +++ b/src/map-editor/src/Constants/Movement.elm @@ -0,0 +1,10 @@ +module Constants.Movement exposing (..) + +max_points : Int +max_points = 200 + +cost_when_occupied_tile : Int +cost_when_occupied_tile = 201 + +cost_when_out_of_bounds : Int +cost_when_out_of_bounds = 255 diff --git a/src/map-editor/src/Struct/Event.elm b/src/map-editor/src/Struct/Event.elm index 716718e..2edd09b 100644 --- a/src/map-editor/src/Struct/Event.elm +++ b/src/map-editor/src/Struct/Event.elm @@ -15,26 +15,13 @@ import Struct.UI  -- TYPES -----------------------------------------------------------------------  --------------------------------------------------------------------------------  type Type = -   AbortTurnRequest -   | AnimationEnded -   | AttackWithoutMovingRequest -   | CharacterInfoRequested Int -   | CharacterSelected Int -   | DebugLoadBattlemapRequest -   | DebugTeamSwitchRequest -   | DebugTestAnimation -   | DirectionRequested Struct.Direction.Type +   None     | Failed Struct.Error.Type -   | LookingForCharacter Int -   | None     | ScaleChangeRequested Float     | ServerReplied (Result Http.Error (List Struct.ServerReply.Type))     | TabSelected Struct.UI.Tab     | TileSelected Struct.Location.Ref -   | CharacterOrTileSelected Struct.Location.Ref -   | TurnEnded     | RequestedHelp Struct.HelpRequest.Type -   | WeaponSwitchRequest  attempted : (Result.Result err val) -> Type  attempted act = diff --git a/src/map-editor/src/Struct/HelpRequest.elm b/src/map-editor/src/Struct/HelpRequest.elm index 3357b56..92d80eb 100644 --- a/src/map-editor/src/Struct/HelpRequest.elm +++ b/src/map-editor/src/Struct/HelpRequest.elm @@ -3,11 +3,11 @@ module Struct.HelpRequest exposing (Type(..))  -- Elm -------------------------------------------------------------------------  -- Battlemap ------------------------------------------------------------------- -import Struct.Character +import Struct.Toolbox  --------------------------------------------------------------------------------  -- TYPES -----------------------------------------------------------------------  --------------------------------------------------------------------------------  type Type =     None -   | HelpOnRank Struct.Character.Rank +   | HelpOnTool Struct.Toolbox.Tool diff --git a/src/map-editor/src/Struct/Battlemap.elm b/src/map-editor/src/Struct/Map.elm index fee4901..b5ee795 100644 --- a/src/map-editor/src/Struct/Battlemap.elm +++ b/src/map-editor/src/Struct/Map.elm @@ -1,4 +1,4 @@ -module Struct.Battlemap exposing +module Struct.Map exposing     (        Type,        empty, @@ -14,13 +14,10 @@ module Struct.Battlemap exposing  -- Elm -------------------------------------------------------------------------  import Array --- Battlemap ------------------------------------------------------------------- -import Struct.Character +-- Map -------------------------------------------------------------------  import Struct.Tile  import Struct.Location -import Constants.Movement -  --------------------------------------------------------------------------------  -- TYPES -----------------------------------------------------------------------  -------------------------------------------------------------------------------- @@ -35,29 +32,29 @@ type alias Type =  -- LOCAL -----------------------------------------------------------------------  --------------------------------------------------------------------------------  location_to_index : Struct.Location.Type -> Type -> Int -location_to_index loc bmap = -   ((loc.y * bmap.width) + loc.x) +location_to_index loc map = +   ((loc.y * map.width) + loc.x)  has_location : Struct.Location.Type -> Type -> Bool -has_location loc bmap = +has_location loc map =     (        (loc.x >= 0)        && (loc.y >= 0) -      && (loc.x < bmap.width) -      && (loc.y < bmap.height) +      && (loc.x < map.width) +      && (loc.y < map.height)     )  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  --------------------------------------------------------------------------------  get_width : Type -> Int -get_width bmap = bmap.width +get_width map = map.width  get_height : Type -> Int -get_height bmap = bmap.height +get_height map = map.height  get_tiles : Type -> (Array.Array Struct.Tile.Instance) -get_tiles bmap = bmap.content +get_tiles map = map.content  empty : Type  empty = @@ -80,44 +77,11 @@ try_getting_tile_at : (        Type ->        (Maybe Struct.Tile.Instance)     ) -try_getting_tile_at loc bmap = -   (Array.get (location_to_index loc bmap) bmap.content) - -get_movement_cost_function : ( -      Type -> -      Struct.Location.Type -> -      (List Struct.Character.Type) -> -      Struct.Location.Type -> -      Int -   ) -get_movement_cost_function bmap start_loc char_list loc = -   if (has_location loc bmap) -   then -      case (Array.get (location_to_index loc bmap) bmap.content) of -         (Just tile) -> -            if -               (List.any -                  ( -                     \c -> -                        ( -                           ((Struct.Character.get_location c) == loc) -                           && (loc /= start_loc) -                           && (Struct.Character.is_alive c) -                        ) -                  ) -                  char_list -               ) -            then -               Constants.Movement.cost_when_occupied_tile -            else -               (Struct.Tile.get_instance_cost tile) - -         Nothing -> Constants.Movement.cost_when_out_of_bounds -   else -      Constants.Movement.cost_when_out_of_bounds +try_getting_tile_at loc map = +   (Array.get (location_to_index loc map) map.content)  solve_tiles : (List Struct.Tile.Type) -> Type -> Type -solve_tiles tiles bmap = -   {bmap | -      content = (Array.map (Struct.Tile.solve_tile_instance tiles) bmap.content) +solve_tiles tiles map = +   {map | +      content = (Array.map (Struct.Tile.solve_tile_instance tiles) map.content)     } diff --git a/src/map-editor/src/Struct/Model.elm b/src/map-editor/src/Struct/Model.elm index 0095364..4f089ec 100644 --- a/src/map-editor/src/Struct/Model.elm +++ b/src/map-editor/src/Struct/Model.elm @@ -2,18 +2,9 @@ module Struct.Model exposing     (        Type,        new, -      add_character, -      update_character, -      update_character_fun, -      add_weapon, -      add_armor,        add_tile,        invalidate, -      initialize_animator, -      apply_animator_step, -      move_animator_to_next_step,        reset, -      full_debug_reset,        clear_error     ) @@ -22,19 +13,13 @@ import Array  import Dict --- Battlemap ------------------------------------------------------------------- -import Struct.Armor -import Struct.Battlemap -import Struct.Character -import Struct.CharacterTurn +-- Map ------------------------------------------------------------------- +import Struct.Map  import Struct.Error  import Struct.Flags  import Struct.HelpRequest  import Struct.Tile -import Struct.TurnResult -import Struct.TurnResultAnimator  import Struct.UI -import Struct.Weapon  import Util.Array @@ -44,20 +29,13 @@ import Util.Array  type alias Type =     {        help_request: Struct.HelpRequest.Type, -      animator: (Maybe Struct.TurnResultAnimator.Type), -      battlemap: Struct.Battlemap.Type, -      characters: (Array.Array Struct.Character.Type), -      weapons: (Dict.Dict Struct.Weapon.Ref Struct.Weapon.Type), -      armors: (Dict.Dict Struct.Armor.Ref Struct.Armor.Type), +      map: Struct.Map.Type,        tiles: (Dict.Dict Struct.Tile.Ref Struct.Tile.Type),        error: (Maybe Struct.Error.Type),        player_id: String, -      battlemap_id: String, +      map_id: String,        session_token: String, -      player_ix: Int, -      ui: Struct.UI.Type, -      char_turn: Struct.CharacterTurn.Type, -      timeline: (Array.Array Struct.TurnResult.Type) +      ui: Struct.UI.Type     }  -------------------------------------------------------------------------------- @@ -70,18 +48,14 @@ type alias Type =  new : Struct.Flags.Type -> Type  new flags =     let -      maybe_battlemap_id = (Struct.Flags.maybe_get_param "id" flags) +      maybe_map_id = (Struct.Flags.maybe_get_param "id" flags)        model =           {              help_request = Struct.HelpRequest.None, -            animator = Nothing, -            battlemap = (Struct.Battlemap.empty), -            characters = (Array.empty), -            weapons = (Dict.empty), -            armors = (Dict.empty), +            map = (Struct.Map.empty),              tiles = (Dict.empty),              error = Nothing, -            battlemap_id = "", +            map_id = "",              player_id =                 (                    if (flags.user_id == "") @@ -89,55 +63,20 @@ new flags =                    else flags.user_id                 ),              session_token = flags.token, -            player_ix = 0, -            ui = (Struct.UI.default), -            char_turn = (Struct.CharacterTurn.new), -            timeline = (Array.empty) +            ui = (Struct.UI.default)           }     in -      case maybe_battlemap_id of +      case maybe_map_id of           Nothing ->              (invalidate                 (Struct.Error.new                    Struct.Error.Failure -                  "Could not find battlemap id." +                  "Could not find map id."                 )                 model              ) -         (Just id) -> {model | battlemap_id = id} - -add_character : Struct.Character.Type -> Type -> Type -add_character char model = -   {model | -      characters = -         (Array.push -            char -            model.characters -         ) -   } - -add_weapon : Struct.Weapon.Type -> Type -> Type -add_weapon wp model = -   {model | -      weapons = -         (Dict.insert -            (Struct.Weapon.get_id wp) -            wp -            model.weapons -         ) -   } - -add_armor : Struct.Armor.Type -> Type -> Type -add_armor ar model = -   {model | -      armors = -         (Dict.insert -            (Struct.Armor.get_id ar) -            ar -            model.armors -         ) -   } +         (Just id) -> {model | map_id = id}  add_tile : Struct.Tile.Type -> Type -> Type  add_tile tl model = @@ -158,90 +97,7 @@ reset model =        ui =           (Struct.UI.reset_displayed_nav              (Struct.UI.set_previous_action Nothing model.ui) -         ), -      char_turn = (Struct.CharacterTurn.new) -   } - -full_debug_reset : Type -> Type -full_debug_reset model = -   {model | -      help_request = Struct.HelpRequest.None, -      animator = Nothing, -      battlemap = (Struct.Battlemap.empty), -      characters = (Array.empty), -      weapons = (Dict.empty), -      armors = (Dict.empty), -      tiles = (Dict.empty), -      error = Nothing, -      ui = (Struct.UI.default), -      char_turn = (Struct.CharacterTurn.new), -      timeline = (Array.empty) -   } - -initialize_animator : Type -> Type -initialize_animator model = -   let -      timeline_list = (Array.toList model.timeline) -   in -      {model | -         animator = -            (Struct.TurnResultAnimator.maybe_new -               (List.reverse timeline_list) -               True -            ), -         ui = (Struct.UI.default), -         characters = -            (List.foldr -               (Struct.TurnResult.apply_inverse_to_characters) -               model.characters -               timeline_list -            ) -      } - -move_animator_to_next_step : Type -> Type -move_animator_to_next_step model = -   case model.animator of -      Nothing -> model -      (Just animator) -> -         {model | -            animator = -               (Struct.TurnResultAnimator.maybe_trigger_next_step animator) -         } - -apply_animator_step : Type -> Type -apply_animator_step model = -   case model.animator of -      Nothing -> model -      (Just animator) -> -         {model | -            characters = -               case -                  (Struct.TurnResultAnimator.get_current_animation animator) -               of -                  (Struct.TurnResultAnimator.TurnResult turn_result) -> -                     (Struct.TurnResult.apply_step_to_characters -                        turn_result -                        model.characters -                     ) - -                  _ -> model.characters -         } - -update_character : Int -> Struct.Character.Type -> Type -> Type -update_character ix new_val model = -   {model | -      characters = (Array.set ix new_val model.characters) -   } - -update_character_fun : ( -      Int -> -      ((Maybe Struct.Character.Type) -> (Maybe Struct.Character.Type)) -> -      Type -> -      Type -   ) -update_character_fun ix fun model = -   {model | -      characters = (Util.Array.update ix (fun) model.characters) +         )     }  invalidate : Struct.Error.Type -> Type -> Type diff --git a/src/map-editor/src/Struct/ServerReply.elm b/src/map-editor/src/Struct/ServerReply.elm index 5b88933..6f2da71 100644 --- a/src/map-editor/src/Struct/ServerReply.elm +++ b/src/map-editor/src/Struct/ServerReply.elm @@ -3,12 +3,8 @@ module Struct.ServerReply exposing (Type(..))  -- Elm -------------------------------------------------------------------------  -- Battlemap ------------------------------------------------------------------- -import Struct.Armor -import Struct.Battlemap -import Struct.Character +import Struct.Map  import Struct.Tile -import Struct.TurnResult -import Struct.Weapon  --------------------------------------------------------------------------------  -- TYPES ----------------------------------------------------------------------- @@ -16,13 +12,8 @@ import Struct.Weapon  type Type =     Okay -   | AddArmor Struct.Armor.Type -   | AddWeapon Struct.Weapon.Type -   | AddCharacter (Struct.Character.Type, Int, Int, Int)     | AddTile Struct.Tile.Type -   | SetMap Struct.Battlemap.Type -   | TurnResults (List Struct.TurnResult.Type) -   | SetTimeline (List Struct.TurnResult.Type) +   | SetMap Struct.Map.Type  --------------------------------------------------------------------------------  -- LOCAL ----------------------------------------------------------------------- diff --git a/src/map-editor/src/Struct/Toolbox.elm b/src/map-editor/src/Struct/Toolbox.elm new file mode 100644 index 0000000..81f7c2a --- /dev/null +++ b/src/map-editor/src/Struct/Toolbox.elm @@ -0,0 +1,15 @@ +module Struct.Toolbox exposing (Tool(..)) + +-- Elm ------------------------------------------------------------------------- + +-- Battlemap ------------------------------------------------------------------- +import Struct.Toolbox + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +type Tool = +   Simple +   | Select +   | Fill +   | Square diff --git a/src/map-editor/src/Struct/UI.elm b/src/map-editor/src/Struct/UI.elm index 447cfc4..aa83bd6 100644 --- a/src/map-editor/src/Struct/UI.elm +++ b/src/map-editor/src/Struct/UI.elm @@ -18,40 +18,30 @@ module Struct.UI exposing        try_getting_displayed_nav,        set_displayed_nav,        reset_displayed_nav, -      -- Manual Controls -      has_manual_controls_enabled,        -- Previous Action -      has_focus,        get_previous_action,        set_previous_action     )  -- Battlemap -------------------------------------------------------------------  import Struct.Location -import Struct.Navigator  --------------------------------------------------------------------------------  -- TYPES -----------------------------------------------------------------------  --------------------------------------------------------------------------------  type Tab =     StatusTab -   | CharactersTab +   | TilesTab     | SettingsTab -   | TimelineTab  type Action = -   UsedManualControls -   | SelectedLocation Struct.Location.Ref -   | SelectedCharacter Int -   | AttackedCharacter Int +   SelectedLocation Struct.Location.Ref  type alias Type =     {        zoom_level : Float, -      show_manual_controls : Bool,        displayed_tab : (Maybe Tab), -      previous_action : (Maybe Action), -      displayed_nav : (Maybe Struct.Navigator.Type) +      previous_action : (Maybe Action)     }  -------------------------------------------------------------------------------- @@ -65,10 +55,8 @@ default : Type  default =     {        zoom_level = 1.0, -      show_manual_controls = True,        displayed_tab = Nothing, -      previous_action = Nothing, -      displayed_nav = Nothing +      previous_action = Nothing     }  -- Zoom ------------------------------------------------------------------------ @@ -95,43 +83,14 @@ to_string : Tab -> String  to_string tab =     case tab of        StatusTab -> "Status" -      CharactersTab -> "Characters" +      TilesTab -> "Tiles"        SettingsTab -> "Settings" -      TimelineTab -> "Timeline"  get_all_tabs : (List Tab)  get_all_tabs = -   [StatusTab, CharactersTab, SettingsTab, TimelineTab] - --- Navigator ------------------------------------------------------------------- -try_getting_displayed_nav : Type -> (Maybe Struct.Navigator.Type) -try_getting_displayed_nav ui = ui.displayed_nav - -set_displayed_nav : Struct.Navigator.Type -> Type -> Type -set_displayed_nav nav ui = {ui | displayed_nav = (Just nav)} - -reset_displayed_nav : Type -> Type -reset_displayed_nav ui = {ui | displayed_nav = Nothing} - --- ManualControls -------------------------------------------------------------- -has_manual_controls_enabled : Type -> Bool -has_manual_controls_enabled ui = ui.show_manual_controls - -toggle_manual_controls : Type -> Type -toggle_manual_controls ui = -   if (ui.show_manual_controls) -   then -      {ui | show_manual_controls = False} -   else -      {ui | show_manual_controls = True} - -set_enable_manual_controls : Bool -> Type -> Type -set_enable_manual_controls val ui = {ui | show_manual_controls = val} +   [StatusTab, TilesTab, SettingsTab]  -- Previous Action ------------------------------------------------------------- -has_focus : Type -> Bool -has_focus ui = True -  set_previous_action : (Maybe Action) -> Type -> Type  set_previous_action act ui = {ui | previous_action = act} diff --git a/src/map-editor/src/Update/HandleServerReply.elm b/src/map-editor/src/Update/HandleServerReply.elm index bc347c9..8d5f07d 100644 --- a/src/map-editor/src/Update/HandleServerReply.elm +++ b/src/map-editor/src/Update/HandleServerReply.elm @@ -11,19 +11,14 @@ import Http  import Time --- Battlemap ------------------------------------------------------------------- -import Struct.Armor -import Struct.Battlemap -import Struct.Character +-- Map ------------------------------------------------------------------- +import Struct.Map  import Struct.Error  import Struct.Event  import Struct.Model  import Struct.ServerReply  import Struct.Tile -import Struct.TurnResult -import Struct.TurnResultAnimator  import Struct.UI -import Struct.Weapon  --------------------------------------------------------------------------------  -- TYPES ----------------------------------------------------------------------- @@ -32,30 +27,6 @@ import Struct.Weapon  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -weapon_getter : Struct.Model.Type -> Struct.Weapon.Ref -> Struct.Weapon.Type -weapon_getter model ref = -   case (Dict.get ref model.weapons) of -      (Just w) -> w -      Nothing -> Struct.Weapon.none - -armor_getter : Struct.Model.Type -> Struct.Armor.Ref -> Struct.Armor.Type -armor_getter model ref = -   case (Dict.get ref model.armors) of -      (Just w) -> w -      Nothing -> Struct.Armor.none - ------------ - -add_armor : ( -      Struct.Armor.Type -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -   ) -add_armor ar current_state = -   case current_state of -      (_, (Just _)) -> current_state -      (model, _) -> ((Struct.Model.add_armor ar model), Nothing) -  add_tile : (        Struct.Tile.Type ->        (Struct.Model.Type, (Maybe Struct.Error.Type)) -> @@ -66,41 +37,8 @@ add_tile tl current_state =        (_, (Just _)) -> current_state        (model, _) -> ((Struct.Model.add_tile tl model), Nothing) -add_weapon : ( -      Struct.Weapon.Type -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -   ) -add_weapon wp current_state = -   case current_state of -      (_, (Just _)) -> current_state -      (model, _) -> ((Struct.Model.add_weapon wp model), Nothing) - -add_character : ( -      (Struct.Character.Type, Int, Int, Int) -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -   ) -add_character char_and_refs current_state = -   case current_state of -      (_, (Just _)) -> current_state -      (model, _) -> -         let -            (char, awp_ref, swp_ref, ar_ref) = char_and_refs -            awp = (weapon_getter model awp_ref) -            swp = (weapon_getter model swp_ref) -            ar = (armor_getter model ar_ref) -         in -            ( -               (Struct.Model.add_character -                  (Struct.Character.fill_missing_equipment awp swp ar char) -                  model -               ), -               Nothing -            ) -  set_map : ( -      Struct.Battlemap.Type -> +      Struct.Map.Type ->        (Struct.Model.Type, (Maybe Struct.Error.Type)) ->        (Struct.Model.Type, (Maybe Struct.Error.Type))     ) @@ -110,58 +48,11 @@ set_map map current_state =        (model, _) ->           (              {model | -               battlemap = -                  (Struct.Battlemap.solve_tiles (Dict.values model.tiles) map) +               map = (Struct.Map.solve_tiles (Dict.values model.tiles) map)              },              Nothing           ) -add_to_timeline : ( -      (List Struct.TurnResult.Type) -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -   ) -add_to_timeline turn_results current_state = -   case current_state of -      (_, (Just _)) -> current_state - -      (model, _) -> -         ( -            {model | -               animator = -                  (Struct.TurnResultAnimator.maybe_new -                     (List.reverse turn_results) -                     False -                  ), -               timeline = -                  (Array.append -                     (Array.fromList turn_results) -                     model.timeline -                  ), -               ui = -                  (Struct.UI.set_displayed_tab -                     Struct.UI.TimelineTab -                     model.ui -                  ) -            }, -            Nothing -         ) - -set_timeline : ( -      (List Struct.TurnResult.Type) -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -> -      (Struct.Model.Type, (Maybe Struct.Error.Type)) -   ) -set_timeline turn_results current_state = -   case current_state of -      (_, (Just _)) -> current_state - -      (model, _) -> -         ( -            {model | timeline = (Array.fromList turn_results)}, -            Nothing -         ) -  apply_command : (        Struct.ServerReply.Type ->        (Struct.Model.Type, (Maybe Struct.Error.Type)) -> @@ -169,27 +60,12 @@ apply_command : (     )  apply_command command current_state =     case command of -      (Struct.ServerReply.AddWeapon wp) -> -         (add_weapon wp current_state) - -      (Struct.ServerReply.AddArmor ar) -> -         (add_armor ar current_state) -        (Struct.ServerReply.AddTile tl) ->           (add_tile tl current_state) -      (Struct.ServerReply.AddCharacter char) -> -         (add_character char current_state) -        (Struct.ServerReply.SetMap map) ->           (set_map map current_state) -      (Struct.ServerReply.TurnResults results) -> -         (add_to_timeline results current_state) - -      (Struct.ServerReply.SetTimeline timeline) -> -         (set_timeline timeline current_state) -        Struct.ServerReply.Okay -> current_state  -------------------------------------------------------------------------------- @@ -212,19 +88,6 @@ apply_to model query_result =           )        (Result.Ok commands) -> -         let -            new_model = -               ( -                  case (List.foldl (apply_command) (model, Nothing) commands) of -                     (updated_model, Nothing) -> updated_model -                     (_, (Just error)) -> (Struct.Model.invalidate error model) -               ) -         in -            ( -               new_model, -               if (new_model.animator == Nothing) -               then -                  Cmd.none -               else -                  (Delay.after 1 Time.millisecond Struct.Event.AnimationEnded) -            ) +         case (List.foldl (apply_command) (model, Nothing) commands) of +            (updated_model, Nothing) -> updated_model +            (_, (Just error)) -> (Struct.Model.invalidate error model) diff --git a/src/map-editor/src/Update/SelectTile.elm b/src/map-editor/src/Update/SelectTile.elm index 6d05476..e6bb9fd 100644 --- a/src/map-editor/src/Update/SelectTile.elm +++ b/src/map-editor/src/Update/SelectTile.elm @@ -3,129 +3,15 @@ module Update.SelectTile exposing (apply_to)  -- Elm -------------------------------------------------------------------------  -- Battlemap ------------------------------------------------------------------- -import Struct.CharacterTurn -import Struct.Direction  import Struct.Error  import Struct.Event  import Struct.Location  import Struct.Model -import Struct.Navigator  import Struct.UI  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -try_autopiloting : ( -      Struct.Direction.Type -> -      (Maybe Struct.Navigator.Type) -> -      (Maybe Struct.Navigator.Type) -   ) -try_autopiloting dir maybe_nav = -   case maybe_nav of -      (Just navigator) -> -         (Struct.Navigator.try_adding_step dir navigator) - -      Nothing -> Nothing - -go_to_tile : ( -      Struct.Model.Type -> -      Struct.Navigator.Type -> -      Struct.Location.Ref -> -      (Struct.Model.Type, (Cmd Struct.Event.Type)) -   ) -go_to_tile model navigator loc_ref = -   if -   ( -      loc_ref -      == -      (Struct.Location.get_ref -         (Struct.Navigator.get_current_location navigator) -      ) -   ) -   then -      -- We are already there. -      if -      ( -         (Struct.UI.get_previous_action model.ui) -         == -         (Just (Struct.UI.SelectedLocation loc_ref)) -      ) -      then -         -- And we just clicked on that tile. -         ( -            {model | -               char_turn = -                  (Struct.CharacterTurn.lock_path model.char_turn) -            }, -            Cmd.none -         ) -      else -         -- And we didn't just click on that tile. -         ( -            {model | -               ui = -                  (Struct.UI.reset_displayed_nav -                     (Struct.UI.set_displayed_tab -                        Struct.UI.StatusTab -                        (Struct.UI.set_previous_action -                           (Just (Struct.UI.SelectedLocation loc_ref)) -                           model.ui -                        ) -                     ) -                  ) -            }, -            Cmd.none -         ) -   else -      -- We have to try getting there. -      case -         (Struct.Navigator.try_getting_path_to -            loc_ref -            navigator -         ) -      of -         (Just path) -> -            case -               (List.foldr -                  (try_autopiloting) -                  (Just (Struct.Navigator.clear_path navigator)) -                  path -               ) -            of -               (Just new_navigator) -> -                  ( -                     {model | -                        char_turn = -                           (Struct.CharacterTurn.set_navigator -                              new_navigator -                              model.char_turn -                           ), -                        ui = -                           (Struct.UI.set_displayed_tab -                              Struct.UI.StatusTab -                              (Struct.UI.set_previous_action -                                 (Just (Struct.UI.SelectedLocation loc_ref)) -                                 model.ui -                              ) -                           ) -                     }, -                     Cmd.none -                  ) - -               Nothing -> -                  ( -                     (Struct.Model.invalidate -                        (Struct.Error.new -                           Struct.Error.Programming -                           "SelectTile/Navigator: Could not follow own path." -                        ) -                        model -                     ), -                     Cmd.none -                  ) - -         Nothing -> -- Clicked outside of the range indicator -            ((Struct.Model.reset model), Cmd.none)  --------------------------------------------------------------------------------  -- EXPORTED -------------------------------------------------------------------- @@ -136,23 +22,18 @@ apply_to : (        (Struct.Model.Type, (Cmd Struct.Event.Type))     )  apply_to model loc_ref = -   case (Struct.CharacterTurn.try_getting_navigator model.char_turn) of -      (Just navigator) -> -         (go_to_tile model navigator loc_ref) - -      _ -> -         ( -            {model | -               ui = -                  (Struct.UI.reset_displayed_nav -                     (Struct.UI.set_displayed_tab -                        Struct.UI.StatusTab -                        (Struct.UI.set_previous_action -                           (Just (Struct.UI.SelectedLocation loc_ref)) -                           model.ui -                        ) -                     ) +   ( +      {model | +         ui = +            (Struct.UI.reset_displayed_nav +               (Struct.UI.set_displayed_tab +                  Struct.UI.StatusTab +                  (Struct.UI.set_previous_action +                     (Just (Struct.UI.SelectedLocation loc_ref)) +                     model.ui                    ) -            }, -            Cmd.none -         ) +               ) +            ) +      }, +      Cmd.none +   ) | 


