blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
247
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 4
111
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
58
| visit_date
timestamp[ns]date 2015-07-25 18:16:41
2023-09-06 10:45:08
| revision_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| github_id
int64 3.89k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 25
values | gha_event_created_at
timestamp[ns]date 2012-06-07 00:51:45
2023-09-14 21:58:52
⌀ | gha_created_at
timestamp[ns]date 2008-03-27 23:40:48
2023-08-24 19:49:39
⌀ | gha_language
stringclasses 159
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
10.5M
| extension
stringclasses 111
values | filename
stringlengths 1
195
| text
stringlengths 7
10.5M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0cfee6d4c9cdbe36ea4454472cd16412aa0404f9
|
9f9660f318732124b8a5154e6670e1cfc372acc4
|
/Case_save/Case20/Case/case8/1000/phi
|
16d5ba1b1c6ac29a24ddf742dc3de2e9e1a4af3c
|
[] |
no_license
|
mamitsu2/aircond5
|
9a6857f4190caec15823cb3f975cdddb7cfec80b
|
20a6408fb10c3ba7081923b61e44454a8f09e2be
|
refs/heads/master
| 2020-04-10T22:41:47.782141
| 2019-09-02T03:42:37
| 2019-09-02T03:42:37
| 161,329,638
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 13,631
|
phi
|
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "1000";
object phi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 0 -1 0 0 0 0];
internalField nonuniform List<scalar>
852
(
-0.00293724
0.00299346
-0.00397743
0.00104018
-0.00476677
0.000789345
-0.00538341
0.000616638
-0.00579812
0.000414704
-0.00598823
0.000190109
-0.00593194
-5.62821e-05
-0.00561207
-0.00031987
-0.00504164
-0.000570439
-0.00427323
-0.000768411
-0.00338807
-0.000885159
-0.00247519
-0.000912874
-0.00160968
-0.000865517
-0.000814398
-0.000795281
-0.000812961
-0.000677075
0.00067975
-0.000348697
-0.000328379
0.000258915
-0.000607613
0.000733162
-0.000474248
0.00104816
-0.000315003
0.00124408
-0.000195918
0.0013506
-0.000106522
0.00140349
-5.28895e-05
0.00143333
-2.9843e-05
0.00145158
-1.82484e-05
0.00146175
-1.01675e-05
0.00146494
-3.19098e-06
0.00145919
5.74117e-06
0.00143611
2.3087e-05
0.00137318
6.29253e-05
0.00123259
0.00014059
0.000999531
0.000233055
0.000707046
0.000292484
0.000710643
-0.00209527
0.00524009
-0.00310135
0.00204626
-0.00390721
0.00159521
-0.00451062
0.00122004
-0.0049156
0.000819684
-0.00510843
0.000382942
-0.00506391
-0.000100808
-0.00476798
-0.000615803
-0.00424479
-0.00109362
-0.00355634
-0.00145686
-0.00278519
-0.00165631
-0.00201179
-0.00168628
-0.0013082
-0.00156911
-0.000761741
-0.00134174
-0.000557969
-0.00101673
-7.10014e-05
-0.00048702
-7.10535e-05
0.000374594
0.000312778
0.000799473
-0.00075326
0.0010493
-0.000857436
0.0012587
-0.000683649
0.0014145
-0.000470804
0.00150569
-0.000287109
0.00151981
-0.000120648
0.00152363
-5.67085e-05
0.00152823
-3.44417e-05
0.00153207
-2.20975e-05
0.00153465
-1.27438e-05
0.00153592
-4.46571e-06
0.00153503
6.63595e-06
0.00152839
2.97221e-05
0.00148721
0.000104103
0.00131232
0.000315484
0.00100995
0.000535423
0.000628273
0.000674158
0.00134819
-0.00146625
0.00693783
-0.00232988
0.00290989
-0.00303836
0.00230369
-0.00354907
0.00173075
-0.00389744
0.00116805
-0.00406524
0.000550744
-0.00400762
-0.000158431
-0.00370339
-0.000920034
-0.00319863
-0.00159839
-0.00256955
-0.00208594
-0.00189812
-0.00232774
-0.00124799
-0.0023364
-0.000669665
-0.00214743
-0.000213631
-0.00179778
8.97127e-05
-0.00132008
0.000286913
-0.000684221
0.000215858
0.00148423
-0.00116345
0.00169853
-0.000967556
0.0016781
-0.000837005
0.00167878
-0.00068433
0.00170057
-0.000492602
0.00171244
-0.000298979
0.00159195
0.00153539
0.0015011
0.00147916
0.00146656
0.00146225
0.00146904
0.00149891
0.00160317
0.001323
0.000595648
0.000982371
0.000876053
0.000549068
0.00110746
0.0019114
-0.00102381
0.00826139
-0.00170562
0.00359169
-0.00216692
0.002765
-0.00249369
0.00205752
-0.0027159
0.00139026
-0.00280088
0.00063572
-0.00267369
-0.000285618
-0.00232412
-0.0012696
-0.00183688
-0.00208563
-0.001295
-0.00262783
-0.000765553
-0.00285719
-0.000283254
-0.0028187
0.000134304
-0.00256499
0.000482292
-0.00214576
0.000788457
-0.00162624
0.00115576
-0.00105152
0.00191823
-0.000546616
0.00244752
-0.000522039
0.00204794
-0.00076388
0.00192071
-0.000840326
0.00181021
-0.000726501
0.00171613
-0.000590249
0.00166486
-0.000441334
0.00164372
-0.00027784
0.00175777
-0.00011421
0.00182981
-7.21896e-05
0.001888
-5.83411e-05
0.0019328
-4.49549e-05
0.0019504
-1.7752e-05
0.00191986
3.03864e-05
0.00181653
0.000103176
0.00160805
0.000208317
0.00124032
0.00036758
0.0011099
0.000726065
0.000824069
0.00116188
0.000387902
0.00154363
0.00231786
-0.000717691
0.00933678
-0.0012336
0.00410759
-0.00132031
0.00285171
-0.00137141
0.00210863
-0.00139098
0.00140982
-0.00129743
0.000542173
-0.00101176
-0.000571294
-0.000599829
-0.00168153
-0.000167376
-0.00251808
0.000219952
-0.00301515
0.000536466
-0.00317371
0.000780178
-0.00306242
0.000964674
-0.00274949
0.00111798
-0.00229907
0.00127093
-0.00177919
0.00147477
-0.00125536
0.00176019
-0.000832036
0.00189656
-0.000658414
0.00179931
-0.000666628
0.00162462
-0.000665634
0.00147743
-0.000579312
0.00135722
-0.000470039
0.00127485
-0.000358966
0.00124336
-0.000246359
0.0012842
-0.000155049
0.00133126
-0.000119249
0.0013832
-0.000110281
0.00143667
-9.84238e-05
0.00148122
-6.23023e-05
0.00149744
1.41665e-05
0.00146491
0.000135699
0.00137165
0.000301573
0.00121824
0.000520993
0.00108454
0.000859768
0.000941211
0.00130521
0.000623534
0.0018613
0.000553235
0.00238816
-0.000967774
0.0015208
-0.0014309
0.000462918
-0.00138395
-0.000626219
0.0103696
-0.000978542
0.00445991
-0.000550927
0.00242409
-0.000183518
0.00174122
0.000100122
0.00112618
0.000496707
0.000145587
0.0010002
-0.00107479
0.00142092
-0.00210224
0.00170439
-0.00280156
0.00184815
-0.00315891
0.001883
-0.00320856
0.00183711
-0.00301652
0.00174113
-0.00265351
0.00163122
-0.00218916
0.00154044
-0.00168842
0.00149417
-0.00120909
0.00148635
-0.000824217
0.00143235
-0.000604418
0.00128871
-0.000522987
0.00109883
-0.000475756
0.00093164
-0.000412122
0.000804063
-0.000342462
0.000722101
-0.000277005
0.000693296
-0.000217555
0.000714835
-0.000176589
0.00076247
-0.000166885
0.000825373
-0.000173185
0.000898923
-0.000171975
0.000977605
-0.000140986
0.0010495
-5.77321e-05
0.00109709
8.81106e-05
0.00111618
0.000282479
0.00111465
0.000522528
0.00113965
0.000834766
0.00123876
0.00120609
0.00142529
0.00167477
0.00186828
0.00194517
0.00212953
0.00125956
0.00174086
0.000851582
0.000413426
-0.000679329
0.0114998
-0.000556462
0.00433705
0.000582065
0.00128556
0.00138274
0.000940536
0.00207748
0.000431442
0.00278524
-0.000562174
0.0033256
-0.00161515
0.00360692
-0.00238356
0.00363569
-0.00283034
0.00345812
-0.00298133
0.00313688
-0.00288732
0.00273307
-0.00261271
0.00230003
-0.00222047
0.00188442
-0.00177355
0.00152147
-0.00132547
0.0012269
-0.000914519
0.000999052
-0.000596368
0.000802221
-0.000407588
0.000603653
-0.00032442
0.000414475
-0.000286579
0.0002596
-0.000257249
0.000148809
-0.000231672
8.33067e-05
-0.000211504
6.35325e-05
-0.000197782
8.30649e-05
-0.000196122
0.000127012
-0.000210833
0.000186006
-0.00023218
0.000258988
-0.000244958
0.000350062
-0.000232061
0.00046412
-0.000171792
0.000588932
-3.67021e-05
0.000714083
0.000157326
0.000850569
0.000386041
0.00103604
0.000649294
0.00131866
0.000923476
0.00175978
0.00123365
0.00242624
0.0012787
0.0029673
0.000718498
0.00299034
0.000828538
0.00346489
0.00259767
0.00940666
0.00330489
0.00362983
0.00371307
0.000877382
0.00441589
0.000237721
0.00524103
-0.0003937
0.00586502
-0.00118617
0.00607719
-0.00182732
0.00590995
-0.00221632
0.00544146
-0.00236185
0.00476454
-0.00230441
0.00397475
-0.00209752
0.00315574
-0.00179371
0.00236904
-0.00143377
0.00166335
-0.00106786
0.0010711
-0.000733221
0.000598234
-0.000441655
0.000250186
-0.00024832
-2.24644e-06
-0.000155157
-0.000196288
-0.00013038
-0.000348868
-0.000133999
-0.000464587
-0.000141531
-0.000545534
-0.000150727
-0.00059503
-0.000162008
-0.000616421
-0.000176393
-0.000616211
-0.000196333
-0.000604459
-0.000222587
-0.000586991
-0.000249649
-0.000562943
-0.000269007
-0.000524046
-0.000270959
-0.000451669
-0.00024417
-0.000317028
-0.000171344
-0.000135866
-2.3837e-05
7.73639e-05
0.00017281
0.000346345
0.000380311
0.000682538
0.000587283
0.00112645
0.000789735
0.00161551
0.000789638
0.0018243
0.000509709
0.00108539
0.00156745
0.00479936
0.00996006
0.0135818
0.0124576
0.00200163
0.0117555
0.000939798
0.0110974
0.000264402
0.0102092
-0.000298001
0.00905692
-0.000675003
0.00774573
-0.000905133
0.00636982
-0.000985933
0.00500307
-0.000937661
0.00371267
-0.000807129
0.00255055
-0.000631592
0.0015383
-0.000421518
0.000699658
-0.000229219
4.08982e-05
-7.44621e-05
-0.000421312
2.05545e-05
-0.000705157
3.5523e-05
-0.000880681
2.03663e-05
-0.00100528
-5.7785e-06
-0.00110575
-3.35301e-05
-0.00118819
-5.90947e-05
-0.00125503
-8.38927e-05
-0.00130967
-0.000107368
-0.00135614
-0.000129921
-0.0014009
-0.000151571
-0.00145241
-0.000171086
-0.00151823
-0.000183825
-0.00160559
-0.00018165
-0.00172314
-0.000153412
-0.00188118
-8.61304e-05
-0.00208532
3.27926e-05
-0.00232254
0.000213387
-0.00261952
0.000469789
-0.0030578
0.000818589
-0.00372866
0.00125814
-0.00469891
0.00175998
-0.00608506
0.0021758
-0.00776929
0.00219393
-0.00729864
0.00109681
-0.00222374
0.00467432
0.00350666
0.00377417
0.00183995
0.00414652
-0.000107947
0.0041513
-0.000302775
0.00374567
-0.000269371
0.0031132
-0.000272665
0.00236111
-0.000233842
0.00155682
-0.000133377
0.000743255
6.43631e-06
-2.44626e-05
0.000136124
-0.000656234
0.000210252
-0.00110079
0.000215338
-0.00138171
0.000206453
-0.00154116
0.000180002
-0.00164196
0.00013632
-0.00171459
9.30033e-05
-0.00177548
5.5104e-05
-0.00183306
2.4053e-05
-0.001892
-1.55001e-07
-0.00195402
-2.18775e-05
-0.00201974
-4.1646e-05
-0.00209094
-5.87234e-05
-0.00217077
-7.17389e-05
-0.00226203
-7.98274e-05
-0.00236565
-8.02104e-05
-0.00248058
-6.67234e-05
-0.00260292
-3.1068e-05
-0.00272489
3.5839e-05
-0.00283452
0.000142418
-0.00292863
0.000307493
-0.00301482
0.00055598
-0.00309843
0.000902194
-0.00317508
0.00133479
-0.00319954
0.00178444
-0.00311959
0.00209584
-0.00275576
0.0018301
-0.00149464
-0.000164309
-0.00364648
-0.000534251
0.00410588
0.00029985
0.00100585
-8.90543e-05
0.00028096
-0.000474894
8.30647e-05
-0.000813344
6.90788e-05
-0.00117729
9.12801e-05
-0.00154247
0.000131332
-0.00185677
0.000180924
-0.00207585
0.000225514
-0.00219657
0.00025685
-0.00225058
0.000264256
-0.00227329
0.000238051
-0.00226968
0.000202837
-0.00225657
0.000166897
-0.0022526
0.000132345
-0.00226244
0.000102841
-0.00228568
7.83412e-05
-0.00231984
5.82103e-05
-0.00236153
4.15345e-05
-0.00241197
2.8566e-05
-0.00247022
1.65998e-05
-0.00253428
5.33413e-06
-0.00260147
-4.55012e-06
-0.00266933
-1.19661e-05
-0.00273418
-1.53625e-05
-0.00278919
-1.17146e-05
-0.00282357
3.30707e-06
-0.00282738
3.96484e-05
-0.00279034
0.000105384
-0.00269088
0.000208028
-0.00249782
0.00036292
-0.00218447
0.000588843
-0.00173161
0.000881931
-0.00111094
0.00116377
-0.000151789
0.00113669
0.00114293
0.000535383
0.00158107
-0.000602456
-0.00198665
-0.00722416
-0.0101273
-0.0059786
-0.00495287
-0.00466083
-0.00457094
-0.00449765
-0.00440415
-0.00427219
-0.00409201
-0.00386847
-0.00361475
-0.00335474
-0.00312198
-0.00292532
-0.00276532
-0.00264042
-0.00254546
-0.00247534
-0.0024256
-0.00239273
-0.00237297
-0.00236526
-0.00236886
-0.00238232
-0.00240313
-0.00242722
-0.0024475
-0.00245255
-0.00242101
-0.00232347
-0.00212299
-0.00176733
-0.00118547
-0.000310255
0.000847011
0.00197717
0.00250578
0.00189616
)
;
boundaryField
{
floor
{
type calculated;
value nonuniform List<scalar>
29
(
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-3.59814e-06
-9.2738e-06
-1.41463e-05
-1.85591e-05
-1.4381e-06
-2.67588e-06
-7.62297e-06
-8.00065e-06
-7.25239e-06
)
;
}
ceiling
{
type calculated;
value nonuniform List<scalar>
43
(
-4.54268e-05
-4.41068e-05
-4.27976e-05
-1.98804e-05
-1.10838e-05
-6.82479e-06
-4.2072e-06
-2.22989e-06
-6.23317e-07
7.44182e-07
1.96967e-06
3.12301e-06
4.24679e-06
5.28906e-06
6.17925e-06
6.89321e-06
7.44991e-06
7.88134e-06
8.21515e-06
8.47111e-06
8.66339e-06
8.80105e-06
8.89012e-06
8.92827e-06
8.9109e-06
8.84144e-06
8.72544e-06
8.56416e-06
8.35865e-06
8.11046e-06
7.83798e-06
7.55189e-06
7.26076e-06
6.97575e-06
6.7169e-06
6.49827e-06
6.52813e-06
6.76824e-06
7.16451e-06
8.40033e-06
1.1104e-05
8.05503e-06
-6.49658e-05
)
;
}
sWall
{
type calculated;
value uniform -0.000275068;
}
nWall
{
type calculated;
value nonuniform List<scalar> 6(-4.71528e-05 -5.6518e-05 -6.11211e-05 -7.1902e-05 -7.87559e-05 -9.88905e-05);
}
sideWalls
{
type empty;
value nonuniform 0();
}
glass1
{
type calculated;
value nonuniform List<scalar> 9(-5.62158e-05 -0.000151362 -0.000231493 -0.000299738 -0.000357702 -0.000406603 -0.000450889 -0.000504518 -0.000564504);
}
glass2
{
type calculated;
value nonuniform List<scalar> 2(-0.000249084 -0.00027555);
}
sun
{
type calculated;
value uniform 0;
}
heatsource1
{
type calculated;
value nonuniform List<scalar> 3(2.03953e-07 2.0391e-07 2.03927e-07);
}
heatsource2
{
type calculated;
value nonuniform List<scalar> 4(5.10993e-08 5.12204e-08 0 0);
}
Table_master
{
type calculated;
value nonuniform List<scalar> 9(-1.52964e-07 -1.53046e-07 -1.53075e-07 -1.53095e-07 -1.53109e-07 -1.53118e-07 -1.53122e-07 -1.53116e-07 -1.53083e-07);
}
Table_slave
{
type calculated;
value nonuniform List<scalar> 9(1.52841e-07 1.52867e-07 1.52851e-07 1.52837e-07 1.52832e-07 1.52836e-07 1.52852e-07 1.52894e-07 1.52974e-07);
}
inlet
{
type calculated;
value uniform -0.00617935;
}
outlet
{
type calculated;
value nonuniform List<scalar> 2(0.00754466 0.00294721);
}
}
// ************************************************************************* //
|
|
bb58b37d2493b7fb38a9fdfccc813601f97cf1f8
|
b883b661acbb3fb20dae7695487745674a80dd3b
|
/server/mmocore/inc/c2s/log_off_to_lobby.hpp
|
718d83d3721db52d868c276ead5216740c9d1208
|
[] |
no_license
|
kpyrkosz/tejk_it_izi
|
145c573b421dd2405437444d45e29ae71221b053
|
1149f37da55b6f0e9b650fe07cd3d2fe22db0a5e
|
refs/heads/master
| 2021-07-11T18:23:21.393182
| 2019-11-06T07:08:35
| 2020-08-06T16:48:21
| 181,365,996
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 389
|
hpp
|
log_off_to_lobby.hpp
|
#pragma once
#include <received_packet.hpp>
#include <state_transitioner.hpp>
#include <user_environment.hpp>
class log_off_to_lobby : public received_packet
{
state_transitioner& transitioner_;
user_environment& my_environment_;
public:
log_off_to_lobby(state_transitioner& transitioner, user_environment& my_environment);
virtual void execute_associated_action() override;
};
|
cd92441e76bfc4861c93102f32477cbf3d19ad29
|
62c2367c812112ea913ec6277cd82e8b8a71ffd1
|
/src/mlpack/methods/kmeans/dual_tree_kmeans_rules.hpp
|
4c960bea01c3e65996734ffb4d1394682ee6f0cb
|
[
"BSD-3-Clause"
] |
permissive
|
dayifu/mlpack
|
68983fc2bccb275b72bd20aad753d5b7934c597e
|
dac00b2b348b1bfe7051935ea899e673abf0b166
|
refs/heads/master
| 2020-12-26T04:55:00.052900
| 2015-03-26T10:53:31
| 2015-03-26T10:53:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,659
|
hpp
|
dual_tree_kmeans_rules.hpp
|
/**
* @file dual_tree_kmeans_rules.hpp
* @author Ryan Curtin
*
* A set of tree traversal rules for dual-tree k-means clustering.
*/
#ifndef __MLPACK_METHODS_KMEANS_DUAL_TREE_KMEANS_RULES_HPP
#define __MLPACK_METHODS_KMEANS_DUAL_TREE_KMEANS_RULES_HPP
namespace mlpack {
namespace kmeans {
template<typename MetricType, typename TreeType>
class DualTreeKMeansRules
{
public:
DualTreeKMeansRules(const typename TreeType::Mat& dataset,
const arma::mat& centroids,
arma::mat& newCentroids,
arma::Col<size_t>& counts,
const std::vector<size_t>& mappings,
const size_t iteration,
const arma::vec& clusterDistances,
arma::vec& distances,
arma::Col<size_t>& assignments,
arma::Col<size_t>& visited,
arma::Col<size_t>& distanceIteration,
arma::vec& hamerlyBounds,
const arma::mat& interclusterDistances,
MetricType& metric);
double BaseCase(const size_t queryIndex, const size_t referenceIndex);
double Score(const size_t queryIndex, TreeType& referenceNode);
double Score(TreeType& queryNode, TreeType& referenceNode);
double Rescore(const size_t queryIndex,
TreeType& referenceNode,
const double oldScore) const;
double Rescore(TreeType& queryNode,
TreeType& referenceNode,
const double oldScore) const;
size_t DistanceCalculations() const { return distanceCalculations; }
size_t& DistanceCalculations() { return distanceCalculations; }
typedef neighbor::NeighborSearchTraversalInfo<TreeType> TraversalInfoType;
const TraversalInfoType& TraversalInfo() const { return traversalInfo; }
TraversalInfoType& TraversalInfo() { return traversalInfo; }
private:
const typename TreeType::Mat& dataset;
const arma::mat& centroids;
arma::mat& newCentroids;
arma::Col<size_t>& counts;
const std::vector<size_t>& mappings;
const size_t iteration;
const arma::vec& clusterDistances;
arma::vec& distances;
arma::Col<size_t>& assignments;
arma::Col<size_t>& visited;
arma::Col<size_t>& distanceIteration;
arma::vec& hamerlyBounds;
const arma::mat& interclusterDistances;
MetricType& metric;
size_t distanceCalculations;
TraversalInfoType traversalInfo;
bool IsDescendantOf(const TreeType& potentialParent, const TreeType&
potentialChild) const;
};
} // namespace kmeans
} // namespace mlpack
#include "dual_tree_kmeans_rules_impl.hpp"
#endif
|
1b8921819d623f02b8569429e1ffe95dc983653b
|
31fa42056eca9be2e44adbebf50b46bb0962f03b
|
/src/OFTS/Frustum.h
|
302755bc83524c1285f4840c8bc2c9d8647fd5fd
|
[] |
no_license
|
dormon/Shadows
|
e571ffd900dfddcd5195154b2417d660d55e8ebb
|
e08473aca2ce8fd4cc7b4546839a6a8d7000ba5b
|
refs/heads/master
| 2022-11-24T13:39:32.890151
| 2022-11-10T14:10:17
| 2022-11-10T14:10:17
| 131,889,172
| 0
| 1
| null | 2021-09-21T06:15:21
| 2018-05-02T18:13:27
|
C++
|
UTF-8
|
C++
| false
| false
| 760
|
h
|
Frustum.h
|
#pragma once
#include "Plane.h"
#include <glm/glm.hpp>
class Frustum
{
public:
Frustum();
Frustum(float angle, float aspectRatio, float nearClipDist, float farClipDist, glm::vec3 const& pos, glm::vec3 const& focusPoint, glm::vec3 const& up);
virtual ~Frustum() {}
bool isFrustumIntersecting(Frustum const& frustum) const;
bool TestSphere(glm::vec4 const& sphere) const;
bool isLineIntersecting(glm::vec3 const& p0, glm::vec3 const& p1) const;
private:
enum PlanePos
{
TOP = 0,
BOTTOM = 1,
LEFT = 2,
RIGHT = 3,
NEARP = 4,
FARP = 5,
NOF_PLANES = 6
};
enum IntersectResult
{
OUTSIDE,
INTERSECT,
INSIDE
};
//Planes & points
oftsMath::Plane planes[NOF_PLANES];
glm::vec3 ntl, ntr, nbl, nbr, ftl, ftr, fbl, fbr;
};
|
2b760f1de527d7d0ac9664071408d7ba82ec11c8
|
975c95e22e1e0789adaa143978f1a28a4c78ebf5
|
/스컬/item.h
|
be898b802497e7d4d3b064be76882460b8f3ddeb
|
[] |
no_license
|
jeonchanhee/SKULL
|
e9a6889dd48eae04b5c335b490f8b35274fd3d1e
|
b4453a8915f186fadc664e119e25193adc744316
|
refs/heads/master
| 2022-09-25T18:40:51.431571
| 2020-06-01T02:43:10
| 2020-06-01T02:43:10
| 268,407,893
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 427
|
h
|
item.h
|
#pragma once
#include"gameNode.h"
class item : public gameNode
{
protected:
image* _img;
RECT* _imgRc;
int _x, _y;
int price;
bool _isCreate;
public:
item();
~item();
HRESULT init();
void release();
void update();
void render();
void render(int left, int top);
void setCreate(bool create) { _isCreate = create; }
void setXY(POINT XY)
{
_x = XY.x;
_y = XY.y;
}
RECT* getRc() { return _imgRc; }
};
|
579279712c7ea7d93c2b1ccd0ef55906ce3c262e
|
9b85f76be1070dcf983012524366cfeb517e6219
|
/Magic/Guildpact/CardGuildpact.cpp
|
edc05942773fd13f40b71204b4418184a460687f
|
[] |
no_license
|
Homebrew-Engine-Archive/botarena
|
691d35595a936c7adf5e0a495a5fbf35812244ef
|
044e2713315b165002f2e06911ce7455de2f773f
|
refs/heads/main
| 2023-05-10T15:58:08.520085
| 2021-03-17T13:11:56
| 2021-03-17T13:11:56
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 214,549
|
cpp
|
CardGuildpact.cpp
|
#include "stdafx.h"
#include "CardGuildpact.h"
#define new DEBUG_NEW
#define DEFINE_CARD(C) \
if (!_tcslen(strCardName)) \
{ cardClassNames.push_back(_T(#C)); } \
else \
if (!_tcsicmp(strCardName, _T(#C))) { cpCard = counted_ptr<CCard>(new C(pGame, uID)); break; }
//____________________________________________________________________________
//
counted_ptr<CCard> CreateCard(CGame* pGame, LPCTSTR strCardName, StringArray& cardClassNames, UINT uID)
{
counted_ptr<CCard> cpCard;
do
{
DEFINE_CARD(CAbsolverThrullCard);
DEFINE_CARD(CAbyssalNocturnusCard);
DEFINE_CARD(CAgentOfMasksCard);
DEFINE_CARD(CAngelOfDespairCard);
DEFINE_CARD(CBatteringWurmCard);
DEFINE_CARD(CBelfrySpiritCard);
DEFINE_CARD(CBenedictionOfMoonsCard);
DEFINE_CARD(CBioplasmCard);
DEFINE_CARD(CBlindHunterCard);
DEFINE_CARD(CBloodscaleProwlerCard);
DEFINE_CARD(CBorborygmosCard);
DEFINE_CARD(CCastigateCard);
DEFINE_CARD(CCausticRainCard);
DEFINE_CARD(CCerebralVortexCard);
DEFINE_CARD(CCrashLandingCard);
DEFINE_CARD(CCryptwailingCard);
DEFINE_CARD(CCrystalSeerCard);
DEFINE_CARD(CCryOfContritionCard);
DEFINE_CARD(CCullingSunCard);
DEFINE_CARD(CDaggerclawImpCard);
DEFINE_CARD(CDebtorsKnellCard);
DEFINE_CARD(CDrownedRusalkaCard);
DEFINE_CARD(CDryadSophisticateCard);
DEFINE_CARD(CDouseInGloomCard);
DEFINE_CARD(CDuneBroodNephilimCard);
DEFINE_CARD(CElectrolyzeCard);
DEFINE_CARD(CExhumerThrullCard);
DEFINE_CARD(CFeralAnimistCard);
DEFINE_CARD(CFrazzleCard);
DEFINE_CARD(CGathererOfGracesCard);
DEFINE_CARD(CGelectrodeCard);
DEFINE_CARD(CGhorClanBloodscaleCard);
DEFINE_CARD(CGhorClanSavageCard);
DEFINE_CARD(CGhostCouncilOfOrzhovaCard);
DEFINE_CARD(CGhostwayCard);
DEFINE_CARD(CGiantSolifugeCard);
DEFINE_CARD(CGlintEyeNephilimCard);
DEFINE_CARD(CGodlessShrineCard);
DEFINE_CARD(CGravenDominatorCard);
DEFINE_CARD(CGristlebackCard);
DEFINE_CARD(CGruulGuildmageCard);
DEFINE_CARD(CGruulNodorogCard);
DEFINE_CARD(CGruulScrapperCard);
DEFINE_CARD(CGruulSignetCard);
DEFINE_CARD(CGruulTurfCard);
DEFINE_CARD(CGruulWarPlowCard);
DEFINE_CARD(CHarrierGriffinCard);
DEFINE_CARD(CHatchingPlansCard);
DEFINE_CARD(CHissingMiasmaCard);
DEFINE_CARD(CHypervoltGraspCard);
DEFINE_CARD(CInvokeTheFiremindCard);
DEFINE_CARD(CIzzetBoilerworksCard);
DEFINE_CARD(CIzzetChronarchCard);
DEFINE_CARD(CIzzetGuildmageCard);
DEFINE_CARD(CIzzetSignetCard);
DEFINE_CARD(CKillerInstinctCard);
DEFINE_CARD(CLeylineOfLifeforceCard);
DEFINE_CARD(CLeylineOfLightningCard);
DEFINE_CARD(CLeylineOfSingularityCard);
DEFINE_CARD(CLeylineOfTheMeekCard);
DEFINE_CARD(CLionheartMaverickCard);
//DEFINE_CARD(CLivingInfernoCard);
DEFINE_CARD(CMartyredRusalkaCard);
DEFINE_CARD(CMoratoriumStoneCard);
DEFINE_CARD(CMortifyCard);
DEFINE_CARD(CMourningThrullCard);
DEFINE_CARD(CNivMizzettheFiremindCard);
DEFINE_CARD(COgreSavantCard);
DEFINE_CARD(COrderOfTheStarsCard);
DEFINE_CARD(COrzhovaTheChurchOfDealsCard);
DEFINE_CARD(COrzhovBasilicaCard);
DEFINE_CARD(COrzhovEuthanistCard);
DEFINE_CARD(COrzhovGuildmageCard);
DEFINE_CARD(COrzhovPontiffCard);
DEFINE_CARD(COrzhovSignetCard);
DEFINE_CARD(COstiaryThrullCard);
DEFINE_CARD(CParallectricFeedbackCard);
DEFINE_CARD(CPetrahydroxCard);
DEFINE_CARD(CPetrifiedWoodKinCard);
DEFINE_CARD(CPilloryOfTheSleeplessCard);
DEFINE_CARD(CPlaguedRusalkaCard);
DEFINE_CARD(CPoisonbellyOgreCard);
DEFINE_CARD(CPredatoryFocusCard);
DEFINE_CARD(CPrimevalLightCard);
DEFINE_CARD(CRepealCard);
DEFINE_CARD(CRestlessBonesCard);
DEFINE_CARD(CRevenantPatriarchCard);
DEFINE_CARD(CRumblingSlumCard);
DEFINE_CARD(CRuneboggleCard);
DEFINE_CARD(CSanguinePraetorCard);
DEFINE_CARD(CScabClanMaulerCard);
DEFINE_CARD(CSchismotivateCard);
DEFINE_CARD(CScorchedRusalkaCard);
DEFINE_CARD(CSeizeTheSoulCard);
DEFINE_CARD(CShadowLanceCard);
DEFINE_CARD(CShriekingGrotesqueCard);
DEFINE_CARD(CSilhanaLedgewalkerCard);
DEFINE_CARD(CSilhanaStarfletcherCard);
DEFINE_CARD(CSinstrikersWillCard);
DEFINE_CARD(CSkarrganFirebirdCard);
DEFINE_CARD(CSkarrganPitSkulkCard);
DEFINE_CARD(CSkarrganSkybreakerCard);
DEFINE_CARD(CSkarrgTheRagePitsCard);
DEFINE_CARD(CSkeletalVampireCard);
DEFINE_CARD(CSkyriderTraineeCard);
DEFINE_CARD(CSkySwallowerCard);
DEFINE_CARD(CSmogsteedRiderCard);
//DEFINE_CARD(CSoulsOfTheFaultlessCard);
DEFINE_CARD(CStarvedRusalkaCard);
DEFINE_CARD(CSteamcoreWeirdCard);
DEFINE_CARD(CSteamVentsCard);
DEFINE_CARD(CStitchInTimeCard);
DEFINE_CARD(CStompingGroundCard);
DEFINE_CARD(CStormHerdCard);
DEFINE_CARD(CStratozeppelidCard);
DEFINE_CARD(CStreetbreakerWurmCard);
DEFINE_CARD(CTeysaOrzhovScionCard);
DEFINE_CARD(CTiborAndLumiaCard);
DEFINE_CARD(CTinStreetHooliganCard);
DEFINE_CARD(CToArmsCard);
DEFINE_CARD(CTorchDrakeCard);
DEFINE_CARD(CUlashttheHateSeedCard);
DEFINE_CARD(CVedalkenPlotterCard);
DEFINE_CARD(CVertigoSpawnCard);
DEFINE_CARD(CWeeDragonautsCard);
DEFINE_CARD(CWildCantorCard);
DEFINE_CARD(CWildsizeCard);
DEFINE_CARD(CWitchMawNephilimCard);
DEFINE_CARD(CWithstandCard);
DEFINE_CARD(CWreakHavocCard);
DEFINE_CARD(CWurmweaverCoilCard);
DEFINE_CARD(CYoreTillerNephilimCard);
} while (false);
return cpCard;
}
//____________________________________________________________________________
//
CAbyssalNocturnusCard::CAbyssalNocturnusCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Abyssal Nocturnus"), CardType::Creature, CREATURE_TYPE(Horror), nID,
_T("1") BLACK_MANA_TEXT BLACK_MANA_TEXT, Power(2), Life(2))
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CWhenCardDiscarded > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetMonitorOpponentsOnly(TRUE);
cpAbility->GetLifeModifier().SetLifeDelta(Life(+2));
cpAbility->GetPowerModifier().SetPowerDelta(Power(+2));
cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter2);
cpAbility->GetCreatureKeywordMod().GetModifier().SetToAdd(CreatureKeyword::Fear);
cpAbility->GetCreatureKeywordMod().GetModifier().SetOneTurnOnly(TRUE);
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CAngelOfDespairCard::CAngelOfDespairCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Angel of Despair"), CardType::Creature, CREATURE_TYPE(Angel), nID,
_T("3") WHITE_MANA_TEXT WHITE_MANA_TEXT BLACK_MANA_TEXT BLACK_MANA_TEXT, Power(5), Life(5))
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new TrueCardComparer);
cpAbility->GetMoveCardModifier().SetMoveType(MoveType::Destroy);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Graveyard));
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CGruulTurfCard::CGruulTurfCard(CGame* pGame, UINT nID)
: CNonbasicLandCard(pGame, _T("Gruul Turf"), nID)
{
SetIntoPlayTapped();
counted_ptr<CManaProductionAbility> cpNonbasicLandManaAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, RED_MANA_TEXT GREEN_MANA_TEXT));
cpNonbasicLandManaAbility->AddTapCost();
AddAbility(cpNonbasicLandManaAbility.GetPointer());
{
typedef
TTriggeredSubjectAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetGatherer().SetIncludeControllerCardsOnly();
cpAbility->GetGatherer().SetSubjectZoneId(ZoneId::Battlefield);
cpAbility->GetGatherer().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::_Land, false));
cpAbility->GetGatherer().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Hand);
cpAbility->GetMoveCardModifier().SetToOwnersZone(TRUE);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Hand));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CIzzetBoilerworksCard::CIzzetBoilerworksCard(CGame* pGame, UINT nID)
: CNonbasicLandCard(pGame, _T("Izzet Boilerworks"), nID)
{
SetIntoPlayTapped();
counted_ptr<CManaProductionAbility> cpNonbasicLandManaAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, BLUE_MANA_TEXT RED_MANA_TEXT));
cpNonbasicLandManaAbility->AddTapCost();
AddAbility(cpNonbasicLandManaAbility.GetPointer());
{
typedef
TTriggeredSubjectAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetGatherer().SetIncludeControllerCardsOnly();
cpAbility->GetGatherer().SetSubjectZoneId(ZoneId::Battlefield);
cpAbility->GetGatherer().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::_Land, false));
cpAbility->GetGatherer().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Hand);
cpAbility->GetMoveCardModifier().SetToOwnersZone(TRUE);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Hand));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CNivMizzettheFiremindCard::CNivMizzettheFiremindCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Niv-Mizzet, the Firemind"), CardType::_LegendaryCreature, CREATURE_TYPE2(Dragon, Wizard), nID,
_T("2") BLUE_MANA_TEXT BLUE_MANA_TEXT RED_MANA_TEXT RED_MANA_TEXT, Power(4), Life(4))
{
{
typedef
TTriggeredTargetAbility< CTriggeredModifyLifeAbility, CWhenCardDrew > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->GetTargeting().SetIncludePlayers(TRUE);
cpAbility->GetLifeModifier().SetLifeDelta(Life(-1));
cpAbility->GetLifeModifier().SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
cpAbility->AddAbilityTag(AbilityTag::DamageSource);
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CDrawCardSpell>> cpAbility(
::CreateObject<CActivatedAbility<CDrawCardSpell>>(this,
_T(""), 1));
cpAbility->AddTapCost();
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
COrzhovBasilicaCard::COrzhovBasilicaCard(CGame* pGame, UINT nID)
: CNonbasicLandCard(pGame, _T("Orzhov Basilica"), nID)
{
SetIntoPlayTapped();
counted_ptr<CManaProductionAbility> cpNonbasicLandManaAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, WHITE_MANA_TEXT BLACK_MANA_TEXT));
cpNonbasicLandManaAbility->AddTapCost();
AddAbility(cpNonbasicLandManaAbility.GetPointer());
{
typedef
TTriggeredSubjectAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetGatherer().SetIncludeControllerCardsOnly();
cpAbility->GetGatherer().SetSubjectZoneId(ZoneId::Battlefield);
cpAbility->GetGatherer().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::_Land, false));
cpAbility->GetGatherer().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Hand);
cpAbility->GetMoveCardModifier().SetToOwnersZone(TRUE);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Hand));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CGodlessShrineCard::CGodlessShrineCard(CGame* pGame, UINT nID)
: CDualLandCard(pGame, _T("Godless Shrine"), nID,
CardType::Plains | CardType::Swamp | CardType::NonbasicLand,
WHITE_MANA_TEXT, BLACK_MANA_TEXT)
{
GetCardKeyword()->AddMovementReplacement(FALSE, ZoneId::_AllZones, ZoneId::Battlefield, MoveType::Others, 0, _T("pay 2 life"), NULL);
}
//____________________________________________________________________________
//
CSteamVentsCard::CSteamVentsCard(CGame* pGame, UINT nID)
: CDualLandCard(pGame, _T("Steam Vents"), nID,
CardType::Island | CardType::Mountain | CardType::NonbasicLand,
BLUE_MANA_TEXT, RED_MANA_TEXT)
{
GetCardKeyword()->AddMovementReplacement(FALSE, ZoneId::_AllZones, ZoneId::Battlefield, MoveType::Others, 0, _T("pay 2 life"), NULL);
}
//____________________________________________________________________________
//
CStompingGroundCard::CStompingGroundCard(CGame* pGame, UINT nID)
: CDualLandCard(pGame, _T("Stomping Ground"), nID,
CardType::Mountain | CardType::Forest | CardType::NonbasicLand,
RED_MANA_TEXT, GREEN_MANA_TEXT)
{
GetCardKeyword()->AddMovementReplacement(FALSE, ZoneId::_AllZones, ZoneId::Battlefield, MoveType::Others, 0, _T("pay 2 life"), NULL);
}
//____________________________________________________________________________
//
CDebtorsKnellCard::CDebtorsKnellCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Debtors' Knell"), CardType::GlobalEnchantment, nID,
_T("4") WHITE_MANA_TEXT WHITE_MANA_TEXT WHITE_MANA_TEXT, AbilityType::Enchantment)
{
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Enchantment,
_T("4") WHITE_MANA_TEXT WHITE_MANA_TEXT BLACK_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
cpSpell->SetAbilityText(_T("casts"));
AddSpell(cpSpell.GetPointer());
}
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Enchantment,
_T("4") WHITE_MANA_TEXT BLACK_MANA_TEXT BLACK_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
cpSpell->SetAbilityText(_T("casts"));
AddSpell(cpSpell.GetPointer());
}
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Enchantment,
_T("4") BLACK_MANA_TEXT BLACK_MANA_TEXT BLACK_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
cpSpell->SetAbilityText(_T("casts"));
AddSpell(cpSpell.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenNodeChanged > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, NodeId::UpkeepStep));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->GetTargeting().SetSubjectZoneId(ZoneId::Graveyard);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
CGainControlModifier* pModifier1 = new CGainControlModifier(GetGame(), (CCard*)this);
cpAbility->GetMoveCardModifier().LinkCardModifier(pModifier1);
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Graveyard);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToOwnersZone(FALSE);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Battlefield));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CSilhanaLedgewalkerCard::CSilhanaLedgewalkerCard(CGame* pGame, UINT nID)
: CFearCreatureCard(pGame, _T("Silhana Ledgewalker"), CardType::Creature, CREATURE_TYPE2(Elf, Rogue), nID,
_T("1") GREEN_MANA_TEXT, Power(1), Life(1),
CCardFilter::GetFilter(_T("flying creatures"))) //can't be blocked except by "this"
{
GetCardKeyword()->AddHexproof(FALSE);
}
//____________________________________________________________________________
//
CBorborygmosCard::CBorborygmosCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Borborygmos"), CardType::_LegendaryCreature, CREATURE_TYPE(Cyclops), nID,
_T("3") RED_MANA_TEXT RED_MANA_TEXT GREEN_MANA_TEXT GREEN_MANA_TEXT, Power(6), Life(7))
, m_cpEventListener(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CBorborygmosCard::OnResolutionCompleted))
{
GetCreatureKeyword()->AddTrample(FALSE);
{
typedef
TTriggeredAbility< CTriggeredModifyCardAbility, CWhenSelfDamageDealt,
CWhenSelfDamageDealt::PlayerEventCallback,
&CWhenSelfDamageDealt::SetPlayerEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetCombatDamageOnly();
cpAbility->SetModifyCardOption(TriggeredAbility::ModifyCardOption::ModifyTriggeredPlayersCards);
cpAbility->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener.GetPointer());
//cpAbility->GetCardModifiers().push_back(new CCardCounterModifier(_T("+1/+1"), +1, false)); // add one counter
/*cpAbility->GetLifeModifier().SetLifeDelta(Life(+1));
cpAbility->GetLifeModifier().SetToBase(TRUE);
cpAbility->GetLifeModifier().SetOneTurnOnly(FALSE);
cpAbility->GetPowerModifier().SetPowerDelta(Power(+1));
cpAbility->GetPowerModifier().SetToBase(TRUE);
cpAbility->GetPowerModifier().SetOneTurnOnly(FALSE);*/
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
}
void CBorborygmosCard::OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult)
{
CZone* pBattle = pAbilityAction->GetController()->GetZoneById(ZoneId::Battlefield);
CCardCounterModifier pModifier = CCardCounterModifier(_T("+1/+1"), +1);
for (int i = 0; i < pBattle->GetSize(); ++i)
{
CCard* pOppCard = pBattle->GetAt(i);
if (pOppCard->GetCardType().IsCreature())
pModifier.ApplyTo(pOppCard);
}
}
//____________________________________________________________________________
//
CCrystalSeerCard::CCrystalSeerCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Crystal Seer"), CardType::Creature, CREATURE_TYPE2(Vedalken, Wizard), nID,
_T("4") BLUE_MANA_TEXT, Power(2), Life(2))
{
{
typedef
TTriggeredAbility< CTriggeredRevealLibraryAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetRevealCount(4);
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CSelfMoveCardAbility> cpAbility(
::CreateObject<CSelfMoveCardAbility>(this,
_T("4") BLUE_MANA_TEXT,
ZoneId::Hand, TRUE, MoveType::Others));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CDaggerclawImpCard::CDaggerclawImpCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Daggerclaw Imp"), CardType::Creature, CREATURE_TYPE(Imp), nID,
_T("2") BLACK_MANA_TEXT, Power(3), Life(1))
{
GetCreatureKeyword()->AddCantBlock(FALSE);
}
//____________________________________________________________________________
//
CDrownedRusalkaCard::CDrownedRusalkaCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Drowned Rusalka"), CardType::Creature, CREATURE_TYPE(Spirit), nID,
BLUE_MANA_TEXT, Power(1), Life(1))
, m_cpEventListener(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CDrownedRusalkaCard::OnResolutionCompleted))
{
counted_ptr<CActivatedAbility<CDiscardCardSpell>> cpAbility(
::CreateObject<CActivatedAbility<CDiscardCardSpell>>(this,
BLUE_MANA_TEXT,
1, MoveType::Discard,
CCardFilter::GetFilter(_T("cards")),
ZoneId::Graveyard, TRUE)); //Discard a card.
cpAbility->GetCost().AddSacrificeCardCost(1, CCardFilter::GetFilter(_T("creatures")));
cpAbility->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener.GetPointer());
AddAbility(cpAbility.GetPointer());
}
void CDrownedRusalkaCard::OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult)
{
CPlayer* cont = GetController();
CDrawCardModifier pModifier = CDrawCardModifier(GetGame(), MinimumValue(1), MaximumValue(1));
pModifier.ApplyTo(cont);
}
//____________________________________________________________________________
//
CGelectrodeCard::CGelectrodeCard(CGame* pGame, UINT nID)
: CTargetChgLifeTCreatureCard(pGame, _T("Gelectrode"), CardType::Creature, CREATURE_TYPE(Weird), nID,
_T("1") BLUE_MANA_TEXT RED_MANA_TEXT, Power(0), Life(1),
_T(""),
new AnyCreatureComparer,
TRUE,
Life(-1), // life delta
PreventableType::Preventable)
{
typedef
TTriggeredAbility< CTriggeredTapCardAbility, CWhenSpellCast > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->GetTrigger().GetCardFilterHelper().SetPredefinedFilter(CCardFilter::GetFilter(_T("instant cards or sorcery cards")));
cpAbility->SetTapCardOption(CTriggeredTapCardAbility::TapCardOption::UntapSingleCard);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CGelectrodeCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag::OrientationChange);
AddAbility(cpAbility.GetPointer());
}
bool CGelectrodeCard::BeforeResolution(CAbilityAction* pAction) const
{
if (IsInplay() && GetOrientation()->IsTapped()) return true;
else return false;
}
//____________________________________________________________________________
//
CGhorClanBloodscaleCard::CGhorClanBloodscaleCard(CGame* pGame, UINT nID)
: CPumpCreatureCard(pGame, _T("Ghor-Clan Bloodscale"), CardType::Creature, CREATURE_TYPE2(Viashino, Warrior), nID,
_T("3") RED_MANA_TEXT, Power(2), Life(1),
_T("3") GREEN_MANA_TEXT, Power(+2), Life(+2))
{
m_pPumpAbility->SetMaxTurnUsageCount(1);
GetCreatureKeyword()->AddFirstStrike(FALSE);
}
//____________________________________________________________________________
//
CGiantSolifugeCard::CGiantSolifugeCard(CGame* pGame, UINT nID)
: CHasteCreatureCard(pGame, _T("Giant Solifuge"), CardType::Creature, CREATURE_TYPE(Insect), nID,
_T("2") RED_MANA_TEXT RED_MANA_TEXT, Power(4), Life(1))
{
GetCreatureKeyword()->AddTrample(FALSE);
GetCardKeyword()->AddShroud(FALSE);
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Creature,
_T("2") RED_MANA_TEXT GREEN_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
AddSpell(cpSpell.GetPointer());
}
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Creature,
_T("2") GREEN_MANA_TEXT GREEN_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
AddSpell(cpSpell.GetPointer());
}
}
//____________________________________________________________________________
//
CGruulGuildmageCard::CGruulGuildmageCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Gruul Guildmage"), CardType::Creature, CREATURE_TYPE2(Human, Shaman), nID,
RED_MANA_TEXT RED_MANA_TEXT, Power(2), Life(2))
{
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Creature,
RED_MANA_TEXT GREEN_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
AddSpell(cpSpell.GetPointer());
}
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Creature,
GREEN_MANA_TEXT GREEN_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
AddSpell(cpSpell.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTargetChgLifeSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgLifeSpell>>(this,
_T("3") RED_MANA_TEXT,
FALSE_CARD_COMPARER,
TRUE,
Life(-2), PreventableType::Preventable));
ATLASSERT(cpAbility);
cpAbility->GetCost().AddSacrificeCardCost(1, CCardFilter::GetFilter(_T("lands")));
cpAbility->SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTargetChgPwrTghAttrSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgPwrTghAttrSpell>>(this,
_T("3") GREEN_MANA_TEXT,
Power(+2), Life(+2),
CreatureKeyword::Null, CreatureKeyword::Null,
TRUE, PreventableType::NotPreventable));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CGruulNodorogCard::CGruulNodorogCard(CGame* pGame, UINT nID)
: CPumpCreatureCard(pGame, _T("Gruul Nodorog"), CardType::Creature, CREATURE_TYPE(Beast), nID,
_T("4") GREEN_MANA_TEXT GREEN_MANA_TEXT, Power(4), Life(4),
RED_MANA_TEXT, Power(+0), Life(+0), CreatureKeyword::CantBeBlockedBy1)
{
}
//____________________________________________________________________________
//
CHarrierGriffinCard::CHarrierGriffinCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Harrier Griffin"), CardType::Creature, CREATURE_TYPE(Griffin), nID,
_T("5") WHITE_MANA_TEXT, Power(3), Life(3))
{
typedef
TTriggeredTargetAbility< CTriggeredTapCardAbility, CWhenNodeChanged > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this,
NodeId::UpkeepStep));
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetTapCardOption(CTriggeredTapCardAbility::TapCardOption::TapSingleCard);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->AddAbilityTag(AbilityTag::OrientationChange);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CIzzetChronarchCard::CIzzetChronarchCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Izzet Chronarch"), CardType::Creature, CREATURE_TYPE2(Human, Wizard), nID,
_T("3") BLUE_MANA_TEXT RED_MANA_TEXT, Power(2), Life(2))
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().SetThisCardsControllerOnly(this);
cpAbility->GetTargeting().SetSubjectZoneId(ZoneId::Graveyard);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::Instant | CardType::Sorcery, false));
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Graveyard);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Hand);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Hand));
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CLionheartMaverickCard::CLionheartMaverickCard(CGame* pGame, UINT nID)
: CPumpCreatureCard(pGame, _T("Lionheart Maverick"), CardType::Creature, CREATURE_TYPE2(Human, Knight), nID,
WHITE_MANA_TEXT, Power(1), Life(1),
_T("4") WHITE_MANA_TEXT, Power(+1), Life(+2), CreatureKeyword::Null)
{
GetCreatureKeyword()->AddVigilance(FALSE);
}
//____________________________________________________________________________
//
//
//"Living Inferno\n{6RR}\nCreature - Elemental\nGPT,R\n{T}: Living Inferno deals damage equal to its power divided as you choose among any number of target creatures. Each of those creatures deals damage equal to its power to Living Inferno.\n8/5"
//
//CLivingInfernoCard::CLivingInfernoCard(CGame* pGame, UINT nID)
// : CCreatureCard(pGame, _T("Living Inferno"), CardType::Creature, CREATURE_TYPE(Elemental), nID,
// _T("6") RED_MANA_TEXT RED_MANA_TEXT, Power(8), Life(5))
//{
// counted_ptr<CActivatedAbility<CTargetChgLifeSpell3>> cpAbility(
// ::CreateObject<CActivatedAbility<CTargetChgLifeSpell3>>(this,
// _T(""),
// new AnyCreatureComparer, FALSE,
// PreventableType::Preventable));
// ATLASSERT(cpAbility);
//
// cpAbility->AddTapCost();
// cpAbility->SetReceiveDamageFromTargetedCreature();
//
// cpAbility->GetTargeting()->SetDistributeValues(); //With it the ability can't be used.
//
// AddAbility(cpAbility.GetPointer());
//}
//
////____________________________________________________________________________
////
CMartyredRusalkaCard::CMartyredRusalkaCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Martyred Rusalka"), CardType::Creature, CREATURE_TYPE(Spirit), nID,
WHITE_MANA_TEXT, Power(1), Life(1))
{
counted_ptr<CActivatedAbility<CTargetChgPwrTghAttrSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgPwrTghAttrSpell>>(this,
WHITE_MANA_TEXT,
Power(+0), Life(+0),
CreatureKeyword::CantAttack, CreatureKeyword::Null,
TRUE, PreventableType::NotPreventable));
cpAbility->GetCost().AddSacrificeCardCost(1, CCardFilter::GetFilter(_T("creatures")));
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CMourningThrullCard::CMourningThrullCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Mourning Thrull"), CardType::Creature, CREATURE_TYPE(Thrull), nID,
_T("1") WHITE_MANA_TEXT, Power(1), Life(1))
{
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Enchantment,
_T("1") BLACK_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
cpSpell->SetAbilityText(_T("casts"));
AddSpell(cpSpell.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredModifyLifeAbility, CWhenSelfDamageDealt,
CWhenSelfDamageDealt::DamageEventCallback,
&CWhenSelfDamageDealt::SetDamageEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CMourningThrullCard::SetTriggerContext));
cpAbility->AddAbilityTag(AbilityTag::LifeGain);
AddAbility(cpAbility.GetPointer());
}
}
bool CMourningThrullCard::SetTriggerContext(CTriggeredModifyLifeAbility::TriggerContextType& triggerContext, Damage damage) const
{
triggerContext.m_LifeModifier.SetLifeDelta(Life(-damage.m_nLifeDelta));
return true;
}
//____________________________________________________________________________
//
COrzhovGuildmageCard::COrzhovGuildmageCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Orzhov Guildmage"), CardType::Creature, CREATURE_TYPE2(Human, Wizard), nID,
WHITE_MANA_TEXT WHITE_MANA_TEXT, Power(2), Life(2))
{
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Creature,
WHITE_MANA_TEXT BLACK_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
AddSpell(cpSpell.GetPointer());
}
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Creature,
BLACK_MANA_TEXT BLACK_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
AddSpell(cpSpell.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTargetChgLifeSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgLifeSpell>>(this,
_T("2") WHITE_MANA_TEXT,
FALSE_CARD_COMPARER, TRUE,
Life(+1), PreventableType::NotPreventable));
cpAbility->SetDamageType(DamageType::NotDealingDamage);
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CGlobalChgLifeSpell>> cpAbility(
::CreateObject<CActivatedAbility<CGlobalChgLifeSpell>>(this,
_T("2") BLACK_MANA_TEXT,
Life(-1), // life delta
FALSE_CARD_COMPARER, TRUE, PreventableType::NotPreventable, DamageType::NotDealingDamage));
cpAbility->SetAbilityText(_T("Each player loses 1 life. Activates"));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
COstiaryThrullCard::COstiaryThrullCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Ostiary Thrull"), CardType::Creature, CREATURE_TYPE(Thrull), nID,
_T("3") BLACK_MANA_TEXT, Power(2), Life(2))
{
counted_ptr<CActivatedAbility<CTargetTapUntapCardSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetTapUntapCardSpell>>(this,
WHITE_MANA_TEXT,
TRUE, // tap
FALSE, // untap
new AnyCreatureComparer));
ATLASSERT(cpAbility);
cpAbility->AddTapCost();
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CPetrahydroxCard::CPetrahydroxCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Petrahydrox"), CardType::Creature, CREATURE_TYPE(Weird), nID,
_T("3") BLUE_MANA_TEXT, Power(3), Life(3))
{
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Enchantment,
_T("3") RED_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
cpSpell->SetAbilityText(_T("casts"));
AddSpell(cpSpell.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredMoveCardAbility, CWhenSubjectTargeted,
CWhenSubjectTargeted::CardEventCallback, &CWhenSubjectTargeted::SetCardEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this, TRUE, FALSE));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Hand);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Hand));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CPlaguedRusalkaCard::CPlaguedRusalkaCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Plagued Rusalka"), CardType::Creature, CREATURE_TYPE(Spirit), nID,
BLACK_MANA_TEXT, Power(1), Life(1))
{
counted_ptr<CActivatedAbility<CTargetChgPwrTghAttrSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgPwrTghAttrSpell>>(this,
BLACK_MANA_TEXT,
Power(-1), Life(-1),
CreatureKeyword::Null, CreatureKeyword::Null,
TRUE, PreventableType::NotPreventable));
cpAbility->GetCost().AddSacrificeCardCost(1, CCardFilter::GetFilter(_T("creatures")));
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CPoisonbellyOgreCard::CPoisonbellyOgreCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Poisonbelly Ogre"), CardType::Creature, CREATURE_TYPE2(Ogre, Warrior), nID,
_T("4") BLACK_MANA_TEXT, Power(3), Life(3))
{
typedef
TTriggeredAbility< CTriggeredModifyLifeAbility, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::_AllZones, ZoneId::Battlefield));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new AnyCreatureComparer);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new NegateCardComparer(new SpecificCardComparer(this)));
cpAbility->GetLifeModifier().SetLifeDelta(Life(-1));
cpAbility->GetLifeModifier().SetDamageType(DamageType::NotDealingDamage);
cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
cpAbility->AddAbilityTag(AbilityTag::LifeLost);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CRestlessBonesCard::CRestlessBonesCard(CGame* pGame, UINT nID)
: CRegenerationCreatureCard(pGame, _T("Restless Bones"), CardType::Creature, CREATURE_TYPE(Skeleton), nID,
_T("2") BLACK_MANA_TEXT, Power(1), Life(1),
_T("1") BLACK_MANA_TEXT)
{
counted_ptr<CActivatedAbility<CTargetChgPwrTghAttrSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgPwrTghAttrSpell>>(this,
_T("3") BLACK_MANA_TEXT,
Power(+0), Life(+0),
CreatureKeyword::Swampwalk, CreatureKeyword::Null,
TRUE, PreventableType::NotPreventable));
cpAbility->AddTapCost();
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CRumblingSlumCard::CRumblingSlumCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Rumbling Slum"), CardType::Creature, CREATURE_TYPE(Elemental), nID,
_T("1") RED_MANA_TEXT GREEN_MANA_TEXT GREEN_MANA_TEXT, Power(5), Life(5))
{
typedef
TTriggeredAbility< CTriggeredModifyLifeAbility, CWhenNodeChanged > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, NodeId::UpkeepStep));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToAllPlayers);
cpAbility->GetLifeModifier().SetLifeDelta(Life(-1));
cpAbility->GetLifeModifier().SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CScorchedRusalkaCard::CScorchedRusalkaCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Scorched Rusalka"), CardType::Creature, CREATURE_TYPE(Spirit), nID,
RED_MANA_TEXT, Power(1), Life(1))
{
counted_ptr<CActivatedAbility<CTargetChgLifeSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgLifeSpell>>(this,
RED_MANA_TEXT,
FALSE_CARD_COMPARER, TRUE,
Life(-1), PreventableType::Preventable));
ATLASSERT(cpAbility);
cpAbility->GetCost().AddSacrificeCardCost(1, CCardFilter::GetFilter(_T("creatures")));
cpAbility->SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CSkeletalVampireCard::CSkeletalVampireCard(CGame* pGame, UINT nID)
: CRegenerationCreatureCard(pGame, _T("Skeletal Vampire"), CardType::Creature, CREATURE_TYPE2(Vampire, Skeleton), nID,
_T("4") BLACK_MANA_TEXT BLACK_MANA_TEXT, Power(3), Life(3),
_T(""))
, m_CardFilter(_T("a Bat"), _T("Bats"), new CreatureTypeComparer(CREATURE_TYPE(Bat), false))
{
m_pRegenerationAbility->GetCost().AddSacrificeCardCost(1, &m_CardFilter);
GetCreatureKeyword()->AddFlying(FALSE);
{
typedef
TTriggeredAbility< CTriggeredCreateTokenAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetCreateTokenOption(TRUE, _T("Bat A"), 2803, 2);
cpAbility->AddAbilityTag(AbilityTag::TokenCreation);
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTokenProductionSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTokenProductionSpell>>(this,
_T("3") BLACK_MANA_TEXT BLACK_MANA_TEXT,
_T("Bat A"), 2803,
2));
cpAbility->GetCost().AddSacrificeCardCost(1, &m_CardFilter);
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CSkyriderTraineeCard::CSkyriderTraineeCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Skyrider Trainee"), CardType::Creature, CREATURE_TYPE2(Human, Soldier), nID,
_T("4") WHITE_MANA_TEXT, Power(3), Life(3))
{
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CWhenSelfEnchantCountChanged,
CWhenSelfEnchantCountChanged::EventCallback,
&CWhenSelfEnchantCountChanged::SetEnchantEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetCreatureKeywordMod().GetModifier().SetToAdd(CreatureKeyword::Flying);
cpAbility->GetCreatureKeywordMod().GetModifier().SetOneTurnOnly(FALSE);
cpAbility->SetSkipStack(TRUE);
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CWhenSelfEnchantCountChanged,
CWhenSelfEnchantCountChanged::EventCallback,
&CWhenSelfEnchantCountChanged::SetDisenchantEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetCreatureKeywordMod().GetModifier().SetToRemove(CreatureKeyword::Flying);
cpAbility->GetCreatureKeywordMod().GetModifier().SetOneTurnOnly(FALSE);
cpAbility->SetSkipStack(TRUE);
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CSmogsteedRiderCard::CSmogsteedRiderCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Smogsteed Rider"), CardType::Creature, CREATURE_TYPE2(Human, Wizard), nID,
_T("2") BLACK_MANA_TEXT BLACK_MANA_TEXT, Power(2), Life(2))
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CWhenSelfAttackedBlocked,
CWhenSelfAttackedBlocked::AttackEventCallback,
&CWhenSelfAttackedBlocked::SetAttackingEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetModifyCreatureOption(TriggeredAbility::ModifyCreatureOption::ModifyTriggeredPlayersCreatures);
cpAbility->GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetCardFilterHelper().GetCustomFilter().AddComparer(new AttackingCreatureComparer);
cpAbility->GetCardFilterHelper().GetCustomFilter().AddNegateComparer(new SpecificCardComparer(this));
cpAbility->GetCreatureKeywordMod().GetModifier().SetToAdd(CreatureKeyword::Fear);
cpAbility->GetCreatureKeywordMod().GetModifier().SetOneTurnOnly(TRUE);
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CStarvedRusalkaCard::CStarvedRusalkaCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Starved Rusalka"), CardType::Creature, CREATURE_TYPE(Spirit), nID,
GREEN_MANA_TEXT, Power(1), Life(1))
{
counted_ptr<CActivatedAbility<CChgLifeSpell>> cpAbility(
::CreateObject<CActivatedAbility<CChgLifeSpell>>(this,
GREEN_MANA_TEXT,
Life(+1), PreventableType::NotPreventable));
cpAbility->GetCost().AddSacrificeCardCost(1, CCardFilter::GetFilter(_T("creatures")));
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CStratozeppelidCard::CStratozeppelidCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Stratozeppelid"), CardType::Creature, CREATURE_TYPE(Beast), nID,
_T("4") BLUE_MANA_TEXT, Power(4), Life(4))
{
GetCreatureKeyword()->AddCanOnlyBlockFlying(FALSE);
}
//____________________________________________________________________________
//
CStreetbreakerWurmCard::CStreetbreakerWurmCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Streetbreaker Wurm"), CardType::Creature, CREATURE_TYPE(Wurm), nID,
_T("3") RED_MANA_TEXT GREEN_MANA_TEXT, Power(6), Life(4))
{
}
//____________________________________________________________________________
//
CTeysaOrzhovScionCard::CTeysaOrzhovScionCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Teysa, Orzhov Scion"), CardType::_LegendaryCreature, CREATURE_TYPE2(Human, Advisor), nID,
_T("1") WHITE_MANA_TEXT BLACK_MANA_TEXT, Power(2), Life(3))
{
{
counted_ptr<CActivatedAbility<CTargetMoveCardSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetMoveCardSpell>>(this,
_T(""),
new AnyCreatureComparer,
ZoneId::Battlefield, ZoneId::Exile, TRUE, MoveType::Others));
cpAbility->GetTargeting()->SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetCost().AddSacrificeCardCost(3, CCardFilter::GetFilter(_T("white creatures")));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredCreateTokenAbility, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this,
ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new CardTypeComparer(CardType::Black | CardType::Creature, true));
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new NegateCardComparer(new SpecificCardComparer(this)));
cpAbility->GetTrigger().SetFromControllerOnly(TRUE);
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetCreateTokenOption(TRUE, _T("Spirit J"), 2944, 1);
cpAbility->AddAbilityTag(AbilityTag::TokenCreation);
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CTiborAndLumiaCard::CTiborAndLumiaCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Tibor and Lumia"), CardType::_LegendaryCreature, CREATURE_TYPE2(Human, Wizard), nID,
_T("2") BLUE_MANA_TEXT RED_MANA_TEXT, Power(3), Life(3))
{
{
typedef
TTriggeredTargetAbility< CTriggeredModifyCreatureAbility, CWhenSpellCast > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->GetTrigger().GetCardFilterHelper().SetPredefinedFilter(CCardFilter::GetFilter(_T("blue cards")));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetCreatureKeywordMod().GetModifier().SetToAdd(CreatureKeyword::Flying);
cpAbility->GetCreatureKeywordMod().GetModifier().SetOneTurnOnly(TRUE);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Positive);
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CWhenSpellCast > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->GetTrigger().GetCardFilterHelper().SetPredefinedFilter(CCardFilter::GetFilter(_T("red cards")));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetModifyCreatureOption(TriggeredAbility::ModifyCreatureOption::ModifyAllPlayersCreatures);
cpAbility->GetLifeModifier().SetLifeDelta(Life(-1));
cpAbility->GetLifeModifier().SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
cpAbility->GetCardFilterHelper().SetPredefinedFilter(CCardFilter::GetFilter(_T("non-flying creatures")));
cpAbility->AddAbilityTag(AbilityTag::DamageSource);
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CTorchDrakeCard::CTorchDrakeCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Torch Drake"), CardType::Creature, CREATURE_TYPE(Drake), nID,
_T("3") BLUE_MANA_TEXT, Power(2), Life(2))
{
counted_ptr<CPumpAbility> cpAbility(
::CreateObject<CPumpAbility>(this,
_T("1") RED_MANA_TEXT,
Power(+1), Life(+0)));
ATLASSERT(cpAbility);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CWeeDragonautsCard::CWeeDragonautsCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Wee Dragonauts"), CardType::Creature, CREATURE_TYPE2(Faerie, Wizard), nID,
_T("1") BLUE_MANA_TEXT RED_MANA_TEXT, Power(1), Life(3))
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CWhenSpellCast > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->GetTrigger().GetCardFilterHelper().SetPredefinedFilter(CCardFilter::GetFilter(_T("instant cards or sorcery cards")));
cpAbility->GetPowerModifier().SetPowerDelta(Power(+2));
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CWildCantorCard::CWildCantorCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Wild Cantor"), CardType::Creature, CREATURE_TYPE2(Human, Druid), nID,
RED_MANA_TEXT, Power(1), Life(1))
{
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Creature,
GREEN_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
AddSpell(cpSpell.GetPointer());
}
{
counted_ptr<CManaProductionBySacificeAbility> cpAbility(
::CreateObject<CManaProductionBySacificeAbility>(this,
WHITE_MANA_TEXT));
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CManaProductionBySacificeAbility> cpAbility(
::CreateObject<CManaProductionBySacificeAbility>(this,
BLUE_MANA_TEXT));
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CManaProductionBySacificeAbility> cpAbility(
::CreateObject<CManaProductionBySacificeAbility>(this,
BLACK_MANA_TEXT));
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CManaProductionBySacificeAbility> cpAbility(
::CreateObject<CManaProductionBySacificeAbility>(this,
RED_MANA_TEXT));
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CManaProductionBySacificeAbility> cpAbility(
::CreateObject<CManaProductionBySacificeAbility>(this,
GREEN_MANA_TEXT));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
COrzhovaTheChurchOfDealsCard::COrzhovaTheChurchOfDealsCard(CGame* pGame, UINT nID)
: CNonbasicLandCard(pGame, _T("Orzhova, the Church of Deals"), nID)
{
{
counted_ptr<CManaProductionAbility> cpNonbasicLandManaAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, _T("1")));
cpNonbasicLandManaAbility->AddTapCost();
AddAbility(cpNonbasicLandManaAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTargetChgLifeSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgLifeSpell>>(this,
_T("3") WHITE_MANA_TEXT BLACK_MANA_TEXT,
FALSE_CARD_COMPARER, TRUE,
Life(-1), PreventableType::NotPreventable));
cpAbility->AddTapCost();
cpAbility->SetReverseLifeDeltaToController();
cpAbility->SetDamageType(DamageType::NotDealingDamage);
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CSkarrgTheRagePitsCard::CSkarrgTheRagePitsCard(CGame* pGame, UINT nID)
: CNonbasicLandCard(pGame, _T("Skarrg, the Rage Pits"), nID)
{
{
counted_ptr<CManaProductionAbility> cpNonbasicLandManaAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, _T("1")));
cpNonbasicLandManaAbility->AddTapCost();
AddAbility(cpNonbasicLandManaAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTargetChgPwrTghAttrSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgPwrTghAttrSpell>>(this,
RED_MANA_TEXT GREEN_MANA_TEXT,
Power(+1), Life(+1),
CreatureKeyword::Trample, CreatureKeyword::Null,
TRUE, PreventableType::NotPreventable));
cpAbility->AddTapCost();
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CGruulSignetCard::CGruulSignetCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Gruul Signet"), CardType::Artifact, nID,
_T("2"), AbilityType::Artifact)
{
counted_ptr<CManaProductionAbility> cpAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, RED_MANA_TEXT GREEN_MANA_TEXT));
ATLASSERT(cpAbility);
cpAbility->AddTapCost();
cpAbility->GetCost().AddManaCost(_T("1"));
AddAbility(cpAbility.GetPointer());
}
//{
// counted_ptr<CManaFilterAbility> cpAbility(
// ::CreateObject<CManaFilterAbility>(this, _T(""), AbilityType::Activated, RED_MANA_TEXT GREEN_MANA_TEXT, _T("1")));
// ATLASSERT(cpAbility);
//
// cpAbility->AddTapCost();
//
// AddAbility(cpAbility.GetPointer());
//}
//____________________________________________________________________________
//
CGruulWarPlowCard::CGruulWarPlowCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Gruul War Plow"), CardType::Artifact, nID,
_T("4"), AbilityType::Artifact)
{
{
counted_ptr<CPwrTghAttrEnchantment> cpAbility(
::CreateObject<CPwrTghAttrEnchantment>(this,
new AnyCreatureComparer,
Power(+0), Life(+0), CreatureKeyword::Trample));
cpAbility->SetAffectControllerCardsOnly();
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CIsAlsoAAbility> cpAbility(
::CreateObject<CIsAlsoAAbility>(this,
_T("1") RED_MANA_TEXT GREEN_MANA_TEXT,
_T("Juggernaut AA"), 64062));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CIzzetSignetCard::CIzzetSignetCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Izzet Signet"), CardType::Artifact, nID,
_T("2"), AbilityType::Artifact)
{
counted_ptr<CManaProductionAbility> cpAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, BLUE_MANA_TEXT RED_MANA_TEXT));
ATLASSERT(cpAbility);
cpAbility->AddTapCost();
cpAbility->GetCost().AddManaCost(_T("1"));
AddAbility(cpAbility.GetPointer());
}
//{
// counted_ptr<CManaFilterAbility> cpAbility(
// ::CreateObject<CManaFilterAbility>(this, _T(""), AbilityType::Activated, BLUE_MANA_TEXT RED_MANA_TEXT, _T("1")));
// ATLASSERT(cpAbility);
//
// cpAbility->AddTapCost();
//
// AddAbility(cpAbility.GetPointer());
//}
//____________________________________________________________________________
//
COrzhovSignetCard::COrzhovSignetCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Orzhov Signet"), CardType::Artifact, nID,
_T("2"), AbilityType::Artifact)
{
counted_ptr<CManaProductionAbility> cpAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, WHITE_MANA_TEXT BLACK_MANA_TEXT));
ATLASSERT(cpAbility);
cpAbility->AddTapCost();
cpAbility->GetCost().AddManaCost(_T("1"));
AddAbility(cpAbility.GetPointer());
}
//{
// counted_ptr<CManaFilterAbility> cpAbility(
// ::CreateObject<CManaFilterAbility>(this, _T(""), AbilityType::Activated, WHITE_MANA_TEXT BLACK_MANA_TEXT, _T("1")));
// ATLASSERT(cpAbility);
//
// cpAbility->AddTapCost();
//
// AddAbility(cpAbility.GetPointer());
//}
//____________________________________________________________________________
//
CHatchingPlansCard::CHatchingPlansCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Hatching Plans"), CardType::GlobalEnchantment, nID,
_T("1") BLUE_MANA_TEXT, AbilityType::Enchantment)
{
typedef
TTriggeredAbility< CTriggeredDrawCardAbility, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this,
ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetDrawCount(3);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CHissingMiasmaCard::CHissingMiasmaCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Hissing Miasma"), CardType::GlobalEnchantment, nID,
_T("1") BLACK_MANA_TEXT BLACK_MANA_TEXT, AbilityType::Enchantment)
{
typedef
TTriggeredAbility< CTriggeredModifyLifeAbility, CWhenAttackedBlocked,
CWhenAttackedBlocked::PlayerEventCallback, &CWhenAttackedBlocked::SetAttackingEventCallback> TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->GetTrigger().SetMonitorOpponentsOnly(TRUE);
cpAbility->GetLifeModifier().SetLifeDelta(Life(-1));
cpAbility->GetLifeModifier().SetDamageType(DamageType::NotDealingDamage);
cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CHissingMiasmaCard::SetTriggerContext));
cpAbility->AddAbilityTag(AbilityTag::LifeLost);
AddAbility(cpAbility.GetPointer());
}
bool CHissingMiasmaCard::SetTriggerContext(CTriggeredModifyLifeAbility::TriggerContextType& triggerContext,
CCreatureCard* pCreature,
AttackSubject attacked) const
{
return (pCreature->GetAttackedPlayer() == GetController()); //Does the creature attack defending player (and not a planeswalker)?
}
//____________________________________________________________________________
//
CHypervoltGraspCard::CHypervoltGraspCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Hypervolt Grasp"), CardType::EnchantCreature, nID)
{
{
counted_ptr<CCreatureAbilityEnchant> cpSpell(
::CreateObject<CCreatureAbilityEnchant>(this,
_T("2") RED_MANA_TEXT,
CAbilityEnchant::CreateAbilityCallback(this,
&CHypervoltGraspCard::CreateEnchantAbility),
CAbilityEnchant::AdditionType::ToEnchantedCard));
cpSpell->GetTargeting()->SetDefaultCharacteristic(Characteristic::Positive);
AddSpell(cpSpell.GetPointer());
}
{
counted_ptr<CSelfMoveCardAbility> cpAbility(
::CreateObject<CSelfMoveCardAbility>(this,
_T("1") BLUE_MANA_TEXT,
ZoneId::Hand, TRUE, MoveType::Others));
AddAbility(cpAbility.GetPointer());
}
}
counted_ptr<CAbility> CHypervoltGraspCard::CreateEnchantAbility(CCard* pEnchantedCard, CCard* pEnchantCard, ContextValue_& contextValue)
{
counted_ptr<CActivatedAbility<CTargetChgLifeSpell>> cpEnchantAbility(
::CreateObject<CActivatedAbility<CTargetChgLifeSpell>>(pEnchantedCard,
_T(""),
new AnyCreatureComparer, TRUE,
Life(-1), PreventableType::Preventable));
ATLASSERT(cpEnchantAbility);
cpEnchantAbility->AddTapCost();
cpEnchantAbility->SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
return counted_ptr<CAbility>(cpEnchantAbility.GetPointer());
}
//____________________________________________________________________________
//
CSinstrikersWillCard::CSinstrikersWillCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Sinstriker's Will"), CardType::EnchantCreature, nID)
{
counted_ptr<CCreatureAbilityEnchant> cpSpell(
::CreateObject<CCreatureAbilityEnchant>(this,
_T("3") WHITE_MANA_TEXT,
CAbilityEnchant::CreateAbilityCallback(this,
&CSinstrikersWillCard::CreateEnchantAbility),
CAbilityEnchant::AdditionType::ToEnchantedCard));
cpSpell->GetTargeting()->SetDefaultCharacteristic(Characteristic::Positive);
AddSpell(cpSpell.GetPointer());
}
counted_ptr<CAbility> CSinstrikersWillCard::CreateEnchantAbility(CCard* pEnchantedCard, CCard* pEnchantCard, ContextValue_& contextValue)
{
counted_ptr<CActivatedAbility<CTargetChgLifeSpell3>> cpEnchantAbility(
::CreateObject<CActivatedAbility<CTargetChgLifeSpell3>>(pEnchantedCard,
_T(""),
new AttackingBlockingCreatureComparer, FALSE,
PreventableType::Preventable, DamageType::AbilityDamage | DamageType::NonCombatDamage));
ATLASSERT(cpEnchantAbility);
cpEnchantAbility->AddTapCost();
//cpEnchantAbility->SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
return counted_ptr<CAbility>(cpEnchantAbility.GetPointer());
}
//____________________________________________________________________________
//
CDouseInGloomCard::CDouseInGloomCard(CGame* pGame, UINT nID)
: CTargetChgLifeSpellCard(pGame, _T("Douse in Gloom"), CardType::Instant, nID, AbilityType::Instant,
_T("2") BLACK_MANA_TEXT,
new AnyCreatureComparer,
FALSE, // Target player?
Life(-2), // Life delta
PreventableType::Preventable) // Preventable?
{
m_pTargetChgLifeSpell->SetDamageType(DamageType::SpellDamage | DamageType::NonCombatDamage);
m_pTargetChgLifeSpell->GetResolutionModifier().CPlayerModifiers::push_back(new CLifeModifier(Life(+2), this, PreventableType::NotPreventable));
}
//____________________________________________________________________________
//
CElectrolyzeCard::CElectrolyzeCard(CGame* pGame, UINT nID)
: CTargetChgLifeSpellCard(pGame, _T("Electrolyze"), CardType::Instant, nID, AbilityType::Instant,
_T("1") BLUE_MANA_TEXT RED_MANA_TEXT,
new AnyCreatureComparer,
TRUE,
Life(-2),
PreventableType::Preventable)
{
m_pTargetChgLifeSpell->SetDamageType(DamageType::SpellDamage | DamageType::NonCombatDamage);
m_pTargetChgLifeSpell->GetTargeting()->SetDistributeValues();
m_pTargetChgLifeSpell->GetResolutionModifier().CPlayerModifiers::push_back(new CDrawCardModifier(GetGame(), MinimumValue(1), MaximumValue(1)));
}
//____________________________________________________________________________
//
CFrazzleCard::CFrazzleCard(CGame* pGame, UINT nID)
: CCounterSpellCard(pGame, _T("Frazzle"), CardType::Instant, nID,
_T("3") BLUE_MANA_TEXT, AbilityType::Instant,
new NegateCardComparer(new CardTypeComparer(CardType::Blue, false)))
{
}
//____________________________________________________________________________
//
CMortifyCard::CMortifyCard(CGame* pGame, UINT nID)
: CTargetMoveCardSpellCard(pGame, _T("Mortify"), CardType::Instant, nID,
_T("1") WHITE_MANA_TEXT BLACK_MANA_TEXT, AbilityType::Instant,
new CardTypeComparer(CardType::Creature | CardType::_Enchantment, false),
ZoneId::Battlefield, ZoneId::Graveyard, TRUE, MoveType::Destroy)
{
}
//____________________________________________________________________________
//
CRuneboggleCard::CRuneboggleCard(CGame* pGame, UINT nID)
: CCounterSpellCard(pGame, _T("Runeboggle"), CardType::Instant, nID,
_T("2") BLUE_MANA_TEXT, AbilityType::Instant,
new TrueCardComparer)
{
m_pCounterSpell->SetCanBeDenied();
m_pCounterSpell->GetDenialCost().SetManaCost(_T("1"));
m_pCounterSpell->GetResolutionModifier().CPlayerModifiers::push_back(new CDrawCardModifier(GetGame(), MinimumValue(1), MaximumValue(1)));
}
//____________________________________________________________________________
//
CToArmsCard::CToArmsCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("To Arms!"), CardType::Instant, nID)
{
counted_ptr<CGlobalUntapSpell> cpSpell(
::CreateObject<CGlobalUntapSpell>(this, AbilityType::Instant,
_T("1") WHITE_MANA_TEXT,
new AnyCreatureComparer));
cpSpell->SetAffectControllerCardsOnly();
cpSpell->GetResolutionModifier().CPlayerModifiers::push_back(new CDrawCardModifier(GetGame(), MinimumValue(1), MaximumValue(1)));
AddSpell(cpSpell.GetPointer());
}
//____________________________________________________________________________
//
CWildsizeCard::CWildsizeCard(CGame* pGame, UINT nID)
: CChgPwrTghAttrSpellCard(pGame, _T("Wildsize"), CardType::Instant, nID, AbilityType::Instant,
_T("2") GREEN_MANA_TEXT,
Power(+2), Life(+2),
CreatureKeyword::Trample, CreatureKeyword::Null,
TRUE, PreventableType::NotPreventable)
{
m_pTargetChgPwrTghAttrSpell->GetResolutionModifier().CPlayerModifiers::push_back(new CDrawCardModifier(GetGame(), MinimumValue(1), MaximumValue(1)));
}
//____________________________________________________________________________
//
CWithstandCard::CWithstandCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Withstand"), CardType::Instant, nID)
{
counted_ptr<CTargetDamagePreventionSpell> cpSpell(
::CreateObject<CTargetDamagePreventionSpell>(this, AbilityType::Instant,
_T("2") WHITE_MANA_TEXT,
new AnyCreatureComparer, TRUE,
Life(3), SourceColor::Null));
cpSpell->GetResolutionModifier().CPlayerModifiers::push_back(new CDrawCardModifier(GetGame(), MinimumValue(1), MaximumValue(1)));
AddSpell(cpSpell.GetPointer());
}
//____________________________________________________________________________
//
CCastigateCard::CCastigateCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Castigate"), CardType::Sorcery, nID)
{
counted_ptr<CTargetPlayerDiscardCardSpell> cpSpell(
::CreateObject<CTargetPlayerDiscardCardSpell>(this, AbilityType::Sorcery,
WHITE_MANA_TEXT BLACK_MANA_TEXT,
1, MoveType::Others, ZoneId::Exile, TRUE,
FALSE, // TRUE -> Targeted player chooses, FALSE -> Caster chooses
CCardFilter::GetFilter(_T("non-lands")))); // Exclude land cards
cpSpell->GetTargeting()->SetIncludeOpponentPlayersOnly();
AddSpell(cpSpell.GetPointer());
}
//____________________________________________________________________________
//
CCausticRainCard::CCausticRainCard(CGame* pGame, UINT nID)
: CTargetMoveCardSpellCard(pGame, _T("Caustic Rain"), CardType::Sorcery, nID,
_T("2") BLACK_MANA_TEXT BLACK_MANA_TEXT, AbilityType::Sorcery,
new CardTypeComparer(CardType::_Land, false),
ZoneId::Battlefield, ZoneId::Exile, TRUE, MoveType::Others)
{
m_pTargetMoveCardSpell->GetTargeting()->SetDefaultCharacteristic(Characteristic::Negative);
}
//____________________________________________________________________________
//
CCullingSunCard::CCullingSunCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Culling Sun"), CardType::Sorcery, nID)
{
counted_ptr<CGlobalMoveCardSpell> cpSpell(
::CreateObject<CGlobalMoveCardSpell>(this, AbilityType::Sorcery,
_T("2") WHITE_MANA_TEXT WHITE_MANA_TEXT BLACK_MANA_TEXT,
new AnyCreatureComparer,
ZoneId::Graveyard, TRUE, MoveType::Destroy));
cpSpell->GetGlobalCardFilter().AddComparer(new ConvertedManaCostComparer<std::less<int>>(4));
AddSpell(cpSpell.GetPointer());
}
//____________________________________________________________________________
//
CInvokeTheFiremindCard::CInvokeTheFiremindCard(CGame* pGame, UINT nID)
: CTargetChgLifeSpellCard(pGame, _T("Invoke the Firemind"), CardType::Sorcery, nID, AbilityType::Sorcery,
BLUE_MANA_TEXT BLUE_MANA_TEXT RED_MANA_TEXT,
new AnyCreatureComparer,
TRUE,
Life(0),
PreventableType::Preventable)
{
m_pTargetChgLifeSpell->SetDamageType(DamageType::SpellDamage | DamageType::NonCombatDamage);
m_pTargetChgLifeSpell->GetCost().SetExtraManaCost(SpecialNumber::Any, TRUE, CManaCost::AllCostColors);
m_pTargetChgLifeSpell->SetExtraActionValueVector(ContextValue(-1));
m_pTargetChgLifeSpell->AddAbilityTag(AbilityTag::DamageSource);
{
counted_ptr<CTargetDrawCardSpell> cpSpell(
::CreateObject<CTargetDrawCardSpell>(this, AbilityType::Sorcery,
BLUE_MANA_TEXT BLUE_MANA_TEXT RED_MANA_TEXT, 0));
cpSpell->GetCost().SetExtraManaCost();
cpSpell->SetExtraActionValueVector();
AddSpell(cpSpell.GetPointer());
}
}
//____________________________________________________________________________
//
CPredatoryFocusCard::CPredatoryFocusCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Predatory Focus"), CardType::Sorcery, nID)
{
counted_ptr<CPwrTghAttrEnchantment> cpSpell(
::CreateObject<CPwrTghAttrEnchantment>(this, AbilityType::Sorcery,
_T("3") GREEN_MANA_TEXT GREEN_MANA_TEXT,
new AnyCreatureComparer,
Power(+0), Life(+0), CreatureKeyword::CanAssignCombatDamageToDefPlayer));
cpSpell->SetAffectControllerCardsOnly();
AddSpell(cpSpell.GetPointer());
}
//____________________________________________________________________________
//
CPrimevalLightCard::CPrimevalLightCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Primeval Light"), CardType::Sorcery, nID)
{
{
//Opponent
counted_ptr<CGlobalMoveCardSpell> cpSpell(
::CreateObject<CGlobalMoveCardSpell>(this, AbilityType::Sorcery,
_T("3") GREEN_MANA_TEXT,
new CardTypeComparer(CardType::_Enchantment, false),
ZoneId::Graveyard, TRUE, MoveType::Destroy));
cpSpell->SetAffectOpponentCardsOnly();
cpSpell->SetAbilityText(_T("Destroy all enchantments your opponent controls with"));
AddSpell(cpSpell.GetPointer());
}
{
//Controller
counted_ptr<CGlobalMoveCardSpell> cpSpell(
::CreateObject<CGlobalMoveCardSpell>(this, AbilityType::Sorcery,
_T("3") GREEN_MANA_TEXT,
new CardTypeComparer(CardType::_Enchantment, false),
ZoneId::Graveyard, TRUE, MoveType::Destroy));
cpSpell->SetAffectControllerCardsOnly();
cpSpell->SetAbilityText(_T("Destroy all enchantments you control with"));
AddSpell(cpSpell.GetPointer());
}
}
//____________________________________________________________________________
//
CWreakHavocCard::CWreakHavocCard(CGame* pGame, UINT nID)
: CTargetMoveCardSpellCard(pGame, _T("Wreak Havoc"), CardType::Sorcery, nID,
_T("2") RED_MANA_TEXT GREEN_MANA_TEXT, AbilityType::Sorcery,
new CardTypeComparer(CardType::Artifact | CardType::_Land, false),
ZoneId::Battlefield, ZoneId::Graveyard, TRUE, MoveType::Destroy)
{
GetCardKeyword()->AddCantBeCountered(FALSE);
}
//____________________________________________________________________________
//
CAgentOfMasksCard::CAgentOfMasksCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Agent of Masks"), CardType::Creature, CREATURE_TYPE2(Human, Advisor), nID,
_T("3") WHITE_MANA_TEXT BLACK_MANA_TEXT, Power(2), Life(3))
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenNodeChanged > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, NodeId::UpkeepStep));
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CAgentOfMasksCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag::LifeLost);
cpAbility->AddAbilityTag(AbilityTag::LifeGain);
AddAbility(cpAbility.GetPointer());
}
bool CAgentOfMasksCard::BeforeResolution(CAbilityAction* pAction) const
{
int LifeGain = 0;
int PrevLife = 0;
int NewLife = 0;
CPlayer* pController = pAction->GetController();
CLifeModifier pModifier1 = CLifeModifier(Life(-1), this, PreventableType::NotPreventable, DamageType::NotDealingDamage);
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
{
CPlayer* pPlayer = GetGame()->GetPlayer(ip);
if (pPlayer != pController)
{
PrevLife = (int)pPlayer->GetLife();
pModifier1.ApplyTo(pPlayer);
NewLife = (int)pPlayer->GetLife();
if (NewLife < PrevLife)
LifeGain += PrevLife - NewLife;
}
}
if (LifeGain > 0)
{
CLifeModifier pModifier2 = CLifeModifier(Life(+LifeGain), this, PreventableType::NotPreventable, DamageType::NotDealingDamage);
pModifier2.ApplyTo(pController);
}
return true;
}
//____________________________________________________________________________
//
CCryptwailingCard::CCryptwailingCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Cryptwailing"), CardType::GlobalEnchantment, nID,
_T("3") BLACK_MANA_TEXT, AbilityType::Enchantment)
{
counted_ptr<CActivatedAbility<CTargetPlayerDiscardCardSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetPlayerDiscardCardSpell>>(this,
_T("1"),
1, MoveType::Discard, ZoneId::Graveyard, TRUE,
TRUE,
CCardFilter::GetFilter(_T("cards"))));
cpAbility->GetCost().AddExileGraveyardCardCost(2, CCardFilter::GetFilter(_T("creatures")));
cpAbility->SetAbilityType((cpAbility->GetAbilityType() & ~AbilityType::Activated) | AbilityType::AsSorcery);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CDuneBroodNephilimCard::CDuneBroodNephilimCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Dune-Brood Nephilim"), CardType::Creature, CREATURE_TYPE(Nephilim), nID,
BLACK_MANA_TEXT RED_MANA_TEXT GREEN_MANA_TEXT WHITE_MANA_TEXT, Power(3), Life(3))
{
typedef
TTriggeredAbility< CTriggeredCreateTokenAbility, CWhenSelfDamageDealt,
CWhenSelfDamageDealt::PlayerEventCallback,
&CWhenSelfDamageDealt::SetPlayerEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->GetTrigger().SetCombatDamageOnly();
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->AddAbilityTag(AbilityTag::TokenCreation);
cpAbility->SetBeforeResolveSelectionCallback(TriggeredAbility::BeforeResolveSelectionCallback(this, &CDuneBroodNephilimCard::BeforeResolution));
cpAbility->SetCreateTokenOption(TRUE, _T("Sand"), 2839, 0);
AddAbility(cpAbility.GetPointer());
}
bool CDuneBroodNephilimCard::BeforeResolution(TriggeredAbility::TriggeredActionType* pAction)
{
CZone* pContBattle = GetController()->GetZoneById(ZoneId::Battlefield);
int nCount = 0;
for (int i = 0; i < pContBattle->GetSize(); ++i)
{
CCard* pCard = pContBattle->GetAt(i);
if (pCard->GetCardType().IsLand())
++nCount;
}
TriggeredAbility::TriggerContextType triggerContext(pAction->GetTriggerContext());
triggerContext.nValue1 = nCount;
pAction->SetTriggerContext(triggerContext);
return (nCount>0);
}
//____________________________________________________________________________
//
CWitchMawNephilimCard::CWitchMawNephilimCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Witch-Maw Nephilim"), CardType::Creature, CREATURE_TYPE(Nephilim), nID,
GREEN_MANA_TEXT WHITE_MANA_TEXT BLUE_MANA_TEXT BLACK_MANA_TEXT, Power(1), Life(1))
{
{
typedef
TTriggeredAbility< CTriggeredModifyCardAbility, CWhenSpellCast > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->GetTrigger().GetCardFilterHelper().SetPredefinedFilter(CCardFilter::GetFilter(_T("cards")));
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->GetTriggeredCardModifiers().push_back(new CCardCounterModifier(_T("+1/+1"), +2));
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CWhenSelfAttackedBlocked,
CWhenSelfAttackedBlocked::AttackEventCallback,
&CWhenSelfAttackedBlocked::SetAttackingEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetCreatureKeywordMod().GetModifier().SetToAdd(CreatureKeyword::Trample);
cpAbility->GetCreatureKeywordMod().GetModifier().SetOneTurnOnly(TRUE);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CWitchMawNephilimCard::SetTriggerContextL));
cpAbility->SetBeforeResolveSelectionCallback(TriggeredAbility::BeforeResolveSelectionCallback(this, &CWitchMawNephilimCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
}
bool CWitchMawNephilimCard::SetTriggerContextL(CTriggeredModifyCreatureAbility::TriggerContextType& triggerContext,
AttackSubject attacked) const
{
return (GET_INTEGER(GetLastKnownPower())>=10);
}
bool CWitchMawNephilimCard::BeforeResolution(TriggeredAbility::TriggeredActionType* pAction)
{
return (GET_INTEGER(GetLastKnownPower())>=10);
}
//____________________________________________________________________________
//
CGruulScrapperCard::CGruulScrapperCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Gruul Scrapper"), CardType::Creature, CREATURE_TYPE2(Human, Berserker), nID,
_T("3") GREEN_MANA_TEXT, Power(3), Life(2))
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetCreatureKeywordMod().GetModifier().SetToAdd(CreatureKeyword::Haste);
cpAbility->GetCreatureKeywordMod().GetModifier().SetOneTurnOnly(TRUE);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CGruulScrapperCard::SetTriggerContext));
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
bool CGruulScrapperCard::SetTriggerContext(CTriggeredModifyCreatureAbility::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const
{
if (moveType != MoveType::Cast)
return false;
int nColorCount = GetLastCastingManaCost().GetMana(CManaPool::Color::Red);
return (nColorCount!=0); //Warning: "!=" operator used. Means: "If this color was spent, then it will trigger."
}
//____________________________________________________________________________
//
COgreSavantCard::COgreSavantCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Ogre Savant"), CardType::Creature, CREATURE_TYPE2(Ogre, Wizard), nID,
_T("4") RED_MANA_TEXT, Power(3), Life(2))
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetSubjectZoneId(ZoneId::Battlefield);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::Creature, false));
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Hand);
cpAbility->GetMoveCardModifier().SetToOwnersZone(TRUE);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &COgreSavantCard::SetTriggerContext));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Hand));
AddAbility(cpAbility.GetPointer());
}
bool COgreSavantCard::SetTriggerContext(CTriggeredMoveCardAbility::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const
{
if (moveType != MoveType::Cast)
return false;
int nColorCount = GetLastCastingManaCost().GetMana(CManaPool::Color::Blue);
return (nColorCount!=0); //Warning: "!=" operator used. Means: "If this color was spent, then it will trigger."
}
//____________________________________________________________________________
//
CShriekingGrotesqueCard::CShriekingGrotesqueCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Shrieking Grotesque"), CardType::Creature, CREATURE_TYPE(Gargoyle), nID,
_T("2") WHITE_MANA_TEXT, Power(2), Life(1))
{
typedef
TTriggeredTargetAbility< CTriggeredDiscardCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().SetIncludePlayers(TRUE);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CShriekingGrotesqueCard::SetTriggerContext));
AddAbility(cpAbility.GetPointer());
}
bool CShriekingGrotesqueCard::SetTriggerContext(CTriggeredDiscardCardAbility::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const
{
if (moveType != MoveType::Cast)
return false;
int nColorCount = GetLastCastingManaCost().GetMana(CManaPool::Color::Black);
return (nColorCount!=0); //Warning: "!=" operator used. Means: "If this color was spent, then it will trigger."
}
//____________________________________________________________________________
//
CSteamcoreWeirdCard::CSteamcoreWeirdCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Steamcore Weird"), CardType::Creature, CREATURE_TYPE(Weird), nID,
_T("3") BLUE_MANA_TEXT, Power(1), Life(3))
{
typedef
TTriggeredTargetAbility< CTriggeredModifyLifeAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetLifeModifier().SetLifeDelta(Life(-2));
cpAbility->GetLifeModifier().SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->GetTargeting().SetIncludePlayers(TRUE);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CSteamcoreWeirdCard::SetTriggerContext));
cpAbility->AddAbilityTag(AbilityTag::DamageSource);
AddAbility(cpAbility.GetPointer());
}
bool CSteamcoreWeirdCard::SetTriggerContext(CTriggeredModifyLifeAbility::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const
{
if (moveType != MoveType::Cast)
return false;
int nColorCount = GetLastCastingManaCost().GetMana(CManaPool::Color::Red);
return (nColorCount!=0); //Warning: "!=" operator used. Means: "If this color was spent, then it will trigger."
}
//____________________________________________________________________________
//
CTinStreetHooliganCard::CTinStreetHooliganCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Tin Street Hooligan"), CardType::Creature, CREATURE_TYPE2(Goblin, Rogue), nID,
_T("1") RED_MANA_TEXT, Power(2), Life(1))
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::Artifact, false));
cpAbility->GetMoveCardModifier().SetMoveType(MoveType::Destroy);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CTinStreetHooliganCard::SetTriggerContext));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Graveyard));
AddAbility(cpAbility.GetPointer());
}
bool CTinStreetHooliganCard::SetTriggerContext(CTriggeredMoveCardAbility::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const
{
if (moveType != MoveType::Cast)
return false;
int nColorCount = GetLastCastingManaCost().GetMana(CManaPool::Color::Green);
return (nColorCount!=0); //Warning: "!=" operator used. Means: "If this color was spent, then it will trigger."
}
//____________________________________________________________________________
//
CGlintEyeNephilimCard::CGlintEyeNephilimCard(CGame* pGame, UINT nID)
: CPumpCreatureCard(pGame, _T("Glint-Eye Nephilim"), CardType::Creature, CREATURE_TYPE(Nephilim), nID,
BLUE_MANA_TEXT BLACK_MANA_TEXT RED_MANA_TEXT GREEN_MANA_TEXT, Power(2), Life(2),
_T("1"), Power(+1), Life(+1))
{
m_pPumpAbility->GetCost().AddDiscardCardCost(1, CCardFilter::GetFilter(_T("cards")));
{
typedef
TTriggeredAbility< CTriggeredDrawCardAbility, CWhenSelfDamageDealt,
CWhenSelfDamageDealt::PlayerEventCallback,
&CWhenSelfDamageDealt::SetPlayerEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetCombatDamageOnly();
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CGlintEyeNephilimCard::SetTriggerContextL));
m_pTriggeredAbility = cpAbility.GetPointer();
AddAbility(m_pTriggeredAbility);
}
}
bool CGlintEyeNephilimCard::SetTriggerContextL(CTriggeredDrawCardAbility::TriggerContextType& triggerContext, CPlayer* pByPlayer,
Damage damage) const
{
triggerContext.nValue1 = GET_INTEGER(-damage.m_nLifeDelta);
return true;
}
//____________________________________________________________________________
//
CBloodscaleProwlerCard::CBloodscaleProwlerCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Bloodscale Prowler"), CardType::Creature, CREATURE_TYPE2(Viashino, Warrior), nID,
_T("2") RED_MANA_TEXT, Power(3), Life(1))
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CBloodscaleProwlerCard::OnZoneChanged))
{
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
}
void CBloodscaleProwlerCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone) return;
bool bBloodthirst = false;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if ((GetGame()->GetPlayer(ip) != GetController()) && (GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn() > 0))
{
bBloodthirst = true;
break;
}
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield && bBloodthirst)
{
CCardCounterModifier modifier(_T("+1/+1"), +1, true);
modifier.ApplyTo(this);
}
}
//____________________________________________________________________________
//
CGhorClanSavageCard::CGhorClanSavageCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Ghor-Clan Savage"), CardType::Creature, CREATURE_TYPE2(Centaur, Berserker), nID,
_T("3") GREEN_MANA_TEXT GREEN_MANA_TEXT, Power(2), Life(3))
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CGhorClanSavageCard::OnZoneChanged))
{
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
}
void CGhorClanSavageCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone) return;
bool bBloodthirst = false;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if ((GetGame()->GetPlayer(ip) != GetController()) && (GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn() > 0))
{
bBloodthirst = true;
break;
}
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield && bBloodthirst)
{
CCardCounterModifier modifier(_T("+1/+1"), +3, true);
modifier.ApplyTo(this);
}
}
//____________________________________________________________________________
//
CScabClanMaulerCard::CScabClanMaulerCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Scab-Clan Mauler"), CardType::Creature, CREATURE_TYPE2(Human, Berserker), nID,
RED_MANA_TEXT GREEN_MANA_TEXT, Power(1), Life(1))
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CScabClanMaulerCard::OnZoneChanged))
{
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
GetCreatureKeyword()->AddTrample(FALSE);
}
void CScabClanMaulerCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone) return;
bool bBloodthirst = false;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if ((GetGame()->GetPlayer(ip) != GetController()) && (GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn() > 0))
{
bBloodthirst = true;
break;
}
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield && bBloodthirst)
{
CCardCounterModifier modifier(_T("+1/+1"), +2, true);
modifier.ApplyTo(this);
}
}
//____________________________________________________________________________
//
CSkarrganSkybreakerCard::CSkarrganSkybreakerCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Skarrgan Skybreaker"), CardType::Creature, CREATURE_TYPE2(Giant, Shaman), nID,
_T("4") RED_MANA_TEXT RED_MANA_TEXT GREEN_MANA_TEXT, Power(3), Life(3))
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CSkarrganSkybreakerCard::OnZoneChanged))
{
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
{
m_CardFilter.AddComparer(new SpecificCardComparer(this));
counted_ptr<CActivatedAbility<CTargetChgLifeSpell2>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgLifeSpell2>>(this,
_T("1"),
new AnyCreatureComparer, TRUE,
&m_CardFilter,
PreventableType::Preventable, DamageType::AbilityDamage | DamageType::NonCombatDamage));
ATLASSERT(cpAbility);
AddAbility(cpAbility.GetPointer());
}
}
void CSkarrganSkybreakerCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone) return;
bool bBloodthirst = false;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if ((GetGame()->GetPlayer(ip) != GetController()) && (GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn() > 0))
{
bBloodthirst = true;
break;
}
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield && bBloodthirst)
{
CCardCounterModifier modifier(_T("+1/+1"), +3, true);
modifier.ApplyTo(this);
}
}
//____________________________________________________________________________
//
CSkarrganFirebirdCard::CSkarrganFirebirdCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Skarrgan Firebird"), CardType::Creature, CREATURE_TYPE(Phoenix), nID,
_T("4") RED_MANA_TEXT RED_MANA_TEXT, Power(3), Life(3))
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CSkarrganFirebirdCard::OnZoneChanged))
{
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
{
counted_ptr<CSelfMoveCardAbility> cpAbility(
::CreateObject<CSelfMoveCardAbility>(this,
RED_MANA_TEXT RED_MANA_TEXT RED_MANA_TEXT,
ZoneId::Hand, TRUE, MoveType::Others));
cpAbility->SetGraveyardOnly();
counted_ptr<CPlayableIfTrait> cpTrait(
::CreateObject<CPlayableIfTrait>(
m_pUntapAbility,
CPlayableIfTrait::PlayableCallback(this,
&CSkarrganFirebirdCard::CanPlay)));
cpAbility->Add(cpTrait.GetPointer());
AddAbility(cpAbility.GetPointer());
}
}
void CSkarrganFirebirdCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone) return;
bool bBloodthirst = false;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if ((GetGame()->GetPlayer(ip) != GetController()) && (GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn() > 0))
{
bBloodthirst = true;
break;
}
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield && bBloodthirst)
{
CCardCounterModifier modifier(_T("+1/+1"), +3, true);
modifier.ApplyTo(this);
}
}
BOOL CSkarrganFirebirdCard::CanPlay(BOOL bIncludeTricks)
{
bool bBloodthirst = false;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if ((GetGame()->GetPlayer(ip) != GetController()) && (GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn() > 0))
{
bBloodthirst = true;
break;
}
return bBloodthirst;
}
//____________________________________________________________________________
//
CUlashttheHateSeedCard::CUlashttheHateSeedCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Ulasht, the Hate Seed"), CardType::_LegendaryCreature, CREATURE_TYPE2(Hellion, Hydra), nID,
_T("2") RED_MANA_TEXT GREEN_MANA_TEXT, Power(0), Life(0))
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CUlashttheHateSeedCard::OnZoneChanged))
, m_CardFilter1(_T("a red creature"), _T("red creatures"), new CardTypeComparer(CardType::Red | CardType::Creature, true))
, m_CardFilter2(_T("a green creature"), _T("green creatures"), new CardTypeComparer(CardType::Green | CardType::Creature, true))
{
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
m_CardFilter1.AddComparer(new NegateCardComparer(new SpecificCardComparer(this)));
m_CardFilter2.AddComparer(new NegateCardComparer(new SpecificCardComparer(this)));
{
counted_ptr<CActivatedAbility<CTargetChgLifeSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetChgLifeSpell>>(this,
_T("1"),
new AnyCreatureComparer, FALSE,
Life(-1), PreventableType::Preventable));
cpAbility->GetCost().AddCounterCost(GetCounterContainer()->GetCounter(_T("+1/+1")), -1);
cpAbility->SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTokenProductionSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTokenProductionSpell>>(this,
_T("1"),
_T("Saproling B"), 2712, 1));
cpAbility->GetCost().AddCounterCost(GetCounterContainer()->GetCounter(_T("+1/+1")), -1);
AddAbility(cpAbility.GetPointer());
}
}
void CUlashttheHateSeedCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone || pCard != this)
return;
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield)
{
CZone* pBat = GetController()->GetZoneById(ZoneId::Battlefield);
int red = m_CardFilter1.CountIncluded(pBat->GetCardContainer());
int green = m_CardFilter2.CountIncluded(pBat->GetCardContainer());
int summ = red+green;
CCardCounterModifier pModifier = CCardCounterModifier(_T("+1/+1"), +summ);
pModifier.ApplyTo(this);
}
}
//____________________________________________________________________________
//
CPilloryOfTheSleeplessCard::CPilloryOfTheSleeplessCard(CGame* pGame, UINT nID)
: CChgPwrTghAttrEnchantCard(pGame, _T("Pillory of the Sleepless"), nID,
_T("1") WHITE_MANA_TEXT BLACK_MANA_TEXT,
Power(+0), Life(+0),
CreatureKeyword::CantAttack | CreatureKeyword::CantBlock)
{
CCardAbilityModifier* pModifier = new CCardAbilityModifier(CCardAbilityModifier::CreateAbilityCallback(this,
&CPilloryOfTheSleeplessCard::CreateAdditionalAbility));
m_pChgPwrTghAttrEnchant->GetTargeting()->SetDefaultCharacteristic(Characteristic::Negative);
m_pChgPwrTghAttrEnchant->GetCardKeywordMod().LinkCardModifier(pModifier);
}
counted_ptr<CAbility> CPilloryOfTheSleeplessCard::CreateAdditionalAbility(CCard* pCard)
{
typedef
TTriggeredAbility< CTriggeredModifyLifeAbility, CWhenNodeChanged > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(pCard, NodeId::UpkeepStep));
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->GetLifeModifier().SetLifeDelta(Life(-1));
cpAbility->GetLifeModifier().SetDamageType(DamageType::NotDealingDamage);
cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
cpAbility->AddAbilityTag(AbilityTag::LifeLost);
return counted_ptr<CAbility>(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CGhostCouncilOfOrzhovaCard::CGhostCouncilOfOrzhovaCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Ghost Council of Orzhova"), CardType::_LegendaryCreature, CREATURE_TYPE(Spirit), nID,
WHITE_MANA_TEXT WHITE_MANA_TEXT BLACK_MANA_TEXT BLACK_MANA_TEXT, Power(4), Life(4))
, m_cpEventListener1(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CGhostCouncilOfOrzhovaCard::OnResolutionCompleted1))
{
{
typedef
TTriggeredTargetAbility< CTriggeredModifyLifeAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetLifeModifier().SetLifeDelta(Life(-1));
cpAbility->GetLifeModifier().SetDamageType(DamageType::NotDealingDamage); // life lost
cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().SetIncludePlayers(TRUE);
cpAbility->GetTargeting().SetIncludeOpponentPlayersOnly();
cpAbility->GetResolutionModifier().CPlayerModifiers::push_back(new CLifeModifier(Life(+1), this, PreventableType::NotPreventable));
cpAbility->AddAbilityTag(AbilityTag::LifeLost);
cpAbility->AddAbilityTag(AbilityTag::LifeGain);
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CGenericSpell>> cpAbility(
::CreateObject<CActivatedAbility<CGenericSpell>>(this,
_T("1")));
ATLASSERT(cpAbility);
cpAbility->GetCost().AddSacrificeCardCost(1, CCardFilter::GetFilter(_T("creatures")));
cpAbility->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener1.GetPointer());
AddAbility(cpAbility.GetPointer());
}
}
void CGhostCouncilOfOrzhovaCard::OnResolutionCompleted1(const CAbilityAction* pAbilityAction, BOOL bResult)
{
if (!IsInplay()) return;
CMoveCardModifier pModifier1 = CMoveCardModifier(ZoneId::Battlefield, ZoneId::Exile, TRUE, MoveType::Others, pAbilityAction->GetController());
pModifier1.ApplyTo(this);
CCountedCardContainer pSubjects;
if (GetZoneId() == ZoneId::Exile)
pSubjects.AddCard(this, CardPlacement::Top);
CContainerEffectModifier pModifier2 = CContainerEffectModifier(GetGame(), _T("End Step Return from Exile Effect"), 61057, &pSubjects);
pModifier2.ApplyTo(pAbilityAction->GetController());
}
//____________________________________________________________________________
//
CStormHerdCard::CStormHerdCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Storm Herd"), CardType::Sorcery, nID)
{
counted_ptr<CTokenProductionSpell> cpSpell(
::CreateObject<CTokenProductionSpell>(this, AbilityType::Sorcery,
_T("8") WHITE_MANA_TEXT WHITE_MANA_TEXT,
_T("Pegasus A"), 2741,
0));
cpSpell->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CStormHerdCard::BeforeResolution));
AddSpell(cpSpell.GetPointer());
}
bool CStormHerdCard::BeforeResolution(CAbilityAction* pAction) const
{
int nLifeTotal = GET_INTEGER(GetController()->GetLife());
ContextValue Context(pAction->GetValue());
Context.nValue1 = nLifeTotal;
pAction->SetValue(Context);
return true;
}
//____________________________________________________________________________
//
CGristlebackCard::CGristlebackCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Gristleback"), CardType::Creature, CREATURE_TYPE2(Boar, Beast), nID,
_T("2") GREEN_MANA_TEXT, Power(2), Life(2))
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CGristlebackCard::OnZoneChanged))
{
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
{
counted_ptr<CActivatedAbility<CChgLifeSpell>> cpAbility(
::CreateObject<CActivatedAbility<CChgLifeSpell>>(this,
_T(""),
Life(+0), PreventableType::NotPreventable));
cpAbility->AddSacrificeCost();
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CGristlebackCard::BeforeResolution));
AddAbility(cpAbility.GetPointer());
}
}
void CGristlebackCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone) return;
bool bBloodthirst = false;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if ((GetGame()->GetPlayer(ip) != GetController()) && (GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn() > 0))
{
bBloodthirst = true;
break;
}
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield && bBloodthirst)
{
CCardCounterModifier modifier(_T("+1/+1"), +1, true);
modifier.ApplyTo(this);
}
}
bool CGristlebackCard::BeforeResolution(CAbilityAction* pAction) const
{
CCard* pCard = pAction->GetSacrificeCards()->GetAt(0);
if (!pCard->GetCardType().IsCreature())
return false;
CCreatureCard* pCreature = (CCreatureCard*)pCard;
int nPower = GET_INTEGER(pCreature->GetLastKnownPower());
CLifeModifier modifier(Life(+nPower), this, PreventableType::NotPreventable, DamageType::NotDealingDamage);
modifier.ApplyTo(GetController());
return true;
}
//____________________________________________________________________________
//
CSchismotivateCard::CSchismotivateCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Schismotivate"), CardType::Instant, nID)
//{
// counted_ptr<CTargetChgPwrTghAttrSpell> cpSpell(
// ::CreateObject<CTargetChgPwrTghAttrSpell>(this, AbilityType::Instant,
// _T("1") BLUE_MANA_TEXT RED_MANA_TEXT,
// Power(+4), Life(+0),
// CreatureKeyword::Null, CreatureKeyword::Null,
// TRUE, PreventableType::NotPreventable));
//
// cpSpell->FlagTargets(TRUE, TRUE);
// cpSpell->SetToZoneIfSuccess(ZoneId::_Tokens, TRUE);
//
// AddSpell(cpSpell.GetPointer());
//
// {
// typedef
// TTriggeredAbility< CTriggeredMoveCardAbility, CWhenSelfMoved > TriggeredAbility;
//
// counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this,
// ZoneId::Stack, ZoneId::_Tokens));
//
// cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
// cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::_Tokens);
// cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Graveyard);
// cpAbility->SetSkipStack(TRUE);
//
// AddAbility(cpAbility.GetPointer());
// }
// {
// typedef
// TTriggeredTargetAbility< CTriggeredModifyCreatureAbility, CWhenSelfMoved > TriggeredAbility;
//
// counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this,
// ZoneId::Stack, ZoneId::_Tokens));
//
// cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
// cpAbility->GetPowerModifier().SetPowerDelta(Power(-0));
// cpAbility->GetLifeModifier().SetLifeDelta(Life(-4));
// cpAbility->GetLifeModifier().SetDamageType(DamageType::NotDealingDamage);
// cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
//
// cpAbility->GetTargeting().GetSubjectCardFilter().AddNegateComparer(new CardAbilityFlagComparer(cpSpell.GetPointer()));
// cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
// cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
//
// cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
// cpAbility->SetSkipStack(TRUE);
//
// AddAbility(cpAbility.GetPointer());
// }
//}
{
{
counted_ptr<CDoubleTargetChgPwrTghAttrSpell> cpSpell(
::CreateObject<CDoubleTargetChgPwrTghAttrSpell>(this,
AbilityType::Instant,
_T("1") RED_MANA_TEXT BLUE_MANA_TEXT,
Power(+4), Life(0),
Power(-4), Life(0),
CreatureKeyword::Null, CreatureKeyword::Null,
CreatureKeyword::Null, CreatureKeyword::Null,
TRUE, PreventableType::NotPreventable));
AddSpell(cpSpell.GetPointer());
}
}
//____________________________________________________________________________
//
CLeylineOfLifeforceCard::CLeylineOfLifeforceCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Leyline of Lifeforce"), CardType::GlobalEnchantment, nID,
_T("2") GREEN_MANA_TEXT GREEN_MANA_TEXT, AbilityType::Enchantment)
{
counted_ptr<CPlayerEffectEnchantment> cpAbility(
::CreateObject<CPlayerEffectEnchantment>(this,
PlayerEffectType::SpellsCantBeCountered,
reinterpret_cast<int>(CCardFilter::GetFilter(_T("creatures")))));
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CLeylineOfLightningCard::CLeylineOfLightningCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Leyline of Lightning"), CardType::GlobalEnchantment, nID,
_T("2") RED_MANA_TEXT RED_MANA_TEXT, AbilityType::Enchantment)
{
typedef
TTriggeredTargetAbility< CTriggeredModifyLifeAbility, CWhenSpellCast > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->GetTrigger().GetCardFilterHelper().SetPredefinedFilter(CCardFilter::GetFilter(_T("cards")));
cpAbility->GetLifeModifier().SetLifeDelta(Life(-1));
cpAbility->GetLifeModifier().SetDamageType(DamageType::AbilityDamage | DamageType::NonCombatDamage);
cpAbility->GetTargeting().SetIncludePlayers(TRUE);
cpAbility->SetResolutionCost(_T("1"));
cpAbility->AddAbilityTag(AbilityTag::DamageSource);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CLeylineOfSingularityCard::CLeylineOfSingularityCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Leyline of Singularity"), CardType::GlobalEnchantment, nID,
_T("2") BLUE_MANA_TEXT BLUE_MANA_TEXT, AbilityType::Enchantment)
{
counted_ptr<CCardTypeEnchantment> cpAbility(
::CreateObject<CCardTypeEnchantment>(this,
new NegateCardComparer(new CardTypeComparer(CardType::_Land, false)),
CardType::Legendary, CardType::Null));
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CLeylineOfTheMeekCard::CLeylineOfTheMeekCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Leyline of the Meek"), CardType::GlobalEnchantment, nID,
_T("2") WHITE_MANA_TEXT WHITE_MANA_TEXT, AbilityType::Enchantment)
{
counted_ptr<CPwrTghAttrEnchantment> cpAbility(
::CreateObject<CPwrTghAttrEnchantment>(this,
new CardTypeComparer(CardType::Creature | CardType::Token, true),
Power(+1), Life(+1)));
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
COrderOfTheStarsCard::COrderOfTheStarsCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Order of the Stars"), CardType::Creature, CREATURE_TYPE2(Human, Cleric), nID,
WHITE_MANA_TEXT, Power(0), Life(1))
, m_Selection(pGame,CSelectionSupport::SelectionCallback(this, &COrderOfTheStarsCard::OnSelectionDone))
{
GetCreatureKeyword()->AddDefender(FALSE);
}
void COrderOfTheStarsCard::Move(CZone* pToZone,
const CPlayer* pByPlayer,
MoveType moveType,
CardPlacement cardPlacement, BOOL can_dredge)
{
bool bBattlefield = (GetZoneId() == ZoneId::Battlefield) || (GetZoneId() == ZoneId::_PhasedOut);
if (!bBattlefield && (pToZone->GetZoneId() == ZoneId::Battlefield))
{
SelectedProtection = CardKeyword::Null;
std::vector<SelectionEntry> entries;
{
SelectionEntry entry;
entry.dwContext = 1;
entry.strText.Format(_T("choose protection from %s"), _T("white"));
entries.push_back(entry);
}
{
SelectionEntry entry;
entry.dwContext = 2;
entry.strText.Format(_T("choose protection from %s"), _T("blue"));
entries.push_back(entry);
}
{
SelectionEntry entry;
entry.dwContext = 3;
entry.strText.Format(_T("choose protection from %s"), _T("black"));
entries.push_back(entry);
}
{
SelectionEntry entry;
entry.dwContext = 4;
entry.strText.Format(_T("choose protection from %s"), _T("red"));
entries.push_back(entry);
}
{
SelectionEntry entry;
entry.dwContext = 5;
entry.strText.Format(_T("choose protection from %s"), _T("green"));
entries.push_back(entry);
}
m_Selection.AddSelectionRequest(entries, 1, 1, NULL, GetController());
}
__super::Move(pToZone, pByPlayer, moveType, cardPlacement, can_dredge);
if (bBattlefield && (pToZone->GetZoneId() != ZoneId::Battlefield))
{
CCardKeywordModifier pModifier = CCardKeywordModifier(SelectedProtection, TRUE, FALSE);
pModifier.RemoveFrom(this);
}
}
void COrderOfTheStarsCard::OnSelectionDone(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5)
{
for (std::vector<SelectionEntry>::const_iterator it = selection.begin(); it != selection.end(); ++it)
if (it->bSelected)
{
int nSelectedIndex = it->dwContext;
if (nSelectedIndex == 1)
{
SelectedProtection = CardKeyword::ProtectionFromWhite;
CCardKeywordModifier pModifier = CCardKeywordModifier(SelectedProtection, TRUE, FALSE);
pModifier.ApplyTo(this);
return;
}
if (nSelectedIndex == 2)
{
SelectedProtection = CardKeyword::ProtectionFromBlue;
CCardKeywordModifier pModifier = CCardKeywordModifier(SelectedProtection, TRUE, FALSE);
pModifier.ApplyTo(this);
return;
}
if (nSelectedIndex == 3)
{
SelectedProtection = CardKeyword::ProtectionFromBlack;
CCardKeywordModifier pModifier = CCardKeywordModifier(SelectedProtection, TRUE, FALSE);
pModifier.ApplyTo(this);
return;
}
if (nSelectedIndex == 4)
{
SelectedProtection = CardKeyword::ProtectionFromRed;
CCardKeywordModifier pModifier = CCardKeywordModifier(SelectedProtection, TRUE, FALSE);
pModifier.ApplyTo(this);
return;
}
if (nSelectedIndex == 5)
{
SelectedProtection = CardKeyword::ProtectionFromGreen;
CCardKeywordModifier pModifier = CCardKeywordModifier(SelectedProtection, TRUE, FALSE);
pModifier.ApplyTo(this);
return;
}
}
}
//____________________________________________________________________________
//
CBioplasmCard::CBioplasmCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Bioplasm"), CardType::Creature, CREATURE_TYPE(Ooze), nID,
_T("3") GREEN_MANA_TEXT GREEN_MANA_TEXT, Power(4), Life(4))
, m_cpEventListener(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CBioplasmCard::OnResolutionCompleted))
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfAttackedBlocked,
CWhenSelfAttackedBlocked::AttackEventCallback,
&CWhenSelfAttackedBlocked::SetAttackingEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Library, ZoneId::Exile));
cpAbility->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener.GetPointer());
AddAbility(cpAbility.GetPointer());
}
void CBioplasmCard::OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult)
{
CZone* lib=GetController()->GetZoneById(ZoneId::Library);
if (lib->GetSize()>0)
{
CCard* pNextDraw = GetController()->GetZoneById(ZoneId::Library)->GetTopCard();
CZoneModifier pModifier = CDrawCardModifier(GetGame(), MinimumValue(1), MaximumValue(1));
pModifier.GetSelection(0).nMinSelectionCount = MinimumValue(0);
pModifier.GetSelection(0).nMaxSelectionCount = MaximumValue(0);
pModifier.GetSelection(0).moveType = MoveType::Others;
pModifier.AddSelection(MinimumValue(1), MaximumValue(1), // select cards to bootom
CZoneModifier::RoleType::PrimaryPlayer, // select by
CZoneModifier::RoleType::AllPlayers, // reveal to
NULL, // any cards
ZoneId::Exile, // if selected, move cards to
CZoneModifier::RoleType::PrimaryPlayer, // select by this player
CardPlacement::Top, // put selected cards on top
MoveType::Others, // move type
CZoneModifier::RoleType::PrimaryPlayer); // order selected cards by this player
pModifier.ApplyTo(GetController());
if (pNextDraw->GetCardType().IsCreature())
{
CCreatureCard* pCreature = (CCreatureCard*)pNextDraw;
int nPower = GET_INTEGER(pCreature->GetLastKnownPower());
int nToughness = GET_INTEGER(pCreature->GetLastKnownToughness());
CPowerModifier pModifier1 = CPowerModifier(Power(+nPower), TRUE);
CLifeModifier pModifier2 = CLifeModifier(Life(+nToughness), this, PreventableType::NotPreventable, DamageType::NotDealingDamage, TRUE);
pModifier1.ApplyTo(this);
pModifier2.ApplyTo(this);
}
}
}
//____________________________________________________________________________
//
CFeralAnimistCard::CFeralAnimistCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Feral Animist"), CardType::Creature, CREATURE_TYPE2(Goblin, Shaman), nID,
_T("1") RED_MANA_TEXT GREEN_MANA_TEXT, Power(2), Life(1))
{
counted_ptr<CPumpAbility> cpAbility(
::CreateObject<CPumpAbility>(this,
_T("3"),
Power(+0), Life(+0)));
ATLASSERT(cpAbility);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CFeralAnimistCard::BeforeResolution));
AddAbility(cpAbility.GetPointer());
}
bool CFeralAnimistCard::BeforeResolution(CAbilityAction* pAction) const
{
CPowerModifier pModifier1 = CPowerModifier(Power(this->GetLastKnownPower()));
pModifier1.ApplyTo((CCreatureCard*)this);
return true;
}
//____________________________________________________________________________
//
CPetrifiedWoodKinCard::CPetrifiedWoodKinCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Petrified Wood-Kin"), CardType::Creature, CREATURE_TYPE2(Elemental, Warrior), nID,
_T("6") GREEN_MANA_TEXT, Power(3), Life(3))
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CPetrifiedWoodKinCard::OnZoneChanged))
{
GetCardKeyword()->AddCantBeCountered(FALSE);
GetCardKeyword()->AddSpecialProtection(FALSE, CCardFilter::GetFilter(_T("instant cards")));
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
}
void CPetrifiedWoodKinCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone) return;
int nDamage = 0;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if (GetGame()->GetPlayer(ip) != GetController())
nDamage += GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn();
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield && nDamage > 0)
{
CCardCounterModifier modifier(_T("+1/+1"), +nDamage, true);
modifier.ApplyTo(this);
}
}
//____________________________________________________________________________
//
CSanguinePraetorCard::CSanguinePraetorCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Sanguine Praetor"), CardType::Creature, CREATURE_TYPE2(Avatar, Praetor), nID,
_T("6") BLACK_MANA_TEXT BLACK_MANA_TEXT, Power(7), Life(5))
, m_cpEventListener(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CSanguinePraetorCard::OnResolutionCompleted))
{
counted_ptr<CActivatedAbility<CChgLifeSpell>> cpAbility(
::CreateObject<CActivatedAbility<CChgLifeSpell>>(this,
BLACK_MANA_TEXT,
Life(+0), PreventableType::NotPreventable));
cpAbility->GetCost().AddSacrificeCardCost(1, CCardFilter::GetFilter(_T("creatures")));
cpAbility->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener.GetPointer());
AddAbility(cpAbility.GetPointer());
}
void CSanguinePraetorCard::OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult)
{
CCard* pCard = pAbilityAction->GetSacrificeCards()->GetAt(0);
if (pCard->GetCardType().IsCreature())
{
CCreatureCard* pCreature = (CCreatureCard*)pCard;
int converted = pCreature->GetConvertedManaCost();
CCardFilter m_CardFilter_temp;
m_CardFilter_temp.SetComparer(new AnyCreatureComparer);
m_CardFilter_temp.AddComparer(new ConvertedManaCostComparer<std::equal_to<int>>(converted));
CZoneCardModifier pModifier = CZoneCardModifier(ZoneId::Battlefield, &m_CardFilter_temp,
std::auto_ptr<CCardModifier>(new CMoveCardModifier(ZoneId::Battlefield, ZoneId::Graveyard, TRUE, MoveType::Destroy)));
pModifier.ApplyTo(GetController());
pModifier.ApplyTo(m_pGame->GetNextPlayer(GetController()));
}
}
//____________________________________________________________________________
//
//"Souls of the Faultless\n{WBB}\nCreature - Spirit\nGPT,U\nDefender\rWhenever Souls of the Faultless is dealt combat damage, you gain that much life and attacking player loses that much life.\n0/4"
//CSoulsOfTheFaultlessCard::CSoulsOfTheFaultlessCard(CGame* pGame, UINT nID)
// : CCreatureCard(pGame, _T("Souls of the Faultless"), CardType::Creature, CREATURE_TYPE(Spirit), nID,
// WHITE_MANA_TEXT BLACK_MANA_TEXT BLACK_MANA_TEXT, Power(0), Life(4))
//{
// //GetCreatureKeyword()->AddDefender(FALSE);
//
// {
// typedef
// TTriggeredAbility< CTriggeredModifyLifeAbility, CWhenDamageDealt,
// CWhenDamageDealt::CreatureEventCallback,
// &CWhenDamageDealt::SetCreatureEventCallback > TriggeredAbility;
//
// counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
//
// cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
//
// cpAbility->GetTrigger().SetCombatDamageOnly(TRUE);
// cpAbility->GetTrigger().GetToCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
// cpAbility->GetTrigger().GetToCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
//
// cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CSoulsOfTheFaultlessCard::SetTriggerContext1));
//
// cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
// cpAbility->AddAbilityTag(AbilityTag::LifeGain);
//
// AddAbility(cpAbility.GetPointer());
// }
// {
// typedef
// TTriggeredAbility< CTriggeredModifyLifeAbility, CWhenDamageDealt,
// CWhenDamageDealt::CreatureEventCallback,
// &CWhenDamageDealt::SetCreatureEventCallback > TriggeredAbility;
//
// counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
//
// cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
// cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
//
// cpAbility->GetTrigger().SetCombatDamageOnly(TRUE);
// cpAbility->GetTrigger().GetToCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
// cpAbility->GetTrigger().GetToCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
//
// cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CSoulsOfTheFaultlessCard::SetTriggerContext2));
//
// cpAbility->GetLifeModifier().SetDamageType(DamageType::NotDealingDamage);
// cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
// cpAbility->AddAbilityTag(AbilityTag::LifeLost);
// cpAbility->SetSkipStack(TRUE);
//
// AddAbility(cpAbility.GetPointer());
// }
//}
//
//bool CSoulsOfTheFaultlessCard::SetTriggerContext1(CTriggeredModifyLifeAbility::TriggerContextType& triggerContext,
// CCard* pCard, CCreatureCard* pToCreature, Damage damage) const
//{
// triggerContext.m_LifeModifier.SetLifeDelta(Life(-damage.m_nLifeDelta));
// return true;
//}
//
//bool CSoulsOfTheFaultlessCard::SetTriggerContext2(CTriggeredModifyLifeAbility::TriggerContextType& triggerContext,
// CCard* pCard, CCreatureCard* pToCreature, Damage damage) const
//{
// triggerContext.m_LifeModifier.SetLifeDelta(Life(damage.m_nLifeDelta));
// triggerContext.m_LifeModifier.SetDamageType(DamageType::NotDealingDamage);
// triggerContext.m_LifeModifier.SetPreventable(PreventableType::NotPreventable);
// return true;
//}
//
////____________________________________________________________________________
////
CShadowLanceCard::CShadowLanceCard(CGame* pGame, UINT nID)
: CChgPwrTghAttrEnchantCard(pGame, _T("Shadow Lance"), nID,
WHITE_MANA_TEXT,
Power(+0), Life(+0), CreatureKeyword::FirstStrike)
{
CCardAbilityModifier* pModifier = new CCardAbilityModifier(CCardAbilityModifier::CreateAbilityCallback(this,
&CShadowLanceCard::CreateAdditionalAbility));
m_pChgPwrTghAttrEnchant->GetCardKeywordMod().LinkCardModifier(pModifier);
}
counted_ptr<CAbility> CShadowLanceCard::CreateAdditionalAbility(CCard* pCard)
{
counted_ptr<CPumpAbility> cpAbility(
::CreateObject<CPumpAbility>(this,
_T("1") BLACK_MANA_TEXT,
Power(+2), Life(+2), CreatureKeyword::Null,
(CCreatureCard*)pCard));
ATLASSERT(cpAbility);
return counted_ptr<CAbility>(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CCrashLandingCard::CCrashLandingCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Crash Landing"), CardType::Instant, nID)
, m_cpEventListener(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CCrashLandingCard::OnResolutionCompleted))
{
counted_ptr<CTargetChgPwrTghAttrSpell> cpSpell(
::CreateObject<CTargetChgPwrTghAttrSpell>(this, AbilityType::Instant,
_T("2") GREEN_MANA_TEXT,
Power(+0), Life(+0),
CreatureKeyword::Null, CreatureKeyword::Flying,
TRUE, PreventableType::NotPreventable,
new CreatureKeywordComparer(CreatureKeyword::Flying, false)));
cpSpell->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener.GetPointer());
AddSpell(cpSpell.GetPointer());
}
void CCrashLandingCard::OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult)
{
CCard* pCard = pAbilityAction->GetAssociatedCard();
CCreatureCard* pCreature = (CCreatureCard*)pCard;
CZone* pBattlefield = GetController()->GetZoneById(ZoneId::Battlefield);
CCardFilter m_CardFilter_temp;
m_CardFilter_temp.SetComparer(new CardTypeComparer(CardType::Forest, false));
int nDomainCount = m_CardFilter_temp.CountIncluded(pBattlefield->GetCardContainer());
CLifeModifier pModifier = CLifeModifier(Life(-nDomainCount), this, PreventableType::Preventable, DamageType::SpellDamage | DamageType::NonCombatDamage);
if (bResult) pModifier.ApplyTo(pCreature);
}
//____________________________________________________________________________
//
CParallectricFeedbackCard::CParallectricFeedbackCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Parallectric Feedback"), CardType::Instant, nID)
{
counted_ptr<CTargetChgPwrTghAttrSpell> cpSpell(
::CreateObject<CTargetChgPwrTghAttrSpell>(this, AbilityType::Instant,
_T("3") RED_MANA_TEXT,
Power(+0), Life(+0),
CreatureKeyword::Null, CreatureKeyword::Null,
TRUE, PreventableType::NotPreventable,
new TrueCardComparer));
cpSpell->GetTargeting()->SetSubjectZoneId(ZoneId::Stack);
cpSpell->GetTargeting()->SetDefaultCharacteristic(Characteristic::Negative);
cpSpell->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CParallectricFeedbackCard::BeforeResolution));
AddSpell(cpSpell.GetPointer());
}
bool CParallectricFeedbackCard::BeforeResolution(CAbilityAction* pAction) const
{
CCard* target = pAction->GetAssociatedCard();
int converted = target->GetSpells().GetAt(0)->GetCost().GetOriginalManaCost().GetTotal();
CLifeModifier pModifier=CLifeModifier(Life(-converted), this, PreventableType::Preventable, DamageType::SpellDamage | DamageType::NonCombatDamage);
pModifier.ApplyTo(target->GetController());
return true;
}
//____________________________________________________________________________
//
CRepealCard::CRepealCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Repeal"), CardType::Instant, nID)
{
counted_ptr<CTargetExtraMoveCardSpell> cpSpell(::CreateObject<CTargetExtraMoveCardSpell>(this, AbilityType::Instant,
BLUE_MANA_TEXT,
new TrueCardComparer,
ZoneId::Battlefield, ZoneId::Hand, TRUE, MoveType::Others));
cpSpell->GetCost().SetExtraManaCost(SpecialNumber::Any, TRUE, CManaCost::AllCostColors);
cpSpell->GetTargeting()->GetSubjectCardFilter().AddNegateComparer(new CardTypeComparer(CardType::_Land, false));
cpSpell->GetTargeting()->GetSubjectCardFilter().AddNegateComparer(new AlsoCardTypeComparer(CardType::_Land, false));
cpSpell->GetResolutionModifier().CPlayerModifiers::push_back(new CDrawCardModifier(GetGame(), MinimumValue(1), MaximumValue(1)));
AddSpell(cpSpell.GetPointer());
}
//____________________________________________________________________________
//
CYoreTillerNephilimCard::CYoreTillerNephilimCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Yore-Tiller Nephilim"), CardType::Creature, CREATURE_TYPE(Nephilim), nID,
WHITE_MANA_TEXT BLUE_MANA_TEXT BLACK_MANA_TEXT RED_MANA_TEXT, Power(2), Life(2))
{
{
typedef
TTriggeredTargetAbility< CMoveAttackingAbility, CWhenSelfAttackedBlocked,
CWhenSelfAttackedBlocked::AttackEventCallback,
&CWhenSelfAttackedBlocked::SetAttackingEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetSubjectZoneId(ZoneId::Graveyard);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Positive);
cpAbility->GetTargeting().SetIncludeControllerCardsOnly();
cpAbility->SetFromZoneId(ZoneId::Graveyard);
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CGathererOfGracesCard::CGathererOfGracesCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Gatherer of Graces"), CardType::Creature, CREATURE_TYPE2(Human, Druid), nID,
_T("1") GREEN_MANA_TEXT, Power(1), Life(2))
{
{
counted_ptr<CPwrTghAttrEnchantmentCount> cpAbility(
::CreateObject<CPwrTghAttrEnchantmentCount>(this,
new SpecificCardComparer(this),
Power(+1), Life(+1)));
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CRegenerationAbility> cpAbility(
::CreateObject<CRegenerationAbility>(this,
_T("")));
ATLASSERT(cpAbility);
cpAbility->GetCost().AddSacrificeCardCost(1, CCardFilter::GetFilter(_T("aura cards")));
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CSkySwallowerCard::CSkySwallowerCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Sky Swallower"), CardType::Creature, CREATURE_TYPE(Leviathan), nID,
_T("3") BLUE_MANA_TEXT BLUE_MANA_TEXT, Power(8), Life(8))
{
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetIncludeOpponentPlayersOnly();
cpAbility->SetBeforeResolveSelectionCallback(TriggeredAbility::BeforeResolveSelectionCallback(
this, &CSkySwallowerCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Battlefield));
cpAbility->SetAbilityName(_T("gain control ability"));
AddAbility(cpAbility.GetPointer());
}
// This is not perfect, auras get unattached while moving if they have controller restriction
bool CSkySwallowerCard::BeforeResolution(TriggeredAbility::TriggeredActionType* pAction)
{
TriggeredAbility* pAbility = (TriggeredAbility*)pAction->GetAbility();
CZone* pContInPlay = pAction->GetController()->GetZoneById(ZoneId::Battlefield);
pAbility->GetTriggeredPlayerModifiers().Clear();
if(pAbility)
{
for (int i = 0; i < pContInPlay->GetSize(); ++i)
{
CCard* pCard = pContInPlay->GetAt(i);
if (pCard == this)
continue;
pAbility->GetTriggeredPlayerModifiers().push_back(
new CTransferControlModifier(GetGame(), pCard, (CCard*)this));
}
}
return true;
}
//____________________________________________________________________________
//
CRevenantPatriarchCard::CRevenantPatriarchCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Revenant Patriarch"), CardType::Creature, CREATURE_TYPE(Spirit), nID,
_T("4") BLACK_MANA_TEXT, Power(4), Life(3))
, m_cpEventListener(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CRevenantPatriarchCard::OnResolutionCompleted))
{
GetCreatureKeyword()->AddCantBlock(FALSE);
typedef
TTriggeredTargetAbility< CTriggeredDiscardCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener.GetPointer());
cpAbility->SetDiscardCount(0);
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().SetIncludePlayers(TRUE);
cpAbility->SetAbilityName(_T("skip next combat phase ability"));
cpAbility->SetPickerIsTriggeredPlayer(FALSE);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CRevenantPatriarchCard::SetTriggerContext));
AddAbility(cpAbility.GetPointer());
}
bool CRevenantPatriarchCard::SetTriggerContext(CTriggeredDiscardCardAbility::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const
{
if (moveType != MoveType::Cast) return false;
int nColorCount = GetLastCastingManaCost().GetMana(CManaPool::Color::White);
return (nColorCount!=0);
}
void CRevenantPatriarchCard::OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult)
{
CPlayer* target = pAbilityAction->GetAssociatedPlayer();
CPlayerEffectModifier pmodifier = CPlayerEffectModifier(PlayerEffectType::SkipNextCombatPhase);
if (bResult) pmodifier.ApplyTo(target);
}
//____________________________________________________________________________
//
CVedalkenPlotterCard::CVedalkenPlotterCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Vedalken Plotter"), CardType::Creature, CREATURE_TYPE2(Vedalken, Wizard), nID,
_T("2") BLUE_MANA_TEXT, Power(1), Life(1))
{
typedef
TTriggeredDoubleTargetAbility< CTriggeredExchangeControlAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback,
&CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting1().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::_Land, false));
cpAbility->GetTargeting1().SetIncludeControllerCardsOnly();
cpAbility->GetTargeting1().SetDefaultCharacteristic(Characteristic::Positive);
cpAbility->GetTargeting2().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::_Land, false));
cpAbility->GetTargeting2().SetIncludeNonControllerCardsOnly();
cpAbility->GetTargeting2().SetDefaultCharacteristic(Characteristic::Negative);
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CDryadSophisticateCard::CDryadSophisticateCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Dryad Sophisticate"), CardType::Creature, CREATURE_TYPE(Dryad), nID,
_T("1") GREEN_MANA_TEXT, Power(2), Life(1))
{
m_CardFilter.AddComparer(new CardTypeComparer(CardType::_Land, false));
m_CardFilter.AddNegateComparer(new CardTypeComparer(CardType::BasicLand, false));
GetCreatureKeyword()->AddNonBasicWalk(FALSE, &m_CardFilter);
}
//____________________________________________________________________________
//
CWurmweaverCoilCard::CWurmweaverCoilCard(CGame* pGame, UINT nID)
: CChgPwrTghAttrEnchantCard(pGame, _T("Wurmweaver Coil"), nID,
_T("4") GREEN_MANA_TEXT GREEN_MANA_TEXT,
Power(+6), Life(+6))
{
m_pChgPwrTghAttrEnchant->GetTargeting()->GetSubjectCardFilter().SetComparer(new CardTypeComparer(CardType::Creature | CardType::Green, true));
counted_ptr<CActivatedAbility<CTokenProductionSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTokenProductionSpell>>(this,
GREEN_MANA_TEXT GREEN_MANA_TEXT GREEN_MANA_TEXT,
_T("Wurm B"), 2767, 1));
cpAbility->AddSacrificeCost();
AddAbility(cpAbility.GetPointer());
}
//____________________________________________________________________________
//
CSkarrganPitSkulkCard::CSkarrganPitSkulkCard(CGame* pGame, UINT nID)
: CFearCreatureCard(pGame, _T("Skarrgan Pit-Skulk"), CardType::Creature, CREATURE_TYPE2(Human, Warrior), nID,
GREEN_MANA_TEXT, Power(1), Life(1),
&m_CardFilter)
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CSkarrganPitSkulkCard::OnZoneChanged))
{
m_CardFilter.AddComparer(new AnyCreatureComparer);
m_CardFilter.AddComparer(new CreatureCreaturePowerComparer<std::greater_equal<int>>(this));
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
}
void CSkarrganPitSkulkCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone) return;
bool bBloodthirst = false;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if ((GetGame()->GetPlayer(ip) != GetController()) && (GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn() > 0))
{
bBloodthirst = true;
break;
}
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield && bBloodthirst)
{
CCardCounterModifier modifier(_T("+1/+1"), +1, true);
modifier.ApplyTo(this);
}
}
//____________________________________________________________________________________
//
CBatteringWurmCard::CBatteringWurmCard(CGame* pGame, UINT nID)
: CFearCreatureCard(pGame, _T("Battering Wurm"), CardType::Creature, CREATURE_TYPE(Wurm), nID,
_T("6") GREEN_MANA_TEXT, Power(4), Life(3),
&m_CardFilter)
, m_cpAListener(VAR_NAME(m_cpAListener), CardMovementEventSource::Listener::EventCallback(this, &CBatteringWurmCard::OnZoneChanged))
{
m_CardFilter.AddComparer(new AnyCreatureComparer);
m_CardFilter.AddComparer(new CreatureCreaturePowerComparer<std::greater_equal<int>>(this));
GetMovedEventSource()->AddListener(m_cpAListener.GetPointer());
}
void CBatteringWurmCard::OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (!pFromZone || !pToZone) return;
bool bBloodthirst = false;
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if ((GetGame()->GetPlayer(ip) != GetController()) && (GetGame()->GetPlayer(ip)->GetDamageTakenThisTurn() > 0))
{
bBloodthirst = true;
break;
}
if (pFromZone->GetZoneId() != ZoneId::Battlefield && pToZone->GetZoneId() == ZoneId::Battlefield && bBloodthirst)
{
CCardCounterModifier modifier(_T("+1/+1"), +1, true);
modifier.ApplyTo(this);
}
}
//____________________________________________________________________________________
//
CIzzetGuildmageCard::CIzzetGuildmageCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Izzet Guildmage"), CardType::Creature, CREATURE_TYPE2(Human, Wizard), nID,
BLUE_MANA_TEXT BLUE_MANA_TEXT, Power(2), Life(2))
{
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Creature,
BLUE_MANA_TEXT RED_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
AddSpell(cpSpell.GetPointer());
}
{
//hybrid mana cost
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Creature,
RED_MANA_TEXT RED_MANA_TEXT));
cpSpell->SetToZoneIfSuccess(ZoneId::Battlefield, TRUE);
AddSpell(cpSpell.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTargetCopyCastSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetCopyCastSpell>>(this,
_T("2") BLUE_MANA_TEXT,
new CardTypeComparer(CardType::Instant, false),
ZoneId::Stack));
ATLASSERT(cpAbility);
cpAbility->GetTargeting()->GetSubjectCardFilter().AddComparer(new ConvertedManaCostComparer<std::less<int>>(3));
cpAbility->GetTargeting()->SetIncludeControllerCardsOnly();
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTargetCopyCastSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetCopyCastSpell>>(this,
_T("2") RED_MANA_TEXT,
new CardTypeComparer(CardType::Sorcery, false),
ZoneId::Stack));
ATLASSERT(cpAbility);
cpAbility->GetTargeting()->GetSubjectCardFilter().AddComparer(new ConvertedManaCostComparer<std::less<int>>(3));
cpAbility->GetTargeting()->SetIncludeControllerCardsOnly();
AddAbility(cpAbility.GetPointer());
}
}
//____________________________________________________________________________
//
CStitchInTimeCard::CStitchInTimeCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Stitch in Time"), CardType::Sorcery, nID)
, m_FlipSelection(pGame, CSelectionSupport::SelectionCallback(this, &CStitchInTimeCard::OnFlipSelected))
{
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Sorcery,
_T("1") BLUE_MANA_TEXT RED_MANA_TEXT));
cpSpell->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CStitchInTimeCard::BeforeResolution));
AddSpell(cpSpell.GetPointer());
}
bool CStitchInTimeCard::BeforeResolution(CAbilityAction* pAction)
{
CPlayer* pController = pAction->GetController();
int Flip = 2;
if (!m_pGame->IsThinking())
{
int Thumb = 0;
int Exponent = 2;
pController->GetPlayerEffect().HasPlayerEffectSum(PlayerEffectType::CoinFlipCheating, Thumb, FALSE);
for (int i = 0; i < Thumb; ++i)
Exponent = 2 * Exponent;
Flip = pController->GetRand() % Exponent;
}
if (Flip == 0)
{
CString strMessage;
strMessage.Format(_T("%s loses the flip"), pController->GetPlayerName());
m_pGame->Message(
strMessage,
pController->IsComputer() ? m_pGame->GetComputerImage() : m_pGame->GetHumanImage(),
MessageImportance::High
);
CSpecialEffectModifier pModifierCoin = CSpecialEffectModifier(this, COIN_FLIP_LOSE_ID);
pModifierCoin.ApplyTo(this);
}
if (Flip == 1)
{
CString strMessage;
strMessage.Format(_T("%s wins the flip"), pController->GetPlayerName());
m_pGame->Message(
strMessage,
pController->IsComputer() ? m_pGame->GetComputerImage() : m_pGame->GetHumanImage(),
MessageImportance::High
);
CPlayerEffectModifier* pModifier = new CPlayerEffectModifier(PlayerEffectType::TimeWalk, 1, true);
pModifier->ApplyTo(pController);
CSpecialEffectModifier pModifierCoin = CSpecialEffectModifier(this, COIN_FLIP_WIN_ID);
pModifierCoin.ApplyTo(this);
}
if (Flip > 1)
{
std::vector<SelectionEntry> entries;
{
SelectionEntry selectionEntry;
selectionEntry.dwContext = 1;
selectionEntry.strText.Format(_T("win the flip"), this->GetCardName());
entries.push_back(selectionEntry);
}
{
SelectionEntry selectionEntry;
selectionEntry.dwContext = 2;
selectionEntry.strText.Format(_T("lose the flip"), this->GetCardName());
entries.push_back(selectionEntry);
}
m_FlipSelection.AddSelectionRequest(entries, 1, 1, NULL, GetController());
}
return true;
}
void CStitchInTimeCard::OnFlipSelected(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5)
{
ATLASSERT(nSelectedCount == 1);
for (std::vector<SelectionEntry>::const_iterator it = selection.begin(); it != selection.end(); ++it)
if (it->bSelected)
{
if ((int)it->dwContext == 1)
{
if (!m_pGame->IsThinking())
{
CString strMessage;
strMessage.Format(_T("%s wins the flip"), pSelectionPlayer->GetPlayerName());
m_pGame->Message(
strMessage,
pSelectionPlayer->IsComputer() ? m_pGame->GetComputerImage() : m_pGame->GetHumanImage(),
MessageImportance::High
);
}
CPlayerEffectModifier* pModifier = new CPlayerEffectModifier(PlayerEffectType::TimeWalk, 1, true);
pModifier->ApplyTo(pSelectionPlayer);
CSpecialEffectModifier pModifierCoin = CSpecialEffectModifier(this, COIN_FLIP_WIN_ID);
pModifierCoin.ApplyTo(this);
return;
}
if ((int)it->dwContext == 2)
{
if (!m_pGame->IsThinking())
{
CString strMessage;
strMessage.Format(_T("%s loses the flip"), pSelectionPlayer->GetPlayerName());
m_pGame->Message(
strMessage,
pSelectionPlayer->IsComputer() ? m_pGame->GetComputerImage() : m_pGame->GetHumanImage(),
MessageImportance::High
);
}
CSpecialEffectModifier pModifierCoin = CSpecialEffectModifier(this, COIN_FLIP_LOSE_ID);
pModifierCoin.ApplyTo(this);
return;
}
}
}
//____________________________________________________________________________
//
CCerebralVortexCard::CCerebralVortexCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Cerebral Vortex"), CardType::Instant, nID)
, m_cpEventListener(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CCerebralVortexCard::OnResolutionCompleted))
{
counted_ptr<CTargetDrawCardSpell> cpSpell(
::CreateObject<CTargetDrawCardSpell>(this, AbilityType::Instant,
_T("1") BLUE_MANA_TEXT RED_MANA_TEXT, 2));
cpSpell->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener.GetPointer());
AddSpell(cpSpell.GetPointer());
}
void CCerebralVortexCard::OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult)
{
if (!bResult) return;
CPlayer* pPlayer = pAbilityAction->GetAssociatedPlayer();
int nDamage = pPlayer->GetTurnDrawCount();
CLifeModifier pModifier = CLifeModifier(Life(-nDamage), this, PreventableType::Preventable, DamageType::AbilityDamage | DamageType::NonCombatDamage);
pModifier.ApplyTo(pPlayer);
}
//____________________________________________________________________________
//
CSilhanaStarfletcherCard::CSilhanaStarfletcherCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Silhana Starfletcher"), CardType::Creature, CREATURE_TYPE3(Elf, Druid, Archer), nID,
_T("2") GREEN_MANA_TEXT, Power(1), Life(3))
, m_Selection(pGame,CSelectionSupport::SelectionCallback(this, &CSilhanaStarfletcherCard::OnSelectionDone))
{
GetCreatureKeyword()->AddReach(FALSE);
{
counted_ptr<CManaProductionAbility> cpAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, WHITE_MANA_TEXT));
cpAbility->AddTapCost();
counted_ptr<CPlayableIfTrait> cpTrait(
::CreateObject<CPlayableIfTrait>(
m_pUntapAbility,
CPlayableIfTrait::PlayableCallback(this,
&CSilhanaStarfletcherCard::CanPlayW)));
cpAbility->Add(cpTrait.GetPointer());
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CManaProductionAbility> cpAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, BLUE_MANA_TEXT));
cpAbility->AddTapCost();
counted_ptr<CPlayableIfTrait> cpTrait(
::CreateObject<CPlayableIfTrait>(
m_pUntapAbility,
CPlayableIfTrait::PlayableCallback(this,
&CSilhanaStarfletcherCard::CanPlayU)));
cpAbility->Add(cpTrait.GetPointer());
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CManaProductionAbility> cpAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, BLACK_MANA_TEXT));
cpAbility->AddTapCost();
counted_ptr<CPlayableIfTrait> cpTrait(
::CreateObject<CPlayableIfTrait>(
m_pUntapAbility,
CPlayableIfTrait::PlayableCallback(this,
&CSilhanaStarfletcherCard::CanPlayB)));
cpAbility->Add(cpTrait.GetPointer());
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CManaProductionAbility> cpAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, RED_MANA_TEXT));
cpAbility->AddTapCost();
counted_ptr<CPlayableIfTrait> cpTrait(
::CreateObject<CPlayableIfTrait>(
m_pUntapAbility,
CPlayableIfTrait::PlayableCallback(this,
&CSilhanaStarfletcherCard::CanPlayR)));
cpAbility->Add(cpTrait.GetPointer());
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CManaProductionAbility> cpAbility(
::CreateObject<CManaProductionAbility>(this, _T(""), AbilityType::Activated, GREEN_MANA_TEXT));
cpAbility->AddTapCost();
counted_ptr<CPlayableIfTrait> cpTrait(
::CreateObject<CPlayableIfTrait>(
m_pUntapAbility,
CPlayableIfTrait::PlayableCallback(this,
&CSilhanaStarfletcherCard::CanPlayG)));
cpAbility->Add(cpTrait.GetPointer());
AddAbility(cpAbility.GetPointer());
}
}
void CSilhanaStarfletcherCard::Move(CZone* pToZone,
const CPlayer* pByPlayer,
MoveType moveType,
CardPlacement cardPlacement, BOOL can_dredge)
{
bool bBattlefield = (GetZoneId() == ZoneId::Battlefield) || (GetZoneId() == ZoneId::_PhasedOut);
if (!bBattlefield && (pToZone->GetZoneId() == ZoneId::Battlefield))
{
cWhite = false;
cBlue = false;
cBlack = false;
cRed = false;
cGreen = false;
std::vector<SelectionEntry> entries;
{
SelectionEntry entry;
entry.dwContext = 1;
entry.strText.Format(_T("choose %s"), _T("white"));
entries.push_back(entry);
}
{
SelectionEntry entry;
entry.dwContext = 2;
entry.strText.Format(_T("choose %s"), _T("blue"));
entries.push_back(entry);
}
{
SelectionEntry entry;
entry.dwContext = 3;
entry.strText.Format(_T("choose %s"), _T("black"));
entries.push_back(entry);
}
{
SelectionEntry entry;
entry.dwContext = 4;
entry.strText.Format(_T("choose %s"), _T("red"));
entries.push_back(entry);
}
{
SelectionEntry entry;
entry.dwContext = 5;
entry.strText.Format(_T("choose %s"), _T("green"));
entries.push_back(entry);
}
m_Selection.AddSelectionRequest(entries, 1, 1, NULL, GetController());
}
__super::Move(pToZone, pByPlayer, moveType, cardPlacement, can_dredge);
}
void CSilhanaStarfletcherCard::OnSelectionDone(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5)
{
ATLASSERT(nSelectedCount == 1);
for (std::vector<SelectionEntry>::const_iterator it = selection.begin(); it != selection.end(); ++it)
if (it->bSelected)
{
int nSelectedIndex = it->dwContext;
if (nSelectedIndex == 1)
{
cWhite = true;
return;
}
if (nSelectedIndex == 2)
{
cBlue = true;
return;
}
if (nSelectedIndex == 3)
{
cBlack = true;
return;
}
if (nSelectedIndex == 4)
{
cRed = true;
return;
}
if (nSelectedIndex == 5)
{
cGreen = true;
return;
}
}
}
BOOL CSilhanaStarfletcherCard::CanPlayW(BOOL bIncludeTricks)
{
return cWhite;
}
BOOL CSilhanaStarfletcherCard::CanPlayU(BOOL bIncludeTricks)
{
return cBlue;
}
BOOL CSilhanaStarfletcherCard::CanPlayB(BOOL bIncludeTricks)
{
return cBlack;
}
BOOL CSilhanaStarfletcherCard::CanPlayR(BOOL bIncludeTricks)
{
return cRed;
}
BOOL CSilhanaStarfletcherCard::CanPlayG(BOOL bIncludeTricks)
{
return cGreen;
}
//____________________________________________________________________________
//
CMoratoriumStoneCard::CMoratoriumStoneCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Moratorium Stone"), CardType::Artifact, nID,
_T("1"), AbilityType::Artifact)
{
{
counted_ptr<CActivatedAbility<CTargetMoveCardSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetMoveCardSpell>>(this,
_T("2"),
new TrueCardComparer,
ZoneId::Graveyard, ZoneId::Exile, TRUE, MoveType::Others));
cpAbility->AddTapCost();
AddAbility(cpAbility.GetPointer());
}
{
counted_ptr<CActivatedAbility<CTargetSpell>> cpAbility(
::CreateObject<CActivatedAbility<CTargetSpell>>(this,
_T("2") WHITE_MANA_TEXT BLACK_MANA_TEXT,
new NegateCardComparer(new CardTypeComparer(CardType::_Land, false)), false));
cpAbility->AddTapCost();
cpAbility->AddSacrificeCost();
cpAbility->GetTargeting()->SetSubjectZoneId(ZoneId::Graveyard);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CMoratoriumStoneCard::BeforeResolution));
AddAbility(cpAbility.GetPointer());
}
}
bool CMoratoriumStoneCard::BeforeResolution(CAbilityAction* pAction)
{
CCard* pTarget = pAction->GetAssociatedCard();
CCardFilter m_CardFilter1;
m_CardFilter1.AddComparer(new CardNameComparer(pTarget->GetPrintedCardName()));
m_CardFilter1.AddNegateComparer(new SpecificCardComparer(pTarget));
CCardFilter m_CardFilter2;
m_CardFilter2.AddComparer(new CardNameComparer(pTarget->GetPrintedCardName()));
CCountedCardContainer cardsGraveyard;
cardsGraveyard.AddCard(pTarget, CardPlacement::Top);
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
{
CZone* pGraveyard = GetGame()->GetPlayer(ip)->GetZoneById(ZoneId::Graveyard);
m_CardFilter1.GetIncluded(*pGraveyard, cardsGraveyard);
}
CCardFilter m_FinalFilterGraveyard;
m_FinalFilterGraveyard.SetComparer(new ContainedinComparer(&cardsGraveyard));
CZoneCardModifier* pModifier1 = new CZoneCardModifier(ZoneId::Graveyard, &m_FinalFilterGraveyard,
std::auto_ptr<CCardModifier>(new CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, TRUE, MoveType::Others, pAction->GetController())));
CZoneCardModifier* pModifier2 = new CZoneCardModifier(ZoneId::Battlefield, &m_CardFilter2,
std::auto_ptr<CCardModifier>(new CMoveCardModifier(ZoneId::Battlefield, ZoneId::Exile, TRUE, MoveType::Others, pAction->GetController())));
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
{
pModifier1->ApplyTo(GetGame()->GetPlayer(ip));
pModifier2->ApplyTo(GetGame()->GetPlayer(ip));
}
return false;
}
//____________________________________________________________________________
//
CBlindHunterCard::CBlindHunterCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Blind Hunter"), CardType::Creature, CREATURE_TYPE(Bat), nID,
_T("2") WHITE_MANA_TEXT BLACK_MANA_TEXT, Power(2), Life(2))
{
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this,
ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CBlindHunterCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredModifyLifeAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetLifeModifier().SetLifeDelta(Life(-2));
cpAbility->GetLifeModifier().SetDamageType(DamageType::NotDealingDamage); // life lost
cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().SetIncludePlayers(TRUE);
cpAbility->GetResolutionModifier().CPlayerModifiers::push_back(new CLifeModifier(Life(+2), this, PreventableType::NotPreventable));
cpAbility->AddAbilityTag(AbilityTag::LifeLost);
cpAbility->AddAbilityTag(AbilityTag::LifeGain);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredModifyLifeAbility, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, true, false, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetLifeModifier().SetLifeDelta(Life(-2));
cpAbility->GetLifeModifier().SetDamageType(DamageType::NotDealingDamage); // life lost
cpAbility->GetLifeModifier().SetPreventable(PreventableType::NotPreventable);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().SetIncludePlayers(TRUE);
cpAbility->GetResolutionModifier().CPlayerModifiers::Add(new CLifeModifier(Life(+2), this, PreventableType::NotPreventable));
cpAbility->AddAbilityTag(AbilityTag::LifeLost);
cpAbility->AddAbilityTag(AbilityTag::LifeGain);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CBlindHunterCard::SetTriggerContext1));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CBlindHunterCard::SetTriggerContext2));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
}
bool CBlindHunterCard::BeforeResolution(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool CBlindHunterCard::SetTriggerContext1(CTriggeredModifyLifeAbility::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
return Haunt;
}
bool CBlindHunterCard::SetTriggerContext2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
//____________________________________________________________________________
//
CCryOfContritionCard::CCryOfContritionCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Cry of Contrition"), CardType::Sorcery, nID)
, m_cpEventListener(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CCryOfContritionCard::OnResolutionCompleted))
{
{
counted_ptr<CTargetPlayerDiscardCardSpell> cpSpell(
::CreateObject<CTargetPlayerDiscardCardSpell>(this, AbilityType::Sorcery,
BLACK_MANA_TEXT,
1, MoveType::Discard, ZoneId::Graveyard, TRUE,
TRUE,
CCardFilter::GetFilter(_T("cards"))));
cpSpell->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener.GetPointer());
AddSpell(cpSpell.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CSpecialTrigger > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetTriggerIndex(1);
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Battlefield);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Graveyard);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CCryOfContritionCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredDiscardCardAbility, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, true, false, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().SetIncludePlayers(TRUE);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CCryOfContritionCard::SetTriggerContext1));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CCryOfContritionCard::SetTriggerContext2));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
}
void CCryOfContritionCard::OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult)
{
if (!bResult) return;
CSpecialEffectModifier pModifier = CSpecialEffectModifier(this, 1);
pModifier.ApplyTo(this);
}
bool CCryOfContritionCard::BeforeResolution(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool CCryOfContritionCard::SetTriggerContext1(CTriggeredDiscardCardAbility::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
return Haunt;
}
bool CCryOfContritionCard::SetTriggerContext2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
//____________________________________________________________________________
//
CExhumerThrullCard::CExhumerThrullCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Exhumer Thrull"), CardType::Creature, CREATURE_TYPE(Thrull), nID,
_T("5") BLACK_MANA_TEXT, Power(3), Life(3))
{
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this,
ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CExhumerThrullCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().SetThisCardsControllerOnly(this);
cpAbility->GetTargeting().SetSubjectZoneId(ZoneId::Graveyard);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Graveyard);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Hand);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Hand));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, false, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().SetThisCardsControllerOnly(this);
cpAbility->GetTargeting().SetSubjectZoneId(ZoneId::Graveyard);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Graveyard);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Hand);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Hand));
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CExhumerThrullCard::SetTriggerContext1));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CExhumerThrullCard::SetTriggerContext2));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
}
bool CExhumerThrullCard::BeforeResolution(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool CExhumerThrullCard::SetTriggerContext1(CTriggeredMoveCardAbility::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
return Haunt;
}
bool CExhumerThrullCard::SetTriggerContext2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
//____________________________________________________________________________
//
CAbsolverThrullCard::CAbsolverThrullCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Absolver Thrull"), CardType::Creature, CREATURE_TYPE(Thrull), nID,
_T("3") WHITE_MANA_TEXT, Power(2), Life(3))
{
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this,
ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CAbsolverThrullCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::_Enchantment, false));
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Graveyard);
cpAbility->GetMoveCardModifier().SetMoveType(MoveType::Destroy);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Graveyard));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, true, false, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new CardTypeComparer(CardType::_Enchantment, false));
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Graveyard);
cpAbility->GetMoveCardModifier().SetMoveType(MoveType::Destroy);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CAbsolverThrullCard::SetTriggerContext1));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CAbsolverThrullCard::SetTriggerContext2));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
}
bool CAbsolverThrullCard::BeforeResolution(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool CAbsolverThrullCard::SetTriggerContext1(CTriggeredMoveCardAbility::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
return Haunt;
}
bool CAbsolverThrullCard::SetTriggerContext2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
//____________________________________________________________________________
//
CBelfrySpiritCard::CBelfrySpiritCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Belfry Spirit"), CardType::Creature, CREATURE_TYPE(Spirit), nID,
_T("3") WHITE_MANA_TEXT WHITE_MANA_TEXT, Power(1), Life(1))
{
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this,
ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CBelfrySpiritCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredCreateTokenAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetCreateTokenOption(TRUE, _T("Bat A"), 2803, 2);
cpAbility->AddAbilityTag(AbilityTag::TokenCreation);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredCreateTokenAbility, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, true, false, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetCreateTokenOption(TRUE, _T("Bat A"), 2803, 2);
cpAbility->AddAbilityTag(AbilityTag::TokenCreation);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CBelfrySpiritCard::SetTriggerContext1));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CBelfrySpiritCard::SetTriggerContext2));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
}
bool CBelfrySpiritCard::BeforeResolution(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool CBelfrySpiritCard::SetTriggerContext1(CTriggeredCreateTokenAbility::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
return Haunt;
}
bool CBelfrySpiritCard::SetTriggerContext2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
//____________________________________________________________________________
//
CBenedictionOfMoonsCard::CBenedictionOfMoonsCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Benediction of Moons"), CardType::Sorcery, nID)
, m_cpEventListener(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CBenedictionOfMoonsCard::OnResolutionCompleted))
{
{
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Sorcery,
WHITE_MANA_TEXT));
cpSpell->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener.GetPointer());
AddSpell(cpSpell.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CSpecialTrigger > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetTriggerIndex(1);
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Battlefield);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Graveyard);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CBenedictionOfMoonsCard::BeforeResolution1));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, true, false, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CBenedictionOfMoonsCard::SetTriggerContext1));
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CBenedictionOfMoonsCard::BeforeResolution2));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CBenedictionOfMoonsCard::SetTriggerContext2));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
}
void CBenedictionOfMoonsCard::OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult)
{
if (!bResult) return;
CLifeModifier pModifier1 = CLifeModifier(Life(GetGame()->GetPlayerCount()), this, PreventableType::NotPreventable, DamageType::NotDealingDamage);
pModifier1.ApplyTo(pAbilityAction->GetController());
CSpecialEffectModifier pModifier2 = CSpecialEffectModifier(this, 1);
pModifier2.ApplyTo(this);
}
bool CBenedictionOfMoonsCard::BeforeResolution1(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool CBenedictionOfMoonsCard::SetTriggerContext1(CTriggeredAbility<>::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
return Haunt;
}
bool CBenedictionOfMoonsCard::BeforeResolution2(CAbilityAction* pAction)
{
CLifeModifier pModifier = CLifeModifier(Life(GetGame()->GetPlayerCount()), this, PreventableType::NotPreventable, DamageType::NotDealingDamage);
pModifier.ApplyTo(pAction->GetController());
return true;
}
bool CBenedictionOfMoonsCard::SetTriggerContext2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
//____________________________________________________________________________
//
CGravenDominatorCard::CGravenDominatorCard(CGame* pGame, UINT nID)
: CFlyingCreatureCard(pGame, _T("Graven Dominator"), CardType::Creature, CREATURE_TYPE(Gargoyle), nID,
_T("4") WHITE_MANA_TEXT WHITE_MANA_TEXT, Power(4), Life(4))
{
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this,
ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CGravenDominatorCard::BeforeResolution1));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CGravenDominatorCard::BeforeResolution2));
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, true, false, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CGravenDominatorCard::SetTriggerContext1));
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CGravenDominatorCard::BeforeResolution3));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CGravenDominatorCard::SetTriggerContext2));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
}
bool CGravenDominatorCard::BeforeResolution1(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool CGravenDominatorCard::BeforeResolution2(CAbilityAction* pAction)
{
CCardFilter m_CardFilter;
m_CardFilter.AddComparer(new AnyCreatureComparer);
m_CardFilter.AddNegateComparer(new SpecificCardComparer(this));
CPowerModifier* pModifier1 = new CPowerModifier(Power(1), TRUE, TRUE);
pModifier1->SetReplacement(TRUE);
CLifeModifier* pModifier2 = new CLifeModifier(Life(1), this, PreventableType::NotPreventable, DamageType::NotDealingDamage, TRUE, TRUE);
pModifier2->SetReplacement(TRUE);
CZoneCreatureModifier pModifier3 = CZoneCreatureModifier(ZoneId::Battlefield, &m_CardFilter,
std::auto_ptr<CCreatureModifier>(pModifier1));
CZoneCreatureModifier pModifier4 = CZoneCreatureModifier(ZoneId::Battlefield, &m_CardFilter,
std::auto_ptr<CCreatureModifier>(pModifier2));
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
{
pModifier3.ApplyTo(GetGame()->GetPlayer(ip));
pModifier4.ApplyTo(GetGame()->GetPlayer(ip));
}
return true;
}
bool CGravenDominatorCard::SetTriggerContext1(CTriggeredAbility<>::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
return Haunt;
}
bool CGravenDominatorCard::BeforeResolution3(CAbilityAction* pAction)
{
CPowerModifier* pModifier1 = new CPowerModifier(Power(1), TRUE, TRUE);
pModifier1->SetReplacement(TRUE);
CLifeModifier* pModifier2 = new CLifeModifier(Life(1), this, PreventableType::NotPreventable, DamageType::NotDealingDamage, TRUE, TRUE);
pModifier2->SetReplacement(TRUE);
CZoneCreatureModifier pModifier3 = CZoneCreatureModifier(ZoneId::Battlefield, CCardFilter::GetFilter(_T("creatures")),
std::auto_ptr<CCreatureModifier>(pModifier1));
CZoneCreatureModifier pModifier4 = CZoneCreatureModifier(ZoneId::Battlefield, CCardFilter::GetFilter(_T("creatures")),
std::auto_ptr<CCreatureModifier>(pModifier2));
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
{
pModifier3.ApplyTo(GetGame()->GetPlayer(ip));
pModifier4.ApplyTo(GetGame()->GetPlayer(ip));
}
return true;
}
bool CGravenDominatorCard::SetTriggerContext2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
//____________________________________________________________________________
//
COrzhovEuthanistCard::COrzhovEuthanistCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Orzhov Euthanist"), CardType::Creature, CREATURE_TYPE2(Human, Assassin), nID,
_T("2") BLACK_MANA_TEXT, Power(2), Life(2))
{
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this,
ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &COrzhovEuthanistCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new CreatureFlagComparer(CreatureFlag::_TakenDamage, false));
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Graveyard);
cpAbility->GetMoveCardModifier().SetMoveType(MoveType::Destroy);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Graveyard));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, true, false, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().SetDefaultCharacteristic(Characteristic::Negative);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new CreatureFlagComparer(CreatureFlag::_TakenDamage, false));
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Graveyard);
cpAbility->GetMoveCardModifier().SetMoveType(MoveType::Destroy);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &COrzhovEuthanistCard::SetTriggerContext1));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &COrzhovEuthanistCard::SetTriggerContext2));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
}
bool COrzhovEuthanistCard::BeforeResolution(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool COrzhovEuthanistCard::SetTriggerContext1(CTriggeredMoveCardAbility::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
return Haunt;
}
bool COrzhovEuthanistCard::SetTriggerContext2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
//____________________________________________________________________________
//
COrzhovPontiffCard::COrzhovPontiffCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Orzhov Pontiff"), CardType::Creature, CREATURE_TYPE2(Human, Cleric), nID,
_T("1") WHITE_MANA_TEXT BLACK_MANA_TEXT, Power(1), Life(1))
, m_ModeSelection(pGame, CSelectionSupport::SelectionCallback(this, &COrzhovPontiffCard::OnModeSelected))
{
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this,
ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &COrzhovPontiffCard::BeforeResolution1));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfInplay,
CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &COrzhovPontiffCard::SetTriggerContextAux1));
cpAbility->SetSkipStack(TRUE);
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, true, false, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &COrzhovPontiffCard::SetTriggerContextAux2));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &COrzhovPontiffCard::SetTriggerContext));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CSpecialTrigger > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetTriggerIndex(CHOICE_1_TRIGGER_ID);
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Battlefield);
cpAbility->SetModifyCreatureOption(TriggeredAbility::ModifyCreatureOption::ModifyTriggeredPlayersCreatures);
cpAbility->GetPowerModifier().SetPowerDelta(Power(+1));
cpAbility->GetLifeModifier().SetLifeDelta(Life(+1));
cpAbility->SetAbilityName(_T("Mode 1 - +1/+1"));
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredModifyCreatureAbility, CSpecialTrigger > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetTriggerIndex(CHOICE_1_TRIGGER_ID);
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Exile);
cpAbility->SetModifyCreatureOption(TriggeredAbility::ModifyCreatureOption::ModifyTriggeredPlayersCreatures);
cpAbility->GetPowerModifier().SetPowerDelta(Power(+1));
cpAbility->GetLifeModifier().SetLifeDelta(Life(+1));
cpAbility->SetAbilityName(_T("Mode 1 - +1/+1"));
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CSpecialTrigger > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetTriggerIndex(CHOICE_2_TRIGGER_ID);
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Battlefield);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &COrzhovPontiffCard::BeforeResolution2));
cpAbility->SetAbilityName(_T("Mode 2 - -1/-1"));
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CSpecialTrigger > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetTriggerIndex(CHOICE_2_TRIGGER_ID);
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Exile);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &COrzhovPontiffCard::BeforeResolution2));
cpAbility->SetAbilityName(_T("Mode 2 - -1/-1"));
cpAbility->AddAbilityTag(AbilityTag::CreatureChange);
AddAbility(cpAbility.GetPointer());
}
}
bool COrzhovPontiffCard::BeforeResolution1(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool COrzhovPontiffCard::SetTriggerContextAux1(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
std::vector<SelectionEntry> entries;
{
SelectionEntry selectionEntry;
selectionEntry.dwContext = 1;
selectionEntry.strText.Format(_T("%s: Creatures you control get +1/+1 until end of turn"), GetCardName(TRUE));
entries.push_back(selectionEntry);
}
{
SelectionEntry selectionEntry;
selectionEntry.dwContext = 2;
selectionEntry.strText.Format(_T("%s: Creatures you don't control get -1/-1 until end of turn"), GetCardName(TRUE));
entries.push_back(selectionEntry);
}
m_ModeSelection.AddSelectionRequest(entries, 1, 1, NULL, GetController());
return false;
}
bool COrzhovPontiffCard::SetTriggerContextAux2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
if (Haunt)
{
std::vector<SelectionEntry> entries;
{
SelectionEntry selectionEntry;
selectionEntry.dwContext = 1;
selectionEntry.strText.Format(_T("%s: Creatures you control get +1/+1 until end of turn"), GetCardName(TRUE));
entries.push_back(selectionEntry);
}
{
SelectionEntry selectionEntry;
selectionEntry.dwContext = 2;
selectionEntry.strText.Format(_T("%s: Creatures you don't control get -1/-1 until end of turn"), GetCardName(TRUE));
entries.push_back(selectionEntry);
}
m_ModeSelection.AddSelectionRequest(entries, 1, 1, NULL, GetController());
}
return false;
}
bool COrzhovPontiffCard::SetTriggerContext(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
void COrzhovPontiffCard::OnModeSelected(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5)
{
ATLASSERT(nSelectedCount == 1);
for (std::vector<SelectionEntry>::const_iterator it = selection.begin(); it != selection.end(); ++it)
if (it->bSelected)
{
if ((int)it->dwContext == 1)
{
if (!m_pGame->IsThinking())
{
CString strMessage;
strMessage.Format(_T("%s chooses first mode"), pSelectionPlayer->GetPlayerName());
m_pGame->Message(
strMessage,
pSelectionPlayer->IsComputer() ? m_pGame->GetComputerImage() : m_pGame->GetHumanImage(),
MessageImportance::High
);
}
CSpecialEffectModifier pModifier = CSpecialEffectModifier(this, CHOICE_1_TRIGGER_ID);
pModifier.ApplyTo(this);
return;
}
if ((int)it->dwContext == 2)
{
if (!m_pGame->IsThinking())
{
CString strMessage;
strMessage.Format(_T("%s chooses second mode"), pSelectionPlayer->GetPlayerName());
m_pGame->Message(
strMessage,
pSelectionPlayer->IsComputer() ? m_pGame->GetComputerImage() : m_pGame->GetHumanImage(),
MessageImportance::High
);
}
CSpecialEffectModifier pModifier = CSpecialEffectModifier(this, CHOICE_2_TRIGGER_ID);
pModifier.ApplyTo(this);
return;
}
return;
}
}
bool COrzhovPontiffCard::BeforeResolution2(CAbilityAction* pAction)
{
CPowerModifier* pModifier1 = new CPowerModifier(Power(-1));
CLifeModifier* pModifier2 = new CLifeModifier(Life(-1), this, PreventableType::NotPreventable, DamageType::NotDealingDamage);
CZoneCreatureModifier pModifier3 = CZoneCreatureModifier(ZoneId::Battlefield, CCardFilter::GetFilter(_T("creatures")),
std::auto_ptr<CCreatureModifier>(pModifier1));
CZoneCreatureModifier pModifier4 = CZoneCreatureModifier(ZoneId::Battlefield, CCardFilter::GetFilter(_T("creatures")),
std::auto_ptr<CCreatureModifier>(pModifier2));
for (int ip = 0; ip < GetGame()->GetPlayerCount(); ++ip)
if (GetGame()->GetPlayer(ip) != pAction->GetController())
{
pModifier3.ApplyTo(GetGame()->GetPlayer(ip));
pModifier4.ApplyTo(GetGame()->GetPlayer(ip));
}
return true;
}
//____________________________________________________________________________
//
CSeizeTheSoulCard::CSeizeTheSoulCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Seize the Soul"), CardType::Instant, nID)
, m_cpEventListener1(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CSeizeTheSoulCard::OnResolutionCompleted1))
, m_cpEventListener2(VAR_NAME(m_cpListener), ResolutionCompletedEventSource::Listener::EventCallback(this,
&CSeizeTheSoulCard::OnResolutionCompleted2))
{
{
counted_ptr<CTargetMoveCardSpell> cpSpell(
::CreateObject<CTargetMoveCardSpell>(this, AbilityType::Instant,
_T("2") BLACK_MANA_TEXT BLACK_MANA_TEXT,
new AnyCreatureComparer,
ZoneId::Battlefield, ZoneId::Graveyard, TRUE, MoveType::Destroy));
cpSpell->GetTargeting()->GetSubjectCardFilter().AddNegateComparer(new CardTypeComparer(CardType::White | CardType::Black, false));
cpSpell->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener1.GetPointer());
AddSpell(cpSpell.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredAbility<>, CSpecialTrigger > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetTriggerIndex(1);
cpAbility->GetTrigger().GetCardFilterHelper().SetFilterType(CCardFilterHelper::FilterType::Custom);
cpAbility->GetTrigger().GetCardFilterHelper().GetCustomFilter().AddComparer(new SpecificCardComparer(this));
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Battlefield);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->SetTriggerToPlayerOption(TriggerToPlayerOption::TriggerToParameter1);
cpAbility->GetTrigger().SetTriggerinZone(ZoneId::Graveyard);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CSeizeTheSoulCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Graveyard, ZoneId::Exile));
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredTargetAbility< CTriggeredMoveCardAbility, CWhenCardMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Battlefield, ZoneId::Graveyard, true, false, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTargeting().GetSubjectCardFilter().AddComparer(new AnyCreatureComparer);
cpAbility->GetTargeting().GetSubjectCardFilter().AddNegateComparer(new CardTypeComparer(CardType::White | CardType::Black, false));
cpAbility->GetMoveCardModifier().SetFromZone(ZoneId::Battlefield);
cpAbility->GetMoveCardModifier().SetToZone(ZoneId::Graveyard);
cpAbility->GetMoveCardModifier().SetMoveType(MoveType::Destroy);
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Graveyard));
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CSeizeTheSoulCard::SetTriggerContext1));
cpAbility->GetResolutionCompletedEventSource()->AddListener(m_cpEventListener2.GetPointer());
AddAbility(cpAbility.GetPointer());
}
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenSelfMoved > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, ZoneId::Exile, ZoneId::_AllZones, true, false));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CSeizeTheSoulCard::SetTriggerContext2));
cpAbility->SetSkipStack(TRUE);
AddAbility(cpAbility.GetPointer());
}
}
void CSeizeTheSoulCard::OnResolutionCompleted1(const CAbilityAction* pAbilityAction, BOOL bResult)
{
if (!bResult) return;
CTokenCreationModifier pModifier1 = CTokenCreationModifier(GetGame(), _T("Spirit J"), 2944, 1);
pModifier1.ApplyTo(pAbilityAction->GetController());
CSpecialEffectModifier pModifier2 = CSpecialEffectModifier(this, 1);
pModifier2.ApplyTo(this);
}
void CSeizeTheSoulCard::OnResolutionCompleted2(const CAbilityAction* pAbilityAction, BOOL bResult)
{
if (!bResult) return;
CTokenCreationModifier pModifier = CTokenCreationModifier(GetGame(), _T("Spirit J"), 2944, 1);
pModifier.ApplyTo(pAbilityAction->GetController());
}
bool CSeizeTheSoulCard::BeforeResolution(CAbilityAction* pAction)
{
if (IsInGraveyard())
{
CMoveCardModifier pModifier = CMoveCardModifier(ZoneId::Graveyard, ZoneId::Exile, true, MoveType::Others, pAction->GetController());
pModifier.ApplyTo(this);
pHaunting.RemoveAll();
pHaunting.AddCard(pAction->GetAssociatedCard(), CardPlacement::Top);
}
return true;
}
bool CSeizeTheSoulCard::SetTriggerContext1(CTriggeredMoveCardAbility::TriggerContextType& triggerContext,
CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
if (GetZone()->GetZoneId() != ZoneId::Exile) return false;
bool Haunt = false;
if ((pHaunting.GetSize() > 0) && (pHaunting.GetAt(0) == pCard))
{
if (pToZone->GetZoneId() == ZoneId::Graveyard)
Haunt = true;
pHaunting.RemoveAll();
}
return Haunt;
}
bool CSeizeTheSoulCard::SetTriggerContext2(CTriggeredAbility<>::TriggerContextType& triggerContext,
CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType)
{
pHaunting.RemoveAll();
return false;
}
//____________________________________________________________________________
//
CGhostwayCard::CGhostwayCard(CGame* pGame, UINT nID)
: CCard(pGame, _T("Ghostway"), CardType::Instant, nID)
{
counted_ptr<CGenericSpell> cpSpell(
::CreateObject<CGenericSpell>(this, AbilityType::Instant,
_T("2") WHITE_MANA_TEXT));
cpSpell->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CGhostwayCard::BeforeResolution));
AddSpell(cpSpell.GetPointer());
}
bool CGhostwayCard::BeforeResolution(CAbilityAction* pAction) const
{
CPlayer* pController = pAction->GetController();
CZone* pBattlefield = pController->GetZoneById(ZoneId::Battlefield);
CMoveCardModifier pModifier1 = CMoveCardModifier(ZoneId::Battlefield, ZoneId::Exile, true, MoveType::Others, pController);
CCountedCardContainer pSubjects;
for (int i = pBattlefield->GetSize() - 1; i >= 0; --i)
{
CCard* pCard = pBattlefield->GetAt(i);
if (pCard->GetCardType().IsCreature())
{
pModifier1.ApplyTo(pCard);
if (pCard->GetZoneId() == ZoneId::Exile)
pSubjects.AddCard(pCard, CardPlacement::Top);
}
}
CContainerEffectModifier pModifier = CContainerEffectModifier(GetGame(), _T("End Step Return from Exile Effect"), 61057, &pSubjects);
pModifier.ApplyTo(pController);
return true;
}
//____________________________________________________________________________
//
CKillerInstinctCard::CKillerInstinctCard(CGame* pGame, UINT nID)
: CInPlaySpellCard(pGame, _T("Killer Instinct"), CardType::GlobalEnchantment, nID,
_T("4") RED_MANA_TEXT GREEN_MANA_TEXT, AbilityType::Enchantment)
{
typedef
TTriggeredAbility< CTriggeredAbility<>, CWhenNodeChanged > TriggeredAbility;
counted_ptr<TriggeredAbility> cpAbility(
::CreateObject<TriggeredAbility>(this, NodeId::UpkeepStep));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->GetTrigger().SetMonitorControllerOnly(TRUE);
cpAbility->SetResolutionStartedCallback(CAbility::ResolutionStartedCallback(this, &CKillerInstinctCard::BeforeResolution));
AddAbility(cpAbility.GetPointer());
}
bool CKillerInstinctCard::BeforeResolution(CAbilityAction* pAction)
{
CPlayer* pController = pAction->GetController();
CZone* pLibrary = pController->GetZoneById(ZoneId::Library);
if (pLibrary->GetSize() == 0) return true;
CZoneModifier pModifier = CZoneModifier(GetGame(), ZoneId::Library, 1, CZoneModifier::RoleType::PrimaryPlayer,
CardPlacement::Top, CZoneModifier::RoleType::AllPlayers);
pModifier.ApplyTo(pController);
CCard* pCard = pLibrary->GetTopCard();
if (pCard->GetCardType().IsCreature())
{
CMoveCardModifier pModifier1 = CMoveCardModifier(ZoneId::Library, ZoneId::Battlefield, true, MoveType::Others, pController);
pModifier1.ApplyTo(pCard);
CCreatureKeywordModifier pModifier2 = CCreatureKeywordModifier(CreatureKeyword::Haste, TRUE);
pModifier2.ApplyTo((CCreatureCard*)pCard);
CCountedCardContainer pSubjects;
if (pCard->IsInplay())
pSubjects.AddCard(pCard, CardPlacement::Top);
CContainerEffectModifier pModifier3 = CContainerEffectModifier(GetGame(), _T("End Step Sacrifice Effect"), 61058, &pSubjects);
pModifier3.ApplyTo(pController);
}
return true;
}
//____________________________________________________________________________
//
CVertigoSpawnCard::CVertigoSpawnCard(CGame* pGame, UINT nID)
: CCreatureCard(pGame, _T("Vertigo Spawn"), CardType::Creature, CREATURE_TYPE(Illusion), nID,
_T("1") BLUE_MANA_TEXT, Power(0), Life(3))
{
GetCreatureKeyword()->AddDefender(FALSE);
{
counted_ptr<TriggeredAbility> cpAbility(::CreateObject<TriggeredAbility>(this));
cpAbility->SetOptionalType(TriggeredAbility::OptionalType::Required);
cpAbility->SetContextFunction(TriggeredAbility::ContextFunction(this, &CVertigoSpawnCard::SetTriggerContext));
cpAbility->SetBeforeResolveSelectionCallback(TriggeredAbility::BeforeResolveSelectionCallback(this, &CVertigoSpawnCard::BeforeResolution));
cpAbility->AddAbilityTag(AbilityTag(ZoneId::Battlefield, ZoneId::Hand));
AddAbility(cpAbility.GetPointer());
}
}
bool CVertigoSpawnCard::SetTriggerContext(CTriggeredAbility<>::TriggerContextType& triggerContext,
CCreatureCard* pCreature, BOOL bBlocked, CCreatureCard* pCreature2, int nCount, int nIndex) const
{
triggerContext.nValue1 = (DWORD)pCreature2;
return (IsBlocking() == TRUE);
}
bool CVertigoSpawnCard::BeforeResolution(TriggeredAbility::TriggeredActionType* pAction)
{
CCard* pCard = (CCard*)pAction->GetTriggerContext().nValue1;
CCardOrientationModifier pModifier1 = CCardOrientationModifier();
CCardKeywordModifier pModifier2 = CCardKeywordModifier(CardKeyword::NoUntapInNextContUntap, TRUE, FALSE);
pModifier1.ApplyTo(pCard);
pModifier2.ApplyTo(pCard);
return true;
}
//____________________________________________________________________________
//
|
119837c768e78b28958e39fd1f54ab0aa5f53cae
|
4cb6314478f5e940aff0df4751d4052959b3c24a
|
/qt-trg/verifywindow.cpp
|
5ddc15a929a93565415ec4b878b64964ee6f3d36
|
[
"MIT"
] |
permissive
|
MartensCedric/qt-trustless-random-generator
|
465a47f508cbf0e0f2217184da82362fa2680d51
|
dcc1bd532a9c135d939e78e6d0e07077dbf90dc9
|
refs/heads/master
| 2022-01-07T18:03:33.745318
| 2019-07-10T18:15:04
| 2019-07-10T18:15:04
| 118,159,128
| 2
| 2
|
MIT
| 2019-07-10T18:15:05
| 2018-01-19T17:54:39
|
C++
|
UTF-8
|
C++
| false
| false
| 1,895
|
cpp
|
verifywindow.cpp
|
#include "verifywindow.h"
#include <QComboBox>
#include <QFormLayout>
#include <QLabel>
#include <QLineEdit>
#include <iostream>
#include <qpushbutton.h>
#include <QStatusBar>
VerifyWindow::VerifyWindow(QWidget *parent) :
QMainWindow(parent)
{
resize(WIDTH, HEIGHT);
//this->layout()->setSizeConstraint(QLayout::SetFixedSize);
setWindowTitle(tr("Verify results"));
QLabel* lblBlockchain = new QLabel(this);
lblBlockchain->setText(tr("Blockchain : "));
lblBlockchain->move(20, 20);
cboBlockchain = new QComboBox(this);
cboBlockchain->addItems(QStringList() << "BTC" << "ETH" << "LTC" << "DASH");
cboBlockchain->move(100, 20);
connect(cboBlockchain, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateBlockchain(QString)));
blockchain = new QString("BTC");
QLabel* lblHash = new QLabel(this);
lblHash->setText(tr("Hash : "));
lblHash->move(20, 60);
leHash = new QLineEdit(this);
leHash->move(70, 60);
leHash->resize(WIDTH - lblHash->size().width()/2 - 40, leHash->size().height());
connect(leHash, SIGNAL(textChanged(QString)), this, SLOT(updateButton(QString)));
btnVerify = new QPushButton(this);
btnVerify->setText(tr("Verify results"));
btnVerify->move(20, 100);
btnVerify->resize(WIDTH - 40, btnVerify->size().height());
btnVerify->setEnabled(false);
connect(btnVerify, SIGNAL(clicked()), this, SIGNAL(verify()));
}
void VerifyWindow::showClear()
{
leHash->clear();
cboBlockchain->setCurrentIndex(0);
show();
}
void VerifyWindow::updateButton(QString text)
{
btnVerify->setEnabled(text.length() > 0);
delete hash;
hash = new QString(text);
}
void VerifyWindow::updateBlockchain(QString text)
{
delete blockchain;
blockchain = new QString(text);
}
VerifyWindow::~VerifyWindow()
{
delete btnVerify;
delete hash;
delete blockchain;
}
|
0ae5206ff6bf1824491da9c80877340c788735c5
|
ba01603bcdf696987504e5aa78587a3cb48e5b8a
|
/ip-core/include/ip/core/logging/BackgroundLogger.h
|
c9ae81a982c5d8a344268c93fe0f6a3cba123090
|
[] |
no_license
|
bretambrose/vulkan-dev
|
a24c2701dc5210304a8711ce187d70a44a77b212
|
1b2f192e8758277c95afc5ddfbd15131ca5df078
|
refs/heads/master
| 2022-01-28T15:26:53.630187
| 2019-05-19T23:41:51
| 2019-05-19T23:41:51
| 105,370,220
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 526
|
h
|
BackgroundLogger.h
|
#pragma once
#include <thread>
#include <ip/core/logging/ILogger.h>
namespace IP
{
namespace Logging
{
struct BackgroundLoggerThreadData;
class BackgroundLogger : public ILogger
{
public:
BackgroundLogger(const LoggerFactory& factory);
virtual ~BackgroundLogger();
virtual void Log(LogEntry&& entry) override;
private:
std::shared_ptr<BackgroundLoggerThreadData> m_threadData;
IP::UniquePtr<std::thread> m_backgroundThread;
};
} // namespace Logging
} // namespace IP
|
9211327f11fce7aeba771414708b55ab54731f37
|
3423291c13700a5f1bea9d5c5d0047aaf3c53958
|
/pmake/pmake/MANAGER.h
|
2cf8758c4d11cb3f85b92330f828a7b76537baa9
|
[] |
no_license
|
yumayo/mogupro_utl
|
bbf0203fd011c5f682eef10b8d56fa9ed75c835b
|
42b6835c4927f8cef574b766c43249e50f77e718
|
refs/heads/master
| 2021-09-05T13:58:52.597117
| 2018-01-28T13:56:47
| 2018-01-28T13:56:47
| 114,378,354
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 234
|
h
|
MANAGER.h
|
public:
Packet::_TYPE_::c_TEMPLATE_VALUE_ get_TEMPLATE_VALUE_( );
void unget_TEMPLATE_VALUE_( Packet::_TYPE_::c_TEMPLATE_VALUE_ const& data );
private:
std::stack<Packet::_TYPE_::c_TEMPLATE_VALUE_> m_TEMPLATE_VALUE_;
|
f7eaf0bd08a1bbb2c305c99c9e9462e8a6750204
|
196d3d1e534cff90087f9ef1311af36b928a6fc2
|
/version 0.1/console/playing_field.h
|
76b37c70c90acc21624ba31e9a961515b7372773
|
[] |
no_license
|
akulinich/tic-tac-toe
|
4f93b7331efefef856e7f5972d7baa615f715a7e
|
a4fdbf5e046af5e9ed1c42b6de71039c09312423
|
refs/heads/master
| 2021-01-10T21:23:28.148654
| 2014-08-26T18:45:54
| 2014-08-26T18:45:54
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 638
|
h
|
playing_field.h
|
#ifndef PLAYING_FIELD_H
#define PLAYING_FIELD_H
#include <vector>
using std::vector;
enum Player {
TICK,
TOE,
EMPTY
};
enum GameStatus {
TICK_WIN,
TOE_WIN,
DRAW,
IN_PROGRESS
};
struct Position {
int x_cor;
int y_cor;
Position(int x_cor, int y_cor);
};
class PlayingField {
vector<vector<Player>> field;
bool check_positon_to_win(const Position& position);
public:
explicit PlayingField(int size_of_field);
void do_turn(const Position& position, Player player);
GameStatus end_game_check();
void reset_game();
void print_game();
};
#endif
|
71ebd95fb41260e9bcfd2d69c238c807e55b8cc6
|
84c0f3189fa4dfcf1f0490576abfe5c52759fc4e
|
/Meliq_Melqonyan/Homeworks/c++/11.11.04.18/mergeSort.cpp
|
b194b254b413a3e5dd378402458e2ee2b881b9fb
|
[] |
no_license
|
Araksya-Hambaryan/ITC-9
|
bfb2741c52f5de208d3637e33ed3bb547dd0971a
|
c44b4603a9ddd4395bac86808b3c42217ea60879
|
refs/heads/master
| 2023-02-11T16:11:30.324645
| 2021-05-16T18:45:13
| 2021-05-16T18:45:13
| 127,136,193
| 1
| 7
| null | 2023-01-26T03:22:51
| 2018-03-28T12:22:48
|
Java
|
UTF-8
|
C++
| false
| false
| 1,354
|
cpp
|
mergeSort.cpp
|
#include <iostream>
int a[5];
struct Rect {
int lenght;
int width;
Rect(int a, int b) {
lenght = a;
width = b;
}
int bazm() {
return lenght * width;
}
};
void merge(int, int, int);
void merge_sort(int low,int high) {
int mid;
if(low < high) {
mid = low + (high-low) / 2;
merge_sort(low, mid);
merge_sort(mid+1, high);
merge(low, mid, high);
}
}
void merge(int low, int mid, int high) {
int h, i, j, b[50], k;
h = low;
i = low;
j = mid+1;
while((h <= mid) && (j <= high)) {
if(a[h] <= a[j]) {
b[i]=a[h];
++h;
} else {
b[i] = a[j];
++j;
}
++i;
}
if(h > mid) {
for(k = j; k <= high; ++k) {
b[i] = a[k];
++i;
}
} else {
for(k = h; k <= mid; ++k) {
b[i] = a[k];
++i;
}
}
for(k = low; k <= high; ++k) {
a[k] = b[k];
}
}
int main() {
const int size = 5;
Rect arr[size]{{1,2}, {3,5}, {8,2}, {9,2}, {4,1}};
for(int i = 0; i < size; ++i) {
a[i] = arr[i].bazm();
}
merge_sort(0, 4);
for(int i = 0; i < size; ++i) {
std::cout << a[i] << " ";
}
std::cout << '\n';
return 0;
}
|
f1232efdf672a4f668c6650610f20c05343bcbda
|
908d925380c958868fc7dea7f310d2cdce0f5a6e
|
/BookSamples/Capitolo10/Pa_MidiSynth/Pa_MidiSynth/adsr.cpp
|
33903770460f667faa355945ecd207909d2e873e
|
[
"MIT"
] |
permissive
|
mscarpiniti/ArtBook
|
3d153a012ce4a24c4d77dad443c1299cf6af0520
|
ca74c773c7312d22329cc453f4a5a799fe2dd587
|
refs/heads/main
| 2023-09-04T07:48:26.864011
| 2021-09-28T14:05:52
| 2021-09-28T14:05:52
| 374,614,762
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,264
|
cpp
|
adsr.cpp
|
#include "adsr.h"
void adsr::updateDcyFactors() {
m_dcy_const = ((m_atk_time * (1 - m_dcy_lev)) / m_dcy_time) + 1;
m_dcy_factor = (m_dcy_lev - 1)/m_dcy_time;
}
void adsr::updateSusFactors() {
m_sus_const = m_dcy_lev - (m_dcy_time * ((m_sus_lev - m_dcy_lev)/(m_sus_time - m_dcy_time)));
m_sus_factor = (m_sus_lev - m_dcy_lev)/(m_sus_time - m_dcy_time);
}
adsr::adsr():
m_dcy_const(0),
m_dcy_factor(0),
m_sus_const(0),
m_sus_factor(0)
{
m_note_pressed = false;
m_is_playing = false;
m_rls_level = 0;
m_out_value = 0;
}
void adsr::SetParameter(AdsrParams p_param, double p_val)
{
switch(p_param) {
case Adsr_AttackTime:
m_atk_time = p_val * 44.1;
break;
case Adsr_DecayTime:
m_dcy_time = p_val * 44.1;
break;
case Adsr_DecayLevel:
m_dcy_lev = p_val;
break;
case Adsr_SustainTime:
m_sus_time = p_val * 44.1;
break;
case Adsr_SustainLevel:
m_sus_lev = p_val;
break;
case Adsr_ReleaseTime:
m_rls_time = p_val * 44.1;
break;
default:
break;
}
updateDcyFactors();
updateSusFactors();
}
void adsr::NoteReleased()
{
m_note_pressed = false;
m_rls_level = m_out_value;
m_adsr_time = 0;
}
void adsr::NotePressed()
{
m_note_pressed = true;
m_is_playing = true;
m_rls_level = 0;
m_out_value = 0;
}
bool adsr::IsPlaying()
{
return m_is_playing;
}
double adsr::GetLevel(unsigned long int p_time)
{
if (m_note_pressed) {
if (p_time <= m_atk_time) {
m_out_value = ((double)p_time/m_atk_time);
} else if (p_time > m_atk_time && p_time < (m_atk_time + m_dcy_time)) {
m_out_value = (p_time * m_dcy_factor) + m_dcy_const;
} else if (p_time > (m_atk_time + m_dcy_time) && p_time < (m_atk_time + m_dcy_time + m_sus_time)) {
m_out_value = (p_time * m_sus_factor) + m_sus_const;
}
} else {
m_out_value = m_rls_level - (m_adsr_time++ * (m_rls_level/m_rls_time));
}
if (!m_note_pressed && m_out_value <= 0) {
m_is_playing = false;
}
return m_out_value;
}
|
6c21cef2a4f3b208da5e850c8cb4c8c326bd4d99
|
ccc2f56f2a273ef17d1c0a5105b9c0832a6de47e
|
/shopwater.cpp
|
c01072d352492556b6f90456efa7fc82a8948269
|
[] |
no_license
|
clonerex123/DataStructure
|
d1f4513abd379fee096a772236b43ed2c4095ddc
|
f36de980809f6b2d8e7719935d71471b003279f1
|
refs/heads/master
| 2023-01-02T20:20:29.642627
| 2020-10-26T22:00:43
| 2020-10-26T22:00:43
| 299,992,425
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 258
|
cpp
|
shopwater.cpp
|
#include<iostream>
#include<string>
#include "watertank.cpp"
int main(){
WaterTank t1{"collecter1", false,250,"outside,rear"};
WaterTank t2{"tinyPressure"};
cout << "T1 Capacity" << t1.maxCapacity << '\n';
cout << "T2 name" << t2.getID() << '\n';
}
|
1447bd0b0ac96c2047d9035399b35e5a2349f71b
|
48f71cc36854c8e3f3ea57aba2a38646a8d63004
|
/shirabeengine/shirabeengine/code/include/ecws/entity.h
|
d83407d3ef225aa4eeb196bacd1e621343553602
|
[
"MIT"
] |
permissive
|
Fraaanzi/ShirabeEngine
|
10b6a5bb736432e3fd22b8d32324fd2b6b0396b2
|
39b3aa2c5173084d59b96b7f60c15207bff0ad04
|
refs/heads/master
| 2020-12-07T23:45:58.001712
| 2019-12-30T21:32:24
| 2019-12-30T21:32:24
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,954
|
h
|
entity.h
|
#ifndef __SHIRABE_ENTITY_H__
#define __SHIRABE_ENTITY_H__
#include "core/enginestatus.h"
#include "ecws/icomponent.h"
namespace engine::ecws
{
/**
* A CEntity instance describes an engine entity, which can be enriched by various
* types of engine components.
*/
class CEntity
{
public_constructors:
explicit CEntity(std::string aName);
public_destructors:
~CEntity();
public_methods:
/**
* Return the name of the component.
*
* @return See brief.
*/
[[nodiscard]]
SHIRABE_INLINE const std::string &name() const { return mName; }
/**
* Set the component name.
*
* @param aName The new name of the component.
*/
SHIRABE_INLINE void setName(std::string const& aName) { mName = aName; }
/**
* Update the component with an optionally usable timer component.
*
* @param aTimer A timer providing the currently elapsed time.
* @return Return EEngineStatus::Ok, if successful. An error code otherwise.
*/
EEngineStatus update(CTimer const &aTimer);
/**
* Add a component to the internal component collection.
*
* @param aComponent The component to add to the entity instance.
* @return EEngineStatus::Ok, if successful. An error code otherwise.
*/
template <typename TComponent>
EEngineStatus addComponent(Shared<TComponent> const &aComponent);
/**
* Remove a component from the internal component collection.
*
* @param aComponent The component to add to the entity instance.
* @return EEngineStatus::Ok, if successful. An error code otherwise.
*/
template <typename TComponent>
EEngineStatus removeComponent(Shared<TComponent> const &aComponent);
/**
* Check, wether a specific component type is available in the internal component collection.
*
* @tparam TComponent The type of component to check for.
*/
template<typename TComponent>
[[nodiscard]]
bool hasComponentOfType() const;
/**
* Fetch a list of components of specific type TComponent, if any.
*
* @tparam TComponent The type of component to enumerate.
*/
template <typename TComponent>
CBoundedCollection<Shared<TComponent>> const getTypedComponentsOfType() const;
private_members:
std::string mName;
IComponentMap mComponents;
};
//<-----------------------------------------------------------------------------
//
//<-----------------------------------------------------------------------------
template <typename TComponent>
EEngineStatus CEntity::addComponent(Shared<TComponent> const &aComponent)
{
std::type_index const index = std::type_index(typeid(TComponent));
if(mComponents.end() == mComponents.find(index))
{
mComponents[index] = CBoundedCollection<Shared<IComponent>>(1); // For now permit one component per type...
}
CBoundedCollection<Shared<IComponent>> &collection = mComponents.at(index);
if(collection.contains(aComponent))
{
return EEngineStatus::Error;
}
aComponent->setParentEntity(this);
collection.add(aComponent);
return EEngineStatus::Ok;
}
//<-----------------------------------------------------------------------------
//<-----------------------------------------------------------------------------
//
//<-----------------------------------------------------------------------------
template <typename TComponent>
EEngineStatus CEntity::removeComponent(Shared<TComponent> const &aComponent)
{
std::type_index const index = std::type_index(typeid(TComponent));
if(mComponents.end() != mComponents.find(index))
{
return EEngineStatus::Error;
}
CBoundedCollection<Shared<IComponent>> &collection = mComponents.at(index);
if(not collection.contains(aComponent))
{
return EEngineStatus::Error;
}
collection.remove(aComponent);
return EEngineStatus::Ok;
}
//<-----------------------------------------------------------------------------
//<-----------------------------------------------------------------------------
//
//<-----------------------------------------------------------------------------
template <typename TComponent>
bool CEntity::hasComponentOfType() const {
return false;
}
//<-----------------------------------------------------------------------------
//<-----------------------------------------------------------------------------
//<
//<-----------------------------------------------------------------------------
template <typename TComponent>
CBoundedCollection<Shared<TComponent>> const CEntity::getTypedComponentsOfType() const
{
std::type_index const index = std::type_index(typeid(TComponent));
if(mComponents.end() == mComponents.find(index))
{
return {};
}
CBoundedCollection<Shared<IComponent>> const components = mComponents.at(index);
CBoundedCollection<Shared<TComponent>> casted = {};
casted.assign(components);
return casted;
}
//<-----------------------------------------------------------------------------
//<-----------------------------------------------------------------------------
//<
//<-----------------------------------------------------------------------------
SHIRABE_DECLARE_LIST_OF_TYPE(Shared<CEntity>, Entity);
//<-----------------------------------------------------------------------------
}
#endif
|
a799ddb4071bca2856fd4c94565eb4569e524c0d
|
fb66a5cc43d27f33c85320a6dba8b9a8ff4765a9
|
/gapputils/gml.dimreduce/drl/wrappers/ya_wrap_traits.h
|
916c913d052f81182e41439ebb4b3f9764a71ce5
|
[] |
no_license
|
e-thereal/gapputils
|
7a211c7d92fd2891703cb16bf94e6e05f0fb3b8a
|
a9eca31373c820c12f4f5f308c0e2005e4672fd0
|
refs/heads/master
| 2021-04-26T16:42:58.303603
| 2015-09-02T21:32:45
| 2015-09-02T21:32:45
| 38,838,767
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,416
|
h
|
ya_wrap_traits.h
|
/***************************************************************************
ya_wrap_traits.h
-------------------
W. Michael Brown
Traits for YA_Wrap
__________________________________________________________________________
This file is part of the YALA++ Library
__________________________________________________________________________
begin : Sun Jun 8 2008
authors : W. Michael Brown
email : wmbrown@sandia.gov
***************************************************************************/
/* -----------------------------------------------------------------------
Copyright (2009) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
----------------------------------------------------------------------- */
#ifndef YA_WRAP_TRAITS_H
#define YA_WRAP_TRAITS_H
YALANAMESPACE
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype> struct YA_TITER;
template <class eltype, class itype>
struct YA_TITER<eltype,eltype *,0,itype> {
typedef eltype* iter;
typedef const eltype* citer;
typedef YA_RowIter<eltype,itype> rowiter;
typedef YA_ConstRowIter<eltype,itype> crowiter;
enum { memory=1, blas_stride=0 };
static inline iter begin(const itype &mat) { return mat.c_ptr(); }
};
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype> struct YA_TITER;
template <class eltype, class itype>
struct YA_TITER<eltype,const eltype *,0,itype> {
typedef const eltype* iter;
typedef const eltype* citer;
typedef YA_ConstRowIter<eltype,itype> rowiter;
typedef YA_ConstRowIter<eltype,itype> crowiter;
enum { memory=1, blas_stride=0 };
static inline iter begin(const itype &mat) { return mat.c_ptr(); }
};
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype> struct YA_TITER;
template <class eltype, class itype>
struct YA_TITER<eltype,eltype *,1,itype> {
typedef YA_Iter<eltype,itype> iter;
typedef YA_ConstIter<eltype,itype> citer;
typedef eltype* rowiter;
typedef const eltype* crowiter;
enum { memory=1, blas_stride=0 };
static inline rowiter rowbegin(const itype &mat) { return mat.c_ptr(); }
};
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype> struct YA_TITER;
template <class eltype, class itype>
struct YA_TITER<eltype,const eltype *,1,itype> {
typedef YA_ConstIter<eltype,itype> iter;
typedef YA_ConstIter<eltype,itype> citer;
typedef const eltype* rowiter;
typedef const eltype* crowiter;
enum { memory=1, blas_stride=0 };
static inline rowiter rowbegin(const itype &mat) { return mat.c_ptr(); }
};
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype> struct YA_TITER;
template <class eltype, class itype>
struct YA_TITER<eltype,eltype *,2,itype> {
typedef eltype* iter;
typedef const eltype* citer;
typedef eltype* rowiter;
typedef const eltype* crowiter;
enum { memory=1, blas_stride=0 };
static inline iter begin(const itype &mat) { return mat.c_ptr(); }
static inline iter rowbegin(const itype &mat) { return mat.c_ptr(); }
};
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype> struct YA_TITER;
template <class eltype, class itype>
struct YA_TITER<eltype,const eltype *,2,itype> {
typedef const eltype* iter;
typedef const eltype* citer;
typedef const eltype* rowiter;
typedef const eltype* crowiter;
enum { memory=1, blas_stride=0 };
static inline iter begin(const itype &mat) { return mat.c_ptr(); }
static inline iter rowbegin(const itype &mat) { return mat.c_ptr(); }
};
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype> struct YA_TITER;
template <class eltype, class itype>
struct YA_TITER<eltype,eltype *,3,itype> {
typedef YA_Iter<eltype,itype> iter;
typedef YA_ConstIter<eltype,itype> citer;
typedef YA_RowIter<eltype,itype> rowiter;
typedef YA_ConstRowIter<eltype,itype> crowiter;
enum { memory=1, blas_stride=1 };
};
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype> struct YA_TITER;
template <class eltype, class itype>
struct YA_TITER<eltype,const eltype *,3,itype> {
typedef YA_Iter<eltype,itype> iter;
typedef YA_ConstIter<eltype,itype> citer;
typedef YA_RowIter<eltype,itype> rowiter;
typedef YA_ConstRowIter<eltype,itype> crowiter;
enum { memory=1, blas_stride=1 };
};
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype>
struct YA_TITER {
typedef YA_Iter<eltype,itype> iter;
typedef YA_ConstIter<eltype,itype> citer;
typedef YA_RowIter<eltype,itype> rowiter;
typedef YA_ConstRowIter<eltype,itype> crowiter;
static inline iter begin(itype &mat) { return iter(&mat); }
static inline rowiter rowbegin(itype &mat) { return rowiter(&mat); }
enum { memory=0, blas_stride=0 };
};
// Determine the iterator type for wrappers
template <class eltype,class mat_type,int order,class itype>
struct YA_TITER<eltype,const mat_type,order,itype> {
typedef YA_ConstIter<eltype,itype> iter;
typedef YA_ConstIter<eltype,itype> citer;
typedef YA_ConstRowIter<eltype,itype> rowiter;
typedef YA_ConstRowIter<eltype,itype> crowiter;
static inline iter begin(itype &mat) { return iter(&mat); }
static inline rowiter rowbegin(itype &mat) { return rowiter(&mat); }
enum { memory=0, blas_stride=0 };
};
// Matrix Specific Traits
template <class eltype, class mat_type, int order, int nrows, int ncols,
class reft, class creft, int fixt>
class YA_Traits<YA_WrapT > {
public:
// Iterators
typedef typename YA_TITER<eltype,mat_type,order,YA_WrapT>::iter iter;
typedef typename YA_TITER<eltype,mat_type,order,YA_WrapT>::citer citer;
typedef typename YA_TITER<eltype,mat_type,order,YA_WrapT>::rowiter rowiter;
typedef typename YA_TITER<eltype,mat_type,order,YA_WrapT>::crowiter crowiter;
// Pointers for BLAS, etc.
typedef iter cptr;
typedef citer const_cptr;
// Reference Types
typedef reft ref;
typedef creft cref;
// See matrix_example.h for more info on types
enum MatrixInfo {
VME_MEMORY = YA_TITER<eltype,mat_type,order,YA_WrapT>::memory,
VME_VECTOR = _VM_TEMPLATE_OR_VALUE<nrows,ncols>::isone,
VME_COL_VECTOR = _VM_TEMPLATE_VALUE<ncols>::isone,
VME_ROW_VECTOR = _VM_TEMPLATE_VALUE<nrows>::isone,
VME_SYMMETRIC = 0,
VME_DIAGONAL = 0,
VME_NCOLS = ncols,
VME_NROWS = nrows,
VME_ORDER = order,
VME_BLAS = _YA_TAND<VME_MEMORY,_VM_BLAS_TYPE<eltype>::supported>::ans,
VME_BLAS_STRIDE = _YA_TOR<VME_BLAS,YA_TITER<eltype,mat_type,order,YA_WrapT>::blas_stride>::ans,
#ifdef YA_BLAS
VME_USE_BLAS = _YA_TAND<VME_BLAS,_YA_TNOT<fixt>::ans>::ans,
#else
VME_USE_BLAS = 0,
#endif
VME_TRANSPOSE = 0
};
};
template <class eltype, class mat_type, int order, int nrows, int ncols,
class reft, class creft, int fixt>
class YA_Traits<const YA_WrapT > :
public YA_Traits<YA_WrapT > { };
}
#endif
|
fab345062c90c000d90754918454cb2f52d12a0b
|
e45e32605372dbcea6aedc6b751660f0132ea48b
|
/1ShootingGame/Enemy1.h
|
b0e09f1835572bc166efcc55f02e29868a790a8e
|
[] |
no_license
|
taehwan642/THFramework
|
6beb7af823c723fdb62651f73e7f709facf0c874
|
31dd426df383cc71a13e75eda9b0d312fec160c3
|
refs/heads/main
| 2023-09-05T14:21:48.408068
| 2021-10-05T05:34:23
| 2021-10-05T05:34:23
| 330,841,582
| 10
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 190
|
h
|
Enemy1.h
|
#pragma once
#include "Bullet.h"
#include "Base.h"
class Enemy1 :
public Base
{
public:
EnemyType eType;
Enemy1();
void Move() override;
void Update() override;
};
|
9272ac9c1846993acafce68b6037049cbfec6826
|
a9dcca3cc82ef8571a609456156bda7e02ff989a
|
/source/Wfs/EnmWfsFactory.cpp
|
9c98892a768580263679fda7605e7c0f967f966a
|
[
"MIT"
] |
permissive
|
Borrk/Enzyme-labeled-instrument
|
ea420e174dd8a6b442be6ba19a116e3d899388c9
|
a7c8f4459511c774f7e0c4fee1fe05baf1ae2a5f
|
refs/heads/master
| 2020-06-28T17:39:08.672508
| 2019-09-09T03:14:40
| 2019-09-09T03:14:40
| 200,298,941
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 17,411
|
cpp
|
EnmWfsFactory.cpp
|
// EnmWfsFactory.cpp: implementation of the CEnmWfsFactory class.
//
//////////////////////////////////////////////////////////////////////
#include "EnmWfStepHub.h"
#include "EnmWfoRoot.h"
#include "EnmWfsFactory.h"
#include "EnmMainPage.hpp"
#include "EnmScanContext.h"
#include "EnmModePage.h"
#include "EnmPlatePage.h"
#include "EnmProcPanelPage.h"
#include "EnmFastModePage.h"
#include "EnmConcListPage.h"
#include "EnmCutoffCompute.h"
#include "EnmModePage.h"
#include "EnmWfSelectPage.h"
#include "EnmDeleteCutoffPage.h"
#include "EnmDensityListPage.h"
#include "EnmDensityCurvePage.h"
#include "EnmConsolePage.h"
#include "EnmFmWpModePage.h"
#include "EnmFmWpMeasurePage.h"
#include "EnmFmCmPage.h"
#include "EnmFmCmMeasPage.h"
#include "EnmFmKnConcListPage.h"
#include "EnmPgListPage.h"
#include "EnmPgDtPage.h"
#include "EnmPgEtModePage.h"
#include "EnmPgEtQualityPage.h"
#include "EnmPgEtMixingPage.h"
#include "EnmPgEtCurvePage.h"
#include "EnmPgEtQualitativePage.h"
#include "EnmProgramScanPage.h"
#include "EnmPgEtCutoffPage.h"
#include "EnmSampleConcListPage.h"
#include "EnmControlConcPage.h"
#include "EnmSaveCutoffPage.h"
/// Reader setup
#include "EnmCfgFilterPage.h"
#include "EnmCfgTimePage.h"
#include "EnmCfgCommuPage.h"
#include "EnmCfgPlateCheckPage.h"
#include "EnmCfgPrinterPage.h"
#include "EnmCfgCheckPage.h"
#include "EnmCfgServiceTestPage.h"
CEnmWfoSelector* CEnmWfsFactory::CreateWfs()
{
U32 aMainItem[] =
{
STR_MAIN_MODE,
STR_MAIN_FAST_MODE,
STR_MAIN_PROGRAMMING,
STR_MAIN_PROGRAMLIST,
STR_MAIN_DATA_LIST,
STR_MAIN_SYS_SETUP,
STR_MAIN_HOST_CONTROL
};
CEnmBasePage *apPage = new CEnmWfSelectPage( (U32)STR_BLANK, 2 );
((CEnmWfSelectPage*)apPage)->CreateItems( aMainItem, sizeof(aMainItem) / sizeof(aMainItem[0]) );
CEnmWfoRoot *apSel = new CEnmWfoRoot( );
apSel->SetPage( apPage );
CreateProgramModeTree( *apSel );
CreateFastModeTree( *apSel );
CreateProgrammingTree( *apSel );
CreateProgramListTree( *apSel );
CreateDataListTree( *apSel );
CreateSysConfigTree( *apSel );
CreateHostConsoleTree( *apSel );
return apSel;
}
BOOLEAN CEnmWfsFactory::CreateProgramModeTree( CEnmWfoSelector& root )
{
CEnmWfo *apWfoPm = new CEnmWfo( &root );
root.AddKidAt( *apWfoPm );
/// Create Programmed Mode Tree
CEnmBasePage *apPage;
CEnmWfStepHub *apStepHub;
IWorkStep *apStep;
apStepHub = new CEnmWfStepHub( apWfoPm );
apPage = new CEnmModePage();
apPage->SetTitle( STR_PPROGRAMEDIT_TITLE );
apStepHub->SetPage( apPage );
apWfoPm->AddKidAt( *apStepHub );
apStep = new IWorkStep( apWfoPm );
apPage = new CEnmPlatePage();
apStep->SetPage( apPage );
apWfoPm->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
apStepHub->AddStep( *apStep, 1, -1 );
apStep = new IWorkStep( apWfoPm );
apPage = new CEnmProgramScanPage( "", 0 );
apPage->SetTitle( STR_PPROGRAMEDIT_TITLE );
apStep->SetPage( apPage );
apWfoPm->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
apStepHub->AddStep( *apStep, 1, -1 );
apStep = new IWorkStep( apWfoPm );
apPage = new CEnmConcListPage();
apStep->SetPage( apPage );
apWfoPm->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
apStepHub->AddStep( *apStep, 1, -1 );
/// Qualitative steps
apStep = new IWorkStep( apWfoPm );
apPage = new CEnmDensityListPage();
apStep->SetPage( apPage );
apWfoPm->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 1, -1 );
apStep = new IWorkStep( apWfoPm );
apPage = new CEnmDensityCurvePage();
apPage->SetForWardMode( STEP_BW );
apStep->SetPage( apPage );
apWfoPm->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 1, -1 );
/// Qualititive steps
/// Comput Step Selector
U32 aItem[] =
{
STR_PPROCESS_COMPUTE,
STR_PPROCESS_EDIT,
STR_PPROCESS_DELETE,
STR_PPROCESS_SAVE,
};
apPage = new CEnmWfSelectPage( STR_PPROCESS_TITLE, 1 );
((CEnmWfSelectPage*)apPage)->CreateItems( aItem, sizeof(aItem) / sizeof(aItem[0]) );
CEnmWfoSelector *apSelDataProc = new CEnmWfoSelector( apWfoPm );
apSelDataProc->SetPage( apPage );
apWfoPm->AddKidAt( *apSelDataProc );
apStepHub->AddStep( *apSelDataProc, 0, -1 );
CEnmWfo *apWfoCompute = new CEnmWfo( apSelDataProc );
CEnmWfo *apWfoEditCutoff = new CEnmWfo( apSelDataProc );
CEnmWfo *apWfoDelCutoff = new CEnmWfo( apSelDataProc );
CEnmWfo *apWfoSaveCutoff = new CEnmWfo( apSelDataProc );
apSelDataProc->AddKidAt( *apWfoCompute );
apSelDataProc->AddKidAt( *apWfoEditCutoff );
apSelDataProc->AddKidAt( *apWfoDelCutoff );
apSelDataProc->AddKidAt( *apWfoSaveCutoff );
apStep = new IWorkStep( apWfoCompute );
apPage = new CEnmCutoffCompute();
apStep->SetPage( apPage );
apWfoCompute->AddKidAt( *apStep );
apStep = new IWorkStep( apWfoCompute );
apPage = new CEnmSampleConcListPage();
apStep->SetPage( apPage );
apWfoCompute->AddKidAt( *apStep );
/// Edit Cutoff
apStep = new IWorkStep( apWfoEditCutoff );
apPage = new CEnmControlConcPage();
apStep->SetPage( apPage );
apWfoEditCutoff->AddKidAt( *apStep );
/// Delete Cutoff
apStep = new IWorkStep( apWfoDelCutoff );
apPage = new CEnmDeleteCutoffPage();
apStep->SetPage( apPage );
apWfoDelCutoff->AddKidAt( *apStep );
/// Save Cutoff
apStep = new IWorkStep( apWfoSaveCutoff );
apPage = new CEnmSaveCutoffPage();
apStep->SetPage( apPage );
apWfoSaveCutoff->AddKidAt( *apStep );
return TRUE;
}
BOOLEAN CEnmWfsFactory::CreateFastModeTree( CEnmWfoSelector& root )
{
CEnmBasePage *apPage;
IWorkStep *apStep;
CEnmWfo *apWfoFm = new CEnmWfo( &root );
root.AddKidAt( *apWfoFm );
/// Fast Mode Item
U32 aFmItem[] =
{
STR_PFAST_WHOLEPLATE,
STR_PFAST_COLUMNMONITOR,
STR_PFAST_KINETIC
};
apPage = new CEnmWfSelectPage( STR_PFAST_TITLE, 4 );
((CEnmWfSelectPage*)apPage)->CreateItems( aFmItem, sizeof(aFmItem) / sizeof(aFmItem[0]) );
CEnmWfoSelector *apMeasType = new CEnmWfoSelector( apWfoFm );
apMeasType->SetPage( apPage );
apWfoFm->AddKidAt( *apMeasType );
CEnmWfo *apWfoFmWp = new CEnmWfo( apMeasType );
apMeasType->AddKidAt( *apWfoFmWp );
/// Whole mode
apStep = new IWorkStep( apWfoFmWp );
apPage = new CEnmFmWpModePage();
apStep->SetPage( apPage );
apWfoFmWp->AddKidAt( *apStep );
apStep = new IWorkStep( apWfoFmWp );
apPage = new CEnmFmWpMeasurePage();
apStep->SetPage( apPage );
apWfoFmWp->AddKidAt( *apStep );
apStep = new IWorkStep( apWfoFmWp );
apPage = new CEnmSampleConcListPage();
apStep->SetPage( apPage );
apWfoFmWp->AddKidAt( *apStep );
apStep = new IWorkStep( apWfoFmWp );
apPage = new CEnmFmWpReportPage();
apPage->SetForWardMode( STEP_BW );
apStep->SetPage( apPage );
apWfoFmWp->AddKidAt( *apStep );
/// column monitor
CEnmWfo *apWfoFmCm = new CEnmWfo( apMeasType );
apMeasType->AddKidAt( *apWfoFmCm );
apStep = new IWorkStep( apWfoFmCm );
apPage = new CEnmFmCmModePage();
apStep->SetPage( apPage );
apWfoFmCm->AddKidAt( *apStep );
apStep = new IWorkStep( apWfoFmCm );
apPage = new CEnmFmCmMeasPage();
apStep->SetPage( apPage );
apWfoFmCm->AddKidAt( *apStep );
/// Kinetic
CEnmWfo *apWfoFmKn = new CEnmWfo( apMeasType );
apMeasType->AddKidAt( *apWfoFmKn );
apStep = new IWorkStep( apWfoFmKn );
apPage = new CEnmFmKnModePage();
apStep->SetPage( apPage );
apWfoFmKn->AddKidAt( *apStep );
apStep = new IWorkStep( apWfoFmKn );
apPage = new CEnmFmKnMeasPage();
apStep->SetPage( apPage );
apWfoFmKn->AddKidAt( *apStep );
apStep = new IWorkStep( apWfoFmKn );
apPage = new CEnmFmKnConcListPage();
apPage->SetForWardMode( STEP_BW );
apStep->SetPage( apPage );
apWfoFmKn->AddKidAt( *apStep );
return TRUE;
}
BOOLEAN CEnmWfsFactory::CreateProgrammingTree( CEnmWfoSelector& root )
{
CEnmBasePage *apPage;
CEnmWfStepHub *apStepHub;
IWorkStep *apStep;
CEnmWfo *apWfoPg = new CEnmWfo( &root );
root.AddKidAt( *apWfoPg );
U32 aPgItem[] =
{
STR_MAIN_PROGRAMLIST,
STR_PPROGRAM_NEW,
STR_PPROGRAM_EDIT,
STR_PPROGRAM_DELETE
};
apPage = new CEnmWfSelectPage( STR_PPROGRAM_TITLE, 5 );
((CEnmWfSelectPage*)apPage)->CreateItems( aPgItem, sizeof(aPgItem) / sizeof(aPgItem[0]) );
CEnmWfoSelector *apProgram = new CEnmWfoSelector( apWfoPg );
apProgram->SetPage( apPage );
apWfoPg->AddKidAt( *apProgram );
CEnmWfo *apWfoPgList = new CEnmWfo( apProgram );
CEnmWfo *apWfoPgNew = new CEnmWfo( apProgram );
CEnmWfo *apWfoPgEdit = new CEnmWfo( apProgram );
CEnmWfo *apWfoPgDel = new CEnmWfo( apProgram );
apProgram->AddKidAt( *apWfoPgList );
apProgram->AddKidAt( *apWfoPgNew );
apProgram->AddKidAt( *apWfoPgEdit );
apProgram->AddKidAt( *apWfoPgDel );
#if 1
/************************************************************************/
/* Program List */
/************************************************************************/
apPage = new CEnmPgListPage();
apStep = new IWorkStep( apWfoPgList );
apStep->SetPage( apPage );
apWfoPgList->AddKidAt( *apStep );
/************************************************************************/
/* Create New Program */
/************************************************************************/
apStepHub = new CEnmWfStepHub( apWfoPgNew );
apPage = new CEnmPgEtModePage();
//((CEnmPgEtModePage*)apPage)->SetEditMode( CEnmPgEtModePage::MODE_NEW );
apStepHub->SetPage( apPage );
apWfoPgNew->AddKidAt( *apStepHub );
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtQualityPage();
apStep->SetPage( apPage );
apWfoPgNew->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtMixingPage();
apStep->SetPage( apPage );
apWfoPgNew->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
IWorkStep *apMixingStep = apStep;
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtCurvePage();
apStep->SetPage( apPage );
apWfoPgNew->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
/// Qualitative path
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtQualitativePage();
apStep->SetPage( apPage );
apStepHub->AddStep( *apStep, 1, -1 );
apStepHub->AddStep( *apMixingStep, 1, -1 );
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtCutoffPage();
apStep->SetPage( apPage );
apStepHub->AddStep( *apStep, 1, -1 );
/************************************************************************/
/* Edit program */
/************************************************************************/
apStepHub = new CEnmWfStepHub( apWfoPgEdit );
apPage = new CEnmPgEtModePage();
((CEnmPgEtModePage*)apPage)->SetEditMode( CEnmPgEtModePage::MODE_EDIT );
apStepHub->SetPage( apPage );
apWfoPgEdit->AddKidAt( *apStepHub );
apStep = new IWorkStep( apWfoPgEdit );
apPage = new CEnmPgEtQualityPage();
apStep->SetPage( apPage );
apWfoPgEdit->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
apStep = new IWorkStep( apWfoPgEdit );
apPage = new CEnmPgEtMixingPage();
apStep->SetPage( apPage );
apWfoPgEdit->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
apMixingStep = apStep;
apStep = new IWorkStep( apWfoPgEdit );
apPage = new CEnmPgEtCurvePage();
apStep->SetPage( apPage );
apWfoPgEdit->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
/// Qualitative path
apStep = new IWorkStep( apWfoPgEdit );
apPage = new CEnmPgEtQualitativePage();
apStep->SetPage( apPage );
apStepHub->AddStep( *apStep, 1, -1 );
apStepHub->AddStep( *apMixingStep, 1, -1 );
apStep = new IWorkStep( apWfoPgEdit );
apPage = new CEnmPgEtCutoffPage();
apStep->SetPage( apPage );
apStepHub->AddStep( *apStep, 1, -1 );
/************************************************************************/
/* Delete program */
/************************************************************************/
apPage = new CEnmPgDtPage();
apStep = new IWorkStep( apWfoPgDel );
apStep->SetPage( apPage );
apWfoPgDel->AddKidAt( *apStep );
#else
/// Program List
apPage = new CEnmPgListPage();
apStep = new IWorkStep( apWfoPgList );
apStep->SetPage( apPage );
apWfoPgList->AddKidAt( *apStep );
/// Create New Program
apStepHub = new CEnmWfStepHub( apWfoPgNew );
apPage = new CEnmPgEtModePage();
//((CEnmPgEtModePage*)apPage)->SetEditMode( CEnmPgEtModePage::MODE_EDIT );
apStepHub->SetPage( apPage );
apWfoPgNew->AddKidAt( *apStepHub );
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtQualityPage();
apStep->SetPage( apPage );
apWfoPgNew->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtMixingPage();
apStep->SetPage( apPage );
apWfoPgNew->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
IWorkStep *apMixingStep = apStep;
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtCurvePage();
apStep->SetPage( apPage );
apWfoPgNew->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 0, -1 );
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtQualitativePage();
apStep->SetPage( apPage );
//apWfoPgNew->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 1, -1 );
apStepHub->AddStep( *apMixingStep, 1, -1 );
apStep = new IWorkStep( apWfoPgNew );
apPage = new CEnmPgEtCutoffPage();
apStep->SetPage( apPage );
//apWfoPgNew->AddKidAt( *apStep );
apStepHub->AddStep( *apStep, 1, -1 );
/// Edit program
/// Delete program
apPage = new CEnmPgDtPage();
apStep = new IWorkStep( apWfoPgDel );
apStep->SetPage( apPage );
apWfoPgDel->AddKidAt( *apStep );
#endif
return TRUE;
}
BOOLEAN CEnmWfsFactory::CreateProgramListTree( CEnmWfoSelector& root )
{
CEnmBasePage *apPage;
IWorkStep *apStep;
CEnmWfo *apWfoPl = new CEnmWfo( &root );
root.AddKidAt( *apWfoPl );
apPage = new CEnmPgListPage();
apPage->SetTitle( STR_MAIN_PROGRAMLIST );
apStep = new IWorkStep( apWfoPl );
apStep->SetPage( apPage );
apWfoPl->AddKidAt( *apStep );
return TRUE;
}
BOOLEAN CEnmWfsFactory::CreateDataListTree( CEnmWfoSelector& root )
{
CEnmBasePage *apPage;
IWorkStep *apStep;
CEnmWfo *apWfoCfg = new CEnmWfo( &root );
root.AddKidAt( *apWfoCfg );
return TRUE;
}
BOOLEAN CEnmWfsFactory::CreateSysConfigTree( CEnmWfoSelector& root )
{
CEnmBasePage *apPage;
IWorkStep *apStep;
CEnmWfo *apWfoCfg = new CEnmWfo( &root );
root.AddKidAt( *apWfoCfg );
U32 aPgItem[] =
{
STR_PCFG_FILTER,
STR_PCFG_TIME,
STR_PCFG_SERIALPORT,
STR_PCFG_PRINTER,
STR_PCFG_MAINTENANCE,
STR_PCFG_CHECK_PLATE
};
apPage = new CEnmWfSelectPage( STR_PCFG_TITLE, 5 );
((CEnmWfSelectPage*)apPage)->CreateItems( aPgItem, sizeof(aPgItem) / sizeof(aPgItem[0]) );
CEnmWfoSelector *apConfig = new CEnmWfoSelector( apWfoCfg );
apConfig->SetPage( apPage );
apWfoCfg->AddKidAt( *apConfig );
//////////////////////////////////////////////////
CEnmWfo *apWfoFilter = new CEnmWfo( apConfig );
CEnmWfo *apWfoTime = new CEnmWfo( apConfig );
CEnmWfo *apWfoCommu = new CEnmWfo( apConfig );
CEnmWfo *apWfoPrinter = new CEnmWfo( apConfig );
CEnmWfo *apWfoMaintenance = new CEnmWfo( apConfig );
CEnmWfo *apWfoCheckPlate = new CEnmWfo( apConfig );
apConfig->AddKidAt( *apWfoFilter );
apConfig->AddKidAt( *apWfoTime );
apConfig->AddKidAt( *apWfoCommu );
apConfig->AddKidAt( *apWfoPrinter );
apConfig->AddKidAt( *apWfoMaintenance );
apConfig->AddKidAt( *apWfoCheckPlate );
/// Filter
apStep = new IWorkStep( apWfoFilter );
apPage = new CEnmCfgFilterPage();
apPage->SetTitle( STR_PCFGFILTER_TITLE );
apPage->SetForWardMode( STEP_RETURN );
apStep->SetPage( apPage );
apWfoFilter->AddKidAt( *apStep );
/// Time-Language-Name
apStep = new IWorkStep( apWfoTime );
apPage = new CEnmCfgTimePage();
apPage->SetTitle( STR_PCFG_TIME_TITLE );
apPage->SetForWardMode( STEP_RETURN );
apStep->SetPage( apPage );
apWfoTime->AddKidAt( *apStep );
/// Serial port
apStep = new IWorkStep( apWfoCommu );
apPage = new CEnmCfgCommuPage();
apPage->SetTitle( STR_PCFG_COMMU_TITLE );
apPage->SetForWardMode( STEP_RETURN );
apStep->SetPage( apPage );
apWfoCommu->AddKidAt( *apStep );
/// printer check
apStep = new IWorkStep( apWfoPrinter );
apPage = new CEnmCfgPrinterPage();
apPage->SetTitle( STR_PCFG_PLATECHECK_TITLE );
apPage->SetForWardMode( STEP_RETURN );
apStep->SetPage( apPage );
apWfoPrinter->AddKidAt( *apStep );
/// Maintenance
apStep = new IWorkStep( apWfoMaintenance );
apPage = new CEnmCfgCheckPage();
apPage->SetTitle( STR_PCFG_CHECK_TITLE );
apStep->SetPage( apPage );
apWfoMaintenance->AddKidAt( *apStep );
apStep = new IWorkStep( apWfoMaintenance );
apPage = new CEnmCfgServiceTestPage();
apPage->SetTitle( STR_PCFG_SERVICETEST_TITLE );
apStep->SetPage( apPage );
apWfoMaintenance->AddKidAt( *apStep );
/// Plate check
apStep = new IWorkStep( apWfoCheckPlate );
apPage = new CEnmCfgPlateCheckPage();
apPage->SetTitle( STR_PCFG_PLATECHECK_TITLE );
apPage->SetForWardMode( STEP_RETURN );
apStep->SetPage( apPage );
apWfoCheckPlate->AddKidAt( *apStep );
return TRUE;
}
BOOLEAN CEnmWfsFactory::CreateHostConsoleTree( CEnmWfoSelector& root )
{
CEnmBasePage *apPage;
IWorkStep *apStep;
CEnmWfo *apWfoPl = new CEnmWfo( &root );
root.AddKidAt( *apWfoPl );
apPage = new CEnmConsolePage();
apPage->SetTitle( STR_PPCMODE_TITLE );
apStep = new IWorkStep( apWfoPl );
apStep->SetPage( apPage );
apWfoPl->AddKidAt( *apStep );
return TRUE;
}
|
0f6c05e80e7a72552aa0d8f4b3ea967896d66048
|
6eb517842470db97f23392f518806591f626ba95
|
/inf1010/TP4/LivreNumerique.cpp
|
619e9d23788fee9f769a66c60d2c4ac9d9d45923
|
[] |
no_license
|
CatalinGiu/traveaux-polytechnique
|
60ea1eb821478c730e4287d8ec0f7841e116d7f3
|
be173e407735018681acf8558f4ba316f9e1db31
|
refs/heads/master
| 2022-11-27T19:16:08.720274
| 2020-07-26T17:31:08
| 2020-07-26T17:31:08
| 282,699,635
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,347
|
cpp
|
LivreNumerique.cpp
|
/*
Fichier: LivreNumerique.cpp
Auteur(s): Catalin Giurca & Julien Gauthier
Date de creation: 25 fevrier 2016
Date de modification: 28 fevrier 2016
Description: Initialisation des fonctions de la Classe LivreNumerique
*/
#include "LivreNumerique.h"
using namespace std;
LivreNumerique::LivreNumerique() {
}
//Le constructeur par parametres de LivreNumerique utilise le constructeur par parametre de Livre.
LivreNumerique::LivreNumerique(FORMAT_DOCUMENT format, unsigned int taille,
std::string lien, const std::string &cote, const std::string &titre, unsigned int annee,
unsigned int ageMin, unsigned int nbExemplaires, const std::string &auteur,
const std::string &genre) : Livre(cote, titre, annee, ageMin, nbExemplaires, auteur, genre),
format_(format), tailleOctet_(taille), lien_(lien){
}
LivreNumerique::~LivreNumerique() {
}
std::string LivreNumerique::obtenirFormat() const {
string format;
switch(format_){
case FORMAT_PDF:
format = "pdf";
break;
case FORMAT_DOCX :
format = "docx";
break;
case FORMAT_EPUB:
format = "epub";
break;
case FORMAT_TXT:
format = "txt";
break;
case FORMAT_INCONNU:
format = "inconnu";
break;
}
return format;
}
unsigned int LivreNumerique::obtenirTaille() const {
return tailleOctet_;
}
std::string LivreNumerique::obtenirLien() const {
return lien_;
}
void LivreNumerique::setFormat(FORMAT_DOCUMENT format) {
format_ = format;
}
void LivreNumerique::setTaille(unsigned int taille) {
tailleOctet_ = taille;
}
void LivreNumerique::setLien(const std::string& lien) {
lien_ = lien;
}
bool LivreNumerique::recherche(const std::string& mot) const{
bool trouve = Livre::recherche(mot)
|| convertirMinuscule(mot) == obtenirFormat();
return trouve;
}
std::ostream &operator<<(std::ostream &os, const LivreNumerique &livreNum) {
os << "Objet Numerique! Taille : " << livreNum.tailleOctet_ << " oct. "
<< livreNum.lien_ << " Format : " << livreNum.obtenirFormat() << endl
<< dynamic_cast<const Livre&>(livreNum);
return os;
}
|
8eec287a728e91e60dcb166201a3db83c0d11374
|
bd72dd27f6d28254e449ae7c977afb26391de2e9
|
/lab06/ex6.cpp
|
4819d526e894d9712adf9d2bd23924416b09b0b4
|
[] |
no_license
|
stevenctang/CSE201
|
7feac0c19a83310ae9d60ed424d9261d3db326cd
|
7a3adf5f9ebea4566bc46d8ed27ca954193d062a
|
refs/heads/master
| 2020-04-17T09:58:25.635400
| 2016-08-19T04:01:33
| 2016-08-19T04:01:33
| 66,015,360
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 237
|
cpp
|
ex6.cpp
|
#include <iostream>
#include <cassert>
using namespace std;
bool isAllZeros(int a[50][100]) {
for (int i=0; i<50; ++i){
for (int j=0;j<100;++j) {
if (a[i][j] !=0) return false;
}
}
return true;
}
int main() {
}
|
33f70b626408021813a02bb02848c7097fb8d0b4
|
add3ec755bddb2503e269f334a3f5cd645843873
|
/Area of circle/Area of circle/area.cpp
|
a21fd38ed81faea47da33190586615a4eadfec03
|
[
"MIT"
] |
permissive
|
GreenHackersOTC/C
|
64e2689c61517a5e07e320409cf52ad6861bdf51
|
947b2d18ca1cc60bde9e7a4dfa4511609c5d8a29
|
refs/heads/master
| 2020-12-24T07:26:01.642711
| 2017-11-25T09:35:27
| 2017-11-25T09:35:27
| 65,881,315
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 76
|
cpp
|
area.cpp
|
#include"greenhacker.h"
int main()
{
funArea();
getch();
return 0;
}
|
07804871dfd21ee00d3bbdb762661165f2f6f195
|
b1c1867f3977fa3573de5d0beda0b7187aee0b01
|
/assignments/a1/archive/t.cpp
|
fc0d67ff3f419586734faf3876b2aa69795dcd28
|
[
"MIT"
] |
permissive
|
suryaavala/advancedcpp
|
3523d553b00e8ff796c6f79c2a173ecfa80ee232
|
84c1847bf42ff744f99b4c0f94b77cfa71ca00d8
|
refs/heads/master
| 2021-03-27T14:58:54.620306
| 2018-02-12T13:03:54
| 2018-02-12T13:03:54
| 98,874,887
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 567
|
cpp
|
t.cpp
|
#include <iostream>
#include <string>
#include <iomanip>
#include <string>
#include <sstream>
int main(int argc, char const *argv[]) {
std::string c = "1.1";
int a = std::stoi(c);
double b = std::stod(c);
std::cout << "a = " << a <<", b = " << b << ", c = " << c << " a/b = " <<a/b<<'\n';
std::stringstream stream;
//stream << std::fixed << std::setprecision(3) << a;
//std::string x = stream.str();
stream << std::fixed << std::setprecision(3) << b;
std::string y = stream.str();
std::cout << "x = " << " y = " << y << '\n';
return 0;
}
|
377ae9bd5428dd5a0501b787470633ca50cf1b03
|
6153a4cb3bea620fb4ab7112888555b62d33c075
|
/09_string.cpp
|
e2b005764cddf0f141d272b3efd7d1ccb607e406
|
[] |
no_license
|
Dawson-Jones/learn_cpp_with_me
|
c39fde12b13162a5bd269a28b5b782a8c5fe5286
|
2fcac8f747d3e310d996e00a63049a1af1bbb254
|
refs/heads/master
| 2022-12-17T21:17:52.849340
| 2020-09-21T15:51:39
| 2020-09-21T15:51:39
| 293,581,208
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,116
|
cpp
|
09_string.cpp
|
#include <iostream>
#include <string>
using namespace std;
int main() {
string s1; // 编译为空字符串
string s2 = "c plus plus";
string s3 = s2;
string s4(5, 'a');
int len = s2.length();
cout << len << endl;
string path = "./test.txt";
const char *str = path.c_str(); // 转化为 c 的类型
FILE *fp = fopen(str, "rt");
for (char i : s3) {
cout << i << " ";
}
cout << endl;
s3[6] = '*'; // 能够被改变
cout << s3 << endl;
// use operator '+' to join
cout << s3 + s4 << endl;
// insert
s2.insert(5, "233");
cout << s2 << endl;
// delete substring
// s2: c plu233s plus
s2.erase(5);
cout << s2 << endl;
// s3: c plus*plus
s3.erase(6, 3);
cout << s3 << endl;
// substring
string substr = s3.substr(0, 6);
cout << substr << endl;
// find
s1 = "first second third";
s2 = "second";
int index = s1.find(s2, 5);
if (index < s1.length())
cout << "Found at index : " << index << endl;
else
cout << "Not found" << endl;
return 0;
}
|
6c1111dc722d980a62f79a33c50d6dc46e5e22ce
|
358cc23b3385cd2ab7189bf8289a9f03ed864f55
|
/src/N04_NetworkPNCP/OutNode.hpp
|
9d556ea0182f47cbaec9caa0d5afdde5573e0ff8
|
[] |
no_license
|
adamcavendish/PNCP
|
f903d08050569847dae3d52762100d117fe3d4d9
|
65901bdcdd809d7e157e85efcb14f5ecdf577230
|
refs/heads/master
| 2021-01-13T02:18:35.557914
| 2014-04-17T12:37:41
| 2014-04-17T12:37:41
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,241
|
hpp
|
OutNode.hpp
|
#pragma once
// STL
#include <random>
// omnetpp
#include <omnetpp.h>
// current project
#include "build/N04_NetworkPNCP_m.h"
#include "logger/logger.hpp"
class OutNode04 : public cSimpleModule {
private:
std::random_device rd;
std::default_random_engine engine;
std::uniform_real_distribution<double> udist_generatePacketProb;
int counter; // counter is the number of packets to send
double generatePacketProb; // generatePacketProb is the send probability of every timeslot
DriverMessage04 * pDriverMsg; // this message drives me to send out a message 'msg'
InfoMessage04 * pMsg; // the real message send to other nodes
logger::Logger stat_logger;
int stat_timePassed;
int stat_packageSent;
public:
OutNode04();
virtual ~OutNode04();
protected:
virtual void initialize() override;
virtual void finish() override;
virtual void handleMessage(cMessage * pHandleMsg) override;
/// @brief check whether OutNode is going to send out a message
bool checkSendMessage();
/// @brief generate a message for OutNode to send to InNode
InfoMessage04 * generateMessage();
/// @brief write statistics
void writeStatistics();
};//class OutNode04
|
1d5588ed1e19cbcde1a554540d38578158adbe66
|
af5ac40003f9ec34d59d99c7e6bb9db653198a03
|
/demos/rlCoachKin/OperationalDelegate.cpp
|
f537bd779c98212c7a6184cb0a5a8bcfcbd160b5
|
[
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
roboticslibrary/rl
|
90b7163c50f6341ae11ab2ee58ff07dc653c9ee3
|
2da1f81077247676e5bfd638db206a3ab7cb84a4
|
refs/heads/master
| 2023-02-22T15:48:38.671341
| 2023-02-15T18:49:29
| 2023-02-15T19:33:31
| 20,737,145
| 764
| 194
|
BSD-2-Clause
| 2023-05-24T19:44:17
| 2014-06-11T18:59:13
|
C++
|
UTF-8
|
C++
| false
| false
| 3,174
|
cpp
|
OperationalDelegate.cpp
|
//
// Copyright (c) 2009, Markus Rickert
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#include <QDoubleSpinBox>
#include <QModelIndex>
#include "OperationalDelegate.h"
#include "MainWindow.h"
OperationalDelegate::OperationalDelegate(QObject* parent) :
QItemDelegate(parent)
{
}
OperationalDelegate::~OperationalDelegate()
{
}
QWidget*
OperationalDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QDoubleSpinBox* editor = new QDoubleSpinBox(parent);
editor->setMaximum(std::numeric_limits<double>::max());
editor->setMinimum(-std::numeric_limits<double>::max());
switch (index.column())
{
case 0:
case 1:
case 2:
editor->setDecimals(4);
editor->setSingleStep(0.01);
break;
case 3:
case 4:
case 5:
editor->setDecimals(2);
editor->setSingleStep(1.0);
break;
default:
break;
}
QObject::connect(editor, SIGNAL(valueChanged(double)), this, SLOT(valueChanged(double)));
return editor;
}
void
OperationalDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
QDoubleSpinBox* doubleSpinBox = static_cast<QDoubleSpinBox*>(editor);
doubleSpinBox->setValue(index.model()->data(index, Qt::EditRole).toDouble());
}
void
OperationalDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
QDoubleSpinBox* doubleSpinBox = static_cast<QDoubleSpinBox*>(editor);
doubleSpinBox->interpretText();
if (!model->setData(index, doubleSpinBox->value(), Qt::EditRole))
{
doubleSpinBox->setValue(index.model()->data(index, Qt::EditRole).toDouble());
}
}
void
OperationalDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
editor->setGeometry(option.rect);
}
void
OperationalDelegate::valueChanged(double d)
{
emit commitData(static_cast<QWidget*>(QObject::sender()));
}
|
10206eb3e25ce089cf7469bf3624f0f19542d642
|
3df01d7e712197babed04169b8602811330fb42f
|
/codeblocks/patternMatching/finiteautomata.cpp
|
b42cfb43b5409ab503dd4c3a26a2bcf4265bd94e
|
[] |
no_license
|
rohittiwarirvt/myCompetitiveProg
|
d43d4ec10d81bec0bf84811aaf736206cfcb66b8
|
7d8d257d0eee423893762a833a5cb438a1eca93f
|
refs/heads/mycpp-master
| 2021-01-13T11:18:03.256898
| 2018-06-08T15:19:01
| 2018-06-08T15:19:01
| 81,396,726
| 0
| 0
| null | 2018-06-08T15:19:02
| 2017-02-09T01:54:27
|
C
|
UTF-8
|
C++
| false
| false
| 1,852
|
cpp
|
finiteautomata.cpp
|
// http://www.geeksforgeeks.org/searching-for-patterns-set-5-finite-automata/
// Program for string searching using finite automata
//
#include <stdio.h>
#include <string.h>
#define NO_OF_CHARS 256
int getNextState(char *pat, int pat_len, int state, int x)
{
// if the character c is same as next character in pattern,
// then simply increment state
if ( state < pat_len && x == pat[state]){
return state +1 ;
}
int next_state, i; // next_state stores the result which is next state
// next_state finally contains the longest prefix which is also suffix
// in "pat[0.. state -1] c"
for (next_state = state; next_state > 0 ; next_state--) {
if (pat[next_state -1] == x) {
for ( i = 0 ; i < next_state - 1; i++) {
if (pat[i] != pat[state - next_state +1 +i]) {
break;
}
}
if ( i == next_state -1) {
return next_state;
}
}
}
return 0;
}
// This function helps in building the tf table which represents finite automata for a given pattern
void computeTF(char *pat, int pat_len, int TF[][NO_OF_CHARS])
{
int state, x;
for ( state = 0; state <= pat_len; ++state) {
for (x =0; x < NO_OF_CHARS; ++x) {
TF[state][x] = getNextState(pat, pat_len, state, x);
}
}
}
// prints all the occurence of patter in txt
void search(char *pat, char *txt)
{
int pat_len = strlen(pat);
int txt_len = strlen(txt);
int TF[pat_len + 1][NO_OF_CHARS];
computeTF(pat, pat_len, TF);
// process txt over FA.
int i, state=0;
for( i = 0; i < txt_len; i++) {
state = TF[state][txt[i]];
if (state == pat_len) {
printf("\n Pattern found at index %d", i -pat_len -1);
}
}
}
// Driver program to test the above function
//
int main()
{
char txt[] = "AABAACAADAABAAABAA";
char pat[] = "AABA";
search(pat, txt);
return 0;
}
|
a61495f06d5c60d8dbf070a877bdaa4760dd0f4e
|
d7085a2924fb839285146f88518c69c567e77968
|
/KS/SRC/variants.h
|
bfd35e85eb0410a4fdf205658209164f38ac1af8
|
[] |
no_license
|
historicalsource/kelly-slaters-pro-surfer
|
540f8f39c07e881e9ecebc764954c3579903ad85
|
7c3ade041cc03409a3114ce3ba4a70053c6e4e3b
|
refs/heads/main
| 2023-07-04T09:34:09.267099
| 2021-07-29T19:35:13
| 2021-07-29T19:35:13
| 390,831,183
| 40
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,655
|
h
|
variants.h
|
#ifndef VARIANTS_H
#define VARIANTS_H
//#include "actor.h" // no.. it includes us!
#include "entity.h"
//#include "brain_enums.h"
class variant;
//!class actor;
typedef vector<variant*> variant_list;
enum
{
_BRAIN_ANIM_UNBLOCKABLE = 0x00000001,
_BRAIN_ANIM_STUN = 0x00000002,
_BRAIN_ANIM_KNOCKDOWN = 0x00000004
};
class attachment_info
{
public:
enum
{
USE_CHARACTER_MATERIAL = 0x00000001,
USE_CHARACTER_COLOR = 0x00000002
};
private:
entity *base_copy;
anim_id_t parent_id;
po rel_po;
unsigned int flags;
public:
attachment_info( entity* _base_copy, anim_id_t _parent_id, const po& _rel_po, const unsigned int _flags = 0 )
: base_copy( _base_copy ),
parent_id( _parent_id ),
rel_po( _rel_po ),
flags( _flags )
{
_base_copy->set_flag(EFLAG_MISC_MEMBER_OF_VARIANT, true);
}
entity* get_base_copy() const { return base_copy; }
anim_id_t get_parent_id() const { return parent_id; }
const po& get_rel_po() const { return rel_po; }
void set_flag( unsigned int flg ) { flags |= flg;}
void clear_flag( unsigned int flg ) { flags &= ~flg;}
bool is_flagged( unsigned int flg ) const { return flags & flg;}
};
typedef vector<attachment_info*> attachment_list;
class variant_descriptor
{
private:
stringx name;
stringx char_name;
stringx char_material_name;
color32 char_color;
variant_list pool;
int pool_size;
int pool_capacity;
eAIState AIStates[_BRAIN_MAX_REACTION_STATES];
rational_t default_reload_timer;
rational_t reload_timer_variance;
bool use_alt_material, use_alt_color;
int full_hit_points;
attachment_list attachments;
public:
variant_descriptor( const stringx& _name );
~variant_descriptor();
const eAIState get_ai_state(eReactionState state) const { return AIStates[state]; }
void set_ai_states(eReactionState react, eAIState ai) { AIStates[react] = ai; }
rational_t get_reload_timer() const { return(default_reload_timer); }
rational_t get_reload_timer_variance() const { return(reload_timer_variance); }
void set_reload_timer(rational_t t = 1.0f) { default_reload_timer = t; }
void set_reload_timer_variance(rational_t v = 0.5f) { reload_timer_variance = v; }
int get_full_hit_points() const { return full_hit_points; }
void set_full_hit_points(int hp) { full_hit_points = hp; }
const stringx& get_name() const { return name; }
void set_character( const stringx& _name );
variant* acquire( actor* act );
bool full() const { return pool_size == pool_capacity; }
int get_num_free() const { return pool_capacity - pool_size; }
const color32& get_character_color() const { return char_color;}
const stringx& get_character_material_name() const { return char_material_name;}
bool use_alternative_material() const { return use_alt_material;}
bool use_alternative_color() const { return use_alt_color;}
void set_use_alternative_material( bool torf ) { use_alt_material = torf;}
void set_use_alternative_color( bool torf ) { use_alt_color = torf;}
const attachment_list& get_attachments() const { return attachments; }
void add_attachment( const stringx& ent_name, anim_id_t parent_id, const po& rel_po, const unsigned int flags = 0 );
struct s_t_s_t_r
{
bool operator()( const stringx s1, const stringx s2 ) const { return strcmp(s1.c_str(), s2.c_str()) < 0;}
};
struct brain_anim
{
rational_t percent;
stringx anims[_BRAIN_MAX_REACTION_STATES - 1];
int damage;
rational_t recover_time;
rational_t recover_var;
int flags;
brain_anim();
brain_anim( rational_t _per, const stringx _anim[_BRAIN_MAX_REACTION_STATES - 1], int _dam, rational_t _rec, rational_t _rec_var, int _flags );
};
map<stringx,vector< brain_anim >,s_t_s_t_r> brain_id_map;
typedef map<stringx,vector< brain_anim >,s_t_s_t_r>::iterator brain_id_map_iterator;
typedef vector< brain_anim >::iterator brain_id_map_anims_iterator;
void add_brain_id_map_entry( const stringx& id, rational_t _per, const stringx _anim[_BRAIN_MAX_REACTION_STATES - 1], int _dam, rational_t _rec, rational_t _rec_var, int _flags );
void read_animations_chunk(chunk_file &fs, const stringx &anims_directory);
void read_preloads_chunk(chunk_file &fs, const stringx &anims_directory);
void read_anim_sub_chunk(chunk_file &fs, const stringx &anim_id, const stringx &anims_directory);
void read_brain_anim_stuff( const stringx& anims_filename );
virtual const stringx& extract_random_brain_id_map_anim( stringx& id, eReactionState reaction_level = BRAIN_REACT_IDLE, int *damage_value = NULL, rational_t *recover = NULL, rational_t *recover_var = NULL, int *flags = NULL );
virtual const stringx& extract_given_brain_id_map_anim( stringx& id, int idx, eReactionState reaction_level = BRAIN_REACT_IDLE, int *damage_value = NULL, rational_t *recover = NULL, rational_t *recover_var = NULL, int *flags = NULL );
virtual const stringx& extract_given_brain_id_map_anim_by_number( stringx& id, int idx, eReactionState reaction_level = BRAIN_REACT_IDLE, int *damage_value = NULL, rational_t *recover = NULL, rational_t *recover_var = NULL, int *flags = NULL );
};
class variant
{
private:
variant_descriptor* my_descriptor;
vector<entity*> entities;
bool locked;
actor* my_actor;
public:
variant( variant_descriptor* dsc );
~variant(){}
const stringx& get_variant_name() const { return my_descriptor->get_name(); }
const vector<entity*>& get_entities() const { return entities; }
const variant_descriptor *get_descriptor() const { return my_descriptor; }
bool acquire( actor* act );
void release();
void set_locked( bool torf ) { locked = torf; }
bool is_locked() const { return locked; }
void set_visible( bool torf );
bool use_alternative_material() const { return my_descriptor->use_alternative_material();}
bool use_alternative_color() const { return my_descriptor->use_alternative_color();}
const color32& get_my_color() const { return my_descriptor->get_character_color();}
const stringx& get_my_material_name() const { return my_descriptor->get_character_material_name();}
const stringx& extract_random_brain_id_map_anim( stringx& id, eReactionState reaction_level = BRAIN_REACT_IDLE, int *damage_value = NULL, rational_t *recover = NULL, rational_t *recover_var = NULL, int *flags = NULL ) const
{
return my_descriptor->extract_random_brain_id_map_anim( id, reaction_level, damage_value, recover, recover_var, flags );
}
const stringx& extract_given_brain_id_map_anim( stringx& id, int idx, eReactionState reaction_level = BRAIN_REACT_IDLE, int *damage_value = NULL, rational_t *recover = NULL, rational_t *recover_var = NULL, int *flags = NULL ) const
{
return my_descriptor->extract_given_brain_id_map_anim( id, idx, reaction_level, damage_value, recover, recover_var, flags );
}
const stringx& extract_given_brain_id_map_anim_by_number( stringx& id, int idx, eReactionState reaction_level = BRAIN_REACT_IDLE, int *damage_value = NULL, rational_t *recover = NULL, rational_t *recover_var = NULL, int *flags = NULL ) const
{
return my_descriptor->extract_given_brain_id_map_anim_by_number( id, idx, reaction_level, damage_value, recover, recover_var, flags );
}
};
#endif // VARIANTS_H
|
14531f260fef44db8d15ab5dcda1040cf65c3449
|
3dfde1af0c9178dfc1e13bf444283462d4c320a9
|
/pf/core/include/pf/cache/config.h
|
315276b0bb695ad0d58e2a256e600904cbf35321
|
[
"MIT"
] |
permissive
|
viticm/plainframework
|
deb0f8a93af6a04fd0528e1d512847024899d1ed
|
2107e3edddcbf18e95e65573c20ab19b0cdae8e3
|
refs/heads/master
| 2021-12-14T16:15:07.875283
| 2021-11-25T08:21:21
| 2021-11-25T08:21:21
| 22,244,644
| 7
| 12
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 909
|
h
|
config.h
|
/**
* PLAIN FRAMEWORK ( https://github.com/viticm/pap )
* $Id config.h
* @link https://github.com/viticm/pap for the canonical source repository
* @copyright Copyright (c) 2014- viticm( viticm@126.com )
* @license
* @user viticm<viticm@126.com>
* @date 2016/10/08 15:20
* @uses cache config class
*/
#ifndef PF_CACHE_CONFIG_H_
#define PF_CACHE_CONFIG_H_
#include "pf/basic/config.h"
#include "pf/sys/memory/share.h"
#define CACHE_SHARE_DEFAULT_MINUTES (10) //默认缓存的分钟数
#define CACHE_MODULENAME "cache"
#define CACHE_WORKERS_DEFAULT (4) //Default workers.
namespace pf_cache {
class StoreInterface;
class Repository;
class DBStore;
class Manager;
};
/* Set cache from get value(void *) */
#define cache_set(c,v,n) { memset((c), 0, (n)); \
auto t = reinterpret_cast<const char *>((v)); \
memcpy((c), t, strlen(t)); \
}
#endif //PF_CACHE_CONFIG_H_
|
3ef2cb22ac94d60043993077199c1bd15fa0c71e
|
027ba1e389d45e253dce892220555d6f9826f0cd
|
/packages/ipnoise-neuron/neuron-rc/core/object/http.server/main.cpp
|
ce0f8f773179e8d5a067e9b9a6992872b884aabf
|
[] |
no_license
|
m0r1k/IPNoise
|
1f371ed6a7cd6ba5637edbbe8718190d7f514827
|
dbab828d48aa1ab626fd528e71b1c28e3702be09
|
refs/heads/master
| 2021-01-02T23:09:51.193762
| 2018-02-04T11:23:27
| 2018-02-04T11:23:27
| 99,478,087
| 1
| 4
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 11,939
|
cpp
|
main.cpp
|
#include <sys/time.h>
#include <ipnoise-common/log_common.h>
#include <core/object/object/main.hpp>
#include <core/object/int32/main.hpp>
#include <core/object/http.request/main.hpp>
#include <core/object/map/main.hpp>
#include <core/object/string/main.hpp>
#include <core/object/uint32/main.hpp>
#include <core/object/unique/main.hpp>
#include "main.hpp"
ObjectHttpServer::ObjectHttpServer(
const CreateFlags &a_create_flags)
: Object(a_create_flags)
{
}
ObjectHttpServer::~ObjectHttpServer()
{
}
string ObjectHttpServer::getType()
{
return ObjectHttpServer::s_getType();
}
int32_t ObjectHttpServer::do_init_as_prop(
const char *a_data,
const uint64_t &a_data_size)
{
int32_t err = 0;
err = Object::do_init_as_prop(a_data, a_data_size);
return err;
}
int32_t ObjectHttpServer::do_init_as_object(
const char *a_data,
const uint64_t &a_data_size)
{
int32_t res, err = -1;
res = Object::do_init_as_object(a_data, a_data_size);
if (res){
err = res;
goto fail;
}
m_host = OBJECT<ObjectString>(DEFAULT_LISTEN_HOST);
m_port = OBJECT<ObjectUint32>(DEFAULT_LISTEN_PORT);
m_pending_data = OBJECT<ObjectMap>();
// in
registerActionIn(
"core.action.thread.started",
ObjectHttpServer::s_actionListen
);
registerActionIn(
"core.action.thread.listened",
ObjectHttpServer::s_actionListened
);
registerActionIn(
"core.action.thread.accepted",
ObjectHttpServer::s_actionAccepted
);
registerActionIn(
"core.action.thread.readed",
ObjectHttpServer::s_actionReaded
);
registerActionIn(
"core.action.thread.event",
ObjectHttpServer::s_actionEvent
);
// out
registerActionOut("core.action.thread.listen");
registerActionOut("core.action.thread.watch.add");
registerActionOut("core.action.thread.write");
registerActionOut("core.action.thread.close");
// all ok
err = 0;
out:
return err;
fail:
if (0 <= err){
err = -1;
}
goto out;
}
ObjectSptr ObjectHttpServer::copy()
{
ObjectHttpServerSptr ret;
ret = OBJECT<ObjectHttpServer>();
ret->setHost(m_host->c_str());
ret->setPort(m_port->getVal());
return ret;
}
void ObjectHttpServer::getAllProps(
ObjectMapSptr a_out)
{
CreateFlags flags = getObjectFlags();
if (!(flags & CREATE_PROP)){
a_out->add("server_host", m_host);
a_out->add("server_port", m_port);
a_out->add("server_requests", m_pending_data);
Object::getAllProps(a_out);
}
}
void ObjectHttpServer::setHost(
const char *a_val)
{
m_host = OBJECT<ObjectString>(a_val);
}
ObjectStringSptr ObjectHttpServer::getHost()
{
return m_host;
}
void ObjectHttpServer::setPort(
const uint32_t &a_port)
{
m_port = OBJECT<ObjectUint32>(a_port);
}
ObjectUint32Sptr ObjectHttpServer::getPort()
{
return m_port;
}
// ---------------- static ----------------
int32_t ObjectHttpServer::s_actionListen(
Object *a_object,
Object *a_action)
{
ObjectHttpServer *object = NULL;
string object_path;
object = dynamic_cast<ObjectHttpServer *>(a_object);
if (!object){
PFATAL("missing argument: 'a_object'"
" or it's not ObjectHttpServer\n"
);
}
object_path = object->getObjectPath();
if (!a_action){
PFATAL("missing argument: 'a_action'\n");
}
PWARN("object: '%s', request listen\n",
object->getObjectPath().c_str()
);
{
double cur_time = 0.0f;
struct timeval tv;
gettimeofday(&tv, NULL);
cur_time = tv.tv_sec + tv.tv_usec / 1e6;
PWARN("cur time: '%f'\n", cur_time);
}
{
ObjectSptr action;
action = OBJECT<Object>();
action->setActionName("core.action.thread.listen");
action->setActionParam("host", object->m_host);
action->setActionParam("port", object->m_port);
object->emit(action);
}
return 0;
}
int32_t ObjectHttpServer::s_actionListened(
Object *a_object,
Object *a_action)
{
ObjectHttpServer *object = NULL;
string object_path;
object = dynamic_cast<ObjectHttpServer *>(a_object);
if (!object){
PFATAL("missing argument: 'a_object'"
" or it's not ObjectHttpServer\n"
);
}
object_path = object->getObjectPath();
if (!a_action){
PFATAL("missing argument: 'a_action'\n");
}
PWARN("object: '%s', action: listened\n",
object_path.c_str()
);
{
double cur_time = 0.0f;
struct timeval tv;
gettimeofday(&tv, NULL);
cur_time = tv.tv_sec + tv.tv_usec / 1e6;
PWARN("cur time: '%f'\n", cur_time);
}
return 0;
}
int32_t ObjectHttpServer::s_actionAccepted(
Object *a_object,
Object *a_action)
{
ObjectHttpServer *object = NULL;
int32_t fd = -1;
string object_path;
ObjectInt32Sptr prop_fd;
object = dynamic_cast<ObjectHttpServer *>(a_object);
if (!object){
PFATAL("missing argument: 'a_object'"
" or it's not ObjectHttpServer\n"
);
}
object_path = object->getObjectPath();
if (!a_action){
PFATAL("missing argument: 'a_action'\n");
}
prop_fd = dynamic_pointer_cast<ObjectInt32>(
a_action->getActionParam("fd")
);
fd = prop_fd->getVal();
PDEBUG(100, "object: '%s', new accept, fd: '%d'\n",
object_path.c_str(),
fd
);
{
double cur_time = 0.0f;
struct timeval tv;
gettimeofday(&tv, NULL);
cur_time = tv.tv_sec + tv.tv_usec / 1e6;
PWARN("cur time: '%f'\n", cur_time);
}
{
ObjectSptr action;
ObjectUniqueSptr unique;
unique = OBJECT<ObjectUnique>();
unique->add("read");
unique->add("write");
unique->add("action");
action = OBJECT<Object>();
action->setActionName("core.action.thread.watch.add");
action->setActionParam("events", unique);
action->setActionParam("fd", fd);
object->emit(action);
}
return 0;
}
int32_t ObjectHttpServer::s_actionReaded(
Object *a_object,
Object *a_action)
{
ObjectHttpServer *object = NULL;
int32_t res, fd = -1;
string object_path;
ObjectInt32Sptr prop_fd;
ObjectStringSptr prop_data;
object = dynamic_cast<ObjectHttpServer *>(a_object);
if (!object){
PFATAL("missing argument: 'a_object'"
" or it's not ObjectHttpServer\n"
);
}
if (!a_action){
PFATAL("missing argument: 'a_action'\n");
}
object_path = object->getObjectPath();
prop_fd = dynamic_pointer_cast<ObjectInt32>(
a_action->getActionParam("fd")
);
fd = prop_fd->getVal();
prop_data = dynamic_pointer_cast<ObjectString>(
a_action->getActionParam("data")
);
PDEBUG(100, "object: '%s', new read,"
" fd: '%d',"
" data: '%s'\n",
object_path.c_str(),
fd,
prop_data->c_str()
);
if (!prop_data->empty()){
ObjectMapIt it;
ObjectStringSptr pending_data;
ObjectHttpRequestSptr request;
it = object->m_pending_data->find(prop_fd);
if (object->m_pending_data->end() == it){
request = OBJECT<ObjectHttpRequest>();
object->m_pending_data->add(prop_fd, request);
} else {
request = dynamic_pointer_cast<ObjectHttpRequest>(
it->second
);
}
res = request->parseRequest(
prop_data->c_str(),
prop_data->size()
);
if (!res){
// all content read
} else {
object->save();
goto out;
}
}
{
double cur_time = 0.0f;
struct timeval tv;
gettimeofday(&tv, NULL);
cur_time = tv.tv_sec + tv.tv_usec / 1e6;
PWARN("cur time: '%f'\n", cur_time);
}
if (0){
ObjectSptr action;
action = OBJECT<Object>();
action->setActionName("core.action.thread.write");
action->setActionParam("data", prop_data);
action->setActionParam("fd", fd);
object->emit(action);
}
if (1){
char buffer[512] = { 0x00 };
ObjectSptr action;
ObjectStringSptr data;
string body;
body += "<html>";
body += "<head>";
body += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></meta>";
body += "<title>Hi there!</title>";
body += "</head>";
body += "<body>";
body += "<h1>Зверушкин зверь!</h1>";
body += "</body>";
body += "</html>";
data = OBJECT<ObjectString>();
data->add("HTTP/1.1 200 OK\r\n");
#ifdef __x86_64__
snprintf(buffer, sizeof(buffer),
"Content-Length: %ld\r\n",
body.size()
);
#else
snprintf(buffer, sizeof(buffer),
"Content-Length: %u\r\n",
body.size()
);
#endif
data->add(buffer);
data->add("\r\n");
data->add(body);
action = OBJECT<Object>();
action->setActionName("core.action.thread.write");
action->setActionParam("data", data);
action->setActionParam("fd", fd);
object->emit(action);
}
if (1){
ObjectSptr action;
action = OBJECT<Object>();
action->setActionName("core.action.thread.close");
action->setActionParam("fd", fd);
object->emit(action);
}
out:
return 0;
}
int32_t ObjectHttpServer::s_actionEvent(
Object *a_object,
Object *a_action)
{
ObjectHttpServer *object = NULL;
int32_t fd = -1;
string object_path;
ObjectInt32Sptr prop_fd;
ObjectUniqueSptr prop_flags;
object = dynamic_cast<ObjectHttpServer *>(a_object);
if (!object){
PFATAL("missing argument: 'a_object'"
" or it's not ObjectHttpServer\n"
);
}
object_path = object->getObjectPath();
if (!a_action){
PFATAL("missing argument: 'a_action'\n");
}
prop_fd = dynamic_pointer_cast<ObjectInt32>(
a_action->getActionParam("fd")
);
fd = prop_fd->getVal();
prop_flags = dynamic_pointer_cast<ObjectUnique>(
a_action->getActionParam("flags")
);
PDEBUG(100, "object: '%s', new IO event,"
" fd: '%d', flags: '%s'\n",
object_path.c_str(),
fd,
prop_flags->toString()->c_str()
);
if (prop_flags->has("eof")){
object->m_pending_data->erase(prop_fd);
object->save();
}
return 0;
}
// ---------------- module ----------------
string ObjectHttpServer::s_getType()
{
return "core.object.http.server";
}
int32_t ObjectHttpServer::s_init(
EngineInfo *a_engine_info)
{
g_engine_info = a_engine_info;
return 0;
}
int32_t ObjectHttpServer::s_shutdown()
{
return 0;
}
ObjectSptr ObjectHttpServer::s_objectCreate(
const CreateFlags &a_create_flags)
{
ObjectSptr object;
object = ObjectSptr(new ObjectHttpServer(a_create_flags));
return object;
}
void ObjectHttpServer::s_getTests(
Tests &a_out)
{
}
ModuleInfo core_object_http_server = {
.getType = ObjectHttpServer::s_getType,
.init = ObjectHttpServer::s_init,
.shutdown = ObjectHttpServer::s_shutdown,
.objectCreate = ObjectHttpServer::s_objectCreate,
.getTests = ObjectHttpServer::s_getTests
};
|
532092584988c73bab53b00b4e875c2f3e98c576
|
6f224b734744e38062a100c42d737b433292fb47
|
/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
|
b51d272a790f4a7242a0841990457092e28312a4
|
[
"NCSA",
"LLVM-exception",
"Apache-2.0"
] |
permissive
|
smeenai/llvm-project
|
1af036024dcc175c29c9bd2901358ad9b0e6610e
|
764287f1ad69469cc264bb094e8fcdcfdd0fcdfb
|
refs/heads/main
| 2023-09-01T04:26:38.516584
| 2023-08-29T21:11:41
| 2023-08-31T22:16:12
| 216,062,316
| 0
| 0
|
Apache-2.0
| 2019-10-18T16:12:03
| 2019-10-18T16:12:03
| null |
UTF-8
|
C++
| false
| false
| 19,952
|
h
|
Enums.h
|
//===- Enums.h - Enums for the SparseTensor dialect -------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Typedefs and enums shared between MLIR code for manipulating the
// IR, and the lightweight runtime support library for sparse tensor
// manipulations. That is, all the enums are used to define the API
// of the runtime library and hence are also needed when generating
// calls into the runtime library. Moveover, the `DimLevelType` enum
// is also used as the internal IR encoding of dimension level types,
// to avoid code duplication (e.g., for the predicates).
//
// This file also defines x-macros <https://en.wikipedia.org/wiki/X_Macro>
// so that we can generate variations of the public functions for each
// supported primary- and/or overhead-type.
//
// Because this file defines a library which is a dependency of the
// runtime library itself, this file must not depend on any MLIR internals
// (e.g., operators, attributes, ArrayRefs, etc) lest the runtime library
// inherit those dependencies.
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_DIALECT_SPARSETENSOR_IR_ENUMS_H
#define MLIR_DIALECT_SPARSETENSOR_IR_ENUMS_H
// NOTE: Client code will need to include "mlir/ExecutionEngine/Float16bits.h"
// if they want to use the `MLIR_SPARSETENSOR_FOREVERY_V` macro.
#include <cinttypes>
#include <complex>
#include <optional>
namespace mlir {
namespace sparse_tensor {
/// This type is used in the public API at all places where MLIR expects
/// values with the built-in type "index". For now, we simply assume that
/// type is 64-bit, but targets with different "index" bitwidths should
/// link with an alternatively built runtime support library.
using index_type = uint64_t;
/// Encoding of overhead types (both position overhead and coordinate
/// overhead), for "overloading" @newSparseTensor.
enum class OverheadType : uint32_t {
kIndex = 0,
kU64 = 1,
kU32 = 2,
kU16 = 3,
kU8 = 4
};
// This x-macro calls its argument on every overhead type which has
// fixed-width. It excludes `index_type` because that type is often
// handled specially (e.g., by translating it into the architecture-dependent
// equivalent fixed-width overhead type).
#define MLIR_SPARSETENSOR_FOREVERY_FIXED_O(DO) \
DO(64, uint64_t) \
DO(32, uint32_t) \
DO(16, uint16_t) \
DO(8, uint8_t)
// This x-macro calls its argument on every overhead type, including
// `index_type`.
#define MLIR_SPARSETENSOR_FOREVERY_O(DO) \
MLIR_SPARSETENSOR_FOREVERY_FIXED_O(DO) \
DO(0, index_type)
// These are not just shorthands but indicate the particular
// implementation used (e.g., as opposed to C99's `complex double`,
// or MLIR's `ComplexType`).
using complex64 = std::complex<double>;
using complex32 = std::complex<float>;
/// Encoding of the elemental type, for "overloading" @newSparseTensor.
enum class PrimaryType : uint32_t {
kF64 = 1,
kF32 = 2,
kF16 = 3,
kBF16 = 4,
kI64 = 5,
kI32 = 6,
kI16 = 7,
kI8 = 8,
kC64 = 9,
kC32 = 10
};
// This x-macro includes all `V` types.
#define MLIR_SPARSETENSOR_FOREVERY_V(DO) \
DO(F64, double) \
DO(F32, float) \
DO(F16, f16) \
DO(BF16, bf16) \
DO(I64, int64_t) \
DO(I32, int32_t) \
DO(I16, int16_t) \
DO(I8, int8_t) \
DO(C64, complex64) \
DO(C32, complex32)
// This x-macro includes all `V` types and supports variadic arguments.
#define MLIR_SPARSETENSOR_FOREVERY_V_VAR(DO, ...) \
DO(F64, double, __VA_ARGS__) \
DO(F32, float, __VA_ARGS__) \
DO(F16, f16, __VA_ARGS__) \
DO(BF16, bf16, __VA_ARGS__) \
DO(I64, int64_t, __VA_ARGS__) \
DO(I32, int32_t, __VA_ARGS__) \
DO(I16, int16_t, __VA_ARGS__) \
DO(I8, int8_t, __VA_ARGS__) \
DO(C64, complex64, __VA_ARGS__) \
DO(C32, complex32, __VA_ARGS__)
// This x-macro calls its argument on every pair of overhead and `V` types.
#define MLIR_SPARSETENSOR_FOREVERY_V_O(DO) \
MLIR_SPARSETENSOR_FOREVERY_V_VAR(DO, 64, uint64_t) \
MLIR_SPARSETENSOR_FOREVERY_V_VAR(DO, 32, uint32_t) \
MLIR_SPARSETENSOR_FOREVERY_V_VAR(DO, 16, uint16_t) \
MLIR_SPARSETENSOR_FOREVERY_V_VAR(DO, 8, uint8_t) \
MLIR_SPARSETENSOR_FOREVERY_V_VAR(DO, 0, index_type)
constexpr bool isFloatingPrimaryType(PrimaryType valTy) {
return PrimaryType::kF64 <= valTy && valTy <= PrimaryType::kBF16;
}
constexpr bool isIntegralPrimaryType(PrimaryType valTy) {
return PrimaryType::kI64 <= valTy && valTy <= PrimaryType::kI8;
}
constexpr bool isRealPrimaryType(PrimaryType valTy) {
return PrimaryType::kF64 <= valTy && valTy <= PrimaryType::kI8;
}
constexpr bool isComplexPrimaryType(PrimaryType valTy) {
return PrimaryType::kC64 <= valTy && valTy <= PrimaryType::kC32;
}
/// The actions performed by @newSparseTensor.
enum class Action : uint32_t {
kEmpty = 0,
// newSparseTensor no longer handles `kFromFile=1`, so we leave this
// number reserved to help catch any code that still needs updating.
kFromCOO = 2,
kSparseToSparse = 3,
kEmptyCOO = 4,
kToCOO = 5,
kToIterator = 6,
kPack = 7,
};
/// This enum defines all the sparse representations supportable by
/// the SparseTensor dialect. We use a lightweight encoding to encode
/// both the "format" per se (dense, compressed, singleton) as well as
/// the "properties" (ordered, unique). The encoding is chosen for
/// performance of the runtime library, and thus may change in future
/// versions; consequently, client code should use the predicate functions
/// defined below, rather than relying on knowledge about the particular
/// binary encoding.
///
/// The `Undef` "format" is a special value used internally for cases
/// where we need to store an undefined or indeterminate `DimLevelType`.
/// It should not be used externally, since it does not indicate an
/// actual/representable format.
///
// TODO: We should generalize TwoOutOfFour to N out of M and use property to
// encode the value of N and M.
enum class DimLevelType : uint8_t {
Undef = 0, // 0b00000_00
Dense = 4, // 0b00001_00
Compressed = 8, // 0b00010_00
CompressedNu = 9, // 0b00010_01
CompressedNo = 10, // 0b00010_10
CompressedNuNo = 11, // 0b00010_11
Singleton = 16, // 0b00100_00
SingletonNu = 17, // 0b00100_01
SingletonNo = 18, // 0b00100_10
SingletonNuNo = 19, // 0b00100_11
CompressedWithHi = 32, // 0b01000_00
CompressedWithHiNu = 33, // 0b01000_01
CompressedWithHiNo = 34, // 0b01000_10
CompressedWithHiNuNo = 35, // 0b01000_11
TwoOutOfFour = 64, // 0b10000_00
};
/// This enum defines all the storage formats supported by the sparse compiler,
/// without the level properties.
enum class LevelFormat : uint8_t {
Dense = 4, // 0b00001_00
Compressed = 8, // 0b00010_00
Singleton = 16, // 0b00100_00
CompressedWithHi = 32, // 0b01000_00
TwoOutOfFour = 64, // 0b10000_00
};
/// Returns string representation of the given dimension level type.
constexpr const char *toMLIRString(DimLevelType dlt) {
switch (dlt) {
case DimLevelType::Undef:
return "undef";
case DimLevelType::Dense:
return "dense";
case DimLevelType::Compressed:
return "compressed";
case DimLevelType::CompressedNu:
return "compressed_nu";
case DimLevelType::CompressedNo:
return "compressed_no";
case DimLevelType::CompressedNuNo:
return "compressed_nu_no";
case DimLevelType::Singleton:
return "singleton";
case DimLevelType::SingletonNu:
return "singleton_nu";
case DimLevelType::SingletonNo:
return "singleton_no";
case DimLevelType::SingletonNuNo:
return "singleton_nu_no";
case DimLevelType::CompressedWithHi:
return "compressed_hi";
case DimLevelType::CompressedWithHiNu:
return "compressed_hi_nu";
case DimLevelType::CompressedWithHiNo:
return "compressed_hi_no";
case DimLevelType::CompressedWithHiNuNo:
return "compressed_hi_nu_no";
case DimLevelType::TwoOutOfFour:
return "compressed24";
}
return "";
}
/// Check that the `DimLevelType` contains a valid (possibly undefined) value.
constexpr bool isValidDLT(DimLevelType dlt) {
const uint8_t formatBits = static_cast<uint8_t>(dlt) >> 2;
const uint8_t propertyBits = static_cast<uint8_t>(dlt) & 3;
// If undefined or dense, then must be unique and ordered.
// Otherwise, the format must be one of the known ones.
return (formatBits <= 1 || formatBits == 16)
? (propertyBits == 0)
: (formatBits == 2 || formatBits == 4 || formatBits == 8);
}
/// Check if the `DimLevelType` is the special undefined value.
constexpr bool isUndefDLT(DimLevelType dlt) {
return dlt == DimLevelType::Undef;
}
/// Check if the `DimLevelType` is dense.
constexpr bool isDenseDLT(DimLevelType dlt) {
return dlt == DimLevelType::Dense;
}
/// Check if the `DimLevelType` is 2:4
constexpr bool isTwoOutOfFourDLT(DimLevelType dlt) {
return dlt == DimLevelType::TwoOutOfFour;
}
// We use the idiom `(dlt & ~3) == format` in order to only return true
// for valid DLTs. Whereas the `dlt & format` idiom is a bit faster but
// can return false-positives on invalid DLTs.
/// Check if the `DimLevelType` is compressed (regardless of properties).
constexpr bool isCompressedDLT(DimLevelType dlt) {
return (static_cast<uint8_t>(dlt) & ~3) ==
static_cast<uint8_t>(DimLevelType::Compressed);
}
/// Check if the `DimLevelType` is compressed (regardless of properties).
constexpr bool isCompressedWithHiDLT(DimLevelType dlt) {
return (static_cast<uint8_t>(dlt) & ~3) ==
static_cast<uint8_t>(DimLevelType::CompressedWithHi);
}
/// Check if the `DimLevelType` is singleton (regardless of properties).
constexpr bool isSingletonDLT(DimLevelType dlt) {
return (static_cast<uint8_t>(dlt) & ~3) ==
static_cast<uint8_t>(DimLevelType::Singleton);
}
/// Check if the `DimLevelType` is ordered (regardless of storage format).
constexpr bool isOrderedDLT(DimLevelType dlt) {
return !(static_cast<uint8_t>(dlt) & 2);
}
/// Check if the `DimLevelType` is unique (regardless of storage format).
constexpr bool isUniqueDLT(DimLevelType dlt) {
return !(static_cast<uint8_t>(dlt) & 1);
}
/// Convert a DimLevelType to its corresponding LevelFormat.
/// Returns std::nullopt when input dlt is Undef.
constexpr std::optional<LevelFormat> getLevelFormat(DimLevelType dlt) {
if (dlt == DimLevelType::Undef)
return std::nullopt;
return static_cast<LevelFormat>(static_cast<uint8_t>(dlt) & ~3);
}
/// Convert a LevelFormat to its corresponding DimLevelType with the given
/// properties. Returns std::nullopt when the properties are not applicable for
/// the input level format.
/// TODO: factor out a new LevelProperties type so we can add new properties
/// without changing this function's signature
constexpr std::optional<DimLevelType>
buildLevelType(LevelFormat lf, bool ordered, bool unique) {
auto dlt = static_cast<DimLevelType>(static_cast<uint8_t>(lf) |
(ordered ? 0 : 2) | (unique ? 0 : 1));
return isValidDLT(dlt) ? std::optional(dlt) : std::nullopt;
}
/// Ensure the above conversion works as intended.
static_assert(
(getLevelFormat(DimLevelType::Undef) == std::nullopt &&
*getLevelFormat(DimLevelType::Dense) == LevelFormat::Dense &&
*getLevelFormat(DimLevelType::Compressed) == LevelFormat::Compressed &&
*getLevelFormat(DimLevelType::CompressedNu) == LevelFormat::Compressed &&
*getLevelFormat(DimLevelType::CompressedNo) == LevelFormat::Compressed &&
*getLevelFormat(DimLevelType::CompressedNuNo) == LevelFormat::Compressed &&
*getLevelFormat(DimLevelType::Singleton) == LevelFormat::Singleton &&
*getLevelFormat(DimLevelType::SingletonNu) == LevelFormat::Singleton &&
*getLevelFormat(DimLevelType::SingletonNo) == LevelFormat::Singleton &&
*getLevelFormat(DimLevelType::SingletonNuNo) == LevelFormat::Singleton),
"getLevelFormat conversion is broken");
static_assert(
(buildLevelType(LevelFormat::Dense, false, true) == std::nullopt &&
buildLevelType(LevelFormat::Dense, true, false) == std::nullopt &&
buildLevelType(LevelFormat::Dense, false, false) == std::nullopt &&
*buildLevelType(LevelFormat::Dense, true, true) == DimLevelType::Dense &&
buildLevelType(LevelFormat::TwoOutOfFour, false, true) == std::nullopt &&
buildLevelType(LevelFormat::TwoOutOfFour, true, false) == std::nullopt &&
buildLevelType(LevelFormat::TwoOutOfFour, false, false) == std::nullopt &&
*buildLevelType(LevelFormat::TwoOutOfFour, true, true) ==
DimLevelType::TwoOutOfFour &&
*buildLevelType(LevelFormat::Compressed, true, true) ==
DimLevelType::Compressed &&
*buildLevelType(LevelFormat::Compressed, true, false) ==
DimLevelType::CompressedNu &&
*buildLevelType(LevelFormat::Compressed, false, true) ==
DimLevelType::CompressedNo &&
*buildLevelType(LevelFormat::Compressed, false, false) ==
DimLevelType::CompressedNuNo &&
*buildLevelType(LevelFormat::Singleton, true, true) ==
DimLevelType::Singleton &&
*buildLevelType(LevelFormat::Singleton, true, false) ==
DimLevelType::SingletonNu &&
*buildLevelType(LevelFormat::Singleton, false, true) ==
DimLevelType::SingletonNo &&
*buildLevelType(LevelFormat::Singleton, false, false) ==
DimLevelType::SingletonNuNo),
"buildLevelType conversion is broken");
// Ensure the above predicates work as intended.
static_assert((isValidDLT(DimLevelType::Undef) &&
isValidDLT(DimLevelType::Dense) &&
isValidDLT(DimLevelType::Compressed) &&
isValidDLT(DimLevelType::CompressedNu) &&
isValidDLT(DimLevelType::CompressedNo) &&
isValidDLT(DimLevelType::CompressedNuNo) &&
isValidDLT(DimLevelType::Singleton) &&
isValidDLT(DimLevelType::SingletonNu) &&
isValidDLT(DimLevelType::SingletonNo) &&
isValidDLT(DimLevelType::SingletonNuNo) &&
isValidDLT(DimLevelType::CompressedWithHi) &&
isValidDLT(DimLevelType::CompressedWithHiNu) &&
isValidDLT(DimLevelType::CompressedWithHiNo) &&
isValidDLT(DimLevelType::CompressedWithHiNuNo) &&
isValidDLT(DimLevelType::TwoOutOfFour)),
"isValidDLT definition is broken");
static_assert((!isCompressedDLT(DimLevelType::Dense) &&
isCompressedDLT(DimLevelType::Compressed) &&
isCompressedDLT(DimLevelType::CompressedNu) &&
isCompressedDLT(DimLevelType::CompressedNo) &&
isCompressedDLT(DimLevelType::CompressedNuNo) &&
!isCompressedDLT(DimLevelType::Singleton) &&
!isCompressedDLT(DimLevelType::SingletonNu) &&
!isCompressedDLT(DimLevelType::SingletonNo) &&
!isCompressedDLT(DimLevelType::SingletonNuNo)),
"isCompressedDLT definition is broken");
static_assert((!isCompressedWithHiDLT(DimLevelType::Dense) &&
isCompressedWithHiDLT(DimLevelType::CompressedWithHi) &&
isCompressedWithHiDLT(DimLevelType::CompressedWithHiNu) &&
isCompressedWithHiDLT(DimLevelType::CompressedWithHiNo) &&
isCompressedWithHiDLT(DimLevelType::CompressedWithHiNuNo) &&
!isCompressedWithHiDLT(DimLevelType::Singleton) &&
!isCompressedWithHiDLT(DimLevelType::SingletonNu) &&
!isCompressedWithHiDLT(DimLevelType::SingletonNo) &&
!isCompressedWithHiDLT(DimLevelType::SingletonNuNo)),
"isCompressedWithHiDLT definition is broken");
static_assert((!isSingletonDLT(DimLevelType::Dense) &&
!isSingletonDLT(DimLevelType::Compressed) &&
!isSingletonDLT(DimLevelType::CompressedNu) &&
!isSingletonDLT(DimLevelType::CompressedNo) &&
!isSingletonDLT(DimLevelType::CompressedNuNo) &&
isSingletonDLT(DimLevelType::Singleton) &&
isSingletonDLT(DimLevelType::SingletonNu) &&
isSingletonDLT(DimLevelType::SingletonNo) &&
isSingletonDLT(DimLevelType::SingletonNuNo)),
"isSingletonDLT definition is broken");
static_assert((isOrderedDLT(DimLevelType::Dense) &&
isOrderedDLT(DimLevelType::TwoOutOfFour) &&
isOrderedDLT(DimLevelType::Compressed) &&
isOrderedDLT(DimLevelType::CompressedNu) &&
!isOrderedDLT(DimLevelType::CompressedNo) &&
!isOrderedDLT(DimLevelType::CompressedNuNo) &&
isOrderedDLT(DimLevelType::Singleton) &&
isOrderedDLT(DimLevelType::SingletonNu) &&
!isOrderedDLT(DimLevelType::SingletonNo) &&
!isOrderedDLT(DimLevelType::SingletonNuNo) &&
isOrderedDLT(DimLevelType::CompressedWithHi) &&
isOrderedDLT(DimLevelType::CompressedWithHiNu) &&
!isOrderedDLT(DimLevelType::CompressedWithHiNo) &&
!isOrderedDLT(DimLevelType::CompressedWithHiNuNo)),
"isOrderedDLT definition is broken");
static_assert((isUniqueDLT(DimLevelType::Dense) &&
isUniqueDLT(DimLevelType::TwoOutOfFour) &&
isUniqueDLT(DimLevelType::Compressed) &&
!isUniqueDLT(DimLevelType::CompressedNu) &&
isUniqueDLT(DimLevelType::CompressedNo) &&
!isUniqueDLT(DimLevelType::CompressedNuNo) &&
isUniqueDLT(DimLevelType::Singleton) &&
!isUniqueDLT(DimLevelType::SingletonNu) &&
isUniqueDLT(DimLevelType::SingletonNo) &&
!isUniqueDLT(DimLevelType::SingletonNuNo) &&
isUniqueDLT(DimLevelType::CompressedWithHi) &&
!isUniqueDLT(DimLevelType::CompressedWithHiNu) &&
isUniqueDLT(DimLevelType::CompressedWithHiNo) &&
!isUniqueDLT(DimLevelType::CompressedWithHiNuNo)),
"isUniqueDLT definition is broken");
} // namespace sparse_tensor
} // namespace mlir
#endif // MLIR_DIALECT_SPARSETENSOR_IR_ENUMS_H
|
bd7c04c6bd965e01119ccd6f5866ac825e3a968a
|
f31791f8b526e98a93f67ecae4cfcb3ea6ac1d6b
|
/src/util/messages/types/LockAccessMsg.cpp
|
10db3524054b0fae68c934586793ca7a4dd5c9c7
|
[] |
no_license
|
jeffreymu/ssrg-hyflow-cpp
|
cd590b2691843f719ce7324f20767d5191da1be9
|
91e1b34a3b2b53a33bf7c432ddd9c7b24bb1df8c
|
refs/heads/master
| 2023-03-17T21:34:52.497894
| 2017-01-24T22:05:04
| 2017-01-24T22:05:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,844
|
cpp
|
LockAccessMsg.cpp
|
/*
* LockAccessMsg.cpp
*
* Created on: Sep 4, 2012
* Author: mishras[at]vt.edu
*/
#include <fstream>
#include <iostream>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/serialization/base_object.hpp>
#include "LockAccessMsg.h"
#include "../../networking/NetworkManager.h"
#include "../../../core/context/LockTable.h"
#include "../../messages/MessageMaps.h"
#include "../../logging/Logger.h"
#include "../HyflowMessageFuture.h"
namespace vt_dstm {
LockAccessMsg::LockAccessMsg(std::string objId, int32_t obVer, unsigned long long tid) {
lock = false;
locked = false;
request = false;
objectId = objId;
objVersion = obVer;
txnId = tid;
}
template<class Archive>
void LockAccessMsg::serialize(Archive & ar, const unsigned int version) {
ar & boost::serialization::base_object<BaseMessage>(*this);
ar & lock;
ar & locked;
ar & request;
ar & objectId;
ar & objVersion;
ar & txnId;
}
std::string LockAccessMsg::getObjectId() const {
return objectId;
}
void LockAccessMsg::setObjectId(std::string objectId) {
this->objectId = objectId;}
void LockAccessMsg::lockAccessHandler(HyflowMessage& m) {
LockAccessMsg *lmsg = (LockAccessMsg*) (m.getMsg());
if (lmsg->request) {
if (lmsg->lock) {
LOG_DEBUG ("Got a Lock request for %s from %d for version%d\n", lmsg->objectId.c_str(), m.fromNode, lmsg->objVersion);
lmsg->locked = LockTable::tryLock(lmsg->objectId, lmsg->objVersion, lmsg->txnId);
} else {
LOG_DEBUG ("Got an unlock request for %s from %d for version%d\n", lmsg->objectId.c_str(), m.fromNode, lmsg->objVersion);
LockTable::tryUnlock(lmsg->objectId, lmsg->objVersion, lmsg->txnId);
}
lmsg->setRequest(false);
/* If message as callback and network library don't support the callback, we need to reply manually*/
if (m.isCallback) {
if (!m.isCallbackSupported) {
NetworkManager::sendMessage(m.fromNode, m);
}
}
} else {
if (lmsg->lock) {
LOG_DEBUG ("Got a Lock response for %s\n", lmsg->objectId.c_str());
HyflowMessageFuture* cbfmsg = MessageMaps::getMessageFuture(m.msg_id,
m.msg_t);
if (cbfmsg) {
cbfmsg->setBoolResponse(lmsg->locked);
cbfmsg->notifyMessage();
} else {
Logger::fatal("Can not find Lock access future for m_id %s\n", m.msg_id.c_str());
}
}else {
// Unlock response can be ignored
LOG_DEBUG ("Got a unlock response for %s\n", lmsg->objectId.c_str());
}
}
}
LockAccessMsg::~LockAccessMsg() {
}
bool LockAccessMsg::isLock() const {
return lock;
}
void LockAccessMsg::setLock(bool lock) {
this->lock = lock;
}
bool LockAccessMsg::isLocked() const {
return locked;
}
void LockAccessMsg::setLocked(bool locked) {
this->locked = locked;
}
bool LockAccessMsg::isRequest() const {
return request;
}
void LockAccessMsg::setRequest(bool request) {
this->request = request;}
void LockAccessMsg::serializationTest(){
// create and open a character archive for output
std::ofstream ofs("/tmp/ObjectTrackerMsgReq", std::ios::out);
// create class instance
LockAccessMsg res("3-0",0, 0);
// save data to archive
{
boost::archive::text_oarchive oa(ofs);
// write class instance to archive
oa << res;
// archive and stream closed when destructors are called
}
// ... some time later restore the class instance to its original state
LockAccessMsg r1;
{
// create and open an archive for input
std::ifstream ifs("/tmp/ObjectTrackerMsgReq", std::ios::in);
boost::archive::text_iarchive ia(ifs);
// read class state from archive
ia >> r1;
// archive and stream closed when destructors are called
if (r1.getObjectId().compare("3-0") == 0) {
std::cout<< "LockAccessMsg serialization Test passed"<<std::endl;
}else {
std::cerr<< "LockAccessMsg serialization Test FAILED!!!"<<std::endl;
}
}
}
} /* namespace vt_dstm */
|
9898c66e8ace3fc9a03fcdbf724b236b494f4df2
|
c4163b1455ab10fa3f03ff95ae4e1fa96bd9dfb2
|
/ex02/C.hpp
|
125e3c661f9c48551c5d9ffff1bbce37079f397a
|
[] |
no_license
|
Ovoda/Piscine_CPP_06
|
a3107b77a007ef09633f3a266d360639609e9c43
|
147c60ae9088bcaacc3cde8cab417f6d88cb8c44
|
refs/heads/master
| 2023-06-15T22:28:45.132244
| 2021-07-09T14:45:21
| 2021-07-09T14:45:21
| 383,029,657
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 509
|
hpp
|
C.hpp
|
#ifndef C_HPP
#define C_HPP
#include <iostream>
#include <string>
#include "Base.hpp"
class C : public Base {
public:
C(void) {}
C(C const &src) { *this = src; }
~C() {}
C &operator=(C const &rhs) {
static_cast<void>(rhs);
return *this;
}
};
std::ostream &operator<<(std::ostream &o, C const &i) {
static_cast<void>(i);
o << "Instance of class C";
return (o);
}
#endif /* *************************************************************** C_H \
*/
|
bd8714e4f241ba0b4f628af4793ec0c37bfb6b8e
|
6c22cc907eb6b73af36cb9fe2c0236391ac7cde8
|
/100000566E.cpp
|
bbfb48d33e5be56395cdfa97c43ba5f7bba98450
|
[] |
no_license
|
lilexuan/codeup
|
eafa5949f2fb493874dbef8a71b608bb0f333875
|
33a2c1847198574d3a91d1a33aca5d56503b25d1
|
refs/heads/master
| 2021-07-15T07:22:21.825011
| 2019-03-08T08:31:17
| 2019-03-08T08:31:17
| 110,666,759
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 327
|
cpp
|
100000566E.cpp
|
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
double a,b,c;
scanf("%lf%lf%lf",&a,&b,&c);
double delta = b*b-4*a*c;
double r1,r2;
r1 = (b+sqrt(delta))/(2*a);
r2 = (b-sqrt(delta))/(2*a);
printf("r1= %.2lf\n",r1);
printf("r2= %.2lf",r2);
return 0;
}
|
d72419f7a6b152a37105496c07c56e109844e34c
|
f437e5cb0788428d564dc29bb8c303624a2d260b
|
/libbfcp/samples/client.h
|
809e3c122737c87dad79d9374b7549aebcace1d6
|
[] |
no_license
|
fast01/libbfcp
|
b92831ded01e7d1e9d101e3514abbc7053900895
|
32d5067667210377edf7996b0ebf3afb6e25d53c
|
refs/heads/master
| 2023-02-12T15:22:46.732524
| 2021-01-15T15:14:27
| 2021-01-15T15:14:27
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,021
|
h
|
client.h
|
/**
*
*
* \brief Sample test of BFCP particpant API .
*
*
* \copyright Unpublished Confidential Information of IVES Do not disclose.
* Copyright (c) 2000-2014 IVES All Rights Reserved.
*
* \author Philippe Verney
*
* \file client.h
*
* \version $Revision: 2148 $
*
* \date $Date: 2014-01-22 12:14:17 +0100 (Wed, 22 Jan 2014) $
*
* \remarks
*
* \ingroup libbfcp
*
* \namespace sampleClient
*/
#ifndef _BFCP_CLIENT_TEST_H_
#define _BFCP_CLIENT_TEST_H_
#include <bfcp_participant.h>
#define BFCPAPI_SUCCESS 1
#define BFCPAPI_ERROR 0
typedef enum {
FLOOCTRL_MODE_CLIENT = 0 ,
FLOOCTRL_MODE_SERVER ,
FLOOCTRL_MODE_CLIENT_AND_SERVER
}e_floorctrlMode ;
class sampleClient : public BFCP_Participant::ParticipantEvent {
public:
sampleClient();
~sampleClient();
void SetConfID( UINT32 p_confID ) ;
UINT32 GetConfID( ) ;
void SetUserID( UINT16 p_userID );
UINT16 GetUserID( );
void SetFloorID( UINT16 p_floorID );
UINT16 GetFloorID( ) ;
void SetStreamID( UINT16 p_streamID );
UINT16 GetStreamID( );
void SetIsPassive( bool p_IsServer );
bool GetIsPassive( ) ;
void SetFloorctrlMode( e_floorctrlMode pfloorctrlMode ) ;
e_floorctrlMode GetFloorctrlMode(void) ;
void menu(char *lineptr) ;
// BFCP_Participant::ParticipantEvent
virtual bool OnBfcpParticipantEvent(BFCP_fsm::e_BFCP_ACT p_evt , BFCP_fsm::st_BFCP_fsm_event* p_FsmEvent );
// traces
virtual void Log(const char* pcFile, int iLine, int iErrorLevel, const char* pcFormat, ...) ;
private:
bool connected(void);
bool disconnected(void);
bool floorRequestStatusAccepted(BFCP_fsm::st_BFCP_fsm_event* p_evt);
bool floorRequestStatusGranted(BFCP_fsm::st_BFCP_fsm_event* p_evt);
bool floorRequestStatusAborted(BFCP_fsm::st_BFCP_fsm_event* p_evt);
bool floorStatusAccepted(BFCP_fsm::st_BFCP_fsm_event* p_evt);
bool floorStatusGranted(BFCP_fsm::st_BFCP_fsm_event* p_evt);
bool floorStatusAborted(BFCP_fsm::st_BFCP_fsm_event* p_evt);
bool floorReleaseStatusAborted(BFCP_fsm::st_BFCP_fsm_event* p_evt);
bool floorRequest(BFCP_fsm::st_BFCP_fsm_event* p_evt);
bool floorRelease(BFCP_fsm::st_BFCP_fsm_event* p_evt);
BFCP_Participant* m_BFCP_Participant ;
e_floorctrlMode m_e_floorctrlMode ;
UINT32 m_confID ;
UINT16 m_userID ;
UINT16 m_floorID ;
UINT16 m_streamID ;
bool m_IsPassive ;
int OpenParticipantTcpConnection(const char* local_address, int local_port, const char* remote_address, int remote_port, bool isPassive);
};
#endif
|
e53c0163b4eb5a9bcede24d784fad993231182c6
|
203e602370f4673f65f3c3022355ff6634c268ac
|
/c/book/vector/stringFind.cpp
|
4f7c2da8612a7c9536a4a8faf59e5e120a8cf6b1
|
[
"Apache-2.0"
] |
permissive
|
WeAreChampion/notes
|
4942fbd5c238559eb318787adc27be72f848de44
|
6c0f726d1003e5083d9cf1b75ac6905dc1c19c07
|
refs/heads/master
| 2020-06-14T03:54:00.587873
| 2016-12-07T13:02:45
| 2016-12-07T13:02:45
| 75,520,188
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 166
|
cpp
|
stringFind.cpp
|
#include<iostream>
using namespace std;
void Test()
{
string s="asdasdasvx";
cout<<s.find("b")<<endl;
cout<<s.find("d")<<endl;
}
int main()
{
Test();
return 0;
}
|
7addf9ef5c8c2cde0f1c6cc594621c68f8683a55
|
f8b6238c44679460dee0fbd49f3f21c309791e1d
|
/A-Star Ambush/A-Star Ambush/Main.cpp
|
445959809d4c77c4adaff965c7db851fe15a1787
|
[] |
no_license
|
JohnCodd/GamesEngineeringII
|
92a636af91621108895c33c799899ba95b27c570
|
a3b095e221027f1b0cdc52995c38e1efb4c467e6
|
refs/heads/master
| 2020-03-29T16:03:41.284544
| 2019-03-28T15:05:23
| 2019-03-28T15:05:23
| 150,095,001
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 112
|
cpp
|
Main.cpp
|
#include "Game.h"
bool run = true;
int main(int argc, char * argv[])
{
Game game;
game.loop();
return 0;
}
|
c1f1e46224c81f01b0ead459d7e99cb262d99c09
|
90517ce1375e290f539748716fb8ef02aa60823b
|
/solved/f-h/finding-lcm/finding.cpp
|
8b72a352627e2097a4c7b778874621ec7d5ccb39
|
[
"Unlicense",
"LicenseRef-scancode-public-domain"
] |
permissive
|
Code4fun4ever/pc-code
|
23e4b677cffa57c758deeb655fd4f71b36807281
|
77ce51d692acf6edcb9e47aeb7b7f06bf56e4e90
|
refs/heads/master
| 2021-01-15T08:15:00.681534
| 2014-09-08T05:28:39
| 2014-09-08T05:28:39
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,035
|
cpp
|
finding.cpp
|
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;
typedef unsigned long long u64;
typedef vector<int> IV;
#define cFor(t,v,c) for(t::const_iterator v=c.begin(); v != c.end(); v++)
// Number Theory
#define IsComp(n) (_c[n>>6]&(1<<((n>>1)&31)))
#define SetComp(n) _c[n>>6]|=(1<<((n>>1)&31))
namespace Num
{
const int MAX = 1000; // sqrt(10^6)
const int LMT = 32; // sqrt(MAX)
int _c[(MAX>>6)+1];
IV primes;
void primeSieve() {
for (int i = 3; i <= LMT; i += 2)
if (!IsComp(i)) for (int j = i*i; j <= MAX; j+=i+i) SetComp(j);
primes.push_back(2);
for (int i=3; i <= MAX; i+=2) if (!IsComp(i)) primes.push_back(i);
}
}
using namespace Num;
u64 gcd(u64 a, u64 b) { for (u64 c = a%b; c; a=b,b=c,c=a%b); return b; }
int main()
{
primeSieve();
int T;
scanf("%d", &T);
int ncase = 1;
while (T--) {
u64 a, b, L;
scanf("%llu%llu%llu", &a, &b, &L);
u64 l = a*b/gcd(a, b); // LCM(a, b)
if (L % l != 0) {
printf("Case %d: impossible\n", ncase++);
continue;
}
u64 f = L/l;
u64 ans = f;
int sa = sqrt(a);
int sb = sqrt(b);
cFor (IV, p, primes) {
int prime = *p;
if (prime > sa && prime > sb) break;
u64 fa = 1;
if (a % prime == 0) {
while (a % prime == 0) {
a /= prime;
fa *= prime;
}
sa = sqrt(a);
}
u64 fb = 1;
if (b % prime == 0) {
while (b % prime == 0) {
b /= prime;
fb *= prime;
}
sb = sqrt(b);
}
if (f % prime == 0)
ans *= max(fa, fb);
}
if (a > 1 && f % a == 0) ans *= a;
if (b > 1 && b != a && f % b == 0) ans *= b;
printf("Case %d: %llu\n", ncase++, ans);
}
return 0;
}
|
0ee72453aa40d1d71a5ca6816e21b09d1a4e715f
|
7f0718647279fbdd0e57938718108e0c70e3e2b8
|
/Source/Engine/src/audio/codec/ogg.cpp
|
45a62400594cc30498a6a2bb65b5437d8198c1a4
|
[
"MIT"
] |
permissive
|
DatZach/Swift
|
26dffa7405195e38899817a915eb320c57abb33b
|
b0c6f9c87e8c8dfe8a19dedc4dd57081fa5cdef7
|
refs/heads/master
| 2022-07-06T03:23:32.575916
| 2019-12-03T15:27:14
| 2019-12-03T15:27:14
| 225,651,121
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,425
|
cpp
|
ogg.cpp
|
/*
* ogg.cpp
* OGG Codec
*/
#include <Audio/Codecs/Ogg.hpp>
namespace Audio
{
CodecOgg::CodecOgg()
: Codec(),
renderer(nullptr),
duhFile(nullptr)
{
static bool dumbInitialized = false;
if (dumbInitialized)
return;
dumb_register_stdfiles();
dumbInitialized = true;
}
CodecOgg::~CodecOgg()
{
if (renderer)
{
duh_end_sigrenderer(renderer);
renderer = nullptr;
}
if (duhFile)
{
unload_duh(duhFile);
duhFile = nullptr;
}
}
bool CodecOgg::Open(const std::string& filename)
{
// Clean up before loading something new
if (renderer)
{
duh_end_sigrenderer(renderer);
renderer = nullptr;
}
if (duhFile)
{
unload_duh(duhFile);
duhFile = nullptr;
}
// Try this codec
duhFile = dumb_load_ogg(filename.c_str(), 0);
if (duhFile == nullptr)
return false;
// Parse audio information for rendering
channelCount = 1;
sampleRate = 44100;
DUMB_IT_SIGDATA* sigData = duh_get_it_sigdata(duhFile);
samples = dumb_it_sd_get_n_samples(sigData);
return true;
}
size_t CodecOgg::Read(short* data, size_t count)
{
if (renderer == nullptr)
return 0;
return duh_render(renderer, 16, 0, 100.0f, 0.0f, count, data);
}
void CodecOgg::Seek(unsigned int offset)
{
if (renderer)
{
duh_end_sigrenderer(renderer);
renderer = nullptr;
}
renderer = duh_start_sigrenderer(duhFile, 0, channelCount, offset << 16);
}
}
|
e450f124965e92870065f1851cb818a52c7e27a8
|
413b1f31ce777599dc33636d582e95cf6d7f171b
|
/Building.hpp
|
9c410d211116190a5cba25bdad49b038d754cea4
|
[] |
no_license
|
MrNeilJ/lab_4
|
5fa19f93022bde530bbd268e221e2cf253bdef0b
|
319145258a4e2a05b008b3daea178fa7c30d5352
|
refs/heads/master
| 2021-01-20T04:25:44.903926
| 2017-04-30T01:08:03
| 2017-04-30T01:08:03
| 89,691,188
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 910
|
hpp
|
Building.hpp
|
/**************************************************************
* Author: Neil Johnson
*
* Date: 4.30.2017
*
* Description: This is the header building class for the University
* program. In here we are able to construct building objects
* and can print out information stored in it, such as
* the name of the building, size in sqft and even the address.
**************************************************************/
#ifndef LAB_4_BUILDING_HPP
#define LAB_4_BUILDING_HPP
#include <iostream>
class Building {
private:
std::string name;
std::string address;
double sqft;
public:
// Constructor
Building(std::string, std::string, double);
// Setters
void setName(std::string);
void setAddress(std::string);
void setSqft(double);
// Getters
std::string getName();
std::string getAddress();
double getSqft();
// Member Functions
void printBuilding();
};
#endif //LAB_4_BUILDING_HPP
|
90669c83dc2bd1ee822c7e17b3a37e5e32e3abb0
|
9401eaffc1830a2e239d6b9aee1e36a9e7470f03
|
/CodeBase/Generic/BaseObjects/Components/Team271_PWM.cpp
|
7661db2bac26e5343d66ae33896aef038fa14edf
|
[] |
no_license
|
Team271/2019Season
|
f552f92f830ce04ec7ec432ea79a75e82a08b2e1
|
acaad0ba0520da9e0e463c9e06ee3df456519957
|
refs/heads/master
| 2020-12-04T10:41:04.246017
| 2020-01-04T08:37:38
| 2020-01-04T08:37:38
| 231,732,146
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,170
|
cpp
|
Team271_PWM.cpp
|
/*
* FRC Team 271's 2019 Comp Season Code
* Copyright (C) 2019 FRC Team 271
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "Team271_Includes.hpp"
#if defined(T271_PWM_ENABLE)
t271_pwm_data_index::t271_pwm_data_index(void)
{
Names_[T271_PWM_DATA_CHANNEL] = "T271_PWM_DATA_CHANNEL";
Names_[T271_PWM_DATA_INVERTED] = "T271_PWM_DATA_INVERTED";
Names_[T271_PWM_DATA_NEUTRAL_DEADBAND] = "T271_PWM_DATA_NEUTRAL_DEADBAND";
}
Team271PWM::Team271PWM(Team271Base* const argParent,
const uint32_t argChannel)
: Team271Base(argParent,
to_string(argChannel),
t271_pwm_data_index::T271_DATA_COUNT)
{
#if defined( T271_IO_ENABLE )
int32_t tmpStatus = 0;
#endif
LOG_TRACE("%s - Constructor Start",
GetName().c_str());
/*
* Store Parameters
*/
Write(t271_pwm_data_index::T271_PWM_DATA_CHANNEL,
argChannel);
if (argChannel >= kNumPWMChannels)
{
LOG_ERROR("%s - Couldn't Open Channel %d",
GetName().c_str(),
argChannel);
}
else
{
#if defined( T271_IO_ENABLE )
Team271IO::getInstance().PWM_InitializePort(argChannel,
&tmpStatus);
#endif
/* Defaults to allow an always valid config. */
SetConfig(2.0,
1.501,
1.5,
1.499,
1.0);
SetPeriodScale(3);
Set(0);
#if defined( T271_IO_ENABLE )
Team271IO::getInstance().PWM_SetEliminateDeadband(argChannel,
0);
#endif
LatchZero();
}
LOG_TRACE("%s - Constructor End",
GetName().c_str());
}
Team271PWM::~Team271PWM(void)
{
#if defined( T271_IO_ENABLE )
int32_t tmpStatus = 0;
#endif
Set(0);
#if defined( T271_IO_ENABLE )
Team271IO::getInstance().PWM_FreePort(Read<uint32_t>(t271_pwm_data_index::T271_PWM_DATA_CHANNEL),
&tmpStatus);
#endif
}
/*
*
* Getters
*
*/
const string Team271PWM::GetClassName(void) const
{
return "Team271PWM";
}
/*
*
* Setters
*
*/
void Team271PWM::SetInverted(const TEAM271_INVERTED_STATE argInverted)
{
Write(t271_pwm_data_index::T271_PWM_DATA_INVERTED,
argInverted);
}
void Team271PWM::SetConfig(const double argMax,
const double argDeadbandMax,
const double argCenter,
const double argDeadbandMin,
const double argMin)
{
#if defined( T271_IO_ENABLE )
int32_t tmpStatus = 0;
Team271IO::getInstance().PWM_SetConfig(Read<uint32_t>(t271_pwm_data_index::T271_PWM_DATA_CHANNEL),
argMax,
argDeadbandMax,
argCenter,
argDeadbandMin,
argMin,
&tmpStatus);
#endif
}
void Team271PWM::SetPeriodScale(const uint32_t argScale)
{
#if defined( T271_IO_ENABLE )
int32_t tmpStatus = 0;
Team271IO::getInstance().PWM_SetPeriodScale(Read<uint32_t>(t271_pwm_data_index::T271_PWM_DATA_CHANNEL),
argScale,
&tmpStatus);
#endif
}
void Team271PWM::SetNeutralDeadband(const float argDeadband)
{
Write(t271_pwm_data_index::T271_PWM_DATA_NEUTRAL_DEADBAND,
argDeadband);
}
/*
*
* Output Functions
*
*/
void Team271PWM::LatchZero(void)
{
#if defined( T271_IO_ENABLE )
int32_t tmpStatus = 0;
Team271IO::getInstance().PWM_LatchPWMZero(Read<uint32_t>(t271_pwm_data_index::T271_PWM_DATA_CHANNEL),
&tmpStatus);
#endif
}
void Team271PWM::Set(const double argSet)
{
#if defined( T271_IO_ENABLE )
int32_t tmpStatus = 0;
double tmpSet = argSet;
float tmpDeadband = Read<float>(t271_pwm_data_index::T271_PWM_DATA_NEUTRAL_DEADBAND);
if (Read<TEAM271_INVERTED_STATE>(t271_pwm_data_index::T271_PWM_DATA_INVERTED) == TEAM271_INVERTED_STATE_INVERTED)
{
tmpSet *= -1.0;
}
if (fabs(tmpSet) < tmpDeadband)
{
tmpSet = 0;
}
Team271IO::getInstance().PWM_SetSpeed(Read<uint32_t>(t271_pwm_data_index::T271_PWM_DATA_CHANNEL),
tmpSet,
&tmpStatus);
#endif
}
#endif
|
d9183bff6b4cfe3ca0dbdfda7e9c591ca0c23c61
|
65deabfadbc675929f17e280156597f92cf2480d
|
/laughing-pancake/Classes/TMXLayerUtil.cpp
|
f655bdc196d7ebac9a06f18cc173250a6bf95424
|
[
"MIT"
] |
permissive
|
Frogp/laughing-pancake
|
ab4121bd3ce59d96ebbb81d62d4b040ed3838938
|
bf102cf2ddfdfbdf1e9e7b5af586882924ca4213
|
refs/heads/master
| 2021-05-04T02:41:05.858104
| 2016-07-21T17:52:22
| 2016-07-21T17:52:22
| 55,394,402
| 0
| 0
| null | null | null | null |
UHC
|
C++
| false
| false
| 5,242
|
cpp
|
TMXLayerUtil.cpp
|
#include "TMXLayerUtil.h"
TMXLayerUtil * TMXLayerUtil::instance;
Point TMXLayerUtil::GenAbsoulutePosition(Point To)
{
return ccp(coordMap[(int)To.y][(int)To.x].x, coordMap[(int)To.y][(int)To.x].y);
}
TMXLayerUtil::TMXLayerUtil()
{
}
TMXLayerUtil::~TMXLayerUtil()
{
}
/*
moveTo(이동하고자 하는 좌표, 캐릭터, 타일 하나 크기, 레이어)
coordMap 에서 맵 좌표와 대응 되는 ui 상 좌표로 캐릭터 setposition 해줌.
*/
bool TMXLayerUtil::moveTo(Point To, VisualCharactor* armature, Size tilesize, cocos2d::TMXLayer *layer)
{
if (map[(int)To.y][(int)To.x] == 0)
{
armature->SetMoveAnimation(GenAbsoulutePosition(To));
return true;
}
else
return false;
}
Point TMXLayerUtil::GetAbsolutePostion(CCPoint input)
{
int middlex = tilemapsize.width / 2;
int middley = tilemapsize.height / 2;
for (int i = 0; i < ROWS; i++)
{
for (int j = 0; j < COLS; j++)
{
if (coordMap[i][j].x - middlex < input.x &&
coordMap[i][j].x + middlex > input.x &&
coordMap[i][j].y < input.y &&
coordMap[i][j].y + tilemapsize.height > input.y)
{
return Point(j, i);
}
}
}
return Point();
}
void TMXLayerUtil::showArea(Point Start, int size, cocos2d::TMXLayer *layer)
{
int xc[10000], yc[10000], lc[10000], pos, cnt;
const int initl = 10;
pos = 0;
cnt = 0;
lc[cnt] = initl;
xc[cnt] = Start.x;
yc[cnt++] = Start.y;
map[(int)Start.y][(int)Start.x] = 11;
while (pos < cnt)
{
for (int i = 0; i < 6; i++)
{
int x, y, l;
Point dir;
l = lc[pos] + 1;
if ((yc[pos]) % 2 == 0)
dir = even_directions[i];
else
dir = odd_directions[i];
x = xc[pos] + dir.x;
y = yc[pos] + dir.y;
if (x >= 0 && y >= 0 && x < ROWS && y < COLS
&& map[y][x] == 0 && l<=(size+ initl))
{
layer->setTileGID(5, Vec2((float)x, (float)y)); //Path Tile Show
lc[cnt] = l;
xc[cnt] = x;
yc[cnt++] = y;
map[y][x] = l;
}
}
pos++;
}
}
void TMXLayerUtil::bfs(Point End, Point Start)
{
int xc[10000], yc[10000], lc[10000], pos, cnt;
pos = 0;
cnt = 0;
lc[cnt] = 11;
xc[cnt] = Start.x;
yc[cnt++] = Start.y;
map[(int)Start.y][(int)Start.x] = 11;
while (pos < cnt)
{
//printf("%d %d\n", xc[pos], yc[pos]);
if (xc[pos] == (int)End.x && yc[pos] == (int)End.y)
break;
for (int i = 0; i < 6; i++)
{
int x, y, l;
Point dir;
l = lc[pos] + 1;
if ((yc[pos]) % 2 == 0)
dir = even_directions[i];
else
dir = odd_directions[i];
x = xc[pos] + dir.x;
y = yc[pos] + dir.y;
//printf("%d %d", x,y);
//printf("%d->%d %d->%d\n", directions[i].x,x, directions[i].y,y);
if (x >= 0 && y >= 0 && x < ROWS && y < COLS
)//&& map[y][x] == 0)
{
lc[cnt] = l;
xc[cnt] = x;
yc[cnt++] = y;
//printf("%d %d\n", x, y);
map[y][x] = l;
}
}
pos++;
}
}
void TMXLayerUtil::GetMovePos(Point pos, int sl, std::vector<Point>& data)
{
int sx = pos.x;
int sy = pos.y;
data.push_back(pos);
for (int i = 0; i < 6; i++)
{
int x, y, l;
Point dir;
l = sl - 1;
if ((sy) % 2 == 0)
dir = even_directions[i];
else
dir = odd_directions[i];
x = sx + dir.x;
y = sy + dir.y;
//printf("%d->%d %d->%d\n", dir.x,x, dir.y,y);
if (x >= 0 && y >= 0 && x < ROWS && y < COLS
&& map[y][x] == l)
{
//printf("%d %d\n", x, y);
GetMovePos(ccp(x, y), l, data);
break;
}
}
}
void TMXLayerUtil::Init_Map(cocos2d::TMXLayer *layer, Size tilesize) {
const float width = tilesize.width/2;
const float height = tilesize.height-60; //실제 보여지는 타일 크기
tilemapsize = tilesize;
int even_y = -1;
int odd_y = -1;
layer->tileAt(ccp(0, 0));
for (int y = 0; y < ROWS; y++) //initcol, initrow 를 기준으로 맵 좌표*타일크기들 각각 해서 계산.
{
float initcol = width; // 0,0 좌표
float initrow = height;
if (y % 2!=0) //y좌표가 홀수 짝수냐에 따라 시작 기준 위치 틀림.
{
initcol = width * 2; // 0,1 좌표
initrow = height + (tilesize.height / 2);
odd_y++;
}
else
{
even_y++;
}
for (int x = 0; x < COLS; x++)
{
coordMap[y][x].x = (x*(tilesize.width))+initcol;
coordMap[y][x].y = realHeight-(((y%2==0?even_y:odd_y)*tilesize.height)+initrow);
//타일맵과 코코스 대응 좌표가 틀리므로 realHeight(약 1000)에서 게산한 y좌표값 빼줌
if (layer->tileGIDAt(Vec2((float)x, (float)y)) == 4) //PASS
{
map[y][x] = 0;
}
else //NON-PASS
{
map[y][x] = 1;
}
}
}
}
std::vector<Point> TMXLayerUtil::SetTestPath(Point End, Point Start, cocos2d::TMXLayer *layer)
{
std::vector<Point> output;
//Init_Map(layer, tilesize);
bfs(End,Start);
GetMovePos(End, map[(int)End.y][(int)End.x],output);
//layer->setTileGID(6, Vec2((float)Start.x, (float)Start.y));
//layer->setTileGID(7, Vec2((float)End.x, (float)End.y));
return output;
}
void TMXLayerUtil::SetTestArea(Point Coords, int size, cocos2d::TMXLayer *layer)
{
//Init_Map(layer, tilesize);
showArea(Coords, size, layer);
layer->setTileGID(6, Vec2((float)Coords.x, (float)Coords.y));
}
void TMXLayerUtil::SetTestMove(Point Coords, cocos2d::TMXLayer *layer, Size tilesize, VisualCharactor* armature)
{
//Init_Map(layer, tilesize);
moveTo(Coords, armature, tilesize, layer);
}
|
822bacf5c45fccc62f0c43f73d2a9c3b653f4330
|
1a1ffb9a920ebf7a252433008303dfeac845adab
|
/Part-I Basic Technieques/Chapter 7 (Dyanmic Programming)/5_knapsack_problem.cpp
|
6226425b124fd6c233a8fa6c609812b3c308f30b
|
[] |
no_license
|
itsamankrsingh/hritikkumar-cp
|
82b06d3d04bb455b783ea6490e979be798865dfa
|
e5545bf018ce64c852bab9a96240176b15af4916
|
refs/heads/master
| 2023-03-17T15:58:26.156977
| 2021-03-11T08:02:53
| 2021-03-11T08:02:53
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,731
|
cpp
|
5_knapsack_problem.cpp
|
// @hritikkumar
#include<bits/stdc++.h> // all header files
#define endl '\n'
using namespace std;
int knapsackDP(int*, int);
int knapsackDPEfficient(int*, int);
int main(void)
{
std::ios::sync_with_stdio(false); cin.tie(0); // fastio
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin>>n;
int* weight = new int [n];
for(int i=0;i<n;i++) cin>> weight[i];
int ans = knapsackDP(weight, n); // using 2d array
ans = knapsackDPEfficient(weight, n); // using 1d array
cout<<ans<<endl;
return 0; // return type is int
}
int knapsackDP(int* weight, int n)
{
int ans = 0;
int total_sum = accumulate(weight, weight + n, 0);
bool** dp_table = new bool*[total_sum+1];
for(int i=0;i<=total_sum;++i)
dp_table[i] = new bool[n+1];
for(int i=0;i<=total_sum; ++i)
for(int j=0;j<=n;j++)
dp_table[i][j] = false;
dp_table[0][0] = true;
for(int k = 1; k<=n; k++)
{
for(int x = 0; x<=total_sum; ++x)
{
// weight index will be [k-1] for kth values in our choices
if( (x - weight[k-1]) >= 0)
dp_table[x][k] |= dp_table[x-weight[k-1]][k-1];
dp_table[x][k] |= dp_table[x][k-1];
}
}
for(int i=0; i<=total_sum; ++i)
{
if(dp_table[i][n])
ans +=1;
}
return ans;
}
int knapsackDPEfficient(int* weight, int n)
{
int ans = 0;
int total_sum = accumulate(weight, weight + n, 0);
bool* dp_table = new bool[total_sum+1];
for(int i=0;i<=total_sum; ++i)
dp_table[i] = false;
dp_table[0] = true;
for(int k = 1; k<=n; k++)
{
for(int x = total_sum; x >= 0; --x)
{
if(dp_table[x])
dp_table[x+weight[k-1]] = true;
}
}
for(int i=0; i<=total_sum; ++i)
{
if(dp_table[i])
ans +=1;
}
return ans;
}
|
0dec439a28972407a71a5f84fa14f7aea21d1042
|
d4376884faa75b28b456bec5bdc4fe8ef8c09c1b
|
/hearblink/hearblink.ino
|
ca2ea08ed698ffa918c9314c888c74aec3a654f4
|
[] |
no_license
|
saptar/arduino_sketches
|
7302c438221c984f448845bebbc175f70c30d2ca
|
031b81196fa73c65fc2e847868a0d130338c0c7c
|
refs/heads/master
| 2021-01-10T04:00:07.667874
| 2015-12-30T03:37:13
| 2015-12-30T03:37:13
| 48,779,901
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,392
|
ino
|
hearblink.ino
|
// Define these at the top of your sketch.
#define LEDBLINK_PIN_BLUE 11 // I/O pin connected to the LED.
#define LEDBLINK_PIN_GREEN 12 // I/O pin connected to the LED.
#define LEDBLINK_PIN_RED 13 // I/O pin connected to the LED.
#define LEDBLINK_MS 500 // Blink rate (in milliseconds).
int ledColorPin[3] = {LEDBLINK_PIN_RED, LEDBLINK_PIN_GREEN, LEDBLINK_PIN_BLUE};
int i = 0;
void setup()
{
// For ledBlink(), set LEDBLINK_PIN to output.
pinMode(LEDBLINK_PIN_BLUE, OUTPUT);
pinMode(LEDBLINK_PIN_GREEN, OUTPUT);
pinMode(LEDBLINK_PIN_RED, OUTPUT);
}
void loop()
{
// Blink the LED to let the user know we are still alive.
ledBlink();
// Do something.
}
//
// LED Heartbeat routine by Allen C. Huffman (www.appleause.com)
//
void ledBlink()
{
static unsigned int ledStatus = LOW; // Last set LED mode.
static unsigned long ledBlinkTime = 0; // LED blink time.
// LED blinking heartbeat. Yes, we are alive.
// For explanation, see:
// http://playground.arduino.cc/Code/TimingRollover
if ( (long)(millis()-ledBlinkTime) >= 0 )
{
// Toggle LED.
ledStatus = (ledStatus==HIGH ? LOW : HIGH);
if(i > 2) {
i = 0;
}
digitalWrite(ledColorPin[i], ledStatus);
if(ledStatus == LOW) {
i++;
}
// Reset "next time to toggle" time.
ledBlinkTime = millis()+LEDBLINK_MS;
}
} // End of ledBlink()
|
ee023de83ba6643c3eea2ca5b6d94dc96b0b3315
|
6c441824fd91d39f3f8b3b654297f0dc75674888
|
/GLES20/Renderer/piperGL11.h
|
6565d47889ba1c0675791f705f4bb2e8db81533f
|
[] |
no_license
|
astojilj/astojilj_animkit
|
6433cb5085933831eeb93f649d94159bd5cf9d00
|
3d281eaf071df4f0e90ff46f1daf629b3bdbed99
|
refs/heads/master
| 2016-08-04T06:09:53.720708
| 2012-05-13T06:37:42
| 2012-05-13T06:37:42
| 3,015,587
| 7
| 4
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 724
|
h
|
piperGL11.h
|
/*
* piperGL11.h
* ReadBlend
*
* Created by astoj@rocketmail.com on 12/28/10.
* Copyright 2010 astoj@rocketmail.com. All rights reserved.
*
*/
#ifndef PIPERGL11_H
#define PIPERGL11_H
#include "piper.h"
/* Collecting and constructing input for graphics pipeline */
class PiperGL11 : public Piper
{
public:
PiperGL11();
//@reimp
void setMatrix(const MATRIX &matrix, Piper::Mode mode);
void pushMatrix(Piper::Mode mode);
void popMatrix(Piper::Mode mode);
void multMatrix(const MATRIX &matrix, Mode mode);
virtual void glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
//@end_reimp
private:
bool setMode(const Piper::Mode mode);
Piper::Mode currentMode;
};
#endif //PIPERGL11_H
|
b6b163cc6bfab4db67c34269082a604e81e9d9bb
|
172f61a44d6d157721721f96f529c0cb59321420
|
/NamedPipe.cpp
|
26bf547e1f02f9764c87848131c6ec0f595a6dc5
|
[] |
no_license
|
rzjh123/IPC
|
b145764ae78d44e8414e09bb833f198ad9255f8a
|
b9aac6131e85fef86faa9d6deddb1470fd8a39ad
|
refs/heads/master
| 2020-05-03T00:53:55.063543
| 2019-03-29T03:32:24
| 2019-03-29T03:32:24
| 178,322,330
| 3
| 1
| null | null | null | null |
GB18030
|
C++
| false
| false
| 17,951
|
cpp
|
NamedPipe.cpp
|
#include "StdAfx.h"
#include "inpsrv.h"
#include "NamedPipe.h"
/////////////////////////////////////////////////////////////////////////////////
CNamedPipe::CNamedPipe(INamedPipeEvent* pNamedPipeEvent)
{
m_hPipe = INVALID_HANDLE_VALUE;
m_hPipeCompletionPort = NULL;
m_pNamedPipeEvent = pNamedPipeEvent;
m_ptrContext = NULL;
m_bMonitor = FALSE;
m_bStartClientRecv = FALSE;
m_bClientPipe = FALSE;
//memset(m_chRecvData, 0, NP_BUFSIZE);
memset(&m_recvOverlapped, 0, sizeof(m_recvOverlapped));
memset(&m_recvData, 0, sizeof(COMPLETIONOVERLAPPEDDATA));
memset(&m_acceptData, 0, sizeof(COMPLETIONOVERLAPPEDDATA));
}
CNamedPipe::~CNamedPipe()
{
DisconnectPipeInstance(FALSE);
}
//断开连接并释放该管道
VOID WINAPI CNamedPipe::Release()
{
if (m_bClientPipe)
delete this;
else
DisconnectPipeInstance(FALSE);
}
//获取管道句柄
HANDLE WINAPI CNamedPipe::GetHandle()
{
return m_hPipe;
}
BOOL WINAPI CNamedPipe::IsClientPipe()
{
return m_bClientPipe;
}
//设置上下文内容
VOID WINAPI CNamedPipe::SetContext(ULONG_PTR ptrContext)
{
m_ptrContext = ptrContext;
}
//获取上下文内容
ULONG_PTR WINAPI CNamedPipe::GetContext()
{
return m_ptrContext;
}
void WINAPI CNamedPipe::SetMonitor(BOOL bMonitor)
{
m_bMonitor = bMonitor;
}
BOOL WINAPI CNamedPipe::IsMonitor()
{
return m_bMonitor;
}
//连接管道,返回值详见"连接管道的返回值宏定义"
INT WINAPI CNamedPipe::Connect(LPCSTR szPipeName, DWORD dwWaitTimeOut, BOOL bReconnection)
{
return 0;
}
//连接管道,返回值详见"连接管道的返回值宏定义"
INT WINAPI CNamedPipe::ConnectW(LPCWSTR szPipeName, DWORD dwWaitTimeOut, BOOL bReconnection)
{
return 0;
}
//获取管道连接状态
BOOL WINAPI CNamedPipe::IsConnect()
{
if (m_bClientPipe)
return (BOOL)(m_hPipe != INVALID_HANDLE_VALUE);
return m_bStartClientRecv;
}
//断开连接管道
VOID WINAPI CNamedPipe::Disconnect()
{
if (m_bClientPipe)
{
DisconnectPipeInstance(FALSE);
}
else if (m_hPipe != INVALID_HANDLE_VALUE)
{
::FlushFileBuffers(m_hPipe);
// Disconnect the pipe instance.
::DisconnectNamedPipe(m_hPipe);
}
}
BOOL WINAPI CNamedPipe::SendData(LPCSTR lpszSendData,DWORD dwSendSize)
{
//ASSERT(m_hPipe != INVALID_HANDLE_VALUE);
if (m_hPipeCompletionPort)
return SendDataEx(lpszSendData, dwSendSize);
//// Allocate storage for this instance.
//LPSENDPIPE_OVERLAPPED pSendPipe = (LPSENDPIPE_OVERLAPPED) HeapAlloc(GetProcessHeap(),0,sizeof(SENDPIPE_OVERLAPPED));
//if (pSendPipe == NULL) return FALSE;
//pSendPipe->pszSendData = new TCHAR[dwSendSize];
//memcpy(pSendPipe->pszSendData,lpszSendData,dwSendSize);
//pSendPipe->Offset = 0;
//pSendPipe->OffsetHigh = 0;
//pSendPipe->hEvent = NULL;
//pSendPipe->pNamedPipe = this;
//pSendPipe->dwSendSize = dwSendSize;
//Start the read operation for this client.
//Note that this same routine is later used as a completion routine after a write operation.
//if (::WriteFileEx(m_hPipe,pSendPipe->pszSendData,
// pSendPipe->dwSendSize, (LPOVERLAPPED)pSendPipe,
// (LPOVERLAPPED_COMPLETION_ROUTINE)CompletedWriteRoutine))
//{
// return TRUE;
//}
//if (pSendPipe != NULL)
//{
// if (pSendPipe->pszSendData != NULL)
// delete[] pSendPipe->pszSendData;
// HeapFree(GetProcessHeap(),0,pSendPipe);
//}
BOOL bResult = TRUE;
DWORD dwWriteBytes=0,dwTotalWriteBytes=0,dwNeedSendSize=dwSendSize;
LPSTR pszSendData = (LPSTR)lpszSendData;
while (dwTotalWriteBytes < dwSendSize)
{
if (!::WriteFile(m_hPipe,pszSendData,dwNeedSendSize,&dwWriteBytes,NULL))
{
bResult = FALSE;
break;
}
dwTotalWriteBytes += dwWriteBytes;
pszSendData += dwWriteBytes;
dwNeedSendSize -= dwWriteBytes;
}
return bResult;
}
BOOL WINAPI CNamedPipe::RecvData()
{
if (m_hPipeCompletionPort)
return RecvDataEx();
//ASSERT(m_hPipe != INVALID_HANDLE_VALUE);
m_recvOverlapped.pNamedPipe = this;
if (::ReadFileEx(m_hPipe, m_recvOverlapped.chRecvData,
NP_BUFSIZE-m_recvOverlapped.dwRecvSize, (LPOVERLAPPED)&m_recvOverlapped,
(LPOVERLAPPED_COMPLETION_ROUTINE)CompletedReadRoutine))
{
return TRUE;
}
return FALSE;
//ASSERT(m_hPipe != INVALID_HANDLE_VALUE);
//// Allocate storage for this instance.
//LPRECVPIPE_OVERLAPPED pRecvPipe = (LPRECVPIPE_OVERLAPPED) HeapAlloc(GetProcessHeap(),0,sizeof(RECVPIPE_OVERLAPPED));
//if (pRecvPipe == NULL) return FALSE;
//pRecvPipe->Offset = 0;
//pRecvPipe->OffsetHigh = 0;
//pRecvPipe->hEvent = NULL;
//pRecvPipe->pNamedPipe = this;
//pRecvPipe->dwRecvSize = 0;
//if (::ReadFileEx(m_hPipe, pRecvPipe->chRecvData,
// NP_BUFSIZE, (LPOVERLAPPED)pRecvPipe,
// (LPOVERLAPPED_COMPLETION_ROUTINE)CompletedReadRoutine))
//{
// return TRUE;
//}
//HeapFree(GetProcessHeap(),0,pRecvPipe);
//return FALSE;
}
VOID CNamedPipe::CompletedCreate()
{
if (m_pNamedPipeEvent != NULL)
m_pNamedPipeEvent->OnCompletedCreate(this);
}
VOID CNamedPipe::CompletedConnect()
{
m_bStartClientRecv = TRUE;
if (m_pNamedPipeEvent != NULL)
m_pNamedPipeEvent->OnCompletedConnect(this);
RecvDataEx();
}
BOOL CNamedPipe::CompletedSend(LPCSTR lpszSendData, DWORD dwSendSize)
{
BOOL bResult = FALSE;
if (m_hPipeCompletionPort)
{
LPCOMPLETIONOVERLAPPEDDATA pSendData = (LPCOMPLETIONOVERLAPPEDDATA)lpszSendData;
LPSTR szSendData = (LPSTR)pSendData->pCompletionData;
if (m_pNamedPipeEvent != NULL)
bResult = m_pNamedPipeEvent->OnCompletedSend(this, szSendData, dwSendSize);
pSendData->dwTransferBytes += dwSendSize;
if (pSendData->dwTransferBytes == pSendData->dwCompletionDataSize)
{
if (szSendData)
{
delete[] szSendData;
pSendData->pCompletionData = NULL;
}
::HeapFree(GetProcessHeap(), 0, pSendData);
}
//继续发送剩余的数据
else
{
DWORD dwWrite = 0;
bResult = ::WriteFile(m_hPipe, pSendData->pCompletionData + pSendData->dwTransferBytes,
pSendData->dwCompletionDataSize - pSendData->dwTransferBytes, &dwWrite, pSendData);
DWORD dwErrCode = ::GetLastError();
if (!bResult)
{
if (dwErrCode == ERROR_IO_PENDING)
return bResult;
if (szSendData)
delete [] szSendData;
::HeapFree(GetProcessHeap(), 0, pSendData);
}
}
}
else if (m_pNamedPipeEvent != NULL)
{
bResult = m_pNamedPipeEvent->OnCompletedSend(this, lpszSendData, dwSendSize);
}
return bResult;
}
DWORD CNamedPipe::CompletedRecv(LPCSTR lpszRecvData, DWORD dwRecvSize)
{
BOOL bWrite = FALSE;
DWORD dwRemainRecvDataSize = 0;
if (m_hPipeCompletionPort)
{
LPCOMPLETIONOVERLAPPEDDATA pRecvData = (LPCOMPLETIONOVERLAPPEDDATA)lpszRecvData;
//ASSERT(pRecvData == &m_recvData);
dwRecvSize += pRecvData->dwTransferBytes;
if (m_pNamedPipeEvent != NULL)
{
dwRemainRecvDataSize = m_pNamedPipeEvent->OnCompletedRecv(this, (LPCSTR)pRecvData->pCompletionData, dwRecvSize);
if (dwRemainRecvDataSize > dwRecvSize)
dwRemainRecvDataSize = dwRecvSize;
}
DWORD dwProcessDataSize = dwRecvSize - dwRemainRecvDataSize;
if (dwProcessDataSize != dwRecvSize)
{
memmove(m_recvOverlapped.chRecvData, m_recvOverlapped.chRecvData + dwProcessDataSize, dwRemainRecvDataSize);
pRecvData->dwTransferBytes += dwRemainRecvDataSize;
}
else
{
pRecvData->dwTransferBytes = 0;
}
if (!RecvDataEx())
{
DisconnectPipeInstance(FALSE);
}
}
else
{
if (m_pNamedPipeEvent != NULL)
{
dwRemainRecvDataSize = m_pNamedPipeEvent->OnCompletedRecv(this, lpszRecvData, dwRecvSize);
}
}
return dwRemainRecvDataSize;
}
INT CNamedPipe::CreateServerPipeInstance(LPCTSTR lpszPipeName, BOOL bFirstPipeInstance)
{
if (m_hPipe != INVALID_HANDLE_VALUE)
return PIPE_CREATE_ISEXIST;
DWORD dwOpenMode = PIPE_ACCESS_DUPLEX | // read/write access
FILE_FLAG_OVERLAPPED; // overlapped mode
if (bFirstPipeInstance)
dwOpenMode |= FILE_FLAG_FIRST_PIPE_INSTANCE;
BYTE sd[SECURITY_DESCRIPTOR_MIN_LENGTH];
SECURITY_ATTRIBUTES sa;
sa.lpSecurityDescriptor = (PSECURITY_DESCRIPTOR)sd;
InitializeSecurityDescriptor(sa.lpSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
// ACL is set as NULL in order to allow all access to the object.
SetSecurityDescriptorDacl(sa.lpSecurityDescriptor, TRUE, NULL, FALSE);
sa.nLength = sizeof(sa);
sa.bInheritHandle = TRUE;
m_hPipe = ::CreateNamedPipe(
lpszPipeName, // pipe name
dwOpenMode, // Open mode
//PIPE_TYPE_MESSAGE | // message-type pipe
//PIPE_READMODE_MESSAGE | // message read mode
//PIPE_WAIT, // blocking mode
PIPE_TYPE_BYTE | // byte-type pipe
PIPE_READMODE_BYTE | // byte read mode
PIPE_WAIT, // blocking mode
PIPE_UNLIMITED_INSTANCES, // unlimited instances
NP_BUFSIZE, // output buffer size
NP_BUFSIZE, // input buffer size
NP_SERVER_TIMEOUT, // client time-out
&sa); // default security attributes
return m_hPipe != INVALID_HANDLE_VALUE ? PIPE_CREATE_SUCCEEDED : PIPE_CREATE_FAILED;
}
INT CNamedPipe::CreateClientPipeInstance(LPCTSTR lpszPipeName,DWORD dwWaitTimeOut)
{
if (m_hPipe != INVALID_HANDLE_VALUE)
return PIPE_CREATE_ISEXIST;
// Try to open a named pipe; wait for it, if necessary.
while (m_hPipe == INVALID_HANDLE_VALUE)
{
//CString strPipeName = TEXT("\\\\.\\pipe\\SNDA_");
//strPipeName += lpszPipeName;
m_hPipe = ::CreateFile(
lpszPipeName, // pipe name
GENERIC_READ | GENERIC_WRITE, // read and write access
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
FILE_FLAG_OVERLAPPED, // FILE_FLAG_OVERLAPPED attributes
NULL); // no template file
// Break if the pipe handle is valid.
if (m_hPipe == INVALID_HANDLE_VALUE)
{
// Exit if an error other than ERROR_PIPE_BUSY occurs.
DWORD dwErrorID = GetLastError();
if (ERROR_PIPE_BUSY != dwErrorID)
{
break;
}
// All pipe instances are busy, so wait for 20 seconds.
if (!WaitNamedPipe(lpszPipeName, dwWaitTimeOut))
{
break;
}
}
}
return m_hPipe != INVALID_HANDLE_VALUE ? PIPE_CREATE_SUCCEEDED : PIPE_CREATE_FAILED;
}
BOOL CNamedPipe::ConnectToServer(LPCTSTR lpszPipeName,DWORD dwWaitTimeOut)
{
INT iRet = CreateClientPipeInstance(lpszPipeName, dwWaitTimeOut);
if (PIPE_CREATE_FAILED == iRet)
return FALSE;
if (!m_bStartClientRecv)
{
m_bStartClientRecv = TRUE;
if (m_hPipe != INVALID_HANDLE_VALUE)
{
DWORD dwMode = PIPE_READMODE_BYTE|PIPE_WAIT;
// The pipe connected; change to byte-read mode.
if (!SetNamedPipeHandleState(
m_hPipe, // pipe handle
&dwMode, // new pipe mode
NULL, // don't set maximum bytes
NULL)) // don't set maximum time
{
DisconnectPipeInstance(FALSE);
}
else
{
RecvData();
}
}
if (m_pNamedPipeEvent != NULL)
{
m_pNamedPipeEvent->OnCompletedCreate(this);
}
}
return TRUE;
}
BOOL CNamedPipe::ConnectToClient(LPOVERLAPPED lpo)
{
// ASSERT(m_hPipe != INVALID_HANDLE_VALUE);
if (m_pNamedPipeEvent != NULL)
{
m_pNamedPipeEvent->OnCompletedCreate(this);
}
if (!lpo)
{
memset(&m_acceptData, 0, sizeof(COMPLETIONOVERLAPPEDDATA));
m_acceptData.pCompletionKey = this;
m_acceptData.dwCompletionType = NAMEDPIPE_IO_CONNECT;
lpo = &m_acceptData;
}
// Start an overlapped connection for this pipe instance.
// Overlapped ConnectNamedPipe should return zero.
if (::ConnectNamedPipe(m_hPipe, lpo))
{
return FALSE;
}
BOOL bPendingIO = FALSE;
switch (GetLastError())
{
// The overlapped connection in progress.
case ERROR_IO_PENDING:
bPendingIO = TRUE;
break;
// Client is already connected, so signal an event.
case ERROR_PIPE_CONNECTED:
if (lpo->hEvent)
SetEvent(lpo->hEvent);
else
bPendingIO = TRUE;
break;
case ERROR_PIPE_LISTENING:
bPendingIO = TRUE;
break;
// If an error occurs during the connect operation...
}
return bPendingIO;
}
//closes its handle to the pipe.
VOID CNamedPipe::DisconnectPipeInstance(BOOL bAutoDelete)
{
if (m_hPipe != INVALID_HANDLE_VALUE)
{
HANDLE hPipe = m_hPipe;
::FlushFileBuffers(hPipe);
// Disconnect the pipe instance.
::DisconnectNamedPipe(hPipe);
if (m_pNamedPipeEvent != NULL)
{
m_pNamedPipeEvent->OnCompletedDisconnect(this);
}
m_hPipe = INVALID_HANDLE_VALUE;
// Close the handle to the pipe instance.
::CloseHandle(hPipe);
}
if (m_hPipeCompletionPort)
{
m_hPipeCompletionPort = NULL;
}
m_bStartClientRecv = FALSE;
m_bMonitor = FALSE;
if (bAutoDelete)
{
INamedPipeEvent* pNamedPipeEvent = m_pNamedPipeEvent;
m_pNamedPipeEvent = NULL;
if (pNamedPipeEvent && pNamedPipeEvent->OnBeforeRelease(this))
delete this;
}
}
BOOL CNamedPipe::SendDataEx(LPCSTR lpszSendData, DWORD dwSendSize)
{
//ASSERT(m_hPipe != INVALID_HANDLE_VALUE);
//PBYTE szSendData = new BYTE[dwSendSize];
//if (!szSendData)
//{
// return FALSE;
//}
//COMPLETIONOVERLAPPEDDATA sendPipe;
//memset(&sendPipe, 0, sizeof (COMPLETIONOVERLAPPEDDATA));
//sendPipe.pCompletionKey = this;
//sendPipe.dwCompletionType = NAMEDPIPE_IO_SENDDATA;
//sendPipe.pCompletionData = (LPVOID)szSendData;
//sendPipe.dwTransferByte = dwSendSize;
//memcpy(sendPipe.pCompletionData, lpszSendData, sendPipe.dwTransferByte);
//DWORD dwWrite = 0;
//BOOL bResult = ::WriteFile(m_hPipe, sendPipe.pCompletionData, sendPipe.dwTransferByte, &dwWrite, &sendPipe);
//DWORD dwErrCode = ::GetLastError();
//if (!bResult)
//{
// if (dwErrCode == ERROR_IO_PENDING)
// return TRUE;
// if (szSendData)
// delete [] szSendData;
//}
//return bResult;
// Allocate storage for this instance.
LPCOMPLETIONOVERLAPPEDDATA pSendPipe = (LPCOMPLETIONOVERLAPPEDDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(COMPLETIONOVERLAPPEDDATA));
if (!pSendPipe) return FALSE;
PBYTE szSendData = new BYTE[dwSendSize];
if (!szSendData)
{
::HeapFree(GetProcessHeap(), 0, pSendPipe);
return FALSE;
}
pSendPipe->pCompletionKey = this;
pSendPipe->dwCompletionType = NAMEDPIPE_IO_SENDDATA;
pSendPipe->pCompletionData = szSendData;
pSendPipe->dwCompletionDataSize = dwSendSize;
memcpy(pSendPipe->pCompletionData, lpszSendData, pSendPipe->dwCompletionDataSize);
DWORD dwWrite = 0;
BOOL bResult = ::WriteFile(m_hPipe, pSendPipe->pCompletionData, pSendPipe->dwCompletionDataSize, &dwWrite, pSendPipe);
DWORD dwErrCode = ::GetLastError();
if (!bResult)
{
if (dwErrCode == ERROR_IO_PENDING)
return TRUE;
if (szSendData)
delete [] szSendData;
::HeapFree(GetProcessHeap(), 0, pSendPipe);
}
return bResult;
}
BOOL CNamedPipe::RecvDataEx()
{
// ASSERT(m_hPipe != INVALID_HANDLE_VALUE);
memset(&m_recvData, 0, sizeof(COMPLETIONOVERLAPPEDDATA));
m_recvData.pCompletionKey = this;
m_recvData.dwCompletionType = NAMEDPIPE_IO_RECVDATA;
m_recvData.pCompletionData = (PBYTE)(m_recvOverlapped.chRecvData + m_recvData.dwTransferBytes);
m_recvData.dwCompletionDataSize = NP_BUFSIZE - m_recvData.dwTransferBytes;
DWORD dwRead = 0;
BOOL bResult = ::ReadFile(m_hPipe, m_recvData.pCompletionData, m_recvData.dwCompletionDataSize, &dwRead, &m_recvData);
DWORD dwErrorCode = ::GetLastError();
if (!bResult && (dwErrorCode == ERROR_IO_PENDING || dwErrorCode == ERROR_MORE_DATA))
{
return TRUE;
}
return bResult;
}
// This routine is called as a completion routine after writing to
// the pipe, or when a new client has connected to a pipe instance. It
// starts another read operation.
VOID WINAPI CNamedPipe::CompletedWriteRoutine(DWORD dwErrorID, DWORD dwSendSize,LPOVERLAPPED lpo)
{
// lpOverlap points to storage for this instance.
LPSENDPIPE_OVERLAPPED pSendPipe = (LPSENDPIPE_OVERLAPPED)lpo;
CNamedPipe* pNamedPipe = (CNamedPipe*)pSendPipe->pNamedPipe;
BOOL bRead = FALSE;
// ASSERT(pNamedPipe != NULL);
// The write operation has finished, so read the next request (if there is no error).
if ((dwErrorID == 0) && (dwSendSize == pSendPipe->dwSendSize))
{
bRead = pNamedPipe->CompletedSend(pSendPipe->pszSendData,pSendPipe->dwSendSize);
}
// Disconnect if an error occurred.
if (!bRead)
{
pNamedPipe->DisconnectPipeInstance(TRUE);
}
if (pSendPipe != NULL)
{
if (pSendPipe->pszSendData != NULL)
delete[] pSendPipe->pszSendData;
HeapFree(GetProcessHeap(),0,pSendPipe);
}
}
// This routine is called as an I/O completion routine after reading a
// request from the client. It gets data and writes it to the pipe.
VOID WINAPI CNamedPipe::CompletedReadRoutine(DWORD dwErrorID, DWORD dwRecvSize, LPOVERLAPPED lpo)
{
// lpOverlap points to storage for this instance.
LPRECVPIPE_OVERLAPPED pRecvPipe = (LPRECVPIPE_OVERLAPPED)lpo;
CNamedPipe* pNamedPipe = (CNamedPipe*)pRecvPipe->pNamedPipe;
DWORD dwRemainDataSize = 0;
// ASSERT(pNamedPipe != NULL);
// The read operation has finished, so write a response (if no error occurred).
if ((dwErrorID == 0) && (dwRecvSize != 0))
{
dwRecvSize += pRecvPipe->dwRecvSize;
dwRemainDataSize = pNamedPipe->CompletedRecv(pRecvPipe->chRecvData, dwRecvSize);
if (dwRemainDataSize > dwRecvSize)
dwRemainDataSize = dwRecvSize;
DWORD dwProcessDataSize = dwRecvSize - dwRemainDataSize;
if (dwProcessDataSize != dwRecvSize)
{
memmove(pRecvPipe->chRecvData, pRecvPipe->chRecvData + dwProcessDataSize, dwRemainDataSize);
pRecvPipe->dwRecvSize += dwRemainDataSize;
}
else
{
pRecvPipe->dwRecvSize = 0;
}
if (pNamedPipe->RecvData())
return;
}
// Disconnect if an error occurred.
pNamedPipe->DisconnectPipeInstance(TRUE);
//BOOL bWrite = FALSE;
//ASSERT(pNamedPipe != NULL);
//// The read operation has finished, so write a response (if no error occurred).
//if ((dwErrorID == 0) && (dwRecvSize != 0))
//{
// pRecvPipe->dwRecvSize = dwRecvSize;
// bWrite = pNamedPipe->CompletedRecv(pRecvPipe->chRecvData,pRecvPipe->dwRecvSize);
//}
//// Disconnect if an error occurred.
//if (!bWrite)
//{
// pNamedPipe->DisconnectPipeInstance();
//}
//if (pRecvPipe != NULL)
//{
// //GlobalFree(pRecvPipe);
// HeapFree(GetProcessHeap(),0,pRecvPipe);
//}
}
|
406e8c194bec0140dc806587e9fadbdb1bcab633
|
46100f3b30a53ae67de024b5e75bf7cf02149cd6
|
/cpp/rush00/inc/Game.hpp
|
b0a437d5b990f14db9b57555828c77f22579d110
|
[] |
no_license
|
cjulliar/home
|
c23dcb37c1b49cf8f82e06a93566998c2b363d4f
|
3674c66edf09002acfd4bd3a0a0e04665517d534
|
refs/heads/master
| 2021-01-21T11:19:24.358964
| 2019-07-12T00:31:40
| 2019-07-12T00:31:40
| 83,553,241
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,344
|
hpp
|
Game.hpp
|
#ifndef GAME_HPP
#define GAME_HPP
#include <ncurses.h>
#include "defs.hpp"
#include "AShips.hpp"
#include "Player.hpp"
#include "Fighter.hpp"
#include "Boss.hpp"
#include "Stars.hpp"
#include <iostream>
typedef struct s_ships {
AShips* ship;
struct s_ships* next;
} t_ships;
typedef struct s_stars {
AElement* star;
struct s_stars* next;
} t_stars;
class Game {
public:
~Game( void );
Game( Game const & src );
Game & operator=( Game const & src );
Game( WINDOW* const &, t_vector const & );
void init( void );
void push( AShips * const & );
void push( AElement * const & );
void pop( t_ships * const & );
void pop( t_stars * const & );
void voyage( void );
void display( void ) const;
int update( void );
void setTime(int time);
int getTime(void) const;
int getScore(void) const;
t_stars* getStars( void ) const;
t_ships* getShips( void ) const;
WINDOW* getWin( void ) const;
t_vector getWSize( void ) const;
protected:
t_ships* _ships;
WINDOW* _win;
t_vector _wSize;
int _time;
t_stars* _stars;
int _score;
private:
Game( void );
int _handlePlayer( t_ships* const & );
int _moveEnemies( t_ships* const & );
int _moveBoss( t_ships* const & );
void _spawnEnemy( void );
int _checkPositions( void );
void _displayShots( void ) const;
int _destroyKilled( void );
};
#endif
|
007bfe1e790b8b1e0ef12c5945a162b9eac8f57e
|
c33545450d564b367c6108577a3fe2c6056f677c
|
/cdal/CDAL.h
|
66a56f00a1ff8ff411281ec0aac7fc3e5a4eb325
|
[] |
no_license
|
kclegg/Data_Structures_Lists
|
944505f3f007c80cbb3fd4972b40e71d8972ad05
|
f7556feea31041cc140ad092207e37cfccf3edae
|
refs/heads/master
| 2021-03-30T22:59:36.341489
| 2018-03-11T01:20:51
| 2018-03-11T01:20:51
| 124,712,570
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 16,042
|
h
|
CDAL.h
|
#ifndef CDAL_H_
#define CDAL_H_
#include <stdexcept>
#include "List.h"
namespace cop3530{
template <typename E>
class CDAL: public List<E>{
private:
struct Node{
Node* next;
E* CDAL_list;
size_t tailPosition;
Node(){
CDAL_list = new E[50];
tailPosition = 0;
next = nullptr;
}
};
Node* head;
void deallocateArray();
public:
CDAL();
CDAL(size_t cap);
~CDAL() override;
void insert(E element, size_t position) override;
void push_back(E element) override;
void push_front(E element) override;
E replace(E element, size_t position) override;
E remove(size_t position) override;
E pop_back() override;
E pop_front() override;
E item_at(size_t position) override;
E peek_back() override;
E peek_front() override;
bool is_empty() override;
bool is_full() override;
size_t length() override;
void clear() override;
typedef bool (*equals_function)(const E&, const E&);
bool contains(const E& element, equals_function func) override;
std::ostream& print(std::ostream& ostream);
E* const contents() override;
template <typename T>
class CDAL_Iter
{
public:
// type aliases required for C++ iterator compatibility
using value_type = T;
using reference = T&;
using pointer = T*;
using difference_type = std::ptrdiff_t;
using iterator_category = std::forward_iterator_tag;
// type aliases for prettier code
using self_type = CDAL_Iter;
using self_reference = CDAL_Iter&;
private:
T* here;
public:
explicit CDAL_Iter(T* start = nullptr) : here(start) {}
CDAL_Iter(const CDAL_Iter& src) : here(src.here) {}
reference operator*() const {
if(here == nullptr)
throw std::runtime_error("CDAL_Iter<T>.operator*(): iterator pointer error");
return here->data;
}
pointer operator->() const {
if(here == nullptr)
throw std::runtime_error("CDAL_Iter<T>.operator*(): iterator pointer error");
return &(here->data);
}
self_reference operator=( CDAL_Iter<T> const& src ) {
here=src.here;
return *this;
}
// preincrement
self_reference operator++() {
if(here == nullptr)
throw std::runtime_error("CDAL_Iter<T>.operator++(): iterator pointer error");
here = here->next;
return *this;
}
// postincrement
self_type operator++(int) {
if(here == nullptr)
throw std::runtime_error("CDAL_Iter<T>.operator++(int): iterator pointer error");
self_type val = *this;
here = here->next;
return val;
}
bool operator==( CDAL_Iter<T> const& rhs ) const {
if(here == rhs.here)
return true;
return false;
}
bool operator!=( CDAL_Iter<T> const& rhs) const {
if(here != rhs.here)
return true;
return false;
}
};
using value_type = E;
using iterator = CDAL_Iter<E>;
using const_iterator = CDAL_Iter<E const>;
iterator begin() { return CDAL_Iter<E>(head); }
iterator end() { return CDAL_Iter<E>(head); }
const_iterator begin() const { return CDAL_Iter<E>(head); }
const_iterator end() const { return CDAL_Iter<E>(head); }
};
template <typename E>
CDAL<E>::CDAL(){
head = new Node();
head->tailPosition = -1;
}
template <typename E>
CDAL<E>::~CDAL(){
clear();
}
template <typename E>
void
CDAL<E>::deallocateArray(){
if(is_empty()){throw std::runtime_error("CDAL<E>.deallocateArray(): empty list");}
else{
Node* tempHead = head;
size_t tail;
size_t numEmpty = 0;
size_t numLists = 0;
while(tempHead){
tail = tempHead->tailPosition;
numLists++;
if(tail == -1){
numEmpty++;
}
tempHead = tempHead->next;
}
if((numLists/2) < numEmpty){
size_t len = 0;
for(unsigned int i = 0; i < (numEmpty/2); i++){
tempHead = head;
tail = tempHead->tailPosition;
for(unsigned int j = i; j < numLists; j++){
tempHead = tempHead->next;
tail = tempHead->tailPosition;
}
if(tail == -1){
delete[] tempHead->CDAL_list;
delete tempHead;
}
}
}
}
}
template <typename E>
void
CDAL<E>::insert(E element, size_t position){
if(position < 0 || position > length())
throw std::runtime_error("CDAL<E>.insert(): position does not exist");
else if(is_empty()){
if(!head){
head = new Node();
}
head->CDAL_list[0] = element;
head->tailPosition = 0;
}
else{
if(position == 0){
push_front(element);
}
else if(position == length()){
push_back(element);
}
else{
Node* tempHead = head;
bool loop = true;
while(loop){ // first loop to the last node
if(tempHead->next && tempHead->next->tailPosition!=-1){
tempHead = tempHead->next;
}
else{
loop = false;
}
}
size_t tail = tempHead->tailPosition;
if(tail == 49){ // only checks for current last node
Node* newNode = new Node();
newNode->CDAL_list[0] = tempHead->CDAL_list[49];
newNode->tailPosition = 0;
tempHead->next = newNode;
}
else{
tempHead->CDAL_list[tail+1] = tempHead->CDAL_list[tail];
tempHead->tailPosition = (tail+1);
}
tempHead = head;
tail = tempHead->tailPosition;
loop = true;
for(unsigned int i = 49; i < position; i+=50){
tempHead = tempHead->next;
}
size_t index = position;
while(index > 49){ // adjust position index to get a value in [0,49] range
index = index - 50;
}
tail = tempHead->tailPosition;
E* tempList = new E[tail+1]; // temp store all of the elements of current node we are working on
E* lastTempList; // temp list for the last node (not guaranteed to be 49 elements, avoid leftovers)
E lastVal = tempHead->CDAL_list[tail];
for(unsigned int i = tail; i > index; i--){
tempHead->CDAL_list[i] = tempHead->CDAL_list[i-1];
}
tempHead->CDAL_list[index] = element;
if(tail != 49){tempHead->CDAL_list[tail+1] = lastVal;}
else{
while(loop){
if(tempHead->next && tempHead->next->tailPosition!=-1){
tempHead = tempHead->next;
tail = tempHead->tailPosition;
tempList = new E[tail+1];
for(unsigned int i = 1; i < (tail+1); i++){
tempList[i] = tempHead->CDAL_list[i-1];
}
tempList[0] = lastVal;
if(tempHead->next && tempHead->next->tailPosition!=-1){
lastVal = tempHead->CDAL_list[49];
tempHead->CDAL_list = tempList;
}
else{
tempHead->CDAL_list = tempList;
loop = false;
}
}
else{
lastTempList = new E[tail+1];
lastTempList[0] = lastVal;
for(unsigned int i = 1; i < (tail+1); i++){
lastTempList[i] = tempHead->CDAL_list[i-1];
}
tempHead->CDAL_list = lastTempList;
loop = false;
}
}
}
}
}
}
template <typename E>
void
CDAL<E>::push_back(E element){
if(is_empty()){
if(!head){
head = new Node();
}
head->CDAL_list[0] = element;
head->tailPosition = 0;
}
else{
Node* tempHead = head;
bool loop = true;
while(loop){ // loop to last node of cdal
if(tempHead->next && tempHead->next->tailPosition!=-1){
tempHead = tempHead->next;
}
else{
loop = false;
}
}
size_t tail = tempHead->tailPosition;
if(tail == 49){
Node* newNode = new Node();
newNode->CDAL_list[0] = element;
newNode->tailPosition = 0;
tempHead->next = newNode;
}
else{
tempHead->CDAL_list[tail+1] = element;
tempHead->tailPosition = tail+1;
}
}
}
template <typename E>
void
CDAL<E>::push_front(E element){
if(is_empty()){
if(!head){
head = new Node();
}
head->CDAL_list[0] = element;
head->tailPosition = 0;
}
else{
Node* tempHead = head;
bool loop = true;
while(loop){ // first loop to the last node
if(tempHead->next && tempHead->next->tailPosition!=-1){
tempHead = tempHead->next;
}
else{
loop = false;
}
}
size_t tail = tempHead->tailPosition;
if(tail == 49){ // only checks for current last node
Node* newNode = new Node();
newNode->CDAL_list[0] = tempHead->CDAL_list[49];
newNode->tailPosition = 0;
tempHead->next = newNode;
}
else{
tempHead->CDAL_list[tail+1] = tempHead->CDAL_list[tail];
tempHead->tailPosition = (tail+1);
}
tempHead = head;
tail = tempHead->tailPosition;
loop = true;
E* tempList = new E[tail+1]; // temp store all of the elements of current node we are working on
E* lastTempList; // temp list for the last node (not guaranteed to be 49 elements, avoid leftovers)
tempList[0] = element;
while(loop){
if(tempHead->next && tempHead->next->tailPosition!=-1){
E lastElement = tempHead->CDAL_list[49];
for(unsigned int i = 1; i < (tail+1); i++){
tempList[i] = tempHead->CDAL_list[i-1];
}
tempHead->CDAL_list = tempList;
tempHead = tempHead->next;
tail = tempHead->tailPosition;
tempList = new E[tail+1];
tempList[0] = lastElement;
}
else{
lastTempList = new E[tail+1];
lastTempList[0] = tempList[0];
for(unsigned int i = 1; i < (tail+1); i++){
lastTempList[i] = tempHead->CDAL_list[i-1];
}
tempHead->CDAL_list = lastTempList;
loop = false;
}
}
}
}
template <typename E>
E
CDAL<E>::replace(E element, size_t position){
if(is_empty())
throw std::runtime_error("CDAL<E>.replace(): empty list");
else if(position < 0 || position > (length()-1)){
throw std::runtime_error("CDAL<E>.replace(): position does not exist");
}
else{
E val;
Node* tempHead = head;
for(unsigned int i = 49; i < position; i+=50){
tempHead = tempHead->next;
}
size_t index = position;
while(index > 49){ // adjust position index to get a value in [0,49] range
index = index - 50;
}
val = tempHead->CDAL_list[index];
tempHead->CDAL_list[index] = element;
return val;
}
}
template <typename E>
E
CDAL<E>::remove(size_t position){
if(is_empty())
throw std::runtime_error("CDAL<E>.remove(): empty list");
else if((length()-1) < position || position < 0)
throw std::runtime_error("CDAL<E>.remove(): position doesn't exist");
else{
if(position == 0){
E pop = pop_front();
deallocateArray();
return pop;
}
else{
E val;
Node* tempHead = head;
for(unsigned int i = 49; i < position; i+=50){
tempHead = tempHead->next;
}
size_t tempPos = position;
while(tempPos > 49){
tempPos = tempPos - 50;
}
val = tempHead->CDAL_list[tempPos]; // element we are removing
size_t tail;
bool loop = true;
while(loop){
tail = tempHead->tailPosition;
while(tempPos != tail){
tempHead->CDAL_list[tempPos] = tempHead->CDAL_list[tempPos+1];
tempPos++;
}
if(tempHead->next && tempHead->next->tailPosition!=-1){
tempHead->CDAL_list[49] = tempHead->next->CDAL_list[0];
tempHead->tailPosition = 49;
tempHead = tempHead->next;
tempPos = 0;
}
else{
tempHead->CDAL_list[tail] = NULL;
tempHead->tailPosition = tail-1;
loop = false;
}
}
deallocateArray();
return val;
}
}
}
template <typename E>
E
CDAL<E>::pop_back(){
if(is_empty())
throw std::runtime_error("CDAL<E>.pop_back(): empty list");
else{
E val;
Node* tempHead = head;
bool loop = true;
while(loop){ // loop to last node of cdal
if(tempHead->next && tempHead->next->tailPosition!=-1){
tempHead = tempHead->next;
}
else{
loop = false;
}
}
size_t tail = tempHead->tailPosition;
val = tempHead->CDAL_list[tail];
tempHead->CDAL_list[tail] = NULL; // set the last element of the last node to nullptr
tempHead->tailPosition = tail-1;
deallocateArray();
return val;
}
}
template <typename E>
E
CDAL<E>::pop_front(){
if(is_empty())
throw std::runtime_error("CDAL<E>.pop_front(): empty list");
else{
E val = head->CDAL_list[0];
Node* tempHead = head;
size_t tail;
size_t index = 0;
bool loop = true;
while(loop){
tail = tempHead->tailPosition;
if(tail >= 0){
while(index < tail){
// error below
tempHead->CDAL_list[index] = tempHead->CDAL_list[index+1];
index++;
}
}
if(tempHead->next && tempHead->next->tailPosition!=-1){
tempHead->CDAL_list[49] = tempHead->next->CDAL_list[0];
tempHead->tailPosition = 49;
tempHead = tempHead->next;
index = 0;
}
else{
tempHead->CDAL_list[tail] = NULL;
tempHead->tailPosition = tail-1;
loop = false;
}
}
deallocateArray();
return val;
}
}
template <typename E>
E
CDAL<E>::item_at(size_t position){
if(is_empty())
throw std::runtime_error("CDAL<E>.item_at(): empty list");
else if((length()-1) < position || position < 0)
throw std::runtime_error("CDAL<E>.item_at(): position doesn't exist");
else{
Node* tempHead = head;
for(unsigned int i = 49; i < position; i+=50){
tempHead = tempHead->next;
}
size_t index = position;
while(index > 49){
index = index - 50;
}
//0-49, 50-99, 100-149, 150-199
return tempHead->CDAL_list[index];
}
}
template <typename E>
E
CDAL<E>::peek_back(){
if(is_empty())
throw std::runtime_error("CDAL<E>.peek_back(): empty list");
else{
Node* tempHead = head;
bool loop = true;
while(loop){
if(tempHead->next && tempHead->next->tailPosition!=-1){
tempHead = tempHead->next;
}
else{
loop = false;
}
}
size_t tail = tempHead->tailPosition;
return tempHead->CDAL_list[tail];
}
}
template <typename E>
E
CDAL<E>::peek_front(){
if(is_empty())
throw std::runtime_error("CDAL<E>.peek_front(): empty list");
return head->CDAL_list[0];
}
template <typename E>
bool
CDAL<E>::is_empty(){
if((!head) || head->tailPosition == -1){
return true;
}
return false;
}
template <typename E>
bool
CDAL<E>::is_full(){
return false;
}
template <typename E>
size_t
CDAL<E>::length(){
if(is_empty()){return 0;}
else{
size_t num = 0;
Node* tempHead = head;
while(tempHead){
size_t tail = tempHead->tailPosition;
num+=(tail+1);
tempHead = tempHead->next;
}
return num;
}
return 0;
}
template <typename E>
void
CDAL<E>::clear(){
Node* tempHead = head;
while(tempHead){
head = head->next; // set head node equal to next node
tempHead->tailPosition = -1;
delete[] tempHead->CDAL_list;
delete tempHead; // delete previous head node
tempHead = head; // reset temp variable to the new head
}
head = nullptr;
}
template <typename E>
bool
CDAL<E>::contains(const E& element, equals_function func){
if(is_empty()){
throw std::runtime_error("CDAL<E>.contains(): empty list");
}
else{
Node* tempHead = head;
bool loop = true;
while(loop){
size_t tail = tempHead->tailPosition;
for(unsigned int i = 0; i < tail; i++){
if(func(tempHead->CDAL_list[i], element))
return true;
}
if((tempHead->next) && tempHead->next->tailPosition != -1){
tempHead = tempHead->next;
}
else{loop = false;}
}
return false;
}
}
template <typename E>
std::ostream&
CDAL<E>::print(std::ostream& ostream){
if(is_empty()){throw std::runtime_error("CDAL<E>.print(): empty list");}
Node* tempHead = head;
ostream << "[";
while(tempHead){
size_t tail = tempHead->tailPosition;
for(unsigned int i = 0; i < (tail+1); i++){
// error below when more than 1 node
ostream << tempHead->CDAL_list[i];
if((tempHead->next) && tempHead->next->tailPosition != -1){ostream << ",";} // add a comma unless its the last element
else{if((tail) != i){ostream << ",";}}
}
tempHead = tempHead->next;
}
ostream << "]";
return ostream;
}
template <typename E>
E* const
CDAL<E>::contents(){
if(is_empty()){throw std::runtime_error("CDAL<E>.contents(): empty list");}
else{
E* const array = new E[length()]; // array of number of elements
Node* tempHead = head;
size_t index = 0;
bool loop = true;
while(loop){
size_t tail = tempHead->tailPosition;
for(unsigned int i = 0; i < tail+1; i++){
array[index] = tempHead->CDAL_list[i];
index++;
}
if((tempHead->next) && tempHead->next->tailPosition != -1){
tempHead = tempHead->next;
}
else{loop = false;}
}
return array;
}
}
}
#endif /* CDAL_H_ */
|
23623619865696e4c7d149ec2d735bc47f0e694c
|
d3e7b9d2ebe4d4aae85f05ea83f4b409f7a319f4
|
/Longest Palindrome.cpp
|
2b819b2988ee76ead91d860ee747cba0570c94c4
|
[] |
no_license
|
pkuzw/LeetCode-Zhao-Wei-
|
43c952029b3bf5c142d6307836ea4fe6cf65f3f9
|
7834590f03daf944b0e6bb5ef9349aa0f36bca99
|
refs/heads/master
| 2021-03-22T04:45:40.709649
| 2018-12-27T14:51:52
| 2018-12-27T14:51:52
| 22,886,240
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,771
|
cpp
|
Longest Palindrome.cpp
|
//
// Longest Palindrome.cpp
// LeetCode by zhaowei
//
// Created by Zhao Wei on 10/1/16.
// Copyright © 2016 Zhao Wei. All rights reserved.
//
///@file Longest Palindrome
///@author Wei Zhao
///@date 10.01.2016
///@version 1.0
/*
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.
This is case sensitive, for example "Aa" is not considered a palindrome here.
Note:
Assume the length of given string will not exceed 1,010.
Example:
Input:
"abccccdd"
Output:
7
Explanation:
One longest palindrome that can be built is "dccaccd", whose length is 7.
*/
#include <stdio.h>
#include <string>
using namespace std;
class Solution {
public:
///@note hash table
// 1. use an array to store all the letters' appearance time. For the even times, they should be added into the result; for the odd times, it should be minus 1 then add into the result. But for the maximum odd time, we should add it into the result originally.
int longestPalindrome(string s) {
int ht[52] = {0};
for (int i = 0; i < s.length(); i++) {
if (s[i] <= 'z' && s[i] >= 'a')
ht[26 + s[i] - 'a']++;
else
ht[s[i] - 'A']++;
}
int rslt = 0;
int existOdd = 0;
for (int i = 0; i < 52; i++) {
if (ht[i] % 2) {
rslt += ht[i] - 1;
existOdd = 1;
}
else
rslt += ht[i];
}
return rslt + existOdd;
}
};
int main() {
string s = "abccADFSDVaerasdfSDFWRFSSDFasdhaecxzzDFSawebdf";
Solution slt;
int rslt = slt.longestPalindrome(s);
return 0;
}
|
bdc5c35312350ed320ed1b8d46b2aa1f09451f18
|
27a7b51c853902d757c50cb6fc5774310d09385a
|
/4DYUCHIGX_RENDER/3DSprite.h
|
298f780146bcefa5131dd8e86a1b7f9aecfb55e5
|
[] |
no_license
|
WildGenie/LUNAPlus
|
f3ce20cf5b685efe98ab841eb1068819d2314cf3
|
a1d6c24ece725df097ac9a975a94139117166124
|
refs/heads/master
| 2021-01-11T05:24:16.253566
| 2015-06-19T21:34:46
| 2015-06-19T21:34:46
| 71,666,622
| 4
| 2
| null | 2016-10-22T21:27:35
| 2016-10-22T21:27:34
| null |
UTF-8
|
C++
| false
| false
| 1,734
|
h
|
3DSprite.h
|
#ifndef D3DSPRITE_H
#define D3DSPRITE_H
#include "../4DyuchiGRX_common/IGeometry.h"
#include "VertexBuffer.h"
#include "CTexture.h"
#include "IndexBuffer.h"
class CoD3DDevice;
class CTexture;
struct TRANSFORM_STATUS
{
VECTOR2 v2Pos;
VECTOR2 v2Scale;
float fRot;
RECT rect;
DWORD dwColor;
};
class C3DSprite : public IDISpriteObject
{
DWORD m_dwRefCount;
CoD3DDevice* m_pRenderer;
CTexture m_Texture;
TRANSFORM_STATUS m_TrStatus;
VECTOR4 m_v4RectSrc[4];
VECTOR4 m_v4RectDest[4];
IMAGE_DESC* m_pImageDesc;
DWORD m_dwImageDescNum;
VECTOR2 m_v2Center;
float m_fUlength;
float m_fVlength;
TVERTEX m_tvRect[4];
DWORD m_dwWidth;
DWORD m_dwHeight;
CVertexBuffer m_VB;
CIndexBuffer m_IB;
BOOL m_bIsLockable;
void SetVertexList(VECTOR4* pv4Rect,DWORD dwColor);
public:
STDMETHODIMP QueryInterface(REFIID, PPVOID);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
BOOL __stdcall Draw(VECTOR2* pv2Scaling,float fRot,VECTOR2* pv2Trans,RECT* pRect,DWORD dwColor,DWORD dwFlag);
BOOL __stdcall Resize(float fWidth,float fHeight);
BOOL __stdcall GetImageHeader(IMAGE_HEADER* pImgHeader,DWORD dwFrameIndex);
BOOL __stdcall LockRect(LOCKED_RECT* pOutLockedRect, RECT* pRect, TEXTURE_FORMAT TexFormat);
BOOL __stdcall UnlockRect();
// BOOL Initialize(CoD3DDevice* pRenderer,char* szFileName,DWORD dwColor,DWORD dwFlag);
BOOL Initialize(CoD3DDevice* pRenderer,char* szFileName,DWORD dwXPos,DWORD dwYPos,DWORD dwWidth,DWORD dwHeight,DWORD dwColor,DWORD dwFlag);
BOOL InitializeNameless(CoD3DDevice* pRenderer, DWORD dwWidth,DWORD dwHeight, TEXTURE_FORMAT TexFormat, DWORD dwFlag);
C3DSprite();
~C3DSprite();
};
#endif
|
a54d9644ffb511eba415eb01e65fe67576f8157f
|
adf2c58cdc4548c7728369d4fc66f74f6cb23009
|
/google_pano_pix.h
|
e884d6098ca638a3b8efed69f907b511854ff299
|
[] |
no_license
|
devtula/pano_downloader
|
730f624bcd255a470347776c3f307e50f21f7faf
|
2031cd9cc3ffcad2b3e5ab5ed611f3870957bab6
|
refs/heads/master
| 2016-08-03T23:23:01.203817
| 2014-06-19T10:14:17
| 2014-06-19T10:14:17
| 20,996,244
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,104
|
h
|
google_pano_pix.h
|
#ifndef GOOGLE_PANO_PIX_H
#define GOOGLE_PANO_PIX_H
#include <QObject>
#include <QFile>
#include <QTextStream>
#include <QPixmap>
#include <QPainter>
#include <QMutex>
#include <QDateTime>
#include <QSettings>
#include "http_downloader.h"
#include "my_panoparam.h"
class google_pano_pix : public QObject
{
Q_OBJECT
public:
explicit google_pano_pix(QObject *parent = 0);
~google_pano_pix();
void get_google_pix(QString);
signals:
void Pano_Next_Download(QString);
void Current_Tiles_Load(QString);
public slots:
void slotError();
void slotDone(const QByteArray&);
private:
int init_flag;
int LoadedTiles;
http_downloader* my_http_downloader;
QMap <my_PanoParam,int> ParamMap;
// QPixmap fullpix;
QPixmap* fullpix;
QPainter* p;
QMutex mutex;
private:
void insert_param(my_PanoParam);
void commit_downloaded_param(const my_PanoParam &);
my_PanoParam next_download_param();
void clear_param();
void SaveFilePano(const my_PanoParam &);
void Init();
};
#endif // GOOGLE_PANO_PIX_H
|
18931f5ab27dac6687fc36914a729a712c915e86
|
f3b177c26c885400db6b9be0acf22aaae903e744
|
/mbot_autom_param_tuning/mbot_score_functions/mbot_pose_evaluator/ros/include/mbot_pose_evaluator/tf_error_calculator.h
|
b0a95c7364d860e38de7437f7ba0ac8abd922d99
|
[] |
no_license
|
huashuichengbing/autom_param_optimization
|
45991996e0356d3b43d3a489bd3f8de2518c3b64
|
137f5ea8467d018c621ea06fcd55a55b6c6afdb6
|
refs/heads/master
| 2023-06-23T01:12:14.072261
| 2021-07-19T10:34:00
| 2021-07-19T10:34:00
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,675
|
h
|
tf_error_calculator.h
|
/*
* Copyright [2016] <Instituto Superior Tecnico>
*
* Author: Oscar Lima (olima@isr.tecnico.ulisboa.pt)
*
* Publishes the difference between two frames
* in a component wise manner. (x1-x2, y1-y2, etc.)
*
* mcr_manipulation_msgs/ComponentWiseCartesianDifference msg
*
*/
#ifndef MBOT_POSE_EVALUATOR_TF_ERROR_CALCULATOR_NODE_H
#define MBOT_POSE_EVALUATOR_TF_ERROR_CALCULATOR_NODE_H
#include <ros/ros.h>
#include <ros/package.h>
#include <std_msgs/String.h>
#include <mcr_manipulation_msgs/ComponentWiseCartesianDifference.h>
#include <mbot_pose_evaluator/event_in_based_sm.h>
#include <ios>
#include <fstream>
class TFErrorCalculator : public EventInBasedSM
{
public:
TFErrorCalculator();
~TFErrorCalculator();
// get parameters from parameter server
void getParams();
// perform node operation
void running_function();
// the condition to enter the running function
bool condition_to_process();
private:
// ros related variables
ros::Publisher pub_cartesian_difference_;
std::string reference_frame_id_;
std::string target_frame_id_;
// to store the path in which the path will be logged
std::string path_log_file_;
// the fixed global frame, usually map frame
std::string global_frame_id_;
tf::TransformListener tf_listener_;
// to store current time and use can transform, wait for transform and
// lookup transform with the same time
ros::Time now_;
};
#endif // MBOT_POSE_EVALUATOR_TF_ERROR_CALCULATOR_NODE_H
|
82ce324029c3f05d2487d0b05b6a99b0004ed6e5
|
856881f22036b9c85f889cee5709d8907f592e02
|
/drawingcanvas.cpp
|
5496d75e10adfaf5fb80eceb052d9c7dd819b4b3
|
[] |
no_license
|
daljit97/QtPaintTest
|
2dd45ca8d0af353633187228ea62fa26a7256bcc
|
7b9d021136e772a1fe58b41f5fea64283f6e01a8
|
refs/heads/master
| 2020-09-26T01:34:33.126971
| 2020-08-13T11:28:37
| 2020-08-13T11:28:37
| 226,132,915
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,086
|
cpp
|
drawingcanvas.cpp
|
#include "drawingcanvas.h"
#include <QPainter>
#include <QPainterPath>
#include <QtSvg/QSvgGenerator>
#include <QFileDialog>
#include <QElapsedTimer>
#include <QOpenGLFramebufferObject>
#include <math.h>
DrawingCanvas::DrawingCanvas(QQuickItem *parent) : QQuickPaintedItem(parent)
{
m_penWidth = 4;
setRenderTarget(FramebufferObject);
}
bool DrawingCanvas::drawing() const
{
return m_drawing;
}
void DrawingCanvas::penPressed(QPointF pos)
{
setDrawing(true);
m_currentOutline.addPoint(pos);
m_lastPoint = pos;
}
void DrawingCanvas::penMoved(QPointF pos)
{
if(drawing()){
m_currentOutline.addPoint(pos);
// draw the points on the buffer
drawOnBuffer(pos);
}
m_lastPoint = pos;
}
void DrawingCanvas::penReleased()
{
setDrawing(false);
m_outlines.append(m_currentOutline);
m_currentOutline.clear();
m_lastPoint = QPointF();
}
void DrawingCanvas::paint(QPainter *painter)
{
painter->drawImage(m_updateRect, m_buffer, m_updateRect);
m_updateRect = QRect();
}
QString DrawingCanvas::penColor() const
{
return m_penColor;
}
int DrawingCanvas::penWidth() const
{
return m_penWidth;
}
void DrawingCanvas::setDrawing(bool drawing)
{
if (m_drawing == drawing)
return;
m_drawing = drawing;
emit drawingChanged(m_drawing);
}
void DrawingCanvas::setPenWidth(int penWidth)
{
if (m_penWidth == penWidth)
return;
m_penWidth = penWidth;
emit penWidthChanged(m_penWidth);
}
void DrawingCanvas::setPenColor(QString penColor)
{
if (m_penColor == penColor)
return;
m_penColor = penColor;
emit penColorChanged(m_penColor);
}
void DrawingCanvas::initiateBuffer()
{
qDebug() << this << "Initiating buffer" << width() << height();
m_buffer = QImage(width(), height(), QImage::Format_ARGB32_Premultiplied);
m_buffer.fill(Qt::transparent);
}
void DrawingCanvas::drawOnBuffer(QPointF pos)
{
int rad = (penWidth()) + 50;
QPainter bufferPainter;
if(bufferPainter.begin(&m_buffer)){
bufferPainter.setRenderHints(QPainter::SmoothPixmapTransform);
bufferPainter.setRenderHint(QPainter::Antialiasing);
bufferPainter.setCompositionMode(QPainter::CompositionMode_SourceOver);
int pointsLength = m_currentOutline.points.length();
QPainterPath path;
if(pointsLength > 2){
auto previousPoint = m_currentOutline.points.at(pointsLength - 3);
auto mid1 = (m_lastPoint + previousPoint)/2;
auto mid2 = (pos + m_lastPoint)/2;
path.moveTo(m_lastPoint);
path.lineTo(pos);
qreal centerRadius = 1.5;
auto pathLength = path.length();
qreal step = std::min(centerRadius*2/(pathLength)/10, 1.0);
for (qreal i = 0.0; i <= 1; i+=step){
QPointF centerPoint = path.pointAtPercent(i);
QRadialGradient radialGrad(centerPoint, centerRadius);
radialGrad.setColorAt(0.000, QColor(0, 0, 0, 255));
radialGrad.setColorAt(0.2, QColor(0, 0, 0, 0.2 * 255));
radialGrad.setColorAt(1.000, QColor(0, 0, 0, 0));
QPen pen;
pen.setCapStyle(Qt::RoundCap);
pen.setJoinStyle(Qt::RoundJoin);
pen.setWidth(centerRadius * 2);
pen.setBrush(radialGrad);
bufferPainter.setPen(pen);
bufferPainter.drawPoint(centerPoint);
}
}
// update the canvas
auto dirtyRect = path.boundingRect().toRect().normalized()
.adjusted(-rad, -rad, +rad, +rad);
// change the canvas dirty region
if(m_updateRect.isNull()){
m_updateRect = dirtyRect;
}
else{
m_updateRect = m_updateRect.united(dirtyRect);
}
update(m_updateRect);
m_lastPoint = pos;
}
else{
qDebug() << this << "Error initiating buffer painter";
}
// qDebug() << "DRAWING IN " << timer.elapsed() << "ms";
}
|
b1304d042fc166351a7b5628ff7300d3297fc052
|
ca992abcddc8385a5588a5cf81de16e32cec1c70
|
/CAX/Entity2d.cpp
|
97aa06f01f312f8cd766167ad894dd687263e6f9
|
[] |
no_license
|
smallpi/CAX
|
7c47e2c64d43fd2e48b47f5781f43e566a11dc5e
|
ed6635cf056e33373f66cc84b1387c42b4354dfc
|
refs/heads/master
| 2020-03-19T11:53:04.140900
| 2018-06-23T11:52:51
| 2018-06-23T11:52:51
| 136,482,480
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,060
|
cpp
|
Entity2d.cpp
|
#include "Entity2d.h"
#include "MultiInstancePool.h"
#include "TypeTools.h"
#include "Point2d.h"
#include "Line2d.h"
#include "Polyline2d.h"
#include "LwPolyline2d.h"
#include "Arc2d.h"
#include "Circle2d.h"
#include "Ellipse2d.h"
namespace CAX
{
struct Destructor2d
{
void operator () (void* p)
{
Entity2d *pEntity = reinterpret_cast<Entity2d*>(p);
pEntity->~Entity2d();
//switch(pEntity->type())
//{
//case Entity2d::Point:
// reinterpret_cast<Point2d*>(pEntity)->~Point2d();
// break;
//case Entity2d::Line:
// reinterpret_cast<Line2d*>(pEntity)->~Line2d();
// break;
//case Entity2d::Polyline:
// reinterpret_cast<Polyline2d*>(pEntity)->~Polyline2d();
// break;
//case Entity2d::LwPolyline:
// reinterpret_cast<LwPolyline2d*>(pEntity)->~LwPolyline2d();
// break;
//case Entity2d::Arc:
// reinterpret_cast<Arc2d*>(pEntity)->~Arc2d();
// break;
//case Entity2d::Circle:
// reinterpret_cast<Circle2d*>(pEntity)->~Circle2d();
// break;
//case Entity2d::Ellipse:
// break;
//}
}
};
static MultiInstancePool<
SizeTraits<Point2d, Line2d, Polyline2d, LwPolyline2d, Arc2d, Circle2d>::max_value
, 1024, Destructor2d> gPool2d;
Point2d* Entity2d::newPoint()
{
return gPool2d.newInstance<Point2d>();
}
Line2d* Entity2d::newLine()
{
return gPool2d.newInstance<Line2d>();
}
Polyline2d* Entity2d::newPolyline()
{
return gPool2d.newInstance<Polyline2d>();
}
LwPolyline2d* Entity2d::newLwPolyline()
{
return gPool2d.newInstance<LwPolyline2d>();
}
Arc2d* Entity2d::newArc()
{
return gPool2d.newInstance<Arc2d>();
}
Circle2d* Entity2d::newCircle()
{
return gPool2d.newInstance<Circle2d>();
}
Ellipse2d* Entity2d::newEllipse()
{
return gPool2d.newInstance<Ellipse2d>();
}
void Entity2d::deleteInstance(Entity2d* p)
{
gPool2d.deleteInstance(p);
}
//template<typename T>
//T* Entity2d::newInstance()
//{
// return gPool2d.newInstance<T>();
//}
Entity2d::Entity2d()
{
}
Entity2d::~Entity2d()
{
}
} // namespace CAX
|
de8f2aaea033a2b7a9f60f13345565231a57234b
|
286c7126518a531affc0fda945c34d4553774495
|
/multisort/solutions/multisort_quicksort_multibranch_binsearch.cpp
|
60bb077da30a4d32c0c136233cc6e358e690f72f
|
[
"MIT"
] |
permissive
|
indjev99/Competitive-Programming-Problems
|
fb5fe81089e80d737d3c24e6799d1aac583d22e1
|
f5b3203fc2191ba946249af3505259f636f267ef
|
refs/heads/master
| 2023-09-04T07:26:51.528481
| 2023-08-19T00:39:33
| 2023-08-19T00:39:33
| 171,058,102
| 4
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,020
|
cpp
|
multisort_quicksort_multibranch_binsearch.cpp
|
#include "multisort.h"
#include <algorithm>
#include <numeric>
#include <iostream>
std::vector<int> compTemp;
std::vector<std::vector<int>> branchTemps;
std::vector<int> pivots;
void quickSort(int* data, int n, int k)
{
if (n == 0 || n == 1) return;
if (n <= k)
{
compTemp.clear();
std::copy(data, data + n, std::back_inserter(compTemp));
compare(compTemp);
std::copy(compTemp.begin(), compTemp.end(), data);
return;
}
pivots.clear();
compTemp.clear();
std::for_each(branchTemps.begin(), branchTemps.end(), [](auto& v){ v.clear(); });
std::copy(data, data + k - 1, std::back_inserter(compTemp));
compTemp.push_back(0);
int lastPos = k - 1;
for (int i = k - 1; i < n; ++i)
{
compTemp[lastPos] = data[i];
compare(compTemp);
if (i == k - 1)
{
for (int j = 0; j < k; ++j)
{
if (compTemp[j] != data[i]) pivots.push_back(compTemp[j]);
else lastPos = j;
}
}
else
{
int l = 0, r = k - 1;
while (r > l)
{
int mid = (l + r) / 2;
if (compTemp[mid] == pivots[mid]) l = mid + 1;
else r = mid;
}
lastPos = l;
}
branchTemps[lastPos].push_back(data[i]);
}
int m = 0;
std::vector<int> starts;
std::vector<int> lens;
for (int i = 0; i < k; ++i)
{
starts.push_back(m);
lens.push_back(branchTemps[i].size());
std::copy(branchTemps[i].begin(), branchTemps[i].end(), data + m);
m += branchTemps[i].size();
if (i < k - 1) data[m++] = pivots[i];
}
for (int i = 0; i < k; ++i)
{
quickSort(data + starts[i], lens[i], k);
}
}
std::vector<int> multisort(int n, int k)
{
std::vector<int> res(n);
std::iota(res.begin(), res.end(), 0);
branchTemps.resize(k);
quickSort(res.data(), n, k);
return res;
}
|
08bcb7b48648a0bb58de1ae55a54f83aae25ea78
|
21ed98081fa69462fdbfbef916e9c5aac4aaa806
|
/src/generator/PassageTurn.cpp
|
16a0599ec2cd6b31f55971c8c9c9461ad76647b5
|
[] |
no_license
|
jebrax/automatic-rotary-pancake
|
09bbae3fe2d7b39f574535a9266f887e3ad40d21
|
e1b21d1b2224e78d261f2d87957862c7795c0153
|
refs/heads/master
| 2023-09-02T17:25:56.065990
| 2021-10-05T04:33:03
| 2021-10-05T04:33:03
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,213
|
cpp
|
PassageTurn.cpp
|
#include <stdlib.h>
#include <algorithm>
#include <assert.h>
#include <glade/debug/log.h>
#include <glade/math/Vector.h>
#include <strug/generator/PassageTurn.h>
#include <strug/blocks/Terrain.h>
#include <strug/exception/StrugException.h>
#include <strug/generator/common.h>
void PassageTurn::calculatePassageTurnStripe(
/*in-out*/ int &bottom_terrain_height,
/*in-out*/ int &top_terrain_height,
int to_left_width,
int to_right_width,
int area_width,
int area_height,
int current_stripe_number,
int max_passage_thickness,
int min_passage_thickness,
int max_top_steepness,
int max_bottom_steepness)
{
assert(bottom_terrain_height >= 0);
assert(top_terrain_height >= 0);
GENERATOR_LOG("Old terrain bottom: %d, top: %d", bottom_terrain_height, top_terrain_height);
int oldBottomHeight = bottom_terrain_height;
int oldTopHeight = top_terrain_height;
if (current_stripe_number >= to_left_width) {
bottom_terrain_height = 0;
GENERATOR_LOG("Bottom terrain height is set to zero (after turn)");
} else {
// Min and max passage height
int maxHeightThisCol = area_height - oldTopHeight - min_passage_thickness;
int minHeightThisCol = 1;
GENERATOR_LOG("Bottom terrain min height: %d, Max height: %d", minHeightThisCol, maxHeightThisCol);
// generating bottom terrain
GENERATOR_LOG("Bottom steepness:");
Vector2i bottomSteepness = get_constrained_steepness(to_left_width, minHeightThisCol, maxHeightThisCol, oldBottomHeight, 1, current_stripe_number, max_bottom_steepness, true);
bottom_terrain_height =
::rand() % (bottomSteepness.x + bottomSteepness.y + 1) + oldBottomHeight - bottomSteepness.x;
}
int spaceLeft = area_height - bottom_terrain_height;
GENERATOR_LOG("Generateed bottom terrain: %d, Space left: %d", bottom_terrain_height, spaceLeft);
if (current_stripe_number >= area_width - to_right_width) {
top_terrain_height = area_height;
GENERATOR_LOG("Top terrain height is set to max (after turn)");
} else {
// Min and max passage height
int maxHeightThisCol;
if (spaceLeft < area_height) {
maxHeightThisCol = std::min<int>(
// corner blocking with the left neighbor col
area_height - oldBottomHeight - min_passage_thickness,
spaceLeft - min_passage_thickness
);
} else {
maxHeightThisCol = area_height;
}
int minHeightThisCol = std::max<int>(spaceLeft - max_passage_thickness, 1);
GENERATOR_LOG("Top terrain min height: %d, Max height: %d", minHeightThisCol, maxHeightThisCol);
// generating top terrain
GENERATOR_LOG("Top steepness:");
Vector2i topSteepness = get_constrained_steepness(area_width - to_right_width, minHeightThisCol, maxHeightThisCol, oldTopHeight, area_height, current_stripe_number, max_top_steepness, true);
top_terrain_height =
::rand() % (topSteepness.x + topSteepness.y + 1) + oldTopHeight - topSteepness.x;
}
GENERATOR_LOG("RESULT: Terrain bottom: %d, top: %d, passage: %d", bottom_terrain_height, top_terrain_height, area_height - top_terrain_height - bottom_terrain_height);
}
void PassageTurn::createPassageTurn(
Area *area,
bool transpose,
bool invert_x,
bool invert_y,
int max_passage_thickness,
int min_passage_thickness,
int from_top_height,
int from_bottom_height,
int to_left_width,
int to_right_width,
int max_top_steepness,
int max_bottom_steepness)
{
if (max_top_steepness > max_passage_thickness - min_passage_thickness
|| max_bottom_steepness > max_passage_thickness - min_passage_thickness)
{
throw StrugException("Steepness could not be greater than max_passage_thickness - min_passage_thickness");
}
if (max_passage_thickness - min_passage_thickness <= 0) {
throw StrugException("Max passage height should be greater than min passage height");
}
int areaHeight = area->getHeightInBlocks();
int areaWidth = area->getWidthInBlocks();
int bottomTerrainHeight;
int topTerrainHeight;
if (invert_y) {
bottomTerrainHeight = from_top_height;
topTerrainHeight = from_bottom_height;
} else {
bottomTerrainHeight = from_bottom_height;
topTerrainHeight = from_top_height;
}
if (!to_left_width) {
to_left_width = rand() % (areaWidth - max_passage_thickness - 1) + 1;
}
if (!to_right_width) {
int spaceLeft = areaWidth - to_left_width;
to_right_width = rand() % (max_passage_thickness - min_passage_thickness) + spaceLeft - max_passage_thickness;
}
// generating first column
if (bottomTerrainHeight && topTerrainHeight) {
GENERATOR_LOG ("========= FIRST COL============");
calculatePassageTurnStripe(
bottomTerrainHeight,
topTerrainHeight,
to_left_width,
to_right_width,
areaWidth,
areaHeight,
0,
max_passage_thickness,
min_passage_thickness,
max_top_steepness,
max_bottom_steepness
);
} else {
GENERATOR_LOG("========= RANDOM FIRST COL============");
bottomTerrainHeight = ::rand() % (areaHeight - max_passage_thickness - 1) + 1;
int spaceLeft = areaHeight - bottomTerrainHeight;
GENERATOR_LOG("Bottom terrain: %d, space left: %d", bottomTerrainHeight, spaceLeft);
topTerrainHeight = ::rand() % (max_passage_thickness - min_passage_thickness) + spaceLeft - max_passage_thickness;
GENERATOR_LOG("RESULT: Bottom terrain: %d, top terrain: %d, passage: %d", bottomTerrainHeight, topTerrainHeight, areaWidth - bottomTerrainHeight - topTerrainHeight);
}
fill_stripe(area, 0, topTerrainHeight, bottomTerrainHeight, transpose, invert_x, invert_y);
// generating the rest of the columns
for (int i = 1; i < areaWidth; ++i) {
GENERATOR_LOG ("========= COL %d ============", i);
calculatePassageTurnStripe(
bottomTerrainHeight,
topTerrainHeight,
to_left_width,
to_right_width,
areaWidth,
areaHeight,
i,
max_passage_thickness,
min_passage_thickness,
max_top_steepness,
max_bottom_steepness
);
fill_stripe(area, i, topTerrainHeight, bottomTerrainHeight, transpose, invert_x, invert_y);
}
}
|
0dcaa8cfc2a0332000b5c1cb7c61c5ede078d0e4
|
65102ee5aeb8ca70534ae4f09a7214e829ff78ea
|
/Player/JinPlayer/Source/CPlayCtrl.cpp
|
6544602d00829437d02310cb0c5a7dddc28c2505
|
[] |
no_license
|
Fengerking/jinPlayer
|
418ce3b6c4c640c56eb01440699cdab7b9e1a3f5
|
a5b4e48221a8f3a2ad37df8b36daaf322b1b75f0
|
refs/heads/master
| 2021-01-20T09:19:49.822232
| 2017-05-06T00:30:48
| 2017-05-06T00:30:48
| 90,235,474
| 0
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,198
|
cpp
|
CPlayCtrl.cpp
|
/*******************************************************************************
File: CPlayCtrl.cpp
Contains: The play control implement code
Written by: Fenger King
Change History (most recent first):
2014-05-09 Fenger Create file
*******************************************************************************/
#include "windows.h"
#include "tchar.h"
#include "CPlayCtrl.h"
#include "USystemFunc.h"
#include "RPlayerDef.h"
#include "yyLog.h"
#pragma warning (disable : 4996)
CPlayCtrl::CPlayCtrl(HINSTANCE hInst)
: CBaseObject ()
, m_hInst (hInst)
, m_hWnd (NULL)
{
SetObjectName ("CPlayCtrl");
strcpy (m_szName, "CtrlBase");
strcpy (m_szType, "CtrlBase");
m_nID = -1;
SetRectEmpty (&m_rcFile);
SetRectEmpty (&m_rcItem);
SetRectEmpty (&m_rcDraw);
m_nBmpNum = 1;
m_pBmpFile = NULL;
m_nWidth = 0;
m_nHeight = 0;
m_bShow = true;
m_bEnable = true;
m_bUpdate = true;
m_bBtnDown = false;
m_bMusOver = false;
}
CPlayCtrl::~CPlayCtrl(void)
{
YY_DEL_P (m_pBmpFile);
}
bool CPlayCtrl::Create (HWND hWnd, CBaseConfig * pCfg, char * pItemName)
{
TCHAR szPath[1024];
_tcscpy (szPath, pCfg->GetFileName ());
TCHAR * pPos = _tcsrchr (szPath, _T('\\'));
if (pPos != NULL)
*(pPos + 1) = 0;
m_hWnd = hWnd;
strcpy (m_szName, pItemName);
strcpy (m_szType, pCfg->GetItemText (pItemName, "Type", "Base"));
m_nID = pCfg->GetItemValue (pItemName, "ID", m_nID);
m_bShow = pCfg->GetItemValue (pItemName, "Show", m_bShow) > 0 ? true : false;
pCfg->GetItemRect (pItemName, &m_rcFile);
m_nBmpNum = pCfg->GetItemValue (pItemName, "BmpNum", m_nBmpNum);
char * pBmpFile = pCfg->GetItemText (pItemName, "BmpFile", "NoFile");
if (strcmp (pBmpFile, "NoFile"))
m_pBmpFile = CreateBmpFile (szPath, pBmpFile, m_nBmpNum);
m_nWidth = pCfg->GetItemValue (pItemName, "Width", m_nWidth);
m_nHeight = pCfg->GetItemValue (pItemName, "Height", m_nHeight);
UpdateRect ();
return true;
}
bool CPlayCtrl::OnDraw (HDC hDC, HBITMAP hBmp, LPBYTE pBuff, RECT * pRect)
{
return false;
}
bool CPlayCtrl::Show (bool bShow)
{
if (m_bShow == bShow)
return true;
m_bShow = bShow;
UpdateView (&m_rcDraw, FALSE);
return true;
}
bool CPlayCtrl::Enable (bool bEnable)
{
if (m_bEnable == bEnable)
return true;
m_bEnable = bEnable;
UpdateView (&m_rcDraw, FALSE);
return true;
}
bool CPlayCtrl::NeedUpdate (bool bUpdate)
{
m_bUpdate = bUpdate;
UpdateView (&m_rcDraw, FALSE);
return true;
}
LRESULT CPlayCtrl::MsgProc (HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if ((!m_bShow || !m_bEnable) && uMsg != WM_SIZE)
return S_FALSE;
switch (uMsg)
{
case WM_COMMAND:
return OnCommand (uMsg, wParam, lParam);
case WM_LBUTTONDOWN:
return OnLButtonDown (uMsg, wParam, lParam);
case WM_LBUTTONUP:
return OnLButtonUp (uMsg, wParam, lParam);
case WM_MOUSEMOVE:
return OnMouseMove (uMsg, wParam, lParam);
case WM_SIZE:
return OnSize (uMsg, wParam, lParam);
case WM_TIMER:
return OnTimer (uMsg, wParam, lParam);
default:
break;
}
return S_FALSE;
}
LRESULT CPlayCtrl::OnCommand (UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return S_FALSE;
}
LRESULT CPlayCtrl::OnLButtonDown (UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (!InRect (LOWORD (lParam), HIWORD (lParam)))
return S_FALSE;
m_bBtnDown = true;
UpdateView (&m_rcDraw, FALSE);
return S_OK;
}
LRESULT CPlayCtrl::OnLButtonUp (UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (m_bBtnDown)
{
m_bBtnDown = false;
UpdateView (&m_rcDraw, FALSE);
if (InRect (LOWORD (lParam), HIWORD (lParam)))
{
SendMessage (m_hWnd, WM_COMMAND, m_nID, 0);
return S_OK;
}
}
return S_FALSE;
}
LRESULT CPlayCtrl::OnMouseMove (UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int nX = LOWORD (lParam);
int nY = HIWORD (lParam);
if (InRect (nX, nY))
{
if (!m_bMusOver)
{
m_bMusOver = true;
UpdateView (&m_rcDraw, FALSE);
}
return S_OK;
}
else
{
if (m_bMusOver)
{
m_bMusOver = false;
UpdateView (&m_rcDraw, FALSE);
}
}
if (wParam == MK_LBUTTON)
{
if (m_bBtnDown)
{
if (!InRect (nX, nY))
{
m_bBtnDown = false;
UpdateView (&m_rcDraw, FALSE);
}
else
{
return S_OK;
}
}
}
return S_FALSE;
}
LRESULT CPlayCtrl::OnTimer (UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return S_FALSE;
}
LRESULT CPlayCtrl::OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam)
{
UpdateRect ();
return S_FALSE;
}
bool CPlayCtrl::UpdateView (RECT * pRect, BOOL bEraseBG)
{
if (!m_bUpdate)
return true;
InvalidateRect (m_hWnd, pRect, bEraseBG);
return true;
}
bool CPlayCtrl::UpdateRect (void)
{
RECT rcView;
GetClientRect (m_hWnd, &rcView);
int nLeft = m_rcFile.left;
int nTop = m_rcFile.top;
if (IsCenter (nLeft))
{
if (nLeft == YYPOS_CENTER)
nLeft = (rcView.right + rcView.left) / 2 - m_nWidth / 2;
else
nLeft = (rcView.right + rcView.left) / 2 + (nLeft - YYPOS_CENTER);
}
else if (IsRightB (nLeft))
{
nLeft = rcView.right - (YYPOS_RIGHTB - nLeft);
}
if (IsCenter (nTop))
{
if (nTop == YYPOS_CENTER)
nTop = (rcView.bottom + rcView.top) / 2 - m_nHeight / 2;
else
nTop = (rcView.bottom + rcView.top) / 2 + (nTop - YYPOS_CENTER);
}
else if (IsRightB (nTop))
{
nTop = rcView.bottom - (YYPOS_RIGHTB - nTop);
}
if (m_nWidth < 0)
m_rcItem.right = rcView.right - nLeft;
else
m_rcItem.right = nLeft + m_nWidth;
if (m_nHeight < 0)
m_rcItem.bottom = rcView.bottom - nTop;
else
m_rcItem.bottom = nTop + m_nHeight;
SetRect (&m_rcItem, nLeft, nTop, m_rcItem.right, m_rcItem.bottom);
SetRect (&m_rcDraw, nLeft, nTop, m_rcItem.right, m_rcItem.bottom);
if (rcView.bottom < m_rcItem.bottom)
m_rcItem.bottom = rcView.bottom;
if (rcView.right < m_rcItem.right)
m_rcItem.right = rcView.right;
return true;
}
bool CPlayCtrl::InRect (int nX, int nY)
{
POINT pt;
pt.x = nX;
pt.y = nY;
if (PtInRect (&m_rcItem, pt))
return true;
else
return false;
}
bool CPlayCtrl::IsCenter (int nValue)
{
if (nValue > 10000 && nValue < 30000)
return true;
else
return false;
}
bool CPlayCtrl::IsRightB (int nValue)
{
if (nValue > 40000 && nValue < 60000)
return true;
else
return false;
}
CBmpFile * CPlayCtrl::CreateBmpFile (TCHAR * pPath, char * pFile, int nNum)
{
CBmpFile * pBmpFile = NULL;
TCHAR szFile[1024];
_tcscpy (szFile, pPath);
MultiByteToWideChar (CP_ACP, 0, pFile, -1, szFile + _tcslen (szFile), sizeof (szFile) - _tcslen (pPath) * sizeof (TCHAR));
pBmpFile = new CBmpFile ();
HDC hDC = GetDC (m_hWnd);
int nRC = pBmpFile->ReadBmpFile (hDC, szFile, nNum);
ReleaseDC (m_hWnd, hDC);
if (nRC != YY_ERR_NONE)
{
YY_DEL_P (pBmpFile);
return NULL;
}
if (m_rcFile.right <= m_rcFile.left)
m_rcFile.right = m_rcFile.left + pBmpFile->GetWidth ();
if (m_rcFile.bottom <= m_rcFile.top)
m_rcFile.bottom = m_rcFile.top + pBmpFile->GetHeight ();
m_nWidth = m_rcFile.right - m_rcFile.left;
m_nHeight = m_rcFile.bottom - m_rcFile.top;
return pBmpFile;
}
|
cb6b83c77df0eb4b5bd08baf745619422303e542
|
71e82abe092e28efddd231493bc0435892077d2f
|
/第10周作业google.cpp
|
5516bdc2b18952901d25c8d439aef97d504b9bb5
|
[] |
no_license
|
DavidDorry/hello-world
|
fa0f137c898d1a5dd1be52e13de3f771b263067d
|
4d0f1c11d69949bbe306786c4746a4c33995c9ac
|
refs/heads/master
| 2022-04-01T10:46:34.896742
| 2019-11-28T13:59:49
| 2019-11-28T13:59:49
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 1,177
|
cpp
|
第10周作业google.cpp
|
#include <stdio.h>
#include<math.h>
int main(){
int w[6],x[6],y[121],z[121],d,i,j,k,s=10;
for(i=1;i<=5;i++){//输入
scanf("%d",&x[i]);
w[i]=x[i];
}
for(i=1;i<=4;i++){//排序
for(j=i+1;j<=5;j++){
if(x[i]<x[j]){
k=x[i];
x[i]=x[j];
x[j]=k;
}
}
}
k=1;
for(i=10000;i<100000;i++){//寻找这五位数可以组成的所有数
for(j=1;j<=5;j++){
if(i%10==x[j]){
x[j]=-1;
for(j=1;j<=5;j++){
if(i/10%10==x[j]){
x[j]=-1;
for(j=1;j<=5;j++){
if(i/100%10==x[j]){
x[j]=-1;
for(j=1;j<=5;j++){
if(i/1000%10==x[j]){
x[j]=-1;
for(j=1;j<=5;j++){
if(i/10000==x[j]){
y[k]=i;
k++;
}
}
}
}
}
}
}
}
}
}
for(j=1;j<=5;j++){
x[j]=w[j];
}
}
printf("\n");
k=1;
z[k]=0;
for(j=1;j<=120;j++){//判断y中哪些是素数赋值给z
s=sqrt(y[j]);
for(i=2;i<=s & y[j]%i!=0;i++);
if(s<i){
z[k]=y[j];
k++;
}
}
if(z[1]==0){
printf("ERROR");
}
else{
for(i=1;i<k;i++){//找出最大项
d=z[1];
if(z[i]>d){
d=z[i];
}
}
printf("%d",d);
}
return 0;
}
|
b618715e9639cad6ad0a5185aed0deee0ecbd422
|
69779bb8b5feb9d6123b61d57210ad68c84bfb9a
|
/DerivedSources/unified-sources/UnifiedSource-bfc896e1-4.cpp
|
71e63750dd13bf9d69ff68f8f791b7d71bd29ab7
|
[] |
no_license
|
Tsinworks/JavascriptCore_VS2019
|
0633cd2a0c91a7ab713f78b4457afdfe2ad30f73
|
70c54ffd20d8d7e6ec1555b61c0f3f9a2732c67c
|
refs/heads/main
| 2023-08-13T11:02:36.604150
| 2021-10-06T14:27:54
| 2021-10-06T14:27:54
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 287
|
cpp
|
UnifiedSource-bfc896e1-4.cpp
|
#include "dfg/DFGClobberSet.cpp"
#include "dfg/DFGClobberize.cpp"
#include "dfg/DFGClobbersExitState.cpp"
#include "dfg/DFGCodeOriginPool.cpp"
#include "dfg/DFGCombinedLiveness.cpp"
#include "dfg/DFGCommon.cpp"
#include "dfg/DFGCommonData.cpp"
#include "dfg/DFGConstantFoldingPhase.cpp"
|
163761532c5e80b6f86c4ae5e8e81f1245803b10
|
ad5d7be93e9a310d84689b7059d092ac4044a04c
|
/module-1/homework/TypeList/typelist/indexof.h
|
f1045a984e69c0ab214fda7a673eb7fe6fbe70ae
|
[] |
no_license
|
samplec0de/HSE-Course
|
5e88e7c6f5b0d3d4e5f9e5369654e97c5322b9ea
|
787ceb2d74fe762f51ad249ca70a9723dcef33bd
|
refs/heads/master
| 2023-01-28T01:28:11.700193
| 2020-12-02T20:34:47
| 2020-12-02T20:34:47
| 297,139,665
| 0
| 0
| null | 2020-12-02T20:34:48
| 2020-09-20T18:36:01
|
C++
|
UTF-8
|
C++
| false
| false
| 597
|
h
|
indexof.h
|
#pragma once
#include "typelist.h"
template<typename TList, typename TargetType>
struct IndexOf;
template<typename T>
struct IndexOf<NullType, T> {
enum {
pos = -1
};
};
template<typename T>
struct IndexOf<TypeList<T, NullType>, T> {
enum {
pos = 0
};
};
template<typename X, typename T>
struct IndexOf<TypeList<X, NullType>, T> {
enum {
pos = -1
};
};
template<typename X, typename Y, typename Z, typename T>
struct IndexOf<TypeList<X, TypeList<Y, Z>>, T> {
enum {
pos = IndexOf<TypeList<Y, Z>, T>::pos == -1 ? -1 : IndexOf<TypeList<Y, Z>, T>::pos + 1
};
};
|
9ce349f524c65061bc0869caf050a58be88c96f2
|
8eb510b12f7daf7c3653598b0d8587c033afebdc
|
/Graphics/Project1/Ninja/App.h
|
e30184cde375b3911d3cd0902cc19aea289c8647
|
[] |
no_license
|
Scyllas/CSC3224
|
6cf9ce68abcb76ea6f7317b23cfaded52406009f
|
bb85635430346937fc4a84318c098a5551f1034f
|
refs/heads/master
| 2021-03-30T17:07:06.632256
| 2017-04-24T21:24:28
| 2017-04-24T21:24:28
| 80,419,180
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 518
|
h
|
App.h
|
#pragma once
#include <Engine/IMainGame.h>
#include <Engine/ScreenList.h>
#include "GameplayScreen.h"
#include "MainMenuScreen.h"
#include "EditorScreen.h"
class App: public Engine::IMainGame
{
public:
App();
~App();
virtual void onInit() override;
virtual void addScreens() override;
virtual void onExit() override;
private:
std::unique_ptr<MainMenuScreen> m_mainMenuScreen = nullptr;
std::unique_ptr<EditorScreen> m_editorScreen = nullptr;
std::unique_ptr<GameplayScreen> m_gameplayScreen = nullptr;
};
|
1c11cc5147c0f80674e8f077903f61154c3d8ca3
|
d60cae7f3a2a56e4fae06638134de31d7595dace
|
/src/world_node.cpp
|
5aef4e0598efab4d8f83551562920986a42a230a
|
[
"MIT"
] |
permissive
|
silentWatcher3/worldLineSim
|
675406d9c23c5a4bd1a4ee33756e038371ecf62a
|
fab180c9b1800b3f85b78b06166cf3b8025ebbf6
|
refs/heads/main
| 2023-03-04T00:36:16.764297
| 2021-02-10T09:52:59
| 2021-02-10T09:52:59
| 337,617,668
| 0
| 0
|
MIT
| 2021-02-10T07:16:01
| 2021-02-10T04:36:31
|
C++
|
UTF-8
|
C++
| false
| false
| 6,556
|
cpp
|
world_node.cpp
|
#include "world.hpp"
#include "world_node.hpp"
#include "display/display.hpp"
#include "adapter.hpp"
void World_Node::captureState(){
this->paused_time = this->world->getCurrentTime();
State latest_state(this->paused_time);
for( auto&& entity : world->entities ){
if (entity->getPrimaryPos()) {}
else break;
latest_state.curr_pos.push_back(entity->getPrimaryPos().value().point_coord); // snakes will always have a primary position
}
this->states.push_back(latest_state);
}
const StatePlusPlus World_Node::return_data(){
return {
states.back(),
this->_id
};
}
// this is to be provided to the user to edit how the `current` state should be, this option creates a new worldLine for future
// this returns `current state`
const State& World_Node::return_state(){
return states[states.size() - 1]; // or simply states.back(), but leave so as to have better understanding of the two overloads
}
// this is to be provided to the user to edit how the `current` state should be, this option creates a new worldLine for future
// this returns `past state` time t_back back into the past
const State& World_Node::return_state(_timePoint t_back){ // this only `returns` the current state of
if( t_back < states.size() ){ // @caution - Can be concurrently accessing the size and in other thread pushing back state to it
if( !parent_node ){
return parent_node->return_state(t_back - states.size());
} else{
if( t_back == 0 ){
throw std::invalid_argument("You are going 0 seconds before the BIG BANG, ie. TO THE BIG BANG, Sorry Can;t handle that now :-) ");
}
throw std::invalid_argument("Can't go to even before the BIG BANG. Soooorrry for that :D ");
}
}
return this->states[states.size() - 1 - t_back]; // we are seeing from the reverse, thats why we did -t_back, and we had to -1, since what we receive is 1-based index type something (think logically by drawing a stack of states at t = t` for all t` belonging to {0,..., latest(ie. states.size())})
}
// @START_HERE -> LAST TIME I WAS COMPLETETING IMPLEMENTING WORLD_TREE, WITH WORLD_NODE TAKING CHARGE OF MANAGING ALL SIMULATION RELATED TASK OF THE WORLD IT HOLDS A POINTER TO, during doing the latter, i also created the functions return_state and handle_pause, do read the notes given for handle_pause later on
// actual on screen handling of pause to be done by verse, as well as the display, and then calling return_state(), then asking user to modify it, and then that modified state should be passed to this handle_pause()
void World_Node::handle_pause(State that_state){ // the time of pause to be deduced from the time of current world
// @note - stop_simulation should be called before this handle_pause, likely by the Verse itself, because this function will actually just do the work while the actual world has been `kind of` paused (but at same time it should keep running, or pause and resume when created the new node that continues with this world itself)
this->paused_time = world->getCurrentTime();
// @todo - Cr5eating a new world here too, and also a node with this same world
this->left_node = new World_Node(this->tree, this, this->paused_time, true); //this will be almost the copy of this node, with the same world pointer, just starting with an empty states vector, and that it's paused_time will also not be there (ie. by default 0, meaning the world_node has an active world currently running)
}
// should be on a different thread than main thread
void World_Node::start_logging(){ // causes the world to start running
// world_node won't actually simulate the world, let the world do it (this is in opposite of what i earlier though though, think MORE)
// this loop `just waits AND ensures the world_plot has food avaialable`, (since the entities are on there own threads)
while( this->world->_shared_concurrent_data.is_world_running() ){
//if( this->world->world_plot.get_food() == nullptr ) this->world->world_plot.createFood(); //though this if block should NEVER be reached, since ateFood() also creates new Food
this->captureState(); // can PAUSE then capture, for i am preferring some wrong coords in state, rather than stopping and starting threads again and again
//pause for a unit time
std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<int>(statics::UNIT_TIME * 1000)));
}
}
void World_Node::stop_WorldSimulation(){
this->world->_shared_concurrent_data.reset_world_running();
}
/**This will pause the threads for the time being, and update the time, and states vector, then create a new node with the same World* pointer and the world_id */
void World_Node::pauseWorld(){
// @todo @most_important
}
void World_Node::stop_display(){ // invalidates the WINDOW* pointer held by this
this->adapter.reset();
}
void World_Node::update_disp(){
if( ! this->adapter ){
this->adapter->update();
}
}
const World_Ptr World_Node::get_world() const{
return this->world;
}
const dimen_t World_Node::get_world_dimen() const{
return this->world->getWorldDimen();
}
// @note - Be sure you have ALL respective arguments as taken by the World class constructor, since the node itself will need them to construct a new world
World_Node::World_Node( World_Tree* tree, World_Node* parent_node, _timePoint t, bool is_continued) :
continued_world(is_continued)
{
if( is_continued ){
this->world = new World( parent_node->world, t ); // starting from parent_node->world
}else if(parent_node != nullptr)
{
this->world = parent_node->world;
}
else
{
// ie. the root node... create a new world
this->world = new World();
}
this->paused_time = world->getCurrentTime(); //initially
this->tree = tree;
this->world_id = this->world->_id;
// @warning @thread -> See all occurences of such cases where we are accessing data members/functions directly using the arrow notation, and ENSURE IT'S THREADSAFE (where they tend to be on different on different threads)
// dispMngr->addNode(this); // adds this node, as well as initialise this->_display_data
this->adapter = tree->access_disp_manager()->newNodeAdapter(this);
std::thread( &World_Node::start_logging, this ).detach();
}
World_Node::~World_Node(){
if( !this->continued_world )
delete this->world;
}
|
397ce9d7cb9f0d74753b3a55fd5481950c3c97f0
|
e9c1d29ffac999d09c02b23c34abe47dc96bb9a9
|
/smollpt.cpp
|
1e8137e9274db5664092651507460ea731351084
|
[] |
no_license
|
sum-catnip/smoll-pattern-scanner
|
fa26834070b33d8a9e7cc2981e6a190d7db877f8
|
4f1b81b2e5b00ec219d7000014413e7197bb8503
|
refs/heads/master
| 2020-09-21T07:09:08.463580
| 2019-09-14T13:15:16
| 2019-09-14T13:15:16
| 224,719,690
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,439
|
cpp
|
smollpt.cpp
|
#include <Windows.h>
#include <iostream>
#include <iterator>
#include <sstream>
#include <cstddef>
#include <vector>
enum class byte_type { value, wildcard };
struct pattern_byte {
pattern_byte(byte_type _type, std::byte _byte = (std::byte)0) : type(_type), byte(_byte) {}
pattern_byte(byte_type _type, std::string _byte) : type(_type) {
byte = (std::byte)std::stoul(_byte, nullptr, 16);
}
byte_type type;
std::byte byte;
};
class scoped_region {
public:
uintptr_t region_end() { return reinterpret_cast<uintptr_t>(m_memory.BaseAddress) + m_memory.RegionSize -1; }
uintptr_t region_begin() { return reinterpret_cast<uintptr_t>(m_memory.BaseAddress); }
scoped_region(uintptr_t address, bool set_protection = true) {
if (VirtualQuery(reinterpret_cast<const void*>(address), &m_memory, sizeof(m_memory)) != sizeof(m_memory))
std::invalid_argument("failed to obtain information for the provided address. code: " + GetLastError());
std::cout << "------------------------ claiming region ------------------------\n";
std::cout << "from: " << std::hex << reinterpret_cast<uintptr_t>(m_memory.AllocationBase) << std::endl;
std::cout << "to: " << std::hex << reinterpret_cast<uintptr_t>(m_memory.BaseAddress) + m_memory.RegionSize - 1 << std::endl;
// i need to do something about page guards..
if (set_protection) {
m_restore = ! ((
(m_memory.Protect & PAGE_READONLY) ||
(m_memory.Protect & PAGE_READWRITE) ||
(m_memory.Protect & PAGE_WRITECOPY) ||
(m_memory.Protect & PAGE_EXECUTE_READ) ||
(m_memory.Protect & PAGE_EXECUTE_READWRITE) ||
(m_memory.Protect & PAGE_EXECUTE_WRITECOPY)) &&
! (m_memory.Protect & PAGE_NOACCESS)
);
std::cout << "page needs reprotection: " << m_restore << std::endl;
}
if (m_restore)
if (!VirtualProtect(m_memory.BaseAddress, m_memory.RegionSize, PAGE_EXECUTE_READWRITE, &m_old_protection))
std::invalid_argument("failed to protect memory region at the provided address. code: " + GetLastError());
}
~scoped_region() {
std::cout << "unclaiming region\n\n";
// we should be fine if this fails
if (m_restore) VirtualProtect(m_memory.BaseAddress, m_memory.RegionSize, m_old_protection, NULL);
}
private:
bool m_restore = false;
DWORD m_old_protection;
MEMORY_BASIC_INFORMATION m_memory;
};
class memory_scanner {
public:
uintptr_t scan(const std::string& pattern) {
std::vector<pattern_byte> parsed_pattern = parse_pattern(pattern);
uintptr_t current = reinterpret_cast<uintptr_t>(m_info.lpBaseOfDll);
uintptr_t end = reinterpret_cast<uintptr_t>(m_info.lpBaseOfDll) + m_info.SizeOfImage - 1;
std::vector<pattern_byte>::const_iterator it_pattern_byte = parsed_pattern.begin();
bool found = false;
std::cout << "module base: " << std::hex << current << std::endl;
std::cout << "end of module: " << std::hex << end << std::endl << std::endl;
// maybe SizeOfImage actually is the last address
// need to look that up tho (i think x64dbg displays that)
while (current <= end && !found) {
// should get reconstructed every iteration
scoped_region memory_region{ current };
for (; current <= memory_region.region_end(); current++) {
switch (it_pattern_byte->type) {
case byte_type::wildcard: break;
case byte_type::value:
if (*reinterpret_cast<std::byte*>(current) != it_pattern_byte->byte) {
it_pattern_byte = parsed_pattern.begin();
continue;
}
break; // matched
}
if (++it_pattern_byte == parsed_pattern.end()) {
found = true;
break;
}
}
if (found) break;
}
return found ? current : 0;
}
memory_scanner() {
if (!GetModuleInformation(GetCurrentProcess(), GetModuleHandle(NULL), &m_info, sizeof(MODULEINFO)))
throw std::runtime_error("failed to get module information for main module. error: " + GetLastError());
}
private:
MODULEINFO m_info;
std::vector<pattern_byte> parse_pattern(const std::string& pattern) {
std::vector<pattern_byte> parsed_bytes;
std::istringstream stream(pattern);
for (std::string byte_str; stream >> byte_str; ) {
if (byte_str == "??" || byte_str == "?")
parsed_bytes.push_back(pattern_byte(byte_type::wildcard));
else parsed_bytes.push_back(pattern_byte(byte_type::value, byte_str));
}
return parsed_bytes;
}
};
int main() {
memory_scanner scanner{};
std::cout << scanner.scan("AA BB CC DD EE FF");
}
|
1c3f3e7d7bf64fa015ba25f146264a77dde533bf
|
38253760ffa34c665d99f2704cf7df6e08236b08
|
/ARMCortexA9.cpp
|
e94a8e61830c3fb8d2939bc2ec8150dddc321784
|
[] |
no_license
|
azonenberg/jtaghal
|
e3f75c1f7ad6665c48f3c7e04fab2d16b871bf7b
|
4a9e1245263769938d6e635a7e71abb0b1d4d9e8
|
refs/heads/master
| 2021-12-02T16:45:26.155265
| 2021-11-11T21:56:20
| 2021-11-11T21:56:20
| 65,849,157
| 32
| 9
| null | 2020-04-17T12:46:21
| 2016-08-16T19:52:36
|
C++
|
UTF-8
|
C++
| false
| false
| 6,057
|
cpp
|
ARMCortexA9.cpp
|
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2018 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
* following conditions are met: *
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other materials provided with the distribution. *
* *
* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
***********************************************************************************************************************/
/**
@file
@author Andrew D. Zonenberg
@brief Implementation of ARMCortexA9
*/
#include "jtaghal.h"
#include "DebuggableDevice.h"
#include "ARMAPBDevice.h"
#include "ARMDebugAccessPort.h"
#include "ARMDebugMemAccessPort.h"
#include "ARMCortexA9.h"
using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction
ARMCortexA9::ARMCortexA9(
DebuggerInterface* iface,
ARMDebugMemAccessPort* ap,
uint32_t address,
ARMDebugPeripheralIDRegisterBits idreg)
: ARMv7Processor(iface, ap, address, idreg)
{
}
ARMCortexA9::~ARMCortexA9()
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// General device info
void ARMCortexA9::PrintInfo()
{
LogVerbose("%s\n", GetDescription().c_str());
LogIndenter li;
PrintIDRegister(m_deviceID);
//Read DBGDSCR to get status stuff (TODO: make struct) for this
//uint32_t dbgdscr = ReadRegisterByIndex(DBGDSCR_EXT);
//LogDebug("DBGDSCR = %x\n", dbgdscr);
//Pins of interest are MIO bank 1, pins 50/51
//Read MCTRL
//Read PSS_IDCODE from the zynq
//uint32_t pss_idcode = ReadMemory(0xF8000530);
//LogDebug("pss_idcode = %08x\n", pss_idcode);
/*
//Read MCTRL
uint32_t mctrl = ReadMemory(0xF8007080);
LogDebug("mctrl = %08x\n", mctrl);
//Set MIO7 (MIO LED) to output
m_ap->GetDebugPort()->WriteMemory(0xf800071c, 0x00000600); //sclr.MIO_PIN_07
m_ap->GetDebugPort()->WriteMemory(0xe000a204, 0x00000080); //gpio.XGPIOPS_DIRM_OFFSET
m_ap->GetDebugPort()->WriteMemory(0xe000a208, 0x00000080); //gpio.XGPIOPS_OUTEN_OFFSET
for(int i=0; i<10; i++)
{
LogDebug("toggle\n");
m_ap->GetDebugPort()->WriteMemory(0xe000a040, 0x00000080); //gpio.XGPIOPS_DATA_OFFSET
usleep(500 * 1000);
m_ap->GetDebugPort()->WriteMemory(0xe000a040, 0x00000000); //gpio.XGPIOPS_DATA_OFFSET
usleep(500 * 1000);
}
*/
//MIO LED @ MIO7
//MIO inputs at MIO50, 51
//GPIO controller is at 0xe000a000
//Input data (DATA_RO) is at +0x60 - 6c
//
//Read L0_SEL
//Read the PC and dump the instruction at that address
try
{
uint32_t pc = SampleProgramCounter();
LogVerbose("PC = %08x\n", pc);
}
catch(const JtagException& e)
{
LogVerbose("Error reading PC value\n");
}
//uint32_t value = ReadMemory(0xE0000000);//m_ap->ReadWord(0x80000000); //ReadMemory(0xFC000000);
//LogDebug(" value = %08x\n", value);
}
string ARMCortexA9::GetDescription()
{
char tmp[128];
snprintf(
tmp,
sizeof(tmp),
"ARM Cortex-A9 rev %d mod %d stepping %d",
m_idreg.revnum,
m_idreg.cust_mod,
m_idreg.revand
);
return string(tmp);
}
|
5e5d7f7c06714a1d6ab1c94a6192086c6b815798
|
952a397214aa2ff6bbd8be279d9b592dd9b6a9ed
|
/SGIPC practice contests/2k16 single contest 1/keyboard.cpp
|
d585a1e3c460afaceab5e37f4083d9e5821522ab
|
[
"Apache-2.0"
] |
permissive
|
YaminArafat/Vjudge
|
0b074cdedcfa12f96782bb202b0ab2861ebb7ac8
|
d8d2afc4b1a0fbada46d75cb080efc37965dfe9d
|
refs/heads/master
| 2023-03-21T07:57:33.175060
| 2021-03-24T11:26:16
| 2021-03-24T11:26:16
| 351,050,309
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 898
|
cpp
|
keyboard.cpp
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
char str[31]= {'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l',';','z','x','c','v','b','n','m',',','.','/','\0'};
char c;
char inpu[101];
cin>>c;
cin>>inpu;
int i,j;
if (c=='L')
{
for (i=0; i<strlen(inpu); i++)
{
for (j=0; j<strlen(str); j++)
{
if(inpu[i]==str[j])
{
inpu[i]=str[j+1];
break;
}
}
}
}
else if (c=='R')
{
for (i=0; i<strlen(inpu); i++)
{
for (j=0; j<30; j++)
{
if(inpu[i]==str[j])
{
inpu[i]=str[j-1];
break;
}
}
}
}
cout<<inpu<<endl;
return 0;
}
|
3cafce7db86e448eade406ec9d26e27f6fe18454
|
572ca22b9a7722031680c284c76d1e867fa3370c
|
/deletedialog.cpp
|
8983e1b67f768a981c31959a3e8ffc1296af19b2
|
[] |
no_license
|
jack89730/Student-Management
|
414a33bc6f2c0bb9bd501102f3fbf2cd8e6cf9f1
|
61cac12216730e33be7150e995a4bbc3aa147561
|
refs/heads/master
| 2021-05-31T08:02:44.072078
| 2015-10-30T04:45:05
| 2015-10-30T04:45:05
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,491
|
cpp
|
deletedialog.cpp
|
#include "stu.h"
#include "deletedialog.h"
#include "ui_deletedialog.h"
deleteDialog::deleteDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::deleteDialog)
{
ui->setupUi(this);
this->setWindowTitle("删除学生信息");
}
deleteDialog::~deleteDialog()
{
delete ui;
}
//点击确定按键的槽函数
void deleteDialog::on_submitButton_clicked()
{
QString stuId, stuName;
stuId = ui->stuIdLineEdit->text();
stuName = ui->stuNameLineEdit->text();
//记录填入的数据
QSqlQuery query;
query.prepare("SELECT * FROM student WHERE stuId = :i");
query.bindValue(":i", stuId);
query.exec();
//SQL查询语句,查询数据库中是否有该学生
if(!query.next()) {
QMessageBox::warning(this, tr("删除失败"), tr("未找到该学生信息"));
return;
}//若未查到信息,则提示错误信息
query.prepare("DELETE FROM student WHERE stuId = :i && stuName = :n");
query.bindValue(":i", stuId);
query.bindValue(":n", stuName);
query.exec();
//SQL删除语句,删除指定学生的基本信息
query.prepare("DELETE FROM grades WHERE stuId = :i");
query.bindValue(":i", stuId);
query.exec();
//SQL删除语句,删除指定学生的分数信息
QMessageBox::warning(this, tr("删除成功"), tr("已删除该学生全部信息"));
this->close();
}
//点击取消按键的槽函数
void deleteDialog::on_cancelButton_clicked()
{
this->close();
}
|
5e178e239a8ea7f0822e2cacdf64d4776e9f8493
|
71864f24ea02e031a39572373e16bdfbc61df15e
|
/Rare4_구현/hee/13460+구슬탈출2.cpp
|
218fb5558b51125b770afbc336d1d7c1850e3388
|
[] |
no_license
|
kanghuiseon/algorithmStudy
|
38c6401e10830e1fcdba46e8fb0662110af73547
|
dd038391f0562368cfaeda0cfb7c4cd328d884a6
|
refs/heads/master
| 2023-08-12T10:44:11.743292
| 2021-09-14T07:36:27
| 2021-09-14T07:36:27
| 380,399,403
| 0
| 4
| null | 2021-09-14T07:29:14
| 2021-06-26T02:48:49
|
C++
|
UTF-8
|
C++
| false
| false
| 2,393
|
cpp
|
13460+구슬탈출2.cpp
|
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;
int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};
bool check[11][11][11][11];
queue<tuple<int, int, int, int, int>> q;
vector<string> arr(11);
//cnt : 움직인 횟수
tuple<int, int, int> roll(int x, int y, int di, int cnt){
while(arr[x+dx[di]][y+dy[di]] != '#' && arr[x][y] != 'O'){
x += dx[di];
y += dy[di];
cnt += 1;
}
return make_tuple(x, y, cnt);
}
void bfs(){
while(!q.empty()){
int rx = get<0>(q.front());
int ry = get<1>(q.front());
int bx = get<2>(q.front());
int by = get<3>(q.front());
int count = get<4>(q.front());
q.pop();
if(count > 10)
break;
for(int i=0; i<4; i++){
tuple<int, int, int> tmpR = roll(rx, ry, i, 0);
tuple<int, int, int> tmpB = roll(bx, by, i, 0);
int nrx = get<0>(tmpR), nry = get<1>(tmpR), nrcnt = get<2>(tmpR);
int nbx = get<0>(tmpB), nby = get<1>(tmpB), nbcnt = get<2>(tmpB);
// 겹치는 경우
if(arr[nrx][nry] == 'O' && arr[nbx][nby] != 'O'){
printf("%d\n", count + 1);
return;
}
else if(arr[nbx][nby] == 'O'){
continue;
}
if(nrx == nbx && nry == nby){
if(nrcnt < nbcnt){
nbx -= dx[i];
nby -= dy[i];
}
else{
nrx -= dx[i];
nry -= dy[i];
}
}
if(check[nrx][nry][nbx][nby]){
continue;
}
check[nrx][nry][nbx][nby] = true;
q.push(make_tuple(nrx, nry, nbx, nby, count + 1));
}
}
printf("-1\n");
}
int main(){
int n, m;
scanf("%d %d", &n, &m);
for(int i=0; i<n; i++){
cin >> arr[i];
}
int rx=0, ry=0, bx=0, by=0, cnt=0;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(arr[i][j] == 'R'){
rx = i;
ry = j;
}
else if(arr[i][j] == 'B'){
bx = i;
by = j;
}
}
}
check[rx][ry][bx][by] = true;
q.push(make_tuple(rx, ry, bx, by, cnt));
bfs();
return 0;
}
|
3e0a498dbd72552535cb260fb48034a68eaf3f03
|
881b170579cc694a6d6c31ee420002d1da2b3ab3
|
/build-ED_Proyecto2-Desktop_Qt_5_6_0_MinGW_32bit-Debug/debug/ui_buscarcerveza.h
|
a410bcb2abfdd5d525e2d3123d913a59e07db508
|
[] |
no_license
|
pacheevb/ED_Proyecto2
|
6af973f85584e3768b5178bc66439eb6c01e4b77
|
7052c972ddcf26feb7afe0541f159133a7027798
|
refs/heads/master
| 2021-01-20T20:36:49.751107
| 2016-06-09T02:23:18
| 2016-06-09T02:23:18
| 60,022,420
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,080
|
h
|
ui_buscarcerveza.h
|
/********************************************************************************
** Form generated from reading UI file 'buscarcerveza.ui'
**
** Created by: Qt User Interface Compiler version 5.6.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_BUSCARCERVEZA_H
#define UI_BUSCARCERVEZA_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QDialog>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QListWidget>
#include <QtWidgets/QPushButton>
QT_BEGIN_NAMESPACE
class Ui_buscarCerveza
{
public:
QLabel *label;
QListWidget *listWidget;
QComboBox *comboBox;
QLabel *label_2;
QPushButton *btn_buscar;
QComboBox *comboBox_2;
QLabel *label_3;
QLabel *label_4;
void setupUi(QDialog *buscarCerveza)
{
if (buscarCerveza->objectName().isEmpty())
buscarCerveza->setObjectName(QStringLiteral("buscarCerveza"));
buscarCerveza->resize(500, 432);
QPalette palette;
QBrush brush(QColor(255, 255, 255, 255));
brush.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Base, brush);
QBrush brush1(QColor(31, 37, 49, 255));
brush1.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Window, brush1);
palette.setBrush(QPalette::Inactive, QPalette::Base, brush);
palette.setBrush(QPalette::Inactive, QPalette::Window, brush1);
palette.setBrush(QPalette::Disabled, QPalette::Base, brush1);
palette.setBrush(QPalette::Disabled, QPalette::Window, brush1);
buscarCerveza->setPalette(palette);
label = new QLabel(buscarCerveza);
label->setObjectName(QStringLiteral("label"));
label->setGeometry(QRect(100, 20, 311, 31));
label->setPixmap(QPixmap(QString::fromUtf8(":/Recursos/lb_buscarCervezas.png")));
label->setScaledContents(true);
listWidget = new QListWidget(buscarCerveza);
listWidget->setObjectName(QStringLiteral("listWidget"));
listWidget->setGeometry(QRect(180, 120, 291, 291));
comboBox = new QComboBox(buscarCerveza);
comboBox->setObjectName(QStringLiteral("comboBox"));
comboBox->setGeometry(QRect(90, 150, 69, 22));
label_2 = new QLabel(buscarCerveza);
label_2->setObjectName(QStringLiteral("label_2"));
label_2->setGeometry(QRect(30, 150, 51, 16));
QPalette palette1;
palette1.setBrush(QPalette::Active, QPalette::WindowText, brush);
palette1.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
QBrush brush2(QColor(120, 120, 120, 255));
brush2.setStyle(Qt::SolidPattern);
palette1.setBrush(QPalette::Disabled, QPalette::WindowText, brush2);
label_2->setPalette(palette1);
btn_buscar = new QPushButton(buscarCerveza);
btn_buscar->setObjectName(QStringLiteral("btn_buscar"));
btn_buscar->setGeometry(QRect(50, 260, 91, 41));
btn_buscar->setFlat(true);
comboBox_2 = new QComboBox(buscarCerveza);
comboBox_2->setObjectName(QStringLiteral("comboBox_2"));
comboBox_2->setGeometry(QRect(90, 180, 69, 22));
label_3 = new QLabel(buscarCerveza);
label_3->setObjectName(QStringLiteral("label_3"));
label_3->setGeometry(QRect(30, 180, 51, 16));
QPalette palette2;
palette2.setBrush(QPalette::Active, QPalette::WindowText, brush);
palette2.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
palette2.setBrush(QPalette::Disabled, QPalette::WindowText, brush2);
label_3->setPalette(palette2);
label_4 = new QLabel(buscarCerveza);
label_4->setObjectName(QStringLiteral("label_4"));
label_4->setGeometry(QRect(30, 260, 141, 51));
label_4->setPixmap(QPixmap(QString::fromUtf8(":/Recursos/btn_buscar.png")));
label_4->setScaledContents(false);
label->raise();
listWidget->raise();
comboBox->raise();
label_2->raise();
comboBox_2->raise();
label_3->raise();
label_4->raise();
btn_buscar->raise();
retranslateUi(buscarCerveza);
QMetaObject::connectSlotsByName(buscarCerveza);
} // setupUi
void retranslateUi(QDialog *buscarCerveza)
{
buscarCerveza->setWindowTitle(QApplication::translate("buscarCerveza", "Buscar Cerveza", 0));
label->setText(QString());
label_2->setText(QApplication::translate("buscarCerveza", "Familia:", 0));
btn_buscar->setText(QString());
label_3->setText(QApplication::translate("buscarCerveza", "Estilo:", 0));
label_4->setText(QString());
} // retranslateUi
};
namespace Ui {
class buscarCerveza: public Ui_buscarCerveza {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_BUSCARCERVEZA_H
|
7684ccce53910f43dbe4f7d745ecad723ba7e96f
|
dce4ea3398ba66330e7f2f427bd543e73ab3fb9d
|
/Advanced Games Programming/AGPProject2/AGP Project 2/AGP2014 Lab4 Base Code VS13/ParticlesList.h
|
1a152094b9af3714ac89f0636c07c15fd31c4888
|
[
"MIT"
] |
permissive
|
RichardsonDaniel/BSc-University-Coursework
|
8f8ff81945bba5cafa0f20b6771fc3818532fd5e
|
f66351152826cafd4d0064c26efb7dc9c74f6ce6
|
refs/heads/master
| 2020-04-23T11:10:34.763853
| 2019-02-19T07:45:36
| 2019-02-19T07:45:36
| 171,127,366
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 584
|
h
|
ParticlesList.h
|
#pragma once
#include "Particle.h"
#include <iostream>
#include <time.h>
#include <GL\glew.h>
class ParticlesList
{
public:
ParticlesList(int number, glm::vec3 pos, float colour1, float colour2, float colour3);
~ParticlesList();
void update(glm::vec3 cubePos);
void draw();
void particleTimer(int mSeconds);
void checkParticleTimer();
glm::vec3 getPositions(int id);
bool getParticleOn();
private:
int numParticles;
Particle * particleList;
GLuint vao[1];
GLuint vbo[2];
GLfloat * positions;
GLfloat * colours;
GLfloat * velocities;
int alarm;
bool particleOn;
};
|
b8748522f71c363b4fd38c5e785bf5d1704b95d4
|
a031517c90daf357f70360a7636ca63a43ce5e5d
|
/Baekjoon-OJ/1152_wordcount.cpp
|
5fb9ea1094eaa9c9c76033f0a953dbcf2d7f2afd
|
[] |
no_license
|
kmnj951/study
|
7d3aba4d698d0fe51234d7785904d75f1f67582c
|
c6afca81e54015d36d9b74e2b18bdcaaf6605f80
|
refs/heads/master
| 2022-11-16T01:08:14.220887
| 2022-10-30T21:25:35
| 2022-10-30T21:25:35
| 186,276,042
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 306
|
cpp
|
1152_wordcount.cpp
|
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main(void) {
cin.tie(NULL);
ios::sync_with_stdio(false);
string str;
getline(cin, str);
istringstream ss(str);
//ss >> std::noskipws;
int count = 0;
while ( ss >> str ) {
count++;
}
cout << count;
return 0;
}
|
6611676b9456e4ab3aaa6f61f543448548189206
|
c1d75e3c38657b235276aaeec52cd13ddf596ea7
|
/tuneler/player.cpp
|
fb3c14893b131752c656b51acb7eb72b1dbf171e
|
[] |
no_license
|
xzalabai/tuneler
|
f4c60230a3bd4efce6446591b2d15986a0044735
|
4807df4e8499e537e3c4a5eee37cde3dc63065a8
|
refs/heads/master
| 2020-07-13T23:38:24.340148
| 2019-08-29T14:35:45
| 2019-08-29T14:35:45
| 205,179,624
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 16,337
|
cpp
|
player.cpp
|
#include "player.h"
#include "scene.h"
#include "asteroid.h"
#include "desk.h"
#include "camera.h"
#include "shadow.h"
#include "projectile.h"
#include "generator.h"
#include "explosion.h"
#include "house.h"
#include "torus.h"
#include "gulicka.h"
#include "powerUp.h"
#include "Screen.h"
#include "house.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/euler_angles.hpp>
#include <glm/gtx/transform.hpp>
#include <shaders/diffuse_vert_glsl.h>
#include <shaders/diffuse_frag_glsl.h>
#include <windows.h>
#include <chrono>
#include <ctime>
using namespace std;
using namespace glm;
using namespace ppgso;
vector<tinyobj::material_t> Player::material;
map<std::string, int> Player::material_map;
int ProjectileId = 0;
static bool runZooming = false;
Player::Player(int id) {
// Scale the default model
scale *= 1.0f;
rotation.z = -PI/2;
playerId = id;
// Initialize static resources if needed
if (!shader) shader = make_unique<Shader>(diffuse_vert_glsl, diffuse_frag_glsl);
if (id == 1)
if (!texture) texture = make_unique<Texture>(image::loadBMP("grey.bmp"));
if (id == 2)
if (!texture) texture = make_unique<Texture>(image::loadBMP("green.bmp"));
if (!mesh) mesh = make_unique<Mesh>("tank_4.obj");
ifstream myStream ("testAhoj.mtl", std::ifstream::binary);
tinyobj::LoadMtl(material_map, material, myStream);
}
int colorOfRunningPowerUp;
float ageOfPowerUp;
bool powerUpIsRunning = false;
int sizeOfProjectilePlayer1 = 2;
int sizeOfProjectilePlayer2 = 2;
float WinnerPlayerId = 0;
float speedOfPlayer1 = 10.0f;
float speedOfPlayer2 = 10.0f;
bool lock = false;
bool powerUpRunningPlayer1 = false;
bool powerUpRunningPlayer2 = false;
string directionOfPlayer = "";
bool lockCount = false;
bool Player::update(Scene &scene, float dt) {
if (runZooming && WinnerPlayerId != 0 && this->playerId == WinnerPlayerId){
int whoWon;
scene.camera->position.x = this->position.x ;
scene.camera->position.y = this->position.y - 20.0f;
scene.camera->position.z += 0.05f;
if (scene.camera->position.z > -25.0f){
runZooming = false;
scene.newRound = true;
whoWon = this->playerId;
if (scene.winsOfPlayer1 == 3)
whoWon += 2;
else if (scene.winsOfPlayer2 == 3)
whoWon += 2;
auto sc = make_unique<Screen>(whoWon);
sc->position.x = position.x;
sc->position.y = position.y;
sc->scale /= 2;
sc->position.z = -8;
scene.objects.push_back(move(sc));
}
}
if (scene.keyboard[GLFW_KEY_KP_7] && scene.keyboard[GLFW_KEY_K]){
scene.lightDirection.x -= 0.02;
}
else if (scene.keyboard[GLFW_KEY_KP_4]&& scene.keyboard[GLFW_KEY_K]){
scene.lightDirection.y -= 0.02;
}
else if (scene.keyboard[GLFW_KEY_KP_1]&& scene.keyboard[GLFW_KEY_K]){
scene.lightDirection.z -= 0.02;
}
else if (scene.keyboard[GLFW_KEY_KP_7]){
scene.lightDirection.x += 0.02;
}
else if (scene.keyboard[GLFW_KEY_KP_4]){
scene.lightDirection.y += 0.02;
}
else if (scene.keyboard[GLFW_KEY_KP_1]){
scene.lightDirection.z += 0.02;
}
if (scene.keyboard[GLFW_KEY_KP_3] && scene.keyboard[GLFW_KEY_K]){
scene.camera->position.x -= 0.01f;
}
else if (scene.keyboard[GLFW_KEY_KP_6]&& scene.keyboard[GLFW_KEY_K]){
scene.camera->position.y -= 0.04f;
}
else if (scene.keyboard[GLFW_KEY_KP_9]&& scene.keyboard[GLFW_KEY_K]){
scene.camera->position.z -= 0.04f;
}
else if (scene.keyboard[GLFW_KEY_KP_5]&& scene.keyboard[GLFW_KEY_K]){
scene.camera->back.y -= 0.01f;
}
else if (scene.keyboard[GLFW_KEY_KP_8]&& scene.keyboard[GLFW_KEY_K]){
scene.camera->back.z -= 0.01f;
}
else if (scene.keyboard[GLFW_KEY_KP_3]){
scene.camera->position.x += 0.01f;
}
else if (scene.keyboard[GLFW_KEY_KP_6]){
scene.camera->position.y += 0.04f;
}
else if (scene.keyboard[GLFW_KEY_KP_9]){
scene.camera->position.z += 0.04f;
}
else if (scene.keyboard[GLFW_KEY_KP_5]){
scene.camera->back.y += 0.01f;
}
else if (scene.keyboard[GLFW_KEY_KP_8]){
scene.camera->back.z += 0.01f;
}
if (scene.keyboard[GLFW_KEY_R]){
colorOfRunningPowerUp;
ageOfPowerUp;
powerUpIsRunning = false;
sizeOfProjectilePlayer1 = 2;
sizeOfProjectilePlayer2 = 2;
WinnerPlayerId = 0;
speedOfPlayer1 = 10.0f;
speedOfPlayer2 = 10.0f;
lock = false;
powerUpRunningPlayer1 = false;
powerUpRunningPlayer2 = false;
directionOfPlayer = "";
lockCount = false;
}
fireDelay += dt;
bulletTime += dt;
ageOfPowerUp += dt;
bool collisionDetected = false;
auto temp_position = this->position;
//stop the power up after 8seconds
if (powerUpRunningPlayer1 /*&& powerUpIsRunning */&& ageOfPowerUp > 10.0f){
executePowerUpPlayer1(scene,colorOfRunningPowerUp,true, this->playerId);
//powerUpIsRunning = false;
powerUpRunningPlayer1 = false;
}
//stop the power up after 8 seconds
if (powerUpRunningPlayer2 /*&& powerUpIsRunning */&& ageOfPowerUp > 10.0f){
executePowerUpPlayer2(scene,colorOfRunningPowerUp,true, this->playerId);
powerUpIsRunning = false;
powerUpRunningPlayer2 = false;
}
//Player 2
if (this->playerId== 2 && scene.keyboard[GLFW_KEY_W] && scene.keyboard[GLFW_KEY_A]) {
temp_position.x += speedOfPlayer2 * dt;
temp_position.y += speedOfPlayer2* dt;
rotation.y = -PI / 3.0f;
} else if (this->playerId == 2 && scene.keyboard[GLFW_KEY_W] && scene.keyboard[GLFW_KEY_D]) {
temp_position.x -= speedOfPlayer2 * dt;
temp_position.y += 10 * dt;
rotation.y = PI / 3.0f;
} else if (this->playerId == 2 && scene.keyboard[GLFW_KEY_S] && scene.keyboard[GLFW_KEY_D]) {
temp_position.x -= speedOfPlayer2 * dt;
temp_position.y -= speedOfPlayer2 * dt;
rotation.y = PI / 1.5f;
} else if (this->playerId == 2 && scene.keyboard[GLFW_KEY_S] && scene.keyboard[GLFW_KEY_A]) {
temp_position.x += speedOfPlayer2 * dt;
temp_position.y -= speedOfPlayer2 * dt;
rotation.y = -PI / 1.5f;
} else if (this->playerId == 2 && scene.keyboard[GLFW_KEY_A] ) {
temp_position.x += speedOfPlayer2 * dt;
rotation.y = -PI / 2.0f;
} else if (this->playerId == 2 && scene.keyboard[GLFW_KEY_D] ) {
temp_position.x -= speedOfPlayer2 * dt;
rotation.y = PI / 2.0f;
} else if (this->playerId == 2 && scene.keyboard[GLFW_KEY_S]) {
temp_position.y -= speedOfPlayer2 * dt;
rotation.y = PI / 1.0f;
} else if (this->playerId == 2 && scene.keyboard[GLFW_KEY_W] ) {
temp_position.y += speedOfPlayer2 * dt;
rotation.y = 0;
} else {
rotation.z = 0;
}
// Firing projectiles
if (this->playerId == 2 && scene.keyboard[GLFW_KEY_LEFT_SHIFT] && fireDelay > fireRate) {
if (bulletTime > 0.2f) {
fireDelay = 0;
auto projectile = make_unique<Projectile>(rotation.y, sizeOfProjectilePlayer2, 2, ProjectileId);
projectile->position = position + glm::vec3(0.0f, 0.0f, -0.7f);// + fireOffset;
scene.objects.push_back(move(projectile));
auto shad = make_unique<Shadow>(4,ProjectileId);
scene.objects.push_back(move(shad));
ProjectileId++;
bulletTime = 0;
}
}
//Player 1
if (this->playerId== 1 && scene.keyboard[GLFW_KEY_UP] && scene.keyboard[GLFW_KEY_LEFT] ) {
temp_position.x += speedOfPlayer1 * dt;
temp_position.y += speedOfPlayer1* dt;
rotation.y = -PI / 3.0f;
}
else if (this->playerId == 1 && scene.keyboard[GLFW_KEY_UP] && scene.keyboard[GLFW_KEY_RIGHT]) {
temp_position.x -= speedOfPlayer1 * dt;
temp_position.y += speedOfPlayer1 * dt;
rotation.y = PI / 3.0f;
} else if (this->playerId == 1 && scene.keyboard[GLFW_KEY_DOWN] && scene.keyboard[GLFW_KEY_RIGHT]) {
temp_position.x -= speedOfPlayer1 * dt;
temp_position.y -= speedOfPlayer1* dt;
rotation.y = PI / 1.5f;
} else if (this->playerId == 1 && scene.keyboard[GLFW_KEY_DOWN] && scene.keyboard[GLFW_KEY_LEFT]) {
temp_position.x += speedOfPlayer1 * dt;
temp_position.y -= speedOfPlayer1 * dt;
rotation.y = -PI / 1.5f;
} else if (this->playerId == 1 && scene.keyboard[GLFW_KEY_LEFT] ) {
temp_position.x += speedOfPlayer1 * dt;
// rotation.z = -PI/4.0f;
rotation.y = -PI / 2.0f;
} else if (this->playerId == 1 && scene.keyboard[GLFW_KEY_RIGHT] ) {
temp_position.x -= speedOfPlayer1 * dt;
rotation.y = PI / 2.0f;
} else if (this->playerId == 1 && scene.keyboard[GLFW_KEY_DOWN]) {
temp_position.y -= speedOfPlayer1* dt;
rotation.y = PI / 1.0f;
} else if (this->playerId == 1 && scene.keyboard[GLFW_KEY_UP] ) {
temp_position.y += speedOfPlayer1* dt;
rotation.y = 0;
}
else {
rotation.z = 0;
}
// Firing projectiles
if (this->playerId == 1 && scene.keyboard[GLFW_KEY_SPACE] && fireDelay > fireRate) {
fireDelay = 0;
fireOffset = -fireOffset;
// printf("%f ", bulletTime);
if (bulletTime > 0.2f){
auto projectile = make_unique<Projectile>(rotation.y, sizeOfProjectilePlayer1, 1, ProjectileId);
auto shad = make_unique<Shadow>(4,ProjectileId);
ProjectileId++;
projectile->position = position + glm::vec3(0, 0.0f, -0.7);
scene.objects.push_back(move(projectile));
scene.objects.push_back(move(shad));
bulletTime = 0;
}
}
//ak > -24.62y
//ak > -23.5x
//ak > 25.41y
//ak > 24.19
//Collisions
if (temp_position.y < -23.80 || temp_position.x < -23.70 || temp_position.y > 24.90f || temp_position.x > 24.18)
collisionDetected = true;
for ( auto& obj : scene.objects ) {
if (obj.get() == this)
continue;
auto projectile = dynamic_cast<Projectile *>(obj.get());
auto powerUp = dynamic_cast<PowerUp *>(obj.get());
auto enemy = dynamic_cast<Player *>(obj.get());
auto house = dynamic_cast<House *>(obj.get());
auto torus = dynamic_cast<Torus *>(obj.get());
if (!projectile && !powerUp && !enemy && !house && !torus) continue;
if (projectile) {
if (projectile->idOfShooter != this->playerId && distance(position, projectile->position) < scale.y * 2) {
WinnerPlayerId = this->playerId == 1 ? 2 : 1;
runZooming = true;
if (WinnerPlayerId == 1)
scene.winsOfPlayer1++;
if (WinnerPlayerId == 2)
scene.winsOfPlayer2++;
auto explosion = make_unique<Explosion>();
explosion->position = position;
explosion->scale = scale * 3.0f;
scene.objects.push_back(move(explosion));
return false; }}
if (powerUp) {
if (distance(position, powerUp->position) < powerUp->scale.y) {
colorOfRunningPowerUp = powerUp->colorOfPowerUp;
// powerUpIsRunning = true;
ageOfPowerUp = 0;
if (this->playerId == 1){
executePowerUpPlayer1(scene, powerUp->colorOfPowerUp, false, this->playerId);
powerUpRunningPlayer1 = true;
}
else{
executePowerUpPlayer2(scene, powerUp->colorOfPowerUp, false, this->playerId);
powerUpRunningPlayer2 = true;
}
powerUp->destroy();
}
}
if (enemy) {
if (distance(temp_position, enemy->position) < enemy->scale.y * 3.1) {
collisionDetected = true; }}
if (house) {
if (distance(temp_position, house->position) - 1.8f < house->scale.y) {
collisionDetected = true; }}
if (torus){
if (torus->playerId == this->playerId){
// torus->position.x = this->position.x;
// torus->position.y = this->position.y;//- 1.0f;
// torus->position.z = this->position.z;
//
}
}
}
//If we didnt find collision with object
if (!collisionDetected) {
position = temp_position;
}
generateModelMatrix();
return true;
}
void Player::render(Scene &scene) {
vec3 ambient = vec3(material.data()->ambient[0], material.data()->ambient[1], material.data()->ambient[2]);
vec4 diffuse = vec4(material.data()->diffuse[0], material.data()->diffuse[1], material.data()->diffuse[2], 1.0f);
vec3 specular = vec3(material.data()->specular[0], material.data()->specular[1], material.data()->specular[2]);
float shininess = material.data()->shininess * 128;
glEnable(GL_DEPTH_TEST);
// NOTE: this object does not use camera, just renders the entire quad as is
shader->use();
shader->setUniform("LightDirection", scene.lightDirection);
shader->setUniform("LightColor", scene.lightColor);
shader->setUniform("AmbientLightColor", scene.ambientLightColor);
shader->setUniform("CameraPosition", scene.camera->position);
// Pass UV mapping offset to the shader
// Render mesh, not using any projections, we just render in 2D
shader->setUniform("ModelMatrix", modelMatrix);
shader->setUniform("ViewMatrix", scene.camera->viewMatrix);
shader->setUniform("ProjectionMatrix", scene.camera->projectionMatrix);
shader->setUniform("MaterialAmbient", {ambient.x, ambient.y, ambient.z});
shader->setUniform("MaterialDiffuse", {diffuse.x, diffuse.y, diffuse.z, 1.0f});
shader->setUniform("MaterialSpecular", {specular.x, specular.y, specular.z});
shader->setUniform("MaterialShininess", shininess);
shader->setUniform("Texture", *texture);
mesh->render();
glDepthMask(GL_TRUE);
/*shader->use();
// Set up light
shader->setUniform("LightDirection", scene.lightDirection);
// use camera
shader->setUniform("ProjectionMatrix", scene.camera->projectionMatrix);
shader->setUniform("ViewMatrix", scene.camera->viewMatrix);
// render mesh
shader->setUniform("ModelMatrix", modelMatrix);
shader->setUniform("Texture", *texture);
mesh->render();*/
}
void Player::executePowerUpPlayer2(Scene &scene, int typeOfPowerUp, bool stopPowerUp, int playerId) {
if (typeOfPowerUp == 1 && !stopPowerUp){
sizeOfProjectilePlayer2 = 9; }
else if (typeOfPowerUp == 1 && stopPowerUp)
sizeOfProjectilePlayer2 = 2;
else if (typeOfPowerUp == 2 && !stopPowerUp)
speedOfPlayer2 = 16;
else if (typeOfPowerUp == 2 && stopPowerUp){
speedOfPlayer2 = 10;
}
else if (typeOfPowerUp == 3 && !stopPowerUp){
auto torus1 = make_unique<Torus>(2, playerId);
torus1->playerId = 2;
scene.objects.push_back(move(torus1));
auto shadow = make_unique<Shadow>(5, 2);
scene.objects.push_back(move(shadow));
}
else if (typeOfPowerUp == 3 && stopPowerUp){
//described in torus.cpp - after 5sec
}
}
void Player::executePowerUpPlayer1(Scene &scene, int typeOfPowerUp, bool stopPowerUp, int playerId) {
if (typeOfPowerUp == 1 && !stopPowerUp){
sizeOfProjectilePlayer1 = 9; }
else if (typeOfPowerUp == 1 && stopPowerUp)
sizeOfProjectilePlayer1 = 2;
else if (typeOfPowerUp == 2 && !stopPowerUp)
speedOfPlayer1 = 16;
else if (typeOfPowerUp == 2 && stopPowerUp){
speedOfPlayer1 = 10;
}
else if (typeOfPowerUp == 3 && !stopPowerUp){
auto torus1 = make_unique<Torus>(1, playerId);
torus1->playerId = 1;
scene.objects.push_back(move(torus1));
auto shadow = make_unique<Shadow>(5, 1);
scene.objects.push_back(move(shadow));
}
else if (typeOfPowerUp == 3 && stopPowerUp){
//described in torus.cpp - after 5sec
}
}
void Player:: onClick(Scene &scene) {
cout << "Player has been clicked!" << endl;
}
|
be5836048ff4697c663c27174112338993aa432e
|
bd367074bb6a012db58aefc8e765ecfcfb5c4fcf
|
/PICKY_PI/MAE_PICKY.cpp
|
20b311bb004bc03908fbe6dd3a5f80ea8aecfe3c
|
[] |
no_license
|
VegLeMeccano/EUROBOT-2017
|
3bf61c0111676748266756a71be3ecb6ad1e56e4
|
8dd4dc6fae69e41052932bc54071db710c8e0d7b
|
refs/heads/master
| 2020-02-26T15:37:36.385801
| 2017-05-10T15:01:38
| 2017-05-10T15:01:38
| 69,698,393
| 0
| 0
| null | null | null | null |
WINDOWS-1250
|
C++
| false
| false
| 427,773
|
cpp
|
MAE_PICKY.cpp
|
#include "MAE_PICKY.h"
#include "Master.h"
#include <wiringPi.h>
#include <wiringSerial.h>
#include <iostream>
#include <string>
using namespace std;
MAE_PICKY::AnyState::~AnyState() {
}
// perform the 'do activity'
void MAE_PICKY::AnyState::_do(MAE_PICKY &) {
}
void MAE_PICKY::AnyState::create(MAE_PICKY &) {
}
// the current state doesn't manage the event start_mis, give it to the upper state
void MAE_PICKY::AnyState::start_mis(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->start_mis(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition start_mis not expected");
#endif
}
// the current state doesn't manage the event blocage, give it to the upper state
void MAE_PICKY::AnyState::blocage(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->blocage(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition blocage not expected");
#endif
}
// the current state doesn't manage the event time_out, give it to the upper state
void MAE_PICKY::AnyState::time_out(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->time_out(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition time_out not expected");
#endif
}
// the current state doesn't manage the event assFini, give it to the upper state
void MAE_PICKY::AnyState::assFini(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->assFini(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition assFini not expected");
#endif
}
// the current state doesn't manage the event start_enleve, give it to the upper state
void MAE_PICKY::AnyState::start_enleve(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->start_enleve(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition start_enleve not expected");
#endif
}
// the current state doesn't manage the event mission_collecte_module_centraux_initiale, give it to the upper state
void MAE_PICKY::AnyState::mission_collecte_module_centraux_initiale(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->mission_collecte_module_centraux_initiale(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition mission_collecte_module_centraux_initiale not expected");
#endif
}
// the current state doesn't manage the event mission_collecte_module_centraux_restant, give it to the upper state
void MAE_PICKY::AnyState::mission_collecte_module_centraux_restant(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->mission_collecte_module_centraux_restant(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition mission_collecte_module_centraux_restant not expected");
#endif
}
// the current state doesn't manage the event mission_collecte_distributeur_monochrome, give it to the upper state
void MAE_PICKY::AnyState::mission_collecte_distributeur_monochrome(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->mission_collecte_distributeur_monochrome(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition mission_collecte_distributeur_monochrome not expected");
#endif
}
// the current state doesn't manage the event mission_transfert_direct_distributeur_polychrome, give it to the upper state
void MAE_PICKY::AnyState::mission_transfert_direct_distributeur_polychrome(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->mission_transfert_direct_distributeur_polychrome(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition mission_transfert_direct_distributeur_polychrome not expected");
#endif
}
// the current state doesn't manage the event mission_push_distributeur_monochrome, give it to the upper state
void MAE_PICKY::AnyState::mission_push_distributeur_monochrome(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->mission_push_distributeur_monochrome(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition mission_push_distributeur_monochrome not expected");
#endif
}
// the current state doesn't manage the event mission_push_cratere, give it to the upper state
void MAE_PICKY::AnyState::mission_push_cratere(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->mission_push_cratere(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition mission_push_cratere not expected");
#endif
}
// the current state doesn't manage the event mission_drop_zone_depart, give it to the upper state
void MAE_PICKY::AnyState::mission_drop_zone_depart(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->mission_drop_zone_depart(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition mission_drop_zone_depart not expected");
#endif
}
// the current state doesn't manage the event mission_depot_base_diagonale, give it to the upper state
void MAE_PICKY::AnyState::mission_depot_base_diagonale(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->mission_depot_base_diagonale(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition mission_depot_base_diagonale not expected");
#endif
}
// the current state doesn't manage the event mission_depot_base_verticale, give it to the upper state
void MAE_PICKY::AnyState::mission_depot_base_verticale(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->mission_depot_base_verticale(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition mission_depot_base_verticale not expected");
#endif
}
// the current state doesn't manage the event evitement, give it to the upper state
void MAE_PICKY::AnyState::evitement(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->evitement(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition evitement not expected");
#endif
}
// the current state doesn't manage the event end_game, give it to the upper state
void MAE_PICKY::AnyState::end_game(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->end_game(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition end_game not expected");
#endif
}
// the current state doesn't manage the event near, give it to the upper state
void MAE_PICKY::AnyState::near(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->near(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition near not expected");
#endif
}
// the current state doesn't manage the event clw_stocked, give it to the upper state
void MAE_PICKY::AnyState::clw_stocked(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->clw_stocked(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition clw_stocked not expected");
#endif
}
// the current state doesn't manage the event clw_fail_catch, give it to the upper state
void MAE_PICKY::AnyState::clw_fail_catch(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->clw_fail_catch(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition clw_fail_catch not expected");
#endif
}
// the current state doesn't manage the event sto_l_stocked, give it to the upper state
void MAE_PICKY::AnyState::sto_l_stocked(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->sto_l_stocked(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition sto_l_stocked not expected");
#endif
}
// the current state doesn't manage the event sto_l_fail, give it to the upper state
void MAE_PICKY::AnyState::sto_l_fail(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->sto_l_fail(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition sto_l_fail not expected");
#endif
}
// the current state doesn't manage the event sto_c_stocked, give it to the upper state
void MAE_PICKY::AnyState::sto_c_stocked(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->sto_c_stocked(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition sto_c_stocked not expected");
#endif
}
// the current state doesn't manage the event sto_c_fail, give it to the upper state
void MAE_PICKY::AnyState::sto_c_fail(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->sto_c_fail(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition sto_c_fail not expected");
#endif
}
// the current state doesn't manage the event sto_r_stocked, give it to the upper state
void MAE_PICKY::AnyState::sto_r_stocked(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->sto_r_stocked(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition sto_r_stocked not expected");
#endif
}
// the current state doesn't manage the event sto_r_fail, give it to the upper state
void MAE_PICKY::AnyState::sto_r_fail(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->sto_r_fail(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition sto_r_fail not expected");
#endif
}
// the current state doesn't manage the event recall, give it to the upper state
void MAE_PICKY::AnyState::recall(MAE_PICKY & stm) {
AnyState * st = _upper(stm);
if (st != 0)
st->recall(stm);
#ifdef VERBOSE_STATE_MACHINE
else
puts("DEBUG : transition recall not expected");
#endif
}
MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_IN_State::~WAIT_START_IN_State() {
}
// to manage the event start_mis
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_IN_State::start_mis(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._initialisation_state._recalage_ar_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.INITIALISATION.RECALAGE AR");
#endif
stm._mae_picky_state._initialisation_state._recalage_ar_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_IN_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_IN_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.INITIALISATION.WAIT START IN");
#endif
cout<<"wait start, to be inserted"<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_IN_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._initialisation_state;
}
MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_OUT_State::~WAIT_START_OUT_State() {
}
// to manage the event start_enleve
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_OUT_State::start_enleve(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._initialisation_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.INITIALISATION");
#endif
stm._mae_picky_state._initialisation_state._exit1(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_OUT_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_OUT_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.INITIALISATION.WAIT START OUT");
#endif
cout<<"wait start, to be removed"<<endl;
// hold on
serialPrintf(master->getPortSerie(),"S8 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::WAIT_START_OUT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._initialisation_state;
}
MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::AVANCE_State::~AVANCE_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::AVANCE_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._initialisation_state._avance_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._initialisation_state._wait_start_out_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.INITIALISATION.WAIT START OUT");
#endif
stm._mae_picky_state._initialisation_state._wait_start_out_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::AVANCE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::AVANCE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.INITIALISATION.AVANCE");
#endif
// avance de 100 mm
serialPrintf(master->getPortSerie(),"S4 100 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::AVANCE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._initialisation_state;
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::AVANCE_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._initialisation_state._avance_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._initialisation_state._wait_start_out_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.INITIALISATION.WAIT START OUT");
#endif
stm._mae_picky_state._initialisation_state._wait_start_out_state.create(stm);
}
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::AVANCE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.INITIALISATION.AVANCE");
#endif
// evitement on
serialPrintf(master->getPortSerie(),"E1 \n");
}
MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::CHECK_COTE_State::~CHECK_COTE_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::CHECK_COTE_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._initialisation_state._avance_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.INITIALISATION.AVANCE");
#endif
stm._mae_picky_state._initialisation_state._avance_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::CHECK_COTE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::CHECK_COTE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.INITIALISATION.CHECK COTE");
#endif
if(master->is_blue())
{
// enclenche le stocker Left (vers le centre de la table)
// re-ouverture auto
serialPrintf(master->getPortSerie(),"T2 \n");
}
if(master->is_yellow())
{
// enclenche le stocker Right (vers le centre de la table)
// re-ouverture auto
serialPrintf(master->getPortSerie(),"T8 \n");
}
master->set_time_out(1500);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::CHECK_COTE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._initialisation_state;
}
MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::SET_X_Y_CAP_State::~SET_X_Y_CAP_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::SET_X_Y_CAP_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._initialisation_state._check_cote_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.INITIALISATION.CHECK COTE");
#endif
stm._mae_picky_state._initialisation_state._check_cote_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::SET_X_Y_CAP_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::SET_X_Y_CAP_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.INITIALISATION.SET X Y CAP");
#endif
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S0 -602 1915 -90 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S0 602 1915 -90 \n");
}
master->set_time_out(300);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::SET_X_Y_CAP_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._initialisation_state;
}
MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::RECALAGE_AR_State::~RECALAGE_AR_State() {
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::RECALAGE_AR_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._initialisation_state._set_x_y_cap_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.INITIALISATION.SET X Y CAP");
#endif
stm._mae_picky_state._initialisation_state._set_x_y_cap_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::RECALAGE_AR_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::RECALAGE_AR_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.INITIALISATION.RECALAGE AR");
#endif
cout<<"recalage AR"<<endl;
// desactivation de l'evitement
serialPrintf(master->getPortSerie(),"E0 \n");
serialPrintf(master->getPortSerie(),"S0 0 0 0 \n");
// recalage
serialPrintf(master->getPortSerie(),"S2 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::RECALAGE_AR_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._initialisation_state;
}
MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::~INITIALISATION_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._initialisation_state._wait_start_in_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.INITIALISATION.WAIT START IN");
#endif
stm._mae_picky_state._initialisation_state._wait_start_in_state.create(stm);
}
}
// to manage the exit point 'EXIT_INITIALISATION', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::_exit1(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU");
#endif
stm._mae_picky_state._jeu_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.INITIALISATION");
#endif
cout<<"ETAT INITIALISATION"<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::INITIALISATION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state;
}
MAE_PICKY::MAE_PICKY_State::END_State::~END_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::END_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::END_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.END");
#endif
cout<<"ETAT END"<<endl;
// affiche les stats du jeux: element robot, plateau de jeux et mission
serialPrintf(master->getPortSerie(),"S9 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::END_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state;
}
MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::ACTION_TO_DO_State::~ACTION_TO_DO_State() {
}
// to manage the event near
void MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::ACTION_TO_DO_State::near(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._evitement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.EVITEMENT");
#endif
stm._mae_picky_state._evitement_state._exit28(stm);
}
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::ACTION_TO_DO_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._evitement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.EVITEMENT");
#endif
stm._mae_picky_state._evitement_state._exit28(stm);
}
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::ACTION_TO_DO_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._evitement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.EVITEMENT");
#endif
stm._mae_picky_state._evitement_state._exit28(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::ACTION_TO_DO_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::ACTION_TO_DO_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.EVITEMENT.ACTION TO DO");
#endif
serialPrintf(master->getPortSerie(),"S8 \n");
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y0 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
serialPrintf(master->getPortSerie(),"C5 \n");
// vitesse faible
serialPrintf(master->getPortSerie(),"S7 0 \n");
// recule un peu
serialPrintf(master->getPortSerie(),"S4 -50 \n");
master->set_time_out(500);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::ACTION_TO_DO_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._evitement_state;
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::ACTION_TO_DO_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._evitement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.EVITEMENT");
#endif
stm._mae_picky_state._evitement_state._exit28(stm);
}
}
MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::~EVITEMENT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._evitement_state._action_to_do_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.EVITEMENT.ACTION TO DO");
#endif
stm._mae_picky_state._evitement_state._action_to_do_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.EVITEMENT");
#endif
cout<<"ETAT EVITEMENT"<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state;
}
// to manage the exit point 'SORTIE_EVITEMENT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::EVITEMENT_State::_exit28(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU");
#endif
stm._mae_picky_state._jeu_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::~DECISION_MISSION_State() {
}
// to manage the event mission_collecte_module_centraux_initiale
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::mission_collecte_module_centraux_initiale(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state.create(stm);
}
}
// to manage the event mission_collecte_module_centraux_restant
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::mission_collecte_module_centraux_restant(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state.create(stm);
}
}
// to manage the event mission_collecte_distributeur_monochrome
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::mission_collecte_distributeur_monochrome(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state.create(stm);
}
}
// to manage the event mission_transfert_direct_distributeur_polychrome
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::mission_transfert_direct_distributeur_polychrome(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state.create(stm);
}
}
// to manage the event mission_push_distributeur_monochrome
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::mission_push_distributeur_monochrome(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state.create(stm);
}
}
// to manage the event mission_push_cratere
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::mission_push_cratere(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state.create(stm);
}
}
// to manage the event mission_drop_zone_depart
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::mission_drop_zone_depart(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state.create(stm);
}
}
// to manage the event mission_depot_base_diagonale
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::mission_depot_base_diagonale(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state.create(stm);
}
}
// to manage the event mission_depot_base_verticale
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::mission_depot_base_verticale(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.DECISION_MISSION");
#endif
cout<<"[MAE][JEU] -> DECISION DE MISSION"<<endl;
master->decision_nouvelle_mission();
}
// to manage the event recall
void MAE_PICKY::MAE_PICKY_State::JEU_State::DECISION_MISSION_State::recall(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._recall_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.recall");
#endif
stm._mae_picky_state._jeu_state._recall_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::recall_State::~recall_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::recall_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::recall_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::recall_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.recall");
#endif
master->set_time_out(300);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::recall_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::~CAP_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._bf_droite_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.BF DROITE MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._bf_droite_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._bf_droite_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.BF DROITE MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._bf_droite_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.CAP TO MISSION");
#endif
cout<< "BFCAP VERS MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// vitesse moyenne & BF CAP
serialPrintf(master->getPortSerie(),"S7 1 \n");
serialPrintf(master->getPortSerie(),ordre_c);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::BF_DROITE_MISSION_State::~BF_DROITE_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::BF_DROITE_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::BF_DROITE_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::BF_DROITE_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::BF_DROITE_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.BF DROITE MISSION");
#endif
cout<< "BF droite to MISSION "<<endl;
string ordre;
ordre = "S5 "+ master->get_gestionnaire()->get_x_mission_str() + " " + master->get_gestionnaire()->get_y_mission_str() + " " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// BF droite
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"BF droite vers MISSION : "<<ordre<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::BF_DROITE_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::~CAP_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._exit27(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._exit27(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.CAP MISSION");
#endif
cout<< "BF CAP MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"ORIENTATION VERS MISSION : "<<ordre<<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.CAP MISSION");
#endif
// vitesse lente
serialPrintf(master->getPortSerie(),"S7 0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::~WAYPOINT_INIT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::create(MAE_PICKY & stm) {
{
if (master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.CAP TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_to_mission_state.create(stm);
}
else if (!master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state;
}
// to manage the exit point 'SORTIE_WAYPOINT_INIT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::WAYPOINT_INIT_State::_exit27(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._placement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.PLACEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._placement_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::DEGAGEMENT_State::~DEGAGEMENT_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::DEGAGEMENT_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._exit26(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::DEGAGEMENT_State::create(MAE_PICKY & stm) {
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::DEGAGEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::ROUTINE_DE_POSE_State::~ROUTINE_DE_POSE_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::ROUTINE_DE_POSE_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._degagement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.DEGAGEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._degagement_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::ROUTINE_DE_POSE_State::create(MAE_PICKY & stm) {
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::ROUTINE_DE_POSE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::PLACEMENT_State::~PLACEMENT_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::PLACEMENT_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._routine_de_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.ROUTINE DE POSE");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._routine_de_pose_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::PLACEMENT_State::create(MAE_PICKY & stm) {
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::PLACEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::~MISSION_DEPOT_BASE_VERTICALE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_verticale_state._waypoint_init_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_VERTICALE");
#endif
cout<<"[MAE][JEU][MISSION DEPOT BASE VERTICALE]"<<endl;
}
// to manage the exit point 'EXIT_MISSION_DEPOT_BASE_VERTICALE', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_VERTICALE_State::_exit26(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::~CAP_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.CAP TO MISSION");
#endif
cout<< "BFCAP VERS MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// vitesse moyenne & BF CAP
serialPrintf(master->getPortSerie(),"S7 1 \n");
serialPrintf(master->getPortSerie(),ordre_c);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::~CAP_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._exit25(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._exit25(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.CAP MISSION");
#endif
cout<< "BF CAP MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"ORIENTATION VERS MISSION : "<<ordre<<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.CAP MISSION");
#endif
// vitesse lente
serialPrintf(master->getPortSerie(),"S7 0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::~BF_DROITE_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
cout<< "BF droite to MISSION "<<endl;
string ordre;
ordre = "S5 "+ master->get_gestionnaire()->get_x_mission_str() + " " + master->get_gestionnaire()->get_y_mission_str() + " " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// BF droite
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"BF droite vers MISSION : "<<ordre<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::~WAYPOINT_INIT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::create(MAE_PICKY & stm) {
{
if (master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.CAP TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_to_mission_state.create(stm);
}
else if (!master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state;
}
// to manage the exit point 'SORTIE_WAYPOINT_INIT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::WAYPOINT_INIT_State::_exit25(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._placement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.PLACEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._placement_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::DEGAGEMENT_State::~DEGAGEMENT_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::DEGAGEMENT_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._exit24(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::DEGAGEMENT_State::create(MAE_PICKY & stm) {
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::DEGAGEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::ROUTINE_DE_POSE_State::~ROUTINE_DE_POSE_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::ROUTINE_DE_POSE_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._degagement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.DEGAGEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._degagement_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::ROUTINE_DE_POSE_State::create(MAE_PICKY & stm) {
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::ROUTINE_DE_POSE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::PLACEMENT_State::~PLACEMENT_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::PLACEMENT_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._routine_de_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.ROUTINE DE POSE");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._routine_de_pose_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::PLACEMENT_State::create(MAE_PICKY & stm) {
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::PLACEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::~MISSION_DEPOT_BASE_DIAGONALE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_depot_base_diagonale_state._waypoint_init_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DEPOT_BASE_DIAGONALE");
#endif
cout<<"[MAE][JEU][MISSION DEPOT BASE DIAGONALE]"<<endl;
}
// to manage the exit point 'EXIT_MISSION_DEPOT_BASE_DIAGONALE', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DEPOT_BASE_DIAGONALE_State::_exit24(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_to_mission_State::~Cap_to_mission_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_to_mission_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.BF droite to mission");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_to_mission_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.BF droite to mission");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_to_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_to_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.Cap to mission");
#endif
cout<< "BFCAP VERS MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// vitesse moyenne & BF CAP
serialPrintf(master->getPortSerie(),"S7 1 \n");
serialPrintf(master->getPortSerie(),ordre_c);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_to_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_mission_State::~Cap_mission_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_mission_State::_completion(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._exit23(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.Cap mission");
#endif
cout<<"BF CAP MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"ORIENTATION VERS MISSION : "<<ordre<<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_mission_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.Cap mission");
#endif
// vitesse lente
serialPrintf(master->getPortSerie(),"S7 0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::Cap_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::~BF_droite_to_mission_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.Cap mission");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.Cap mission");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.BF droite to mission");
#endif
cout<< "BF droite to MISSION "<<endl;
string ordre;
ordre = "S5 "+ master->get_gestionnaire()->get_x_mission_str() + " " + master->get_gestionnaire()->get_y_mission_str() + " " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// BF droite
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"BF droite vers MISSION : "<<ordre<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::~WAYPOINT_INIT_State() {
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state;
}
// implement a junction, through an operation because shared, internal
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::_junction2(MAE_PICKY & stm) {
{
if (!master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.Cap mission");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._cap_mission_state.create(stm);
}
else if (master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._cap_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT.Cap to mission");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state._cap_to_mission_state.create(stm);
}
}
}
// to manage the exit point 'SORTIE_WAYPOINT_INIT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::WAYPOINT_INIT_State::_exit23(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._bf_droite_zone_depart_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.BF droite zone depart");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._bf_droite_zone_depart_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Range_Arm_State::~Range_Arm_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Range_Arm_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._exit22(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Range_Arm_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Range_Arm_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Range Arm");
#endif
// fermeture pince
serialPrintf(master->getPortSerie(),"C5 \n");
// replis bras
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y0 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Range_Arm_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Recule_State::~Recule_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Recule_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._range_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Range Arm");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._range_arm_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Recule_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._range_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Range Arm");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._range_arm_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Recule_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Recule_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Recule");
#endif
serialPrintf(master->getPortSerie(),"S4 -300 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Recule_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Ouverture_pince_State::~Ouverture_pince_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Ouverture_pince_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._ouverture_pince_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._avance_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Avance");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._avance_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Ouverture_pince_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Ouverture_pince_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Ouverture pince");
#endif
serialPrintf(master->getPortSerie(),"C1 \n");
//serialPrintf(master->getPortSerie(),"C2 \n");
master->set_time_out(200);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Ouverture_pince_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Ouverture pince");
#endif
// ecriture du module dans la zone de depart
master->get_plateau_jeu()->get_depose_module_zone_depart()->add_module(master->get_element_robot()->get_stockage_CLAW()->get_module());
// enleve le module de la pince
//master->get_element_robot()->vidange_claw();
master->get_element_robot()->get_stockage_CLAW()->release();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Ouverture_pince_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Preparation_Arm_State::~Preparation_Arm_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Preparation_Arm_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._ouverture_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Ouverture pince");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._ouverture_pince_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Preparation_Arm_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Preparation_Arm_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Preparation Arm");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P3 \n");
master->set_time_out(500);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Preparation_Arm_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Avance_State::~Avance_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Avance_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._avance_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART");
#endif
if (master->get_element_robot()-> nb_module_present_stock() >0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._vidange_stockage_haut_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Vidange Stockage Haut");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._vidange_stockage_haut_state.create(stm);
}
else if (master->get_element_robot()-> nb_module_present_stock() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._recule_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Recule");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._recule_state.create(stm);
}
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Avance_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._avance_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART");
#endif
if (master->get_element_robot()-> nb_module_present_stock() >0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._vidange_stockage_haut_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Vidange Stockage Haut");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._vidange_stockage_haut_state.create(stm);
}
else if (master->get_element_robot()-> nb_module_present_stock() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._recule_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Recule");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._recule_state.create(stm);
}
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Avance_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Avance_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Avance");
#endif
serialPrintf(master->getPortSerie(),"S4 270 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Avance_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Avance_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Avance");
#endif
// hold position
serialPrintf(master->getPortSerie(),"S8 \n");
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Vidange_Stockage_Haut_State::~Vidange_Stockage_Haut_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Vidange_Stockage_Haut_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._vidange_stockage_haut_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._recule_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Recule");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._recule_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Vidange_Stockage_Haut_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Vidange_Stockage_Haut_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Vidange Stockage Haut");
#endif
// release all Stock
serialPrintf(master->getPortSerie(),"T3 \n");
serialPrintf(master->getPortSerie(),"T6 \n");
serialPrintf(master->getPortSerie(),"T9 \n");
master->set_time_out(1000);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Vidange_Stockage_Haut_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Vidange Stockage Haut");
#endif
// ecriture du module dans la zone de depart
if(master->get_element_robot()->get_stockage_L()->is_stockage_full()){
master->get_plateau_jeu()->get_depose_module_zone_depart()->add_module(master->get_element_robot()->get_stockage_L()->get_module());
}
if(master->get_element_robot()->get_stockage_C()->is_stockage_full()){
master->get_plateau_jeu()->get_depose_module_zone_depart()->add_module(master->get_element_robot()->get_stockage_C()->get_module());
}
if(master->get_element_robot()->get_stockage_R()->is_stockage_full()){
master->get_plateau_jeu()->get_depose_module_zone_depart()->add_module(master->get_element_robot()->get_stockage_R()->get_module());
}
// enleve les module du stock
master->get_element_robot()->vidange_stock();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::Vidange_Stockage_Haut_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::BF_droite_zone_depart_State::~BF_droite_zone_depart_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::BF_droite_zone_depart_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART");
#endif
if (master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._avance_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Avance");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._avance_state.create(stm);
}
else if (!master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._preparation_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Preparation Arm");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._preparation_arm_state.create(stm);
}
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::BF_droite_zone_depart_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART");
#endif
if (master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._avance_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Avance");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._avance_state.create(stm);
}
else if (!master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._preparation_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.Preparation Arm");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._preparation_arm_state.create(stm);
}
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::BF_droite_zone_depart_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::BF_droite_zone_depart_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.BF droite zone depart");
#endif
if(master->is_blue()){
serialPrintf(master->getPortSerie(),"S5 -1158 1533 90 \n");
}
if(master->is_yellow()){
serialPrintf(master->getPortSerie(),"S5 1158 1533 90 \n");
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::BF_droite_zone_depart_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::~MISSION_DROP_ZONE_DEPART_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_drop_zone_depart_state._waypoint_init_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_DROP_ZONE_DEPART");
#endif
cout<<"[MAE][JEU][MISSION DROP ZONE DEPART]"<<endl;
}
// to manage the exit point 'EXIT_MISSION_DROP_ZONE_DEPART', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_DROP_ZONE_DEPART_State::_exit22(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_to_mission_State::~Cap_to_mission_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_to_mission_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.BF droite to mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_to_mission_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.BF droite to mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_to_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_to_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.Cap to mission");
#endif
cout<< "BFCAP VERS MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// vitesse moyenne & BF CAP
serialPrintf(master->getPortSerie(),"S7 1 \n");
serialPrintf(master->getPortSerie(),ordre_c);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_to_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::~BF_droite_to_mission_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.Cap mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.Cap mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.BF droite to mission");
#endif
cout<<"BF droite to MISSION "<<endl;
string ordre;
ordre = "S5 "+ master->get_gestionnaire()->get_x_mission_str() + " " + master->get_gestionnaire()->get_y_mission_str() + " " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// BF droite
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"BF droite vers MISSION : "<<ordre<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_mission_State::~Cap_mission_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_mission_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._exit20(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_mission_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._exit20(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.Cap mission");
#endif
cout<< "BF CAP MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"ORIENTATION VERS MISSION : "<<ordre<<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_mission_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.Cap mission");
#endif
// vitesse lente
serialPrintf(master->getPortSerie(),"S7 0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::Cap_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::~WAYPOINT_INIT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::create(MAE_PICKY & stm) {
{
if (master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.Cap to mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_to_mission_state.create(stm);
}
else if (!master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT.Cap mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state;
}
// to manage the exit point 'SORTIE_WAYPOINT_INIT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::WAYPOINT_INIT_State::_exit20(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._preparation_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.PREPARATION ARM");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._preparation_arm_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RANGE_ARM_State::~RANGE_ARM_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RANGE_ARM_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._exit19(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RANGE_ARM_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RANGE_ARM_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.RANGE ARM");
#endif
// replis bras
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y0 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
master->set_time_out(500);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RANGE_ARM_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RECULE_State::~RECULE_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RECULE_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._range_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.RANGE ARM");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._range_arm_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RECULE_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._range_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.RANGE ARM");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._range_arm_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RECULE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RECULE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.RECULE");
#endif
serialPrintf(master->getPortSerie(),"S4 -300 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::RECULE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::PREPARATION_DU_SWING_State::~PREPARATION_DU_SWING_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::PREPARATION_DU_SWING_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state._shoot_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING.SHOOT");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state._shoot_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::PREPARATION_DU_SWING_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::PREPARATION_DU_SWING_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING.PREPARATION DU SWING");
#endif
if(master->is_blue()){
// position diagonal left, slide left, pitch catch AV
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L0 \n");
serialPrintf(master->getPortSerie(),"Y1 \n");
serialPrintf(master->getPortSerie(),"P2 \n");
}
if(master->is_yellow()){
// position diagonal right, slide right, pitch catch AV
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y3 \n");
serialPrintf(master->getPortSerie(),"P2 \n");
}
master->set_time_out(500);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::PREPARATION_DU_SWING_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::SHOOT_State::~SHOOT_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::SHOOT_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state._shoot_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING");
#endif
if (master->get_compteur()->get_compte() <2) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state._preparation_du_swing_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING.PREPARATION DU SWING");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state._preparation_du_swing_state.create(stm);
}
else if (master->get_compteur()->get_compte() >=2) {
stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state._exit21(stm);
}
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::SHOOT_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::SHOOT_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING.SHOOT");
#endif
if(master->is_blue()){
// position front, slide right, pitch catch AV
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P2 \n");
}
if(master->is_yellow()){
// position front, slide left, pitch catch AV
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L0 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P2 \n");
}
master->set_time_out(500);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::SHOOT_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING.SHOOT");
#endif
master->get_compteur()->incremente();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::SHOOT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::~GOLF_PLAYING_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state._preparation_du_swing_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING.PREPARATION DU SWING");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state._preparation_du_swing_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING");
#endif
// depend du cote: a repeter 1 ou 2 fois
master->get_compteur()->reset();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING");
#endif
master->get_plateau_jeu()->get_cratere_zone_depart()->vidange();
master->get_gestionnaire_mission()->get_mission_push_cratere()->mission_remplie();
}
// to manage the exit point 'SORTIE_GOLF_PLAYING', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::GOLF_PLAYING_State::_exit21(MAE_PICKY & stm) {
_doexit(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._recule_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.RECULE");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._recule_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::AVANCE_State::~AVANCE_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::AVANCE_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_cratere_state._avance_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::AVANCE_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_cratere_state._avance_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.GOLF PLAYING");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._golf_playing_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::AVANCE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::AVANCE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.AVANCE");
#endif
serialPrintf(master->getPortSerie(),"S4 260 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::AVANCE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::AVANCE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.AVANCE");
#endif
// hold position
serialPrintf(master->getPortSerie(),"S8 \n");
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::PREPARATION_ARM_State::~PREPARATION_ARM_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::PREPARATION_ARM_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._avance_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.AVANCE");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._avance_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::PREPARATION_ARM_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::PREPARATION_ARM_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.PREPARATION ARM");
#endif
if(master->is_blue()){
// position diagonal left, slide left, pitch catch AV
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L0 \n");
serialPrintf(master->getPortSerie(),"Y1 \n");
serialPrintf(master->getPortSerie(),"P2 \n");
}
if(master->is_yellow()){
// position diagonal right, slide right, pitch catch AV
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y3 \n");
serialPrintf(master->getPortSerie(),"P2 \n");
}
master->set_time_out(500);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::PREPARATION_ARM_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_cratere_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::~MISSION_PUSH_CRATERE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_CRATERE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_push_cratere_state._waypoint_init_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_CRATERE");
#endif
cout<<"[MAE][JEU][MISSION PUSH CRATERE]"<<endl;
}
// to manage the exit point 'EXIT_MISSION_PUSH_CRATERE', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_CRATERE_State::_exit19(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::~PLACEMENT_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._placement_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._placement_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.PLACEMENT");
#endif
serialPrintf(master->getPortSerie(),"S7 0 \n");
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S5 -349 1648 90 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S5 349 1648 90 \n");
}
//
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.PLACEMENT");
#endif
//hold position
serialPrintf(master->getPortSerie(),"S8 \n");
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::DEGAGEMENT_State::~DEGAGEMENT_State() {
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::DEGAGEMENT_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._exit16(stm);
}
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::DEGAGEMENT_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._exit16(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::DEGAGEMENT_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::DEGAGEMENT_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.DEGAGEMENT");
#endif
serialPrintf(master->getPortSerie(),"S4 -200 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::DEGAGEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_to_mission_State::~Cap_to_mission_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_to_mission_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.BF droite to mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_to_mission_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.BF droite to mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_to_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_to_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.Cap to mission");
#endif
cout<< "BFCAP VERS MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// vitesse moyenne & BF CAP
serialPrintf(master->getPortSerie(),"S7 1 \n");
serialPrintf(master->getPortSerie(),ordre_c);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_to_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_mission_State::~Cap_mission_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_mission_State::_completion(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._exit18(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.Cap mission");
#endif
cout<< "BF CAP MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"ORIENTATION VERS MISSION : "<<ordre<<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_mission_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.Cap mission");
#endif
// vitesse lente
serialPrintf(master->getPortSerie(),"S7 0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::Cap_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::~BF_droite_to_mission_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.Cap mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.Cap mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.BF droite to mission");
#endif
cout<< "BF droite to MISSION "<<endl;
string ordre;
ordre = "S5 "+ master->get_gestionnaire()->get_x_mission_str() + " " + master->get_gestionnaire()->get_y_mission_str() + " " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// BF droite
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"BF droite vers MISSION : "<<ordre<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_droite_to_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::~WAYPOINT_INIT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::create(MAE_PICKY & stm) {
{
if (!master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.Cap mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._cap_mission_state.create(stm);
}
else if (master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._cap_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.Cap to mission");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state._cap_to_mission_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state;
}
// to manage the exit point 'SORTIE_WAYPOINT_INIT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::_exit18(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._placement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.PLACEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._placement_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::ROTATION_AND_SLIDE_VERS_ZONE_DE_POSE_State::~ROTATION_AND_SLIDE_VERS_ZONE_DE_POSE_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::ROTATION_AND_SLIDE_VERS_ZONE_DE_POSE_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._pose_sur_zone_depart_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.POSE SUR ZONE DEPART");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._pose_sur_zone_depart_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::ROTATION_AND_SLIDE_VERS_ZONE_DE_POSE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::ROTATION_AND_SLIDE_VERS_ZONE_DE_POSE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.ROTATION AND SLIDE VERS ZONE DE POSE");
#endif
// position front, slide centre, pitch folded
serialPrintf(master->getPortSerie(),"F0 \n");
if(master->is_blue()){
// slide left, diagonal left
serialPrintf(master->getPortSerie(),"L0 \n");
serialPrintf(master->getPortSerie(),"Y1 \n");
}
if(master->is_yellow()){
// slide left, diagonal left
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y3 \n");
}
serialPrintf(master->getPortSerie(),"P0 \n");
master->set_time_out(500);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::ROTATION_AND_SLIDE_VERS_ZONE_DE_POSE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::REPLIS_State::~REPLIS_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::REPLIS_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._exit17(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::REPLIS_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::REPLIS_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.REPLIS");
#endif
// position front, slide centre, pitch folded
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y0 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
serialPrintf(master->getPortSerie(),"C5 \n");
master->set_time_out(100);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::REPLIS_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECENTRAGE_State::~RECENTRAGE_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECENTRAGE_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW");
#endif
if (!master->get_plateau_jeu()->get_distributeur_monochrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_ar_face_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.PRISE AR FACE");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_ar_face_state.create(stm);
}
else if (master->get_plateau_jeu()->get_distributeur_monochrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._replis_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.REPLIS");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._replis_state.create(stm);
}
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECENTRAGE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECENTRAGE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.RECENTRAGE");
#endif
// position front, slide centre, pitch folded
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
serialPrintf(master->getPortSerie(),"C5 \n");
master->set_time_out(500);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECENTRAGE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::DEGAGEMENT_State::~DEGAGEMENT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::DEGAGEMENT_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::DEGAGEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::DEGAGEMENT_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._degagement_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._recentrage_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.RECENTRAGE");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._recentrage_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::DEGAGEMENT_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.DEGAGEMENT");
#endif
// replis et ouverture de pince
serialPrintf(master->getPortSerie(),"P0 \n");
master->set_time_out(500);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::DEGAGEMENT_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.DEGAGEMENT");
#endif
master->get_plateau_jeu()->get_depose_module_zone_depart()->add_module_monochrome();
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::POSE_SUR_ZONE_DEPART_State::~POSE_SUR_ZONE_DEPART_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::POSE_SUR_ZONE_DEPART_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::POSE_SUR_ZONE_DEPART_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::POSE_SUR_ZONE_DEPART_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._degagement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.DEGAGEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._degagement_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::POSE_SUR_ZONE_DEPART_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.POSE SUR ZONE DEPART");
#endif
// deplis et ouverture de pince
serialPrintf(master->getPortSerie(),"P2 \n");
serialPrintf(master->getPortSerie(),"C2 \n");
master->set_time_out(500);
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECULE_PINCE_State::~RECULE_PINCE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECULE_PINCE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECULE_PINCE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECULE_PINCE_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._rotation_and_slide_vers_zone_de_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.ROTATION AND SLIDE VERS ZONE DE POSE");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._rotation_and_slide_vers_zone_de_pose_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::RECULE_PINCE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.RECULE PINCE");
#endif
// position front, slide centre, pitch folded
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
master->set_time_out(500);
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AV_FACE_State::~PRISE_AV_FACE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AV_FACE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AV_FACE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.PRISE AV FACE");
#endif
// position front, slide centre, pitch folded
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P2 \n");
master->set_time_out(3000);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AV_FACE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AV_FACE_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_av_face_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW");
#endif
if (!master->get_plateau_jeu()->get_distributeur_monochrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_ar_face_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.PRISE AR FACE");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_ar_face_state.create(stm);
}
else if (master->get_plateau_jeu()->get_distributeur_monochrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._replis_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.REPLIS");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._replis_state.create(stm);
}
}
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AV_FACE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.PRISE AV FACE");
#endif
master->get_plateau_jeu()->get_distributeur_monochrome()->remove_from_below();
}
// to manage the event clw_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AV_FACE_State::clw_stocked(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_av_face_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._recule_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.RECULE PINCE");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._recule_pince_state.create(stm);
}
}
// to manage the event clw_fail_catch
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AV_FACE_State::clw_fail_catch(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_av_face_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW");
#endif
if (!master->get_plateau_jeu()->get_distributeur_monochrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_ar_face_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.PRISE AR FACE");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_ar_face_state.create(stm);
}
else if (master->get_plateau_jeu()->get_distributeur_monochrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._replis_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.REPLIS");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._replis_state.create(stm);
}
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AR_FACE_State::~PRISE_AR_FACE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AR_FACE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AR_FACE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AR_FACE_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_ar_face_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_av_face_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.PRISE AV FACE");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_av_face_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AR_FACE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.PRISE AR FACE");
#endif
// position front, slide centre, pitch folded
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
master->set_time_out(300);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::PRISE_AR_FACE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.PRISE AR FACE");
#endif
// claw open wide
serialPrintf(master->getPortSerie(),"C2 \n");
// claw catch auto
serialPrintf(master->getPortSerie(),"C4 \n");
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::~CATCH_AND_THROW_State() {
}
// implement a junction, through an operation because shared, internal
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::_junction1(MAE_PICKY & stm) {
{
if (!master->get_plateau_jeu()->get_distributeur_monochrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_ar_face_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.PRISE AR FACE");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._prise_ar_face_state.create(stm);
}
else if (master->get_plateau_jeu()->get_distributeur_monochrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._replis_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.CATCH AND THROW.REPLIS");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._catch_and_throw_state._replis_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state;
}
// to manage the exit point 'SORTIE CATCH AND THROW', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::CATCH_AND_THROW_State::_exit17(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._degagement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.DEGAGEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._degagement_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::~MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_push_distributeur_monochrome_state._waypoint_init_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_PUSH_DISTRIBUTEUR_MONOCHROME");
#endif
cout<<"[MAE][JEU][MISSION PUSH DISTRIBUTEUR MONOCHROME]"<<endl;
}
// to manage the exit point 'EXIT_MISSION_PUSH_DISTRIBUTEUR_MONOCHROME', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_PUSH_DISTRIBUTEUR_MONOCHROME_State::_exit16(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::~CAP_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.CAP TO MISSION");
#endif
cout<< "BFCAP VERS MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// vitesse moyenne & BF CAP
serialPrintf(master->getPortSerie(),"S7 1 \n");
serialPrintf(master->getPortSerie(),ordre_c);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::~CAP_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._exit14(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._exit14(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.CAP MISSION");
#endif
cout<< "BF CAP MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"ORIENTATION VERS MISSION : "<<ordre<<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.CAP MISSION");
#endif
// vitesse lente
serialPrintf(master->getPortSerie(),"S7 0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::~BF_DROITE_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
cout<< "BF droite to MISSION "<<endl;
string ordre;
ordre = "S5 "+ master->get_gestionnaire()->get_x_mission_str() + " " + master->get_gestionnaire()->get_y_mission_str() + " " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// BF droite
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"BF droite vers MISSION : "<<ordre<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::~WAYPOINT_INIT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::create(MAE_PICKY & stm) {
{
if (master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.CAP TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_to_mission_state.create(stm);
}
else if (!master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state;
}
// to manage the exit point 'SORTIE_WAYPOINT_INIT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::WAYPOINT_INIT_State::_exit14(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._preparation_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.PREPARATION ARM");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._preparation_arm_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::DEGAGEMENT_State::~DEGAGEMENT_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::DEGAGEMENT_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._replis_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.REPLIS ARM");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._replis_arm_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::DEGAGEMENT_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._replis_arm_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.REPLIS ARM");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._replis_arm_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::DEGAGEMENT_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::DEGAGEMENT_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.DEGAGEMENT");
#endif
serialPrintf(master->getPortSerie(),"S4 -200 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::DEGAGEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::PREPARATION_ARM_State::~PREPARATION_ARM_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::PREPARATION_ARM_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._approche_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.APPROCHE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._approche_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::PREPARATION_ARM_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::PREPARATION_ARM_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.PREPARATION ARM");
#endif
// position front, slide centre, pitch folded
serialPrintf(master->getPortSerie(),"F0 \n");
if(master->is_blue()){
serialPrintf(master->getPortSerie(),"L0 \n");
serialPrintf(master->getPortSerie(),"Y1 \n");
}
if(master->is_yellow()){
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y3 \n");
}
serialPrintf(master->getPortSerie(),"P0 \n");
serialPrintf(master->getPortSerie(),"C5 \n");
master->set_time_out(150);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::PREPARATION_ARM_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::REPLIS_ARM_State::~REPLIS_ARM_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::REPLIS_ARM_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._exit13(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::REPLIS_ARM_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::REPLIS_ARM_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.REPLIS ARM");
#endif
// position front, slide centre, pitch folded
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y0 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
serialPrintf(master->getPortSerie(),"C5 \n");
master->set_time_out(150);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::REPLIS_ARM_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::REPLIS_State::~REPLIS_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::REPLIS_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._exit15(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::REPLIS_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::REPLIS_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::REPLIS_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.REPLIS");
#endif
// position front, slide centre, pitch folded
serialPrintf(master->getPortSerie(),"F0 \n");
if(master->is_blue()){
serialPrintf(master->getPortSerie(),"L0 \n");
serialPrintf(master->getPortSerie(),"Y1 \n");
}
if(master->is_yellow()){
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y3 \n");
}
serialPrintf(master->getPortSerie(),"P0 \n");
serialPrintf(master->getPortSerie(),"C5 \n");
serialPrintf(master->getPortSerie(),"C8 \n");
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_DROP_State::~DEGAGEMENT_DROP_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_DROP_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._degagement_drop_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._retour_centre_folded_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.RETOUR CENTRE FOLDED");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._retour_centre_folded_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_DROP_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_DROP_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.DEGAGEMENT DROP");
#endif
if(master->is_blue()){
serialPrintf(master->getPortSerie(),"Y1 \n");
}
if(master->is_yellow()){
serialPrintf(master->getPortSerie(),"Y3 \n");
}
master->set_time_out(200);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_DROP_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.DEGAGEMENT DROP");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_DROP_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::RETOUR_CENTRE_FOLDED_State::~RETOUR_CENTRE_FOLDED_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::RETOUR_CENTRE_FOLDED_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::RETOUR_CENTRE_FOLDED_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::RETOUR_CENTRE_FOLDED_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._retour_centre_folded_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE");
#endif
if (!master->get_plateau_jeu()->get_distributeur_polychrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_ar_diagonal_side_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PRISE AR DIAGONAL SIDE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_ar_diagonal_side_state.create(stm);
}
else if (master->get_plateau_jeu()->get_distributeur_polychrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._replis_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.REPLIS");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._replis_state.create(stm);
}
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::RETOUR_CENTRE_FOLDED_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.RETOUR CENTRE FOLDED");
#endif
serialPrintf(master->getPortSerie(),"P0 \n");
master->set_time_out(200);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::RETOUR_CENTRE_FOLDED_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.RETOUR CENTRE FOLDED");
#endif
if(master->is_blue()){
serialPrintf(master->getPortSerie(),"L0 \n");
}
if(master->is_yellow()){
serialPrintf(master->getPortSerie(),"L2 \n");
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DROP_State::~DROP_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DROP_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DROP_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.DROP");
#endif
master->get_plateau_jeu()->get_depose_module_base_laterale()->add_module_polychrome();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DROP_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DROP_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._drop_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._degagement_drop_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.DEGAGEMENT DROP");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._degagement_drop_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DROP_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.DROP");
#endif
serialPrintf(master->getPortSerie(),"C1 \n");
master->set_time_out(200);
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::COUP_DE_PLACEMENT_State::~COUP_DE_PLACEMENT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::COUP_DE_PLACEMENT_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::COUP_DE_PLACEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::COUP_DE_PLACEMENT_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._drop_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.DROP");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._drop_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::COUP_DE_PLACEMENT_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.COUP DE PLACEMENT");
#endif
serialPrintf(master->getPortSerie(),"Y2 \n");
master->set_time_out(200);
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PITCH_UP_State::~PITCH_UP_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PITCH_UP_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PITCH_UP_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PITCH_UP_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._coup_de_placement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.COUP DE PLACEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._coup_de_placement_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PITCH_UP_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PITCH UP");
#endif
serialPrintf(master->getPortSerie(),"P3 \n");
serialPrintf(master->getPortSerie(),"F1 \n");
master->set_time_out(200);
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::ROTATION_DECALAGE_CENTRAL_State::~ROTATION_DECALAGE_CENTRAL_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::ROTATION_DECALAGE_CENTRAL_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::ROTATION_DECALAGE_CENTRAL_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::ROTATION_DECALAGE_CENTRAL_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._pitch_up_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PITCH UP");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._pitch_up_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::ROTATION_DECALAGE_CENTRAL_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.ROTATION DECALAGE CENTRAL");
#endif
serialPrintf(master->getPortSerie(),"L1 \n");
// possibilité de decaller plus si besoin, voir aller retour
master->set_time_out(100);
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_PRISE_State::~DEGAGEMENT_PRISE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_PRISE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_PRISE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_PRISE_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._rotation_decalage_central_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.ROTATION DECALAGE CENTRAL");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._rotation_decalage_central_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::DEGAGEMENT_PRISE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.DEGAGEMENT PRISE");
#endif
serialPrintf(master->getPortSerie(),"P0 \n");
master->set_time_out(100);
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AV_DIAGONAL_SIDE_State::~PRISE_AV_DIAGONAL_SIDE_State() {
}
// to manage the event clw_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AV_DIAGONAL_SIDE_State::clw_stocked(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_av_diagonal_side_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._degagement_prise_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.DEGAGEMENT PRISE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._degagement_prise_state.create(stm);
}
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AV_DIAGONAL_SIDE_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_av_diagonal_side_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE");
#endif
if (!master->get_plateau_jeu()->get_distributeur_polychrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_ar_diagonal_side_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PRISE AR DIAGONAL SIDE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_ar_diagonal_side_state.create(stm);
}
else if (master->get_plateau_jeu()->get_distributeur_polychrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._replis_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.REPLIS");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._replis_state.create(stm);
}
}
}
// to manage the event clw_fail_catch
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AV_DIAGONAL_SIDE_State::clw_fail_catch(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_av_diagonal_side_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE");
#endif
if (!master->get_plateau_jeu()->get_distributeur_polychrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_ar_diagonal_side_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PRISE AR DIAGONAL SIDE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_ar_diagonal_side_state.create(stm);
}
else if (master->get_plateau_jeu()->get_distributeur_polychrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._replis_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.REPLIS");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._replis_state.create(stm);
}
}
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AV_DIAGONAL_SIDE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PRISE AV DIAGONAL SIDE");
#endif
master->get_plateau_jeu()->get_distributeur_polychrome()->remove_from_below();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AV_DIAGONAL_SIDE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AV_DIAGONAL_SIDE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AV_DIAGONAL_SIDE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PRISE AV DIAGONAL SIDE");
#endif
serialPrintf(master->getPortSerie(),"P2 \n");
master->set_time_out(3000);
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AR_DIAGONAL_SIDE_State::~PRISE_AR_DIAGONAL_SIDE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AR_DIAGONAL_SIDE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AR_DIAGONAL_SIDE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state;
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AR_DIAGONAL_SIDE_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_ar_diagonal_side_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_av_diagonal_side_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PRISE AV DIAGONAL SIDE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_av_diagonal_side_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AR_DIAGONAL_SIDE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PRISE AR DIAGONAL SIDE");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
if(master->is_blue()){
serialPrintf(master->getPortSerie(),"L0 \n");
serialPrintf(master->getPortSerie(),"Y1 \n");
}
if(master->is_yellow()){
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y3 \n");
}
serialPrintf(master->getPortSerie(),"P0 \n");
//master->set_time_out(200);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::PRISE_AR_DIAGONAL_SIDE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PRISE AR DIAGONAL SIDE");
#endif
serialPrintf(master->getPortSerie(),"C2 \n");
serialPrintf(master->getPortSerie(),"C4 \n");
serialPrintf(master->getPortSerie(),"C7 \n");
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::~CATCH_AND_PLACE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::create(MAE_PICKY & stm) {
{
if (!master->get_plateau_jeu()->get_distributeur_polychrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_ar_diagonal_side_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.PRISE AR DIAGONAL SIDE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._prise_ar_diagonal_side_state.create(stm);
}
else if (master->get_plateau_jeu()->get_distributeur_polychrome()->is_empty()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._replis_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE.REPLIS");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state._replis_state.create(stm);
}
}
}
// to manage the exit point 'Sortie_catch_and_place', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::_exit15(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._degagement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.DEGAGEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._degagement_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::CATCH_AND_PLACE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::APPROCHE_State::~APPROCHE_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::APPROCHE_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._approche_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::APPROCHE_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._approche_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.CATCH AND PLACE");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._catch_and_place_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::APPROCHE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::APPROCHE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.APPROCHE");
#endif
if(master->is_blue()){
serialPrintf(master->getPortSerie(),"S5 -1214 900 180 \n");
}
if(master->is_yellow()){
serialPrintf(master->getPortSerie(),"S5 1214 900 0 \n");
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::APPROCHE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::APPROCHE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.APPROCHE");
#endif
// hold position
serialPrintf(master->getPortSerie(),"S8 \n");
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::~MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_transfert_direct_distributeur_polychrome_state._waypoint_init_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME");
#endif
cout<<"[MAE][JEU][MISSION TRANSFERT DIRECT DISTRIBUTEUR POLYCHROME]"<<endl;
}
// to manage the exit point 'EXIT_MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_TRANSFERT_DIRECT_DISTRIBUTEUR_POLYCHROME_State::_exit13(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::~CAP_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.CAP TO MISSION");
#endif
cout<< "BFCAP VERS MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// vitesse moyenne & BF CAP
serialPrintf(master->getPortSerie(),"S7 1 \n");
serialPrintf(master->getPortSerie(),ordre_c);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::~CAP_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._exit12(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._exit12(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.CAP MISSION");
#endif
cout<< "BF CAP MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"ORIENTATION VERS MISSION : "<<ordre<<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.CAP MISSION");
#endif
// vitesse lente
serialPrintf(master->getPortSerie(),"S7 0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::CAP_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::~BF_DROITE_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
cout<< "BF droite to MISSION "<<endl;
string ordre;
ordre = "S5 "+ master->get_gestionnaire()->get_x_mission_str() + " " + master->get_gestionnaire()->get_y_mission_str() + " " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// BF droite
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"BF droite vers MISSION : "<<ordre<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::~WAYPOINT_INIT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::create(MAE_PICKY & stm) {
{
if (!master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_mission_state.create(stm);
}
else if (master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT.CAP TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state._cap_to_mission_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state;
}
// to manage the exit point 'SORTIE_WAYPOINT_INIT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::WAYPOINT_INIT_State::_exit12(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._placement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.PLACEMENT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._placement_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::SORTIE_DE_ZONE_State::~SORTIE_DE_ZONE_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::SORTIE_DE_ZONE_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._exit11(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::SORTIE_DE_ZONE_State::create(MAE_PICKY & stm) {
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::SORTIE_DE_ZONE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::DEBOIT_LE_DISTRIB_State::~DEBOIT_LE_DISTRIB_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::DEBOIT_LE_DISTRIB_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._sortie_de_zone_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.SORTIE DE ZONE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._sortie_de_zone_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::DEBOIT_LE_DISTRIB_State::create(MAE_PICKY & stm) {
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::DEBOIT_LE_DISTRIB_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::~PLACEMENT_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._deboit_le_distrib_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.DEBOIT LE DISTRIB");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._deboit_le_distrib_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::create(MAE_PICKY & stm) {
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::PLACEMENT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::~MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_distributeur_monochrome_state._waypoint_init_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME");
#endif
cout<<"[MAE][JEU][MISSION COLLECTE DISTRIBUTEUR MONOCHROME]"<<endl;
}
// to manage the exit point 'EXIT_MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_DISTRIBUTEUR_MONOCHROME_State::_exit11(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_4_State::~Collecte_Monochrome_4_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_4_State::_completion(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._collecte_monochrome_4_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT");
#endif
if (master->get_element_robot()->nb_slot_available() >= 1) {
if (master->get_plateau_jeu()->get_module_central_5()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._collecte_monochrome_5_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Collecte Monochrome 5");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._collecte_monochrome_5_state.create(stm);
}
else if (!master->get_plateau_jeu()->get_module_central_5()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Sortie de Zone");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state.create(stm);
}
}
else if (master->get_element_robot()->nb_slot_available() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Sortie de Zone");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state.create(stm);
}
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_4_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_4_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Collecte Monochrome 4");
#endif
cout<< "[MAE] -> [COLLECTE MONOCHROME #4]" <<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_4_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_4_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Collecte Monochrome 4");
#endif
master->get_plateau_jeu()->get_module_central_4()->remove();
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::~CAP_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.CAP TO MISSION");
#endif
cout<< "BFCAP VERS MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// vitesse moyenne & BF CAP
serialPrintf(master->getPortSerie(),"S7 1 \n");
serialPrintf(master->getPortSerie(),ordre_c);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_MISSION_State::~CAP_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._exit10(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._exit10(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.CAP MISSION");
#endif
cout<< "BF CAP MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"ORIENTATION VERS MISSION : "<<ordre<<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.CAP MISSION");
#endif
// vitesse lente
serialPrintf(master->getPortSerie(),"S7 0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::CAP_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::~BF_DROITE_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
cout<< "BF droite to MISSION "<<endl;
string ordre;
ordre = "S5 "+ master->get_gestionnaire()->get_x_mission_str() + " " + master->get_gestionnaire()->get_y_mission_str() + " " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// BF droite
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"BF droite vers MISSION : "<<ordre<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::~WAYPOINT_INIT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::create(MAE_PICKY & stm) {
{
if (master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.CAP TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_to_mission_state.create(stm);
}
else if (!master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state;
}
// to manage the exit point 'SORTIE_WAYPOINT_INIT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::WAYPOINT_INIT_State::_exit10(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT");
#endif
if (master->get_element_robot()->nb_slot_available() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Sortie de Zone");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state.create(stm);
}
else if (master->get_element_robot()->nb_slot_available() >= 1) {
if (master->get_plateau_jeu()->get_module_central_4()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._collecte_monochrome_4_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Collecte Monochrome 4");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._collecte_monochrome_4_state.create(stm);
}
else if (!master->get_plateau_jeu()->get_module_central_4()->is_present()) {
if (master->get_plateau_jeu()->get_module_central_5()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._collecte_monochrome_5_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Collecte Monochrome 5");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._collecte_monochrome_5_state.create(stm);
}
else if (!master->get_plateau_jeu()->get_module_central_5()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Sortie de Zone");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state.create(stm);
}
}
}
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Sortie_de_Zone_State::~Sortie_de_Zone_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Sortie_de_Zone_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._exit9(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Sortie_de_Zone_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Sortie_de_Zone_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Sortie de Zone");
#endif
cout<< "[MAE] -> [SORTIE ZONE COLLECTE CENTRAUX RESTANT]" <<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Sortie_de_Zone_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_5_State::~Collecte_Monochrome_5_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_5_State::_completion(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._collecte_monochrome_5_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Sortie de Zone");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._sortie_de_zone_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_5_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_5_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Collecte Monochrome 5");
#endif
cout<< "[MAE] -> [COLLECTE MONOCHROME #5]" <<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_5_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::Collecte_Monochrome_5_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.Collecte Monochrome 5");
#endif
master->get_plateau_jeu()->get_module_central_5()->remove();
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::~MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_restant_state._waypoint_init_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT");
#endif
cout<<"[MAE][JEU][MISSION COLLECTE MODULE CENTRAUX RESTANT]"<<endl;
}
// to manage the exit point 'EXIT_MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_RESTANT_State::_exit9(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Preparation_Pince_State::~Preparation_Pince_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Preparation_Pince_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._bf_droite_sur_le_module_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.BF droite sur le module");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._bf_droite_sur_le_module_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Preparation_Pince_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Preparation_Pince_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Preparation Pince");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P1 \n");
serialPrintf(master->getPortSerie(),"C2 \n");
master->set_time_out(200);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Preparation_Pince_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::garde_pince_State::~garde_pince_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::garde_pince_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._exit3(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::garde_pince_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::garde_pince_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.garde pince");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P1 \n");
master->get_element_robot()->get_stockage_CLAW()->catch_polychrome();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::garde_pince_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::replacement_Pince_State::~replacement_Pince_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::replacement_Pince_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._exit3(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::replacement_Pince_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::replacement_Pince_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.replacement Pince");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P1 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::replacement_Pince_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Yaw_Slide_State::~Stock_L_Yaw_Slide_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Yaw_Slide_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_l_pitch_up_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock L Pitch up");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_l_pitch_up_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Yaw_Slide_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Yaw_Slide_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock L Yaw Slide");
#endif
serialPrintf(master->getPortSerie(),"L0 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
master->set_time_out(200);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Yaw_Slide_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_R_State::~pipo_R_State() {
}
// to manage the event sto_r_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_R_State::sto_r_stocked(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_r_stocked_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock R stocked");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_r_stocked_state.create(stm);
}
}
// to manage the event sto_r_fail
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_R_State::sto_r_fail(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock Pitch down");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_R_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_C_State::~pipo_C_State() {
}
// to manage the event sto_c_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_C_State::sto_c_stocked(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_c_stocked_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock C stocked");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_c_stocked_state.create(stm);
}
}
// to manage the event sto_c_fail
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_C_State::sto_c_fail(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock Pitch down");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_C_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_L_State::~pipo_L_State() {
}
// to manage the event sto_l_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_L_State::sto_l_stocked(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_l_stocked_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock L stocked");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_l_stocked_state.create(stm);
}
}
// to manage the event sto_l_fail
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_L_State::sto_l_fail(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock Pitch down");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::pipo_L_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_stocked_State::~Stock_R_stocked_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_stocked_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock Pitch down");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_stocked_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_stocked_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock R stocked");
#endif
master->get_element_robot()->get_stockage_R()->catch_polychrome();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_stocked_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_stocked_State::~Stock_C_stocked_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_stocked_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock Pitch down");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_stocked_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_stocked_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock C stocked");
#endif
master->get_element_robot()->get_stockage_C()->catch_polychrome();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_stocked_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Pitch_up_State::~Stock_R_Pitch_up_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Pitch_up_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_r_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._pipo_r_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.pipo R");
#endif
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Pitch_up_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Pitch_up_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock R Pitch up");
#endif
serialPrintf(master->getPortSerie(),"P5 \n");
serialPrintf(master->getPortSerie(),"T7 \n");
//master->set_time_out(300);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Pitch_up_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock R Pitch up");
#endif
serialPrintf(master->getPortSerie(),"C2 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Pitch_up_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Pitch_up_State::~Stock_C_Pitch_up_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Pitch_up_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_c_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._pipo_c_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.pipo C");
#endif
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Pitch_up_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Pitch_up_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock C Pitch up");
#endif
serialPrintf(master->getPortSerie(),"P5 \n");
serialPrintf(master->getPortSerie(),"T4 \n");
//master->set_time_out(300);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Pitch_up_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock C Pitch up");
#endif
serialPrintf(master->getPortSerie(),"C2 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Pitch_up_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Recentrage_State::~Recentrage_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Recentrage_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._exit4(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Recentrage_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Recentrage_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Recentrage");
#endif
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Recentrage_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_stocked_State::~Stock_L_stocked_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_stocked_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock Pitch down");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_pitch_down_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_stocked_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_stocked_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock L stocked");
#endif
master->get_element_robot()->get_stockage_L()->catch_polychrome();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_stocked_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_Pitch_down_State::~Stock_Pitch_down_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_Pitch_down_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._recentrage_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Recentrage");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._recentrage_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_Pitch_down_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_Pitch_down_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock Pitch down");
#endif
serialPrintf(master->getPortSerie(),"P1 \n");
//master->set_time_out(200);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_Pitch_down_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Pitch_up_State::~Stock_L_Pitch_up_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Pitch_up_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_l_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._pipo_l_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.pipo L");
#endif
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Pitch_up_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Pitch_up_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock L Pitch up");
#endif
serialPrintf(master->getPortSerie(),"P5 \n");
serialPrintf(master->getPortSerie(),"T1 \n");
//master->set_time_out(300);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Pitch_up_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock L Pitch up");
#endif
serialPrintf(master->getPortSerie(),"C2 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_L_Pitch_up_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Yaw_Slide_State::~Stock_R_Yaw_Slide_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Yaw_Slide_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_r_pitch_up_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock R Pitch up");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_r_pitch_up_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Yaw_Slide_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Yaw_Slide_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock R Yaw Slide");
#endif
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
master->set_time_out(200);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_R_Yaw_Slide_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Yaw_Slide_State::~Stock_C_Yaw_Slide_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Yaw_Slide_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_c_pitch_up_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock C Pitch up");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_c_pitch_up_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Yaw_Slide_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Yaw_Slide_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock C Yaw Slide");
#endif
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
master->set_time_out(200);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::Stock_C_Yaw_Slide_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::~Stockage_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::create(MAE_PICKY & stm) {
{
if (master->get_element_robot()->where_to_stock() == -1) {
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._exit4(stm);
}
else if (master->get_element_robot()->where_to_stock() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_l_yaw_slide_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock L Yaw Slide");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_l_yaw_slide_state.create(stm);
}
else if (master->get_element_robot()->where_to_stock() == 1) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_c_yaw_slide_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock C Yaw Slide");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_c_yaw_slide_state.create(stm);
}
else if (master->get_element_robot()->where_to_stock() == 2) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_r_yaw_slide_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage.Stock R Yaw Slide");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state._stock_r_yaw_slide_state.create(stm);
}
}
}
// to manage the exit point 'Sortie_stockage', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::_exit4(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._exit3(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::Stockage_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::BF_droite_sur_le_module_State::~BF_droite_sur_le_module_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::BF_droite_sur_le_module_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::BF_droite_sur_le_module_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.BF droite sur le module");
#endif
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S5 -560 1620 285 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S5 560 1620 255 \n");
}
serialPrintf(master->getPortSerie(),"C4 \n");
master->set_time_out(3000);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::BF_droite_sur_le_module_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.BF droite sur le module");
#endif
master->get_plateau_jeu()->get_module_central_1()->remove();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::BF_droite_sur_le_module_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state;
}
// to manage the event clw_fail_catch
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::BF_droite_sur_le_module_State::clw_fail_catch(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._bf_droite_sur_le_module_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._replacement_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.replacement Pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._replacement_pince_state.create(stm);
}
}
// to manage the event clw_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::BF_droite_sur_le_module_State::clw_stocked(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._bf_droite_sur_le_module_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1");
#endif
if (master->get_element_robot()->stockage_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Stockage");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._stockage_state.create(stm);
}
else if (!master->get_element_robot()->stockage_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._garde_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.garde pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._garde_pince_state.create(stm);
}
}
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::BF_droite_sur_le_module_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._bf_droite_sur_le_module_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._replacement_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.replacement Pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._replacement_pince_state.create(stm);
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::~Collecte_Polychrome_1_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._preparation_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1.Preparation Pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state._preparation_pince_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1");
#endif
cout<< "[MAE] -> [COLLECTE POLYCHROME #1]" <<endl;
master->get_plateau_jeu()->get_module_central_1()->remove();
}
// to manage the exit point 'SORTIE_COLLECTE_POLYCHROME_1', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Polychrome_1_State::_exit3(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE");
#endif
if (master->get_element_robot()->nb_slot_available() >= 1) {
if (master->get_plateau_jeu()->get_module_central_2()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state.create(stm);
}
else if (!master->get_plateau_jeu()->get_module_central_2()->is_present()) {
if (master->get_plateau_jeu()->get_module_central_3()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state.create(stm);
}
else if (!master->get_plateau_jeu()->get_module_central_3()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Etat check sortie de mission");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state.create(stm);
}
}
}
else if (master->get_element_robot()->nb_slot_available() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Etat check sortie de mission");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state.create(stm);
}
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::~CAP_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._bf_droite_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._bf_droite_to_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.CAP TO MISSION");
#endif
cout<< "BFCAP VERS MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// vitesse moyenne & BF CAP
serialPrintf(master->getPortSerie(),"S7 1 \n");
serialPrintf(master->getPortSerie(),ordre_c);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::~CAP_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._exit8(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_mission_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._exit8(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.CAP MISSION");
#endif
cout<< "BF CAP MISSION "<<endl;
string ordre;
ordre = "S3 " + master->get_gestionnaire()->get_cap_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"ORIENTATION VERS MISSION : "<<ordre<<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.CAP MISSION");
#endif
// vitesse lente
serialPrintf(master->getPortSerie(),"S7 0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::CAP_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::~BF_DROITE_TO_MISSION_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_mission_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.BF DROITE TO MISSION");
#endif
cout<< "BF droite to MISSION "<<endl;
string ordre;
ordre = "S5 "+ master->get_gestionnaire()->get_x_mission_str() + " " + master->get_gestionnaire()->get_y_mission_str() + " " + master->get_gestionnaire()->get_cap_to_mission_str() + " \n";
const char* ordre_c = ordre.c_str();
// BF droite
serialPrintf(master->getPortSerie(),ordre_c);
cout<<"BF droite vers MISSION : "<<ordre<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::BF_DROITE_TO_MISSION_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::~WAYPOINT_INIT_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::create(MAE_PICKY & stm) {
{
if (!master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.CAP MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_mission_state.create(stm);
}
else if (master->get_gestionnaire_mission()->is_mission_far()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_to_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT.CAP TO MISSION");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state._cap_to_mission_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state;
}
// to manage the exit point 'SORTIE_WAYPOINT_INIT', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::WAYPOINT_INIT_State::_exit8(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE");
#endif
if (master->get_element_robot()->nb_slot_available() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Etat check sortie de mission");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state.create(stm);
}
else if (master->get_element_robot()->nb_slot_available() >= 1) {
if (master->get_plateau_jeu()->get_module_central_1()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Polychrome 1");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_polychrome_1_state.create(stm);
}
else if (!master->get_plateau_jeu()->get_module_central_1()->is_present()) {
if (master->get_plateau_jeu()->get_module_central_2()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state.create(stm);
}
else if (!master->get_plateau_jeu()->get_module_central_2()->is_present()) {
if (master->get_plateau_jeu()->get_module_central_3()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state.create(stm);
}
else if (!master->get_plateau_jeu()->get_module_central_3()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Etat check sortie de mission");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state.create(stm);
}
}
}
}
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Etat_check_sortie_de_mission_State::~Etat_check_sortie_de_mission_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Etat_check_sortie_de_mission_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._exit2(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Etat_check_sortie_de_mission_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Etat_check_sortie_de_mission_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Etat_check_sortie_de_mission_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Etat check sortie de mission");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y0 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
serialPrintf(master->getPortSerie(),"C5 \n");
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_placement_State::~BF_droite_placement_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_placement_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._bf_droite_charge_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.BF droite Charge");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._bf_droite_charge_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_placement_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._bf_droite_charge_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.BF droite Charge");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._bf_droite_charge_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_placement_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_placement_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.BF droite placement");
#endif
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S5 -913 920 314 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S5 913 920 -134 \n");
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_placement_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Drop_State::~Drop_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Drop_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._drop_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._recul_chargement_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Recul chargement pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._recul_chargement_pince_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Drop_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Drop_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Drop");
#endif
serialPrintf(master->getPortSerie(),"C1 \n");
master->set_time_out(200);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Drop_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Drop");
#endif
master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->add_module(master->get_element_robot()->get_stockage_CLAW()->get_module());
master->get_element_robot()->get_stockage_CLAW()->release();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Drop_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Avance_pour_pose_State::~Avance_pour_pose_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Avance_pour_pose_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._drop_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Drop");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._drop_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Avance_pour_pose_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._drop_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Drop");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._drop_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Avance_pour_pose_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Avance_pour_pose_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Avance pour pose");
#endif
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S5 -701 706 314 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S5 701 706 -134 \n");
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Avance_pour_pose_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Positionnement_pince_pour_pose_State::~Positionnement_pince_pour_pose_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Positionnement_pince_pour_pose_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._avance_pour_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Avance pour pose");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._avance_pour_pose_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Positionnement_pince_pour_pose_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Positionnement_pince_pour_pose_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Positionnement pince pour pose");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P4 \n");
master->set_time_out(200);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Positionnement_pince_pour_pose_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recul_chargement_pince_State::~Recul_chargement_pince_State() {
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recul_chargement_pince_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
if (master->get_element_robot()->nb_module_present() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.replis pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state.create(stm);
}
else {
if (!master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->is_full()) {
if (!master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Positionnement pince pour pose");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state.create(stm);
}
else if (master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state.create(stm);
}
}
else if (master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->is_full()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.replis pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state.create(stm);
}
}
}
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recul_chargement_pince_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
if (master->get_element_robot()->nb_module_present() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.replis pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state.create(stm);
}
else {
if (!master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->is_full()) {
if (!master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Positionnement pince pour pose");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state.create(stm);
}
else if (master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state.create(stm);
}
}
else if (master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->is_full()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.replis pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state.create(stm);
}
}
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recul_chargement_pince_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recul_chargement_pince_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Recul chargement pince");
#endif
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S5 -913 920 314 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S5 913 920 -134 \n");
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recul_chargement_pince_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_YAW_SLIDE_State::~STO_L_YAW_SLIDE_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_YAW_SLIDE_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_up_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L PITCH UP");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_up_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_YAW_SLIDE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_YAW_SLIDE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L YAW SLIDE");
#endif
serialPrintf(master->getPortSerie(),"L0 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"C1 \n");
master->set_time_out(200);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_YAW_SLIDE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_R_State::~pipo_R_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_R_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R PITCH POSE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_pose_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_R_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_R_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.pipo R");
#endif
if(master->get_element_robot()->get_stockage_R()->is_color_polychrome()){
master->get_element_robot()->get_stockage_CLAW()->catch_polychrome();
}
else{
master->get_element_robot()->get_stockage_CLAW()->catch_monochrome();
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_R_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_C_State::~pipo_C_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_C_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C PITCH POSE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_pose_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_C_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_C_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.pipo C");
#endif
if(master->get_element_robot()->get_stockage_C()->is_color_polychrome()){
master->get_element_robot()->get_stockage_CLAW()->catch_polychrome();
}
else{
master->get_element_robot()->get_stockage_CLAW()->catch_monochrome();
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_C_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_L_State::~pipo_L_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_L_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L PITCH POSE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_pose_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_L_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_L_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.pipo L");
#endif
if(master->get_element_robot()->get_stockage_L()->is_color_polychrome()){
master->get_element_robot()->get_stockage_CLAW()->catch_polychrome();
}
else{
master->get_element_robot()->get_stockage_CLAW()->catch_monochrome();
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::pipo_L_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::RECENTRAGE_State::~RECENTRAGE_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::RECENTRAGE_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._exit7(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::RECENTRAGE_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::RECENTRAGE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.RECENTRAGE");
#endif
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::RECENTRAGE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_POSE_State::~STO_R_PITCH_POSE_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_POSE_State::_completion(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_pose_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._recentrage_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.RECENTRAGE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._recentrage_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_POSE_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_POSE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R PITCH POSE");
#endif
serialPrintf(master->getPortSerie(),"P3 \n");
master->set_time_out(200);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_POSE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R PITCH POSE");
#endif
master->get_element_robot()->get_stockage_R()->release();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_POSE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_POSE_State::~STO_C_PITCH_POSE_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_POSE_State::_completion(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_pose_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._recentrage_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.RECENTRAGE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._recentrage_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_POSE_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_POSE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C PITCH POSE");
#endif
serialPrintf(master->getPortSerie(),"P3 \n");
master->set_time_out(200);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_POSE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C PITCH POSE");
#endif
master->get_element_robot()->get_stockage_C()->release();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_POSE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_YAW_SLIDE_State::~STO_R_YAW_SLIDE_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_YAW_SLIDE_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_up_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R PITCH UP");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_up_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_YAW_SLIDE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_YAW_SLIDE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R YAW SLIDE");
#endif
serialPrintf(master->getPortSerie(),"L2 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"C1 \n");
master->set_time_out(200);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_YAW_SLIDE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_YAW_SLIDE_State::~STO_C_YAW_SLIDE_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_YAW_SLIDE_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_up_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C PITCH UP");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_up_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_YAW_SLIDE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_YAW_SLIDE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C YAW SLIDE");
#endif
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"C1 \n");
master->set_time_out(200);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_YAW_SLIDE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_UP_State::~STO_R_PITCH_UP_State() {
}
// to manage the event clw_fail_catch
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_UP_State::clw_fail_catch(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R PITCH POSE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_pose_state.create(stm);
}
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_UP_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R PITCH POSE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_pose_state.create(stm);
}
}
// to manage the event clw_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_UP_State::clw_stocked(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._pipo_r_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.pipo R");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._pipo_r_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_UP_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_UP_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R PITCH UP");
#endif
serialPrintf(master->getPortSerie(),"P5 \n");
serialPrintf(master->getPortSerie(),"C4 \n");
master->set_time_out(3000);
if(master->get_element_robot()->get_stockage_R()->is_color_polychrome()){
serialPrintf(master->getPortSerie(),"C7 \n");
}
else{
serialPrintf(master->getPortSerie(),"C8 \n");
}
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_UP_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R PITCH UP");
#endif
serialPrintf(master->getPortSerie(),"T9 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_R_PITCH_UP_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_UP_State::~STO_C_PITCH_UP_State() {
}
// to manage the event clw_fail_catch
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_UP_State::clw_fail_catch(MAE_PICKY & stm) {
if (_completion(stm)) return;
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C PITCH POSE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_pose_state.create(stm);
}
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_UP_State::_completion(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C PITCH POSE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_pose_state.create(stm);
return (bool) 1;
}
}
// to manage the event clw_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_UP_State::clw_stocked(MAE_PICKY & stm) {
if (_completion(stm)) return;
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._pipo_c_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.pipo C");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._pipo_c_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_UP_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_UP_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C PITCH UP");
#endif
serialPrintf(master->getPortSerie(),"P5 \n");
serialPrintf(master->getPortSerie(),"C4 \n");
master->set_time_out(3000);
if(master->get_element_robot()->get_stockage_C()->is_color_polychrome()){
serialPrintf(master->getPortSerie(),"C7 \n");
}
else{
serialPrintf(master->getPortSerie(),"C8 \n");
}
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_UP_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C PITCH UP");
#endif
serialPrintf(master->getPortSerie(),"T6 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_C_PITCH_UP_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_POSE_State::~STO_L_PITCH_POSE_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_POSE_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_pose_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._recentrage_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.RECENTRAGE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._recentrage_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_POSE_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_POSE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L PITCH POSE");
#endif
serialPrintf(master->getPortSerie(),"P3 \n");
master->set_time_out(200);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_POSE_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L PITCH POSE");
#endif
master->get_element_robot()->get_stockage_L()->release();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_POSE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_UP_State::~STO_L_PITCH_UP_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_UP_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L PITCH POSE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_pose_state.create(stm);
}
}
// to manage the event clw_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_UP_State::clw_stocked(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._pipo_l_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.pipo L");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._pipo_l_state.create(stm);
}
}
// to manage the event clw_fail_catch
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_UP_State::clw_fail_catch(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_up_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L PITCH POSE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_pitch_pose_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_UP_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_UP_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L PITCH UP");
#endif
serialPrintf(master->getPortSerie(),"P5 \n");
serialPrintf(master->getPortSerie(),"C4 \n");
master->set_time_out(3000);
if(master->get_element_robot()->get_stockage_L()->is_color_polychrome()){
serialPrintf(master->getPortSerie(),"C7 \n");
}
else{
serialPrintf(master->getPortSerie(),"C8 \n");
}
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_UP_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L PITCH UP");
#endif
serialPrintf(master->getPortSerie(),"T3 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::STO_L_PITCH_UP_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::~Prise_de_stock_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::create(MAE_PICKY & stm) {
{
if (master->get_element_robot()->where_to_pick_up() == -1) {
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._exit7(stm);
}
else if (master->get_element_robot()->where_to_pick_up() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_yaw_slide_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO L YAW SLIDE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_l_yaw_slide_state.create(stm);
}
else if (master->get_element_robot()->where_to_pick_up() == 1) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_yaw_slide_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO C YAW SLIDE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_c_yaw_slide_state.create(stm);
}
else if (master->get_element_robot()->where_to_pick_up() == 2) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_yaw_slide_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock.STO R YAW SLIDE");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state._sto_r_yaw_slide_state.create(stm);
}
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
// to manage the exit point 'Sortie_Prise_de_stock', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Prise_de_stock_State::_exit7(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
if (!master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Positionnement pince pour pose");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state.create(stm);
}
else if (master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state.create(stm);
}
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recule_State::~Recule_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recule_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
if (master->get_element_robot()->nb_module_present() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.replis pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state.create(stm);
}
else {
if (!master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->is_full()) {
if (!master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Positionnement pince pour pose");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state.create(stm);
}
else if (master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state.create(stm);
}
}
else if (master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->is_full()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.replis pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state.create(stm);
}
}
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recule_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
if (master->get_element_robot()->nb_module_present() == 0) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.replis pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state.create(stm);
}
else {
if (!master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->is_full()) {
if (!master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Positionnement pince pour pose");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._positionnement_pince_pour_pose_state.create(stm);
}
else if (master->get_element_robot()-> claw_available()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Prise de stock");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._prise_de_stock_state.create(stm);
}
}
else if (master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->is_full()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.replis pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._replis_pince_state.create(stm);
}
}
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recule_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recule_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Recule");
#endif
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S5 -913 920 314 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S5 913 920 -134 \n");
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Recule_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::replis_pince_State::~replis_pince_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::replis_pince_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._exit6(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::replis_pince_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::replis_pince_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.replis pince");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P0 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::replis_pince_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_Charge_State::~BF_droite_Charge_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_Charge_State::assFini(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._bf_droite_charge_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._recule_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Recule");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._recule_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_Charge_State::blocage(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._bf_droite_charge_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._recule_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Recule");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._recule_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_Charge_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_Charge_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.BF droite Charge");
#endif
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S5 -701 706 314 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S5 701 706 -134 \n");
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_Charge_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::BF_droite_Charge_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.BF droite Charge");
#endif
master->get_plateau_jeu()->get_module_central_3()->remove();
master->get_plateau_jeu()->get_depose_module_base_centrale_diagonale()->add_module_polychrome();
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Preparation_du_belier_State::~Preparation_du_belier_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Preparation_du_belier_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._bf_droite_placement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.BF droite placement");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._bf_droite_placement_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Preparation_du_belier_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Preparation_du_belier_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Preparation du belier");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P3 \n");
master->set_time_out(50);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::Preparation_du_belier_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::~Push_Polychrome_3_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::_completion(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Etat check sortie de mission");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._preparation_du_belier_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3.Preparation du belier");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state._preparation_du_belier_state.create(stm);
}
}
// to manage the exit point 'Sortie_Push_Polychrome_3', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::_exit6(MAE_PICKY & stm) {
_doexit(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
cout<< "[MAE] -> [PUSH POLYCHROME #3]" <<endl;
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
master->get_plateau_jeu()->get_module_central_3()->remove();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Push_Polychrome_3_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::Preparation_Pince_State::~Preparation_Pince_State() {
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::Preparation_Pince_State::time_out(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._bf_droite_de_preparation_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.BF droite de preparation");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._bf_droite_de_preparation_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::Preparation_Pince_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::Preparation_Pince_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.Preparation Pince");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P1 \n");
serialPrintf(master->getPortSerie(),"C2 \n");
master->set_time_out(50);
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::Preparation_Pince_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::recule_State::~recule_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::recule_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._exit5(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::recule_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._exit5(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::recule_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::recule_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.recule");
#endif
serialPrintf(master->getPortSerie(),"S4 -190 \n");
serialPrintf(master->getPortSerie(),"C8 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::recule_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::garde_pince_State::~garde_pince_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::garde_pince_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._recule_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.recule");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._recule_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::garde_pince_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::garde_pince_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.garde pince");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P1 \n");
master->get_element_robot()->get_stockage_CLAW()->catch_polychrome();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::garde_pince_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::replacement_de_pince_State::~replacement_de_pince_State() {
}
bool MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::replacement_de_pince_State::_completion(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._recule_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.recule");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._recule_state.create(stm);
return (bool) 1;
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::replacement_de_pince_State::create(MAE_PICKY & stm) {
_doentry(stm);
_completion(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::replacement_de_pince_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.replacement de pince");
#endif
serialPrintf(master->getPortSerie(),"F0 \n");
serialPrintf(master->getPortSerie(),"L1 \n");
serialPrintf(master->getPortSerie(),"Y2 \n");
serialPrintf(master->getPortSerie(),"P1 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::replacement_de_pince_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_sur_le_module_State::~BF_droite_sur_le_module_State() {
}
// to manage the event clw_fail_catch
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_sur_le_module_State::clw_fail_catch(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._bf_droite_sur_le_module_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._replacement_de_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.replacement de pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._replacement_de_pince_state.create(stm);
}
}
// to manage the event time_out
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_sur_le_module_State::time_out(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._bf_droite_sur_le_module_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._replacement_de_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.replacement de pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._replacement_de_pince_state.create(stm);
}
}
// to manage the event clw_stocked
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_sur_le_module_State::clw_stocked(MAE_PICKY & stm) {
{
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._bf_droite_sur_le_module_state._doexit(stm);
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._garde_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.garde pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._garde_pince_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_sur_le_module_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_sur_le_module_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.BF droite sur le module");
#endif
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S5 -836 1054 222 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S5 836 1054 -42 \n");
}
master->set_time_out(3000);
}
// perform the 'exit behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_sur_le_module_State::_doexit(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute exit behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.BF droite sur le module");
#endif
master->get_plateau_jeu()->get_module_central_2()->remove();
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_sur_le_module_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_de_preparation_State::~BF_droite_de_preparation_State() {
}
// to manage the event assFini
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_de_preparation_State::assFini(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._bf_droite_sur_le_module_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.BF droite sur le module");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._bf_droite_sur_le_module_state.create(stm);
}
}
// to manage the event blocage
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_de_preparation_State::blocage(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._bf_droite_sur_le_module_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.BF droite sur le module");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._bf_droite_sur_le_module_state.create(stm);
}
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_de_preparation_State::create(MAE_PICKY & stm) {
_doentry(stm);
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_de_preparation_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.BF droite de preparation");
#endif
if(master->is_blue())
{
serialPrintf(master->getPortSerie(),"S5 -698 1180 222 \n");
}
if(master->is_yellow())
{
serialPrintf(master->getPortSerie(),"S5 698 1180 -42 \n");
}
serialPrintf(master->getPortSerie(),"C4 \n");
serialPrintf(master->getPortSerie(),"C7 \n");
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::BF_droite_de_preparation_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::~Collecte_Poychrome_2_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._preparation_pince_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2.Preparation Pince");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._collecte_poychrome_2_state._preparation_pince_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Collecte Poychrome 2");
#endif
cout<< "[MAE] -> [COLLECTE POLYCHROME #2]" <<endl;
master->get_plateau_jeu()->get_module_central_2()->remove();
}
// to manage the exit point 'Sortie_collecte_polychrome_2', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::Collecte_Poychrome_2_State::_exit5(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE");
#endif
if (master->get_plateau_jeu()->get_module_central_3()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Push Polychrome 3");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._push_polychrome_3_state.create(stm);
}
else if (!master->get_plateau_jeu()->get_module_central_3()->is_present()) {
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.Etat check sortie de mission");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._etat_check_sortie_de_mission_state.create(stm);
}
}
}
MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::~MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE.WAYPOINT INIT");
#endif
stm._mae_picky_state._jeu_state._mission_collecte_module_centraux_initiale_state._waypoint_init_state.create(stm);
}
}
// to manage the exit point 'EXIT_MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE', defined because probably shared
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::_exit2(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state._jeu_state;
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU.MISSION_COLLECTE_MODULE_CENTRAUX_INITIALE");
#endif
cout<<"[MAE][JEU][MISSION COLLECTE MODULE CENTRAUX INITIALE]"<<endl;
}
MAE_PICKY::MAE_PICKY_State::JEU_State::~JEU_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::JEU_State::create(MAE_PICKY & stm) {
_doentry(stm);
{
stm._set_currentState(stm._mae_picky_state._jeu_state._decision_mission_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.JEU.DECISION_MISSION");
#endif
stm._mae_picky_state._jeu_state._decision_mission_state.create(stm);
}
}
// to manage the event evitement
void MAE_PICKY::MAE_PICKY_State::JEU_State::evitement(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._evitement_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.EVITEMENT");
#endif
stm._mae_picky_state._evitement_state.create(stm);
}
}
// to manage the event end_game
void MAE_PICKY::MAE_PICKY_State::JEU_State::end_game(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._end_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.END");
#endif
stm._mae_picky_state._end_state.create(stm);
}
}
// perform the 'entry behavior'
void MAE_PICKY::MAE_PICKY_State::JEU_State::_doentry(MAE_PICKY & stm) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : execute entry behavior of .MAE_PICKY.JEU");
#endif
cout<<"ETAT JEU"<<endl;
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::JEU_State::_upper(MAE_PICKY & stm) {
return &stm._mae_picky_state;
}
MAE_PICKY::MAE_PICKY_State::~MAE_PICKY_State() {
}
// to manage the event create
void MAE_PICKY::MAE_PICKY_State::create(MAE_PICKY & stm) {
{
stm._set_currentState(stm._mae_picky_state._initialisation_state);
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : current state is now .MAE_PICKY.INITIALISATION");
#endif
stm._mae_picky_state._initialisation_state.create(stm);
}
}
// returns the state containing the current
MAE_PICKY::AnyState * MAE_PICKY::MAE_PICKY_State::_upper(MAE_PICKY &) {
return 0;
}
MAE_PICKY::MAE_PICKY() {
_current_state = 0;
}
MAE_PICKY::~MAE_PICKY() {
}
// the operation you call to signal the event create
bool MAE_PICKY::create() {
if (_current_state == 0)
(_current_state = &(*this)._mae_picky_state)->create(*this);
return (_current_state != 0);
}
// the operation you call to signal the event start_mis
bool MAE_PICKY::start_mis() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger start_mis");
#endif
_current_state->start_mis(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event blocage
bool MAE_PICKY::blocage() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger blocage");
#endif
_current_state->blocage(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event time_out
bool MAE_PICKY::time_out() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger time_out");
#endif
_current_state->time_out(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event assFini
bool MAE_PICKY::assFini() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger assFini");
#endif
_current_state->assFini(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event start_enleve
bool MAE_PICKY::start_enleve() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger start_enleve");
#endif
_current_state->start_enleve(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event mission_collecte_module_centraux_initiale
bool MAE_PICKY::mission_collecte_module_centraux_initiale() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger mission_collecte_module_centraux_initiale");
#endif
_current_state->mission_collecte_module_centraux_initiale(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event mission_collecte_module_centraux_restant
bool MAE_PICKY::mission_collecte_module_centraux_restant() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger mission_collecte_module_centraux_restant");
#endif
_current_state->mission_collecte_module_centraux_restant(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event mission_collecte_distributeur_monochrome
bool MAE_PICKY::mission_collecte_distributeur_monochrome() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger mission_collecte_distributeur_monochrome");
#endif
_current_state->mission_collecte_distributeur_monochrome(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event mission_transfert_direct_distributeur_polychrome
bool MAE_PICKY::mission_transfert_direct_distributeur_polychrome() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger mission_transfert_direct_distributeur_polychrome");
#endif
_current_state->mission_transfert_direct_distributeur_polychrome(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event mission_push_distributeur_monochrome
bool MAE_PICKY::mission_push_distributeur_monochrome() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger mission_push_distributeur_monochrome");
#endif
_current_state->mission_push_distributeur_monochrome(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event mission_push_cratere
bool MAE_PICKY::mission_push_cratere() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger mission_push_cratere");
#endif
_current_state->mission_push_cratere(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event mission_drop_zone_depart
bool MAE_PICKY::mission_drop_zone_depart() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger mission_drop_zone_depart");
#endif
_current_state->mission_drop_zone_depart(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event mission_depot_base_diagonale
bool MAE_PICKY::mission_depot_base_diagonale() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger mission_depot_base_diagonale");
#endif
_current_state->mission_depot_base_diagonale(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event mission_depot_base_verticale
bool MAE_PICKY::mission_depot_base_verticale() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger mission_depot_base_verticale");
#endif
_current_state->mission_depot_base_verticale(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event evitement
bool MAE_PICKY::evitement() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger evitement");
#endif
_current_state->evitement(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event end_game
bool MAE_PICKY::end_game() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger end_game");
#endif
_current_state->end_game(*this);
}
return (_current_state != 0);
}
// to execute the current state 'do activity'
void MAE_PICKY::doActivity() {
_current_state->_do(*this);
}
// execution done, internal
void MAE_PICKY::_final() {
_current_state = 0;
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : final state reached");
#endif
}
// the operation you call to signal the event near
bool MAE_PICKY::near() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger near");
#endif
_current_state->near(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event clw_stocked
bool MAE_PICKY::clw_stocked() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger clw_stocked");
#endif
_current_state->clw_stocked(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event clw_fail_catch
bool MAE_PICKY::clw_fail_catch() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger clw_fail_catch");
#endif
_current_state->clw_fail_catch(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event sto_l_stocked
bool MAE_PICKY::sto_l_stocked() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger sto_l_stocked");
#endif
_current_state->sto_l_stocked(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event sto_l_fail
bool MAE_PICKY::sto_l_fail() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger sto_l_fail");
#endif
_current_state->sto_l_fail(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event sto_c_stocked
bool MAE_PICKY::sto_c_stocked() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger sto_c_stocked");
#endif
_current_state->sto_c_stocked(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event sto_c_fail
bool MAE_PICKY::sto_c_fail() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger sto_c_fail");
#endif
_current_state->sto_c_fail(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event sto_r_stocked
bool MAE_PICKY::sto_r_stocked() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger sto_r_stocked");
#endif
_current_state->sto_r_stocked(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event sto_r_fail
bool MAE_PICKY::sto_r_fail() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger sto_r_fail");
#endif
_current_state->sto_r_fail(*this);
}
return (_current_state != 0);
}
// the operation you call to signal the event recall
bool MAE_PICKY::recall() {
if (_current_state != 0) {
#ifdef VERBOSE_STATE_MACHINE
puts("DEBUG : fire trigger recall");
#endif
_current_state->recall(*this);
}
return (_current_state != 0);
}
|
8e467806e291b031fc8099b3595e35aaba3d6c90
|
099489480e970716f13257134fbadb29ba41f9a0
|
/main.cpp
|
69f7e92aca29817e6ff327beb58fdf3eaabcc9fa
|
[
"MIT"
] |
permissive
|
Kronossaurus/OCEV
|
8ee15561f4c0b83a8552c7d4878ed51efd3e64eb
|
181cb42a2d40a759a6024ddd7c0de53827f8aad1
|
refs/heads/master
| 2020-05-22T02:12:57.400977
| 2017-05-25T21:03:43
| 2017-05-25T21:03:43
| 84,661,148
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 309
|
cpp
|
main.cpp
|
#include <cstdio>
#include "genetic.h"
int main(int argc, char **argv){
if(argc != 2){
printf("Wrong Parameters\n");
printf("1- Population Type (b - Binary; i - Integer; r - Real)\n");
exit(0);
}
char type = argv[1][0];
srand(time(NULL));
AG(type);
return 0;
}
|
626996ae9a78727ed1aa3d64d07ab36246858759
|
f699576e623d90d2e07d6c43659a805d12b92733
|
/WTLOnline-SDK/SDK/WTLOnline_MediaUtils_structs.hpp
|
d2e9ffef720a0bf9a6f24a06e97daa54bcc9a96e
|
[] |
no_license
|
ue4sdk/WTLOnline-SDK
|
2309620c809efeb45ba9ebd2fc528fa2461b9ca0
|
ff244cd4118c54ab2048ba0632b59ced111c405c
|
refs/heads/master
| 2022-07-12T13:02:09.999748
| 2019-04-22T08:22:35
| 2019-04-22T08:22:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,048
|
hpp
|
WTLOnline_MediaUtils_structs.hpp
|
#pragma once
// Will To Live Online (0.57) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "WTLOnline_Basic.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Script Structs
//---------------------------------------------------------------------------
// ScriptStruct MediaUtils.MediaPlayerTrackOptions
// 0x001C
struct FMediaPlayerTrackOptions
{
int Audio; // 0x0000(0x0004) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
int Caption; // 0x0004(0x0004) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
int MetaData; // 0x0008(0x0004) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
int Script; // 0x000C(0x0004) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
int Subtitle; // 0x0010(0x0004) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
int Text; // 0x0014(0x0004) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
int Video; // 0x0018(0x0004) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
};
// ScriptStruct MediaUtils.MediaPlayerOptions
// 0x001C
struct FMediaPlayerOptions
{
struct FMediaPlayerTrackOptions Tracks; // 0x0000(0x001C) (CPF_BlueprintVisible)
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
2f5b16066395c10f569d754539a6b2354fa4a01b
|
91719805a27882be3acd432904dcb4ba8c4d971f
|
/src/glvidtex/GLVideoReceiverDrawable.cpp
|
a13c857bf9d506c6a79a39fffeb532120439156d
|
[] |
no_license
|
svn2github/divz
|
1af8366135434ea82f4c1a0aa9ca5d6f7e75c11a
|
3c937a3dbccee49ee5cba9aae22f8f9a5e4356da
|
refs/heads/master
| 2020-05-29T12:51:48.333902
| 2013-04-21T23:00:02
| 2013-04-21T23:00:02
| 25,669,105
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 704
|
cpp
|
GLVideoReceiverDrawable.cpp
|
#include "GLVideoReceiverDrawable.h"
#include "VideoReceiver.h"
GLVideoReceiverDrawable::GLVideoReceiverDrawable(QString host, int port, QObject *parent)
: GLVideoDrawable(parent)
, m_host("localhost")
, m_port(7755)
, m_rx(0)
{
setHost(host);
setPort(port);
}
void GLVideoReceiverDrawable::setHost(const QString& host)
{
if(m_rx)
m_rx->release(this);
m_rx = VideoReceiver::getReceiver(host,m_port);
m_rx->registerConsumer(this);
setVideoSource(m_rx);
m_host = host;
}
void GLVideoReceiverDrawable::setPort(int port)
{
if(m_rx)
m_rx->release(this);
m_rx = VideoReceiver::getReceiver(m_host,port);
m_rx->registerConsumer(this);
setVideoSource(m_rx);
m_port = port;
}
|
ccd9e84cc97e6fac854bdc0a51d934393d0fe5f0
|
1216c957c1ac90c9b6b17c7a5a2fb2796150eeb9
|
/LDR_BLYNK.ino
|
23ed570a26e90e0c024bb1d5ea3dabaf2679fabe
|
[] |
no_license
|
vettri-vel-mahendran/Arduino
|
b62e92e8236a1d2454cb8a46dba7c3c8f6ce2f3e
|
85c9a0b64ecfeca71181ddc84b98b818b10bcf73
|
refs/heads/master
| 2021-08-10T08:22:40.895046
| 2020-08-10T17:32:11
| 2020-08-10T17:32:11
| 286,495,797
| 0
| 0
| null | 2020-08-10T16:24:38
| 2020-08-10T14:21:19
|
C++
|
UTF-8
|
C++
| false
| false
| 708
|
ino
|
LDR_BLYNK.ino
|
/*
LDR data blynk app
This example shows how to log LDR(light depended resistant) sensor data from esp module to blynk app.
created 28 Mar 2019
modified 28 Mar 2019
by Vettri vel Mahendran
*/
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "********"; //Authentication token
char ssid[] = "********"; //Service Set IDentifier i.e, wifi name
char pass[] = "*******"; //wifi password
void setup()
{
Serial.begin(9600); //baud rate
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.0);
Serial.println(voltage);
Blynk.virtualWrite(V0,voltage);
}
|
5425314f35378bc73f2f75abb53ef7c9c0fdc726
|
c9757e5235bb28b3fb744661c268d72b7778c2ca
|
/src/main.cpp
|
8735e229f7e3c0a9ab6f98f7b4394f2bd29c13a8
|
[] |
no_license
|
PorkShoulderHolder/control
|
44ce0a1d3cb37d4f1135e4c110c370adb71ee594
|
a48de21711bedb21fed88a59a451ca300d2e0ce1
|
refs/heads/master
| 2021-01-11T12:35:43.850828
| 2017-11-28T06:46:24
| 2017-11-28T06:46:24
| 76,264,589
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 10,826
|
cpp
|
main.cpp
|
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/aruco.hpp>
#include <string>
#include "ui.h"
#include "camera_calibration.h"
#include "network_manager.h"
#include "bot.h"
#include "state.h"
#include <iostream>
#include <stdexcept>
#include <stdio.h>
#include <string>
#include <map>
#include <cstdlib>
#include <csignal>
#include "argparse.hpp"
#include "behaviors.h"
#include <cstdio>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>
#include <array>
#define DEBUG false
#define CONTROL 0
#define WATCH 1
#define PREDATOR_PREY 2
#define FOLLOW 3
#define RIGHT_ARROW_KEY 63235
#define LEFT_ARROW_KEY 63234
#define TOP_ARROW_KEY 63232
#define BOT_PREFIX "goodvibes"
using namespace cv;
using namespace std;
std::string exec(const char* cmd) {
char buffer[128];
std::string result = "";
FILE* pipe = popen(cmd, "r");
if (!pipe) throw std::runtime_error("popen() failed!");
try {
while (!feof(pipe)) {
if (fgets(buffer, 8, pipe) != NULL )
result += buffer;
}
} catch (...) {
pclose(pipe);
throw;
}
pclose(pipe);
return result;
}
void exiting(int i){
State *S = State::shared_instance();
for( Bot *b : S->devices ){
std::vector<MOTOR> off;
off.push_back(M_RIGHT_OFF);
off.push_back(M_LEFT_OFF);
b->apply_motor_commands(off);
delete b;
}
NetworkManager *manager = new NetworkManager();
std::string msg = "{\"completed\":1}";
char buffer[1024];
std::string brain_host = "127.0.0.1";
manager->send_tcp((char*)brain_host.c_str(), (char*)msg.c_str(), 9999, buffer);
std::cout << "\n --- bye :^) --- \n" << std::endl;
std::exit(0);
}
void handle_event(int key){
State *S = State::shared_instance();
Bot *bot;
if(S->devices.size() > 0) {
bot = S->devices.back();
bot->training = true;
}else {
return;
}
switch(key) {
case RIGHT_ARROW_KEY:{
if (bot->command_queue.size() == 0) {
std::vector<MOTOR> c = motor_instructions(C_LEFT_OFF_RIGHT_ON);
bot->command_queue.push_front(c);
bot->command_queue.push_front(c);
}
else if (bot->command_queue.size() >= 2){
bot->command_queue[0][1] = M_RIGHT_ON;
bot->command_queue[1][1] = M_RIGHT_ON;
}
else{
bot->command_queue[0][1] = M_RIGHT_ON;
}
break;
}
case LEFT_ARROW_KEY:{
if (bot->command_queue.size() == 0) {
std::vector<MOTOR> c = motor_instructions(C_LEFT_ON_RIGHT_OFF);
bot->command_queue.push_front(c);
bot->command_queue.push_front(c);
}
else if (bot->command_queue.size() >= 2){
bot->command_queue[0][0] = M_LEFT_ON;
bot->command_queue[1][0] = M_LEFT_ON;
}
else{
bot->command_queue[0][0] = M_LEFT_ON;
}
break;
}
case TOP_ARROW_KEY:{
std::vector<MOTOR> c = motor_instructions(C_BOTH_ON);
if (bot->command_queue.size() == 0) {
bot->command_queue.push_front(c);
bot->command_queue.push_front(c);
}
else if (bot->command_queue.size() >= 2){
bot->command_queue[0] = c;
bot->command_queue[1] = c;
}
else{
bot->command_queue[0] = c;
}
break;
}
default:
break;
}
}
void generate_markers(int count){
cv::Mat markerImage;
cv::Ptr<cv::aruco::Dictionary> dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_4X4_1000);
int i;
const int width = (int)sqrt(count);
cv::Mat display_image = cv::Mat::ones((count / 5) * 150 + 20, 760, CV_32F);
int buffer = 10;
for(i = 0 ;i < count; i++ ){
cv::aruco::drawMarker(dictionary, i, 100, markerImage, 1);
int x = (i % 5) * 150 + 10;
int y = (int)(i / 5) * 150 + 20;
std::string s = std::to_string(i);
cv::Point p;
p.x = x + 22;
p.y = y + 3;
cv::Rect r = cv::Rect(x + 20, y + 20, 100, 100);
markerImage.copyTo(display_image(r));
cv::putText(display_image, s, p, 1, 1, cv::Scalar(0, 0, 0), 1);
}
cv::imshow("d", display_image);
}
void init_application(){
cv::namedWindow(MAIN_WINDOW, cv::WINDOW_NORMAL);
cv::namedWindow(INFO_WINDOW, cv::WINDOW_NORMAL);
}
std::string update_fps(int i){
static std::string fps_str;
int sample_pd = 80;
static time_t start;
static time_t finish;
if (i == 1){
time(&start);
}
if(i % sample_pd == 0){
time(&finish);
double seconds = difftime (finish, start);
double fps = sample_pd / seconds;
fps_str = std::string(to_string(fps)) + " fps";
time(&start);
}
return fps_str;
}
void main_loop(int device_index, int main_mode, int sub_mode){
cv::Point text_loc(20, 20);
cv::Mat current_image;
int i = 1;
std::string fps_str = "0 fps";
cv::VideoCapture input_stream(device_index);
if (!input_stream.isOpened()) {
std::cout << "Unable to read stream from specified device." << std::endl;
return;
}
init_application();
State *S = State::shared_instance(); // first init
switch (sub_mode){
case FOLLOW:
S->behavior = new FollowTheLeader();
S->behavior->bots = S->devices;
case PREDATOR_PREY:
// S->behavior = new PredatorPrey();
S->behavior->bots = S->devices;
}
Window window;
/* event loop */
while(1){
S = State::shared_instance();
input_stream >> current_image;
if(i > 100){
float ratio = (float)current_image.rows / (float)current_image.cols;
cv::Mat local;
cv::resize(current_image,local, cv::Size((int)(45.0f / ratio), 45));
cv::cvtColor(local, local, CV_RGB2GRAY);
local.convertTo( S->info_image, CV_32FC1);
cv::GaussianBlur( local, local,Size(3,3), 0, 0, BORDER_DEFAULT );
cv::Laplacian( local, local, CV_8U, 3, 1, 0, BORDER_DEFAULT );
cv::threshold(local, local, 15.0f, 255, CV_THRESH_BINARY);
cv::accumulateWeighted(local, S->info_image, 0.01);
// cv::threshold(S->info_image, S->info_image, 15.0f, 255, CV_THRESH_BINARY);
//
// Mat erode_element = getStructuringElement( MORPH_ELLIPSE,
// Size( 2, 2 ));
//
// Mat dilate_element = getStructuringElement( MORPH_ELLIPSE,
// Size( 6, 6 ));
// cv::erode(S->info_image, S->info_image, erode_element);
// cv::dilate(S->info_image, S->info_image, dilate_element);
//
//
//
//
cv::resize(S->info_image, S->info_image, cv::Size((int)(200.0f / ratio), 200) ,0,0, INTER_NEAREST);
cv::imshow(INFO_WINDOW, S->info_image);
}
if(main_mode == CONTROL){
S->update(current_image);
}
else if(main_mode == WATCH) {
int k1 = waitKey(5);
int k2 = waitKey(5);
if (k1 >= 0)
handle_event(k1);
if (k2 != k1 && k2 >= 0)
handle_event(k2);
if ((k1 >= 0 || k2 >= 0) && S->devices.size() > 0) {
std::vector<MOTOR> c = motor_instructions(C_BOTH_OFF);
S->devices.back()->command_queue.push_back(c);
S->devices.back()->command_queue.push_back(c);
}
S->update(current_image);
}
cv::Mat final_draw;
cv::resize(S->display_image, final_draw, Size(612, 384));
fps_str = update_fps(i);
cv::putText(final_draw, fps_str, text_loc, 1, 1, cv::Scalar(155, 155, 0), 1);
cv::imshow(MAIN_WINDOW, final_draw);
if(i == -1) break;
i++;
}
}
void test_network(){
auto *manager = new NetworkManager();
manager->send_udp((char *) "goodvibes1067796.local", (char *) "r:::1", 8888);
}
#ifdef __linux__
std::string exec_cmd(const char* cmd) {
std::array<char, 128> buffer;
std::string result;
std::shared_ptr<FILE> pipe(popen(cmd, "r"), pclose);
if (!pipe) throw std::runtime_error("popen() failed!");
while (!feof(pipe.get())) {
if (fgets(buffer.data(), 128, pipe.get()) != nullptr){
result += buffer.data();
}
}
return result;
}
#endif
int main(int argc, const char** argv )
{
std::map<std::string, int> config;
config["follow"] = FOLLOW;
config["hunt"] = PREDATOR_PREY;
ArgumentParser parser;
parser.addArgument("-r", "--run", '*');
// parser.addArgument("-w", "--watch");
// parser.addArgument("-c", "--camera");
parser.parse((size_t)argc, argv);
std::signal(SIGINT, exiting);
srand (static_cast <unsigned> (time(0)));
if (parser.exists("generate-markers")) {
int count = 50;
if (argc > 2) {
count = atoi(argv[2]);
}
generate_markers(count);
}
else if(strcmp(argv[1], "calibrate_camera") == 0){
calibrate_camera_main(argc, argv);
}
else{
#ifdef __APPLE__
system("gtimeout 2 ./mdns-mod -B");
#elif __linux__
std::string out = exec_cmd("timeout 2 mdns-scan");
std::cout << out << std::endl;
std::cout << "dddddddd" << std::endl;
std::stringstream iss(out);
for (std::string line; std::getline(iss, line); )
{
unsigned long loc = line.find(BOT_PREFIX);
if(loc != std::string::npos){
unsigned long i = line.find(".");
std::string device_name = line.substr(0, i);
FILE *f = fopen("domains.txt", "a");
fprintf(f, "%s.local\n", device_name);
fclose(f);
}
}
#endif
int device_index = 0;
if(parser.exists("camera")){
device_index = parser.retrieve<int>("camera");
}
if(parser.exists("run")){
int sub_mode = 0;
vector<string> arg = parser.retrieve<vector<string>>("run");
std::string a = arg[0];
if(config.count(a) > 0){
sub_mode = config[a];
}
else{
std::cout << "unrecognized arg '" + a + "'" << std::endl;
}
main_loop(device_index, CONTROL, sub_mode);
}
else if(parser.exists("watch")) {
main_loop(device_index, WATCH, 0);
}
}
return 0;
}
|
c8428e13dd9aa0c071c04d949bc218e5b3024acd
|
54cb5df6aeba8800887785cfb2ef88e847a6c1a1
|
/code/sates/tc/tc_result.h
|
87e00ba96fc83b533ad33b97b8610737a7159c94
|
[
"BSD-3-Clause"
] |
permissive
|
seokhwan/sates_cpp
|
6b3eb254f095e03f08c2a8b4254fb6351c78606d
|
8028c7490298d91a85e813118e9deb3c57ad4252
|
refs/heads/master
| 2021-08-18T02:49:09.918880
| 2021-01-08T04:36:50
| 2021-01-08T04:36:50
| 240,502,578
| 1
| 0
| null | 2020-02-15T12:15:34
| 2020-02-14T12:24:02
|
C++
|
UTF-8
|
C++
| false
| false
| 1,323
|
h
|
tc_result.h
|
//------------------------------------------------------------------------------
// Copyright (C) 2018 - Present, Seokhwan Kim (kim at seokhwan.net)
// This file is part of "the SATES"
// For conditions of distribution and use, see copyright notice in
// sates/sates.h
//------------------------------------------------------------------------------
#ifndef __SATES_TC_RESULT_H__
#define __SATES_TC_RESULT_H__
#include <sates/define.h>
#include <vector>
#include <string>
#include <chrono>
namespace sates
{
namespace tc
{
enum class TEST_RESULT
{
INVALID = 1,
OK = 20180417,
NG = 0,
};
class SATES_EXPORT tc_result
{
public:
tc_result(const char* test_name);
tc_result(const std::string& test_name);
~tc_result();
void mark_tc_started();
void mark_tc_completed();
void add_failure(const char* p_failure_msg);
void add_failure(const std::string& failure_msg);
std::string get_time_stamp() const;
float get_taken_time_ms() const;
uint32_t failures;
uint32_t disabled;
uint32_t errors;
std::string test_case_name;
std::string test_ok_ng;
std::vector<std::string> failure_log;
protected:
void init();
protected:
std::chrono::system_clock::time_point time_begin;
std::chrono::system_clock::time_point time_end;
};
}
}
#endif // __SATES_TC_RESULT_H__
|
be4d4f14b7c345f9b7a77756e714637d31cba09c
|
e8dd649814ff7d583dec752a957f01ccaf4d156d
|
/TouchEventArgs.h
|
038ebed771ccf727754b9aafb56f892fa3e96b19
|
[] |
no_license
|
wisemin01/201907SkillContest
|
bd915a52514a30be6e64e4766139a7cf6aa112ac
|
d3bcf3194d5c4461ab29dddde87b9b8521b21214
|
refs/heads/master
| 2020-06-21T05:31:55.946941
| 2019-07-26T07:07:32
| 2019-07-26T07:07:32
| 197,354,775
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 214
|
h
|
TouchEventArgs.h
|
#pragma once
#include "EventArgs.h"
class TouchEventArgs : EventArgs
{
public:
Vector2 MousePosition = Vector2::Zero;
bool isEndProcess = false;
TouchEventArgs(Vector2 pos)
: MousePosition(pos)
{
}
};
|
64c53eb6192cd4e9dc43f5d35f7df5a02b7c9521
|
41f4079b9584f91b431ffaabbefe172b121f6b4f
|
/include/World.h
|
4e2daf06c180d3cec78bcbbdb385ea5579020ec6
|
[
"MIT"
] |
permissive
|
recursivefaults/mustached-wight
|
f3dc9de242b7a8dbb8a11122f7164564c0c3f208
|
4d2e397aeb393e9776d27e03b7786b96663bdd90
|
refs/heads/master
| 2021-01-17T15:17:37.887865
| 2014-09-04T00:34:17
| 2014-09-04T00:34:17
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 334
|
h
|
World.h
|
#ifndef WORLD_H
#define WORLD_H
#include <map>
#include "Entity.h"
#include "Map.h"
#include "Components.h"
#include "SpriteManager.h"
class World
{
public:
std::map<int, Entity *> entities;
std::vector<AABB *> debugBoxes;
Map *map;
SpriteManager manager;
protected:
private:
};
#endif
|
407142b06a8bdf30b87903d3220d512c542c35a0
|
22bd625b1a2ffc102761914469c9673f62cf8e78
|
/benchmarks/src/cuda/shoc-master/src/common/StencilUtil.cpp
|
a69b8378148bf8701f348614059d34870c0e727e
|
[
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
purdue-aalp/gpgpu-sim_simulations
|
f1c32ac5a88c4120d326d1053c82e598ca2d05fe
|
84113a92a4aacfdd1ddbc1beb2f01746060dfb05
|
refs/heads/master
| 2021-08-05T21:56:58.378115
| 2021-01-28T23:31:26
| 2021-01-28T23:31:26
| 154,350,995
| 6
| 15
|
BSD-2-Clause
| 2021-05-18T15:28:08
| 2018-10-23T15:18:42
|
HTML
|
UTF-8
|
C++
| false
| false
| 792
|
cpp
|
StencilUtil.cpp
|
#include "StencilUtil.h"
template<class T>
void
StencilValidater<T>::PrintValidationErrors( std::ostream& s,
const std::vector<ValidationErrorInfo<T> >& validationErrors,
unsigned int nValErrsToPrint ) const
{
unsigned int nErrorsPrinted = 0;
for( typename std::vector<ValidationErrorInfo<T> >::const_iterator iter = validationErrors.begin();
iter != validationErrors.end();
iter++ )
{
if( nErrorsPrinted <= nValErrsToPrint )
{
s << "out[" << iter->i
<< "][" << iter->j
<< "]=" << iter->val
<< ", expected " << iter->exp
<< ", relErr " << iter->relErr
<< '\n';
}
nErrorsPrinted++;
}
}
|
94d3a132f8b6a94863ab7e21854c242c773bfc99
|
4a1b388fc7254e7f8fa2b72df9d61999bf7df341
|
/ThirdParty/ros/include/tf2_msgs/msg/detail/tf2_error__builder.hpp
|
a4c3ca0662d25419f1a954bf8cd68c95c5e175f5
|
[
"Apache-2.0"
] |
permissive
|
rapyuta-robotics/rclUE
|
a2055cf772d7ca4d7c36e991ee9c8920e0475fd2
|
7613773cd4c1226957603d705d68a2d2b4a69166
|
refs/heads/devel
| 2023-08-19T04:06:31.306109
| 2023-07-24T15:23:29
| 2023-07-24T15:23:29
| 334,819,367
| 75
| 17
|
Apache-2.0
| 2023-09-06T02:34:56
| 2021-02-01T03:29:17
|
C++
|
UTF-8
|
C++
| false
| false
| 1,473
|
hpp
|
tf2_error__builder.hpp
|
// generated from rosidl_generator_cpp/resource/idl__builder.hpp.em
// with input from tf2_msgs:msg/TF2Error.idl
// generated code does not contain a copyright notice
#ifndef TF2_MSGS__MSG__DETAIL__TF2_ERROR__BUILDER_HPP_
#define TF2_MSGS__MSG__DETAIL__TF2_ERROR__BUILDER_HPP_
#include "tf2_msgs/msg/detail/tf2_error__struct.hpp"
#include <rosidl_runtime_cpp/message_initialization.hpp>
#include <algorithm>
#include <utility>
namespace tf2_msgs
{
namespace msg
{
namespace builder
{
class Init_TF2Error_error_string
{
public:
explicit Init_TF2Error_error_string(::tf2_msgs::msg::TF2Error & msg)
: msg_(msg)
{}
::tf2_msgs::msg::TF2Error error_string(::tf2_msgs::msg::TF2Error::_error_string_type arg)
{
msg_.error_string = std::move(arg);
return std::move(msg_);
}
private:
::tf2_msgs::msg::TF2Error msg_;
};
class Init_TF2Error_error
{
public:
Init_TF2Error_error()
: msg_(::rosidl_runtime_cpp::MessageInitialization::SKIP)
{}
Init_TF2Error_error_string error(::tf2_msgs::msg::TF2Error::_error_type arg)
{
msg_.error = std::move(arg);
return Init_TF2Error_error_string(msg_);
}
private:
::tf2_msgs::msg::TF2Error msg_;
};
} // namespace builder
} // namespace msg
template<typename MessageType>
auto build();
template<>
inline
auto build<::tf2_msgs::msg::TF2Error>()
{
return tf2_msgs::msg::builder::Init_TF2Error_error();
}
} // namespace tf2_msgs
#endif // TF2_MSGS__MSG__DETAIL__TF2_ERROR__BUILDER_HPP_
|
c818f2cc56868c40a70063e035ea0da4e7770fc9
|
dead9ba62a993f66dcfad13552a0b684f9342d9d
|
/src/util/game.h
|
4f21f0e506272518c5078c39a6071a1c4d0add2e
|
[] |
no_license
|
timostrating/PokeWorld
|
32682cff9a54c6cf424c52d6f8622afb54fc1eca
|
4c00c3dba9b875ff9ffb5c9920742f09735ada00
|
refs/heads/master
| 2021-06-24T15:51:29.497785
| 2021-01-16T21:03:47
| 2021-01-16T21:03:47
| 192,098,963
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 200
|
h
|
game.h
|
//
// Created by sneeuwpop on 16-6-19.
//
#pragma once
#include <GLFW/glfw3.h>
#include "interfaces/screen.h"
namespace GAME
{
bool init();
void run();
void setScreen(Screen *screen);
}
|
c9ed07a20f3539cde332e54f82ddb4e661119ff0
|
6dcaf7fb1be6064049f0c6531e153e7d4139cfbb
|
/src/vocab.h
|
7671e7325033530fccb702650c6c035ba8e927b7
|
[] |
no_license
|
unixnme/fast_corpus
|
c912772b944236fb04efd94ee0907dbbcbd31081
|
82c92931f73cd2403f961f00c74a1eaf4c285b6f
|
refs/heads/master
| 2020-05-24T20:15:21.553978
| 2019-06-19T04:14:45
| 2019-06-19T04:14:45
| 187,451,582
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 406
|
h
|
vocab.h
|
//
// Created by Young Mo Kang on 2019-05-18.
//
#ifndef FAST_CORPUS_VOCAB_H
#define FAST_CORPUS_VOCAB_H
#include <string>
#include <unordered_map>
#include <vector>
#include "dictionary.h"
class Vocabulary {
public:
explicit Vocabulary(const std::string &corpus_file);
private:
std::string corpus_file;
std::unordered_map<std::string, size_t> vocab_count;
};
#endif //FAST_CORPUS_VOCAB_H
|
24412d28024e516e3e08c1e54310108f0e21bf36
|
c96044805d7e30806696ecb482582c25d290f114
|
/src/dota/entity/CTEDecal.h
|
7132d4f42be3bf9b2bda6094b2ab22f411fbdf19
|
[] |
no_license
|
exjam/dota2-replay-cpp
|
f49fbbac2b2d29da22d236a1e8469f2477a8d494
|
a0c445d4b591e354395eb662281445bb5bbb01c9
|
refs/heads/master
| 2021-03-12T21:22:25.915447
| 2015-02-12T23:39:22
| 2015-02-12T23:39:22
| 28,197,953
| 2
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 345
|
h
|
CTEDecal.h
|
#pragma once
#include <cstdint>
#include "clientclass.h"
#include "vector3f.h"
#include "CBaseTempEntity.h"
namespace dota
{
struct CTEDecal : public CBaseTempEntity
{
Vector3f m_vecOrigin;
Vector3f m_vecStart;
uint32_t m_nEntity;
uint32_t m_nHitbox;
uint32_t m_nIndex;
};
DeclareClientClass(CTEDecal);
}
|
9aaba4706172089245a67f5593bf8e3113ab8f2e
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/webrtc/net/dcsctp/packet/chunk/shutdown_complete_chunk_test.cc
|
253900d5cd10fb8f779598809fbaacb0ad47b004
|
[
"BSD-3-Clause",
"LicenseRef-scancode-google-patent-license-webrtc",
"LicenseRef-scancode-google-patent-license-webm",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C++
| false
| false
| 1,179
|
cc
|
shutdown_complete_chunk_test.cc
|
/*
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "net/dcsctp/packet/chunk/shutdown_complete_chunk.h"
#include <stdint.h>
#include <vector>
#include "rtc_base/gunit.h"
#include "test/gmock.h"
namespace dcsctp {
namespace {
TEST(ShutdownCompleteChunkTest, FromCapture) {
/*
SHUTDOWN_COMPLETE chunk
Chunk type: SHUTDOWN_COMPLETE (14)
Chunk flags: 0x00
Chunk length: 4
*/
uint8_t data[] = {0x0e, 0x00, 0x00, 0x04};
EXPECT_TRUE(ShutdownCompleteChunk::Parse(data).has_value());
}
TEST(ShutdownCompleteChunkTest, SerializeAndDeserialize) {
ShutdownCompleteChunk chunk(/*tag_reflected=*/false);
std::vector<uint8_t> serialized;
chunk.SerializeTo(serialized);
EXPECT_TRUE(ShutdownCompleteChunk::Parse(serialized).has_value());
}
} // namespace
} // namespace dcsctp
|
d5e949052b7365d26f49adfdb0e99be53284432e
|
2ede2d49cebb7b85ec30b5765f3e430a50d8f221
|
/mpi/mpi_myrank.cpp
|
bcb7afd52cbe32ff8c75634a33524413a60fe962
|
[] |
no_license
|
imogenproject/gpuImogen
|
6b291b867743315185ebafd191f51160fa5abe7f
|
8dee8ef289725e79af760d2ead429267c4d0e79b
|
refs/heads/master
| 2021-04-19T00:21:38.558687
| 2020-12-18T23:58:41
| 2020-12-18T23:58:41
| 2,936,929
| 5
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 462
|
cpp
|
mpi_myrank.cpp
|
#include "stdio.h"
#include "mpi.h"
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
if((nlhs != 1 ) || (nrhs != 0)) { mexErrMsgTxt("int32 N = mpi_myrank();"); }
int bee;
MPI_Comm_rank(MPI_COMM_WORLD, &bee);
mwSize dims[2]; dims[0] = 1; dims[1] = 1;
plhs[0] = mxCreateNumericArray(2, dims, mxINT32_CLASS, mxREAL);
int *d = (int *)mxGetData(plhs[0]);
d[0] = bee;
}
|
b68a6d1891e8ef6d2df35127f69e6fcfcf6dcc9b
|
6fb3b99f6c45870a2f888e5f147bedc53410412f
|
/src/MonaLisa.cpp
|
1e5915762eb0672ce60b88812624df9ff85a60b9
|
[] |
no_license
|
VienVan/MonaLisa
|
7fa445c8337da505ded89356ee0ed80879aab42a
|
0a8fe8817b44565e579247e98d2a79c54589b303
|
refs/heads/master
| 2021-01-17T20:59:20.730680
| 2017-03-28T06:41:06
| 2017-03-28T06:41:06
| 84,154,962
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 352
|
cpp
|
MonaLisa.cpp
|
//#define _CRT_SECURE_NO_WARNINGS
//
//#include <iostream>
//#include "ControlModule.h"
//using namespace std;
//
//
//int main() {
// cout << "CIS 22C\nFinal Project\nTeam #6\nMembers:" << endl;
// cout << "\tYun Cao, Vincent Ha, Jimmy Nguyen, Kota Iwamoto, Vien Van\n";
//
//
// ControlModule runner;
// runner.userInteraction();
//
// return 0;
//}
|
eb03bb79530bbbca56346f7b35228cd51dacc84c
|
3437fb257545a0bf6d25a76ada6047f7c4686865
|
/NewCoder/6.cpp
|
35e53a533de6e4a1167fd79fc33a25019c8f64fb
|
[] |
no_license
|
whing123/C-Coding
|
62d1db79d6e6c211c7032ca91f466ffda4048ad9
|
3edfbad82acd5667eb0134cb3de787555f9714d8
|
refs/heads/master
| 2021-01-23T01:26:17.228602
| 2019-10-03T16:21:43
| 2019-10-03T16:21:43
| 102,434,473
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,480
|
cpp
|
6.cpp
|
/* *题目:
* 字符串最后一个单词的长度
* *思路:
*
*/
#include<iostream>
#include<string>
using namespace std;
string split(string &str)
{
string::size_type pos, pre = 0;
int size=str.size();
for(int i=0; i<size; i++)
{
pos = str.find(' ',i);
if(pos != string::npos)
{
while(str[pos+1] == ' '){ //跳过多个空格
pos++;
}
i = pos + 1; //最后一个空格的下一个字符位置
pre = i;
}else{
break;
}
}
string res = str.substr(pre,string::npos); //截取最后一个单词
return res;
}
int main(){
string in;
getline(cin,in); //输入整行
int size = in.size();
int i = size-1;
while(in[i] == ' '){ //剔除末尾空格
in.erase(i,1);
i--;
}
cout<<split(in).size();
return 0;
}
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
while(getline(cin,s)){
int n=0, flag=1;
for(int i = s.length()-1; i >= 0; --i){//倒着计算
if(flag && s[i]==' '){//如果末尾有空格,先清除末尾空格
continue;
}
else if(s[i] != ' '){
flag = 0;
++n;
}
else{
break;
}
}
cout << n << endl;
}
return 0;
}
|
629dedb134f3339345362cd84566ea03c94c50cf
|
d76ab9fddaf7b18f697f18cd7c664ddf271e2c27
|
/async/main.cpp
|
0e886a644cdbcec8aa28699e9dd388269da9a5b4
|
[] |
no_license
|
pgplus1628/mpi-hack
|
49f81044f80e3c6a076d1a9a06e91e64f1e9072d
|
8ec61e0396325fb224e30d1d3df2192651df4241
|
refs/heads/master
| 2021-05-29T20:09:05.463866
| 2015-11-06T14:49:18
| 2015-11-06T14:49:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,502
|
cpp
|
main.cpp
|
#include "mpi.h"
#include <iostream>
#include <vector>
#include <glog/logging.h>
#include <gflags/gflags.h>
#include <functional>
#include <unistd.h>
#include "basic_types.hpp"
#include "dvec.hpp"
#include "dc.hpp"
DEFINE_int32(bytes_mb, 32, " send recv bytes to each machine in mb.");
DEFINE_int32(sleep_ms, 0, " sleep in ms to simulate complex operations.");
DEFINE_bool(ring, true, " Ring communication ." );
class Bench {
struct Atype {
int x;
int y;
Atype () {}
Atype (int _x, int _y) : x(_x), y(_y) {}
};
typedef struct Atype Atype;
void data_op(Atype & a) {
a.x += 1;
a.y += 1;
}
public :
size_t bbytes; /* bench bytes */
size_t num_ele;
DistVec<Atype> *send_dvec;
DistVec<Atype> *recv_dvec;
DistControl *dc;
void init_bbytes()
{
size_t ele_size = sizeof(Atype);
size_t tot_bytes = FLAGS_bytes_mb * (1024 * 1024);
num_ele = tot_bytes / ele_size;
bbytes = num_ele * ele_size;
}
void init()
{
init_bbytes();
/* init dvec */
std::vector<size_t> part_eles(dc->num_rank);
std::for_each(part_eles.begin(), part_eles.end(),
[this](size_t &x){x = num_ele;});
send_dvec = new DistVec<Atype>(*dc, part_eles, ROLE_ACT);
send_dvec->init();
recv_dvec = new DistVec<Atype>(*dc, part_eles, ROLE_PAS);
recv_dvec->init();
LOG(INFO) << "Bench init ok. bytes = " << bbytes << " num_ele = " << num_ele;
}
Bench(DistControl * _dc) : dc(_dc)
{
}
void execute_chunk(std::vector<Atype> & vec, Range range)
{
for (size_t it = range.first; it < range.second; it ++) {
data_op(vec[it]);
}
if ( unlikely(FLAGS_sleep_ms != 0) ) {
usleep((uint32_t)FLAGS_sleep_ms * 1000);
}
}
void do_bench()
{
LOG(INFO) << dc->rank << " Bech Begin .";
dc->barrier();
/* post receives */
recv_dvec->post_receives();
int num_chan = dc->num_rank;
/* do work and chunk send */
for(int chan_cnt = 0; chan_cnt < num_chan; chan_cnt ++) {
int chan_id;
if (FLAGS_ring) {
chan_id = ( dc->rank + chan_cnt) % num_chan;
} else {
chan_id = chan_cnt;
}
/* get chunk and do work and send chunk */
auto &chunk_range = *(send_dvec->chunk_ranges[chan_id]);
auto &vec = *(send_dvec->loc_data[chan_id]);
for(size_t chunk_id = 0; chunk_id < chunk_range.size(); chunk_id ++) {
auto range = chunk_range[chunk_id];
/* work chunk */
execute_chunk(vec, range);
/* transfer chunk */
send_dvec->do_asend(chan_id, chunk_id);
}
}
LOG(INFO) << " Send OK.-------------";
/* receive chunk */
int chan_id ;
size_t chunk_id;
while (recv_dvec->wait_any(&chan_id, &chunk_id)) {
//LOG(INFO) << dc->rank << " -> " << chan_id << " chunk " << chunk_id;
}
/* wait finish */
send_dvec->wait_all();
/* report perf */
LOG(INFO) << dc->rank << " METRICS::" << send_dvec->get_metrics("send_dvec");
LOG(INFO) << dc->rank << " METRICS::" << recv_dvec->get_metrics("recv_dvec");
}
};
int main(int argc, char ** argv)
{
google::ParseCommandLineFlags(&argc, &argv, false);
google::InitGoogleLogging(argv[0]);
LOG(INFO) << " Bench async operation performance .";
LOG(INFO) << " bytes_mb : " << FLAGS_bytes_mb << " tbuf_mb : " << FLAGS_tbuf_mb
<< " sleep_ms : " << FLAGS_sleep_ms;
DistControl dc;
dc.init(argc, argv);
Bench bench(&dc);
bench.init();
bench.do_bench();
return 0;
}
|
ed9c6cc225814e601da8edc595f82356977565d4
|
40e036ff56b121a6879b6f801064a9e452f27bea
|
/ConsoleApplication2.cpp
|
6d4a542941f85944d2a252b644133edb1c11b2ea
|
[] |
no_license
|
xiangbaobaojojo/WC
|
442fdfae1bc9d473ca3810c34478cfceabe278ca
|
62889c667e0db5f024af9218498e88460527f51a
|
refs/heads/master
| 2021-07-02T13:52:22.338489
| 2017-09-20T01:29:24
| 2017-09-20T01:29:24
| 104,094,628
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 3,125
|
cpp
|
ConsoleApplication2.cpp
|
#include<stdio.h>
#include<stdlib.h>
#include "stdafx.h"
#include "malloc.h"
#include "windows.h"
#include "string.h"
#define MAX 30
typedef struct node
{
char s[30];
struct node* next;
int count;
}node, *List;
int FindInDict(node **dict, char *s);
void InsertToDict(node **dict, char *s);
void FindTop(node *dict, List top[], int n);
int main()
{
FILE *fp;
char ch;
char word[30];
int len = 0;
int c_ch = 0;
int c_line = 0;
int c_word = 0;
node *dict = (node *)calloc(26, sizeof(node)); //定义动态数组,存放的是相应单词的头结点
node *top[10] = { 0 }; //存放排名前十的单词的指针(内存地址)
int i = 0;
if ((fopen_s(&fp,"F:\\软件工程\\ConsoleApplication2\\count.txt","r")) !=0)
{
printf_s("不能打开文件\n");
getchar();
exit(1);
}
fseek(fp, 0, SEEK_SET);
while ((ch = fgetc(fp)) != EOF)
//注意这里必须(ch=fgetc(fp)),因为!=优先级高,先算!=结果为1,不加()结果ch=1
{
c_ch++;
len = 0;
while (ch >= 'a'&&ch <= 'z')
{
word[len++] = ch;
ch = fgetc(fp);
c_ch++;
}
if (len != 0)
{
word[len] = '\0';
c_word++;
if (FindInDict(&dict, word) == 0)
InsertToDict(&dict, word);
}
if (ch == '\n')
c_line++;
}
printf_s("the number of character is:%d\n", c_ch);
printf_s("the number of line is:%d\n", c_line + 1);
printf_s("the number of word is:%d\n", c_word);
FindTop(dict, top, 10);
for (i = 0; i != 10; ++i)
{
if (top[i] != 0)
printf_s("the top %2d word is %-10s, %d\n", i + 1, top[i]->s, top[i]->count);
}
fclose(fp);
return 0;
}
int FindInDict(node **dict, char *s)
{
int index = (s[0] - 'a');
node *p = ((*dict) + index)->next;
while (p != NULL)
{
if (strcmp((p->s), s)<0)
p = p->next;
else
{
if (strcmp(p->s, s)>0)
return 0;
else
{
p->count++;
return 1;
}
}
}
return 0;
}
void InsertToDict(List *dict, char *s)
{
int index = (s[0] - 'a');
node *p = (*dict + index)->next;
node *word = (node *)malloc(sizeof(node));
word->count = 1;
strcpy_s(word->s, s);
word->next = NULL;
if (NULL == p)
{
(*dict + index)->next = word;
}
else
{
if (strcmp(s, p->s)<0)
{
word->next = p;
(*dict + index)->next = word;
return;
}
while (p->next != NULL)
{
if (strcmp(s, p->next->s)<0)
{
word->next = p->next;
p->next = word;
return;
}
else
p = p->next;
}
if (p->next != word)
p->next = word;
}
}
int cmp(const void *a, const void *b) //List数组中任意两个元素的地址
{
List *i = (List*)a;
List *j = (List*)b;
return ((*j)->count - (*i)->count);
}
void FindTop(List dict, List top[], int n)
{
node *p = dict;
node *q = p->next;
node *tmp[100000] = { 0 };
int i, index = 0;
while (p<dict + 26)
{
while (q != NULL)
{
tmp[index++] = q;
q = q->next;
}
p++;
q = p->next;
}
qsort(tmp, index, sizeof(List), cmp);//排序函数
for (i = 0; i<n; ++i)
top[i] = tmp[i];
}
|
0248e0f8484576d40d5ac4ad230d748a14da171a
|
9f16950a070174c4ad6419b6aa48e0b3fd34a09e
|
/users/marcel/grooop-thetribe/890-thetribe-video-landscape.cpp
|
9330ff460e93fdb1803d102506ffdf8c953b42fe
|
[] |
no_license
|
marcel303/framework
|
594043fad6a261ce2f8e862f921aee1192712612
|
9459898c280223b853bf16d6e382a6f7c573e10e
|
refs/heads/master
| 2023-05-14T02:30:51.063401
| 2023-05-07T07:57:12
| 2023-05-07T10:16:34
| 112,006,739
| 53
| 1
| null | 2020-01-13T18:48:32
| 2017-11-25T13:45:56
|
C++
|
UTF-8
|
C++
| false
| false
| 58,931
|
cpp
|
890-thetribe-video-landscape.cpp
|
#include "890-performance.h"
#include "audioGraph.h"
#include "graph_typeDefinitionLibrary.h"
#include "Noise.h"
#include "objects/audioSourceMix.h"
#include "objects/audioSourceVorbis.h"
#include "Path.h"
#include "Quat.h"
#include "soundVolume.h"
#include "textScroller.h"
#include "vectorLines.h"
#include "vfxGraph.h"
#include "vfxNodeBase.h"
#include "vfxNodes/vfxNodeDisplay.h"
#include "video.h"
#include <math.h>
#define NUM_AUDIOCLIP_SOURCES 16
#define NUM_VIDEOCLIPS 32
#define NUM_VFXCLIPS 0
#define NUM_SPOKENWORD_SOURCES 3
#define ENABLE_INTERACTIVITY 0
#define PARTICLE_SCALE (GFX_SX / 1024.f)
#define ENABLE_FACETILE_AUDIO 0
static const float timeSeed = 1234.f;
static const char * audioFilenames[NUM_AUDIOCLIP_SOURCES] =
{
"welcome/01 Welcome Intro alleeeen zang loop.ogg",
"welcome/02 Welcome Intro zonder zang loop.ogg",
"welcome/03 Welcome couplet 1 alleeen zang loop.ogg",
"welcome/04 Welcome couplet 1 zonder zang loop.ogg",
"welcome/05 Welcome couplet 2 alleen zang loop.ogg",
"welcome/06 Welcome couplet 2 zonder zang loop.ogg",
"welcome/07 Welcome refrein 1 alleen zang loop.ogg",
"welcome/08 Welcome refrein 1 zonder zang loop.ogg",
"welcome/09 Welcome brug alleeeen zang loop.ogg",
"welcome/10 Welcome brug zonder zang loop.ogg",
"welcome/11 Welcome 2e refrein alleeeen zang loop.ogg",
"welcome/12 Welcome 2e refrein zonder zang loop.ogg",
"welcome/13 Welcome Rap Gitaar lick loop.ogg",
"welcome/14 Welcome Rap Alles loop.ogg",
"welcome/15 Welcome Refrein 3 alleeen zang loop.ogg",
"welcome/16 Welcome Refrein 3 zonder zang loop.ogg"
};
std::vector<std::string> videoFilenames(
{
"0.640px.mp4",
"1.640px.mp4",
"2.640px.mp4",
});
static const char * spokenText[NUM_SPOKENWORD_SOURCES] =
{
"albert-tekst1.txt",
"albert-tekst2.txt",
"wiekspreekt.txt"
};
static const char * spokenAudio[NUM_SPOKENWORD_SOURCES] =
{
"albert-tekst1.ogg",
"albert-tekst2.ogg",
"wiekspreekt.ogg" // 8:49 ~= 530 seconds
};
std::vector<std::string> interviewFilenames(
{
"interviews/Albert-small.mp4",
"interviews/Daan-small.mp4",
"interviews/Jasmin-small.mp4",
"interviews/Jur-small.mp4",
"interviews/Lisa-small.mp4",
"interviews/Roos-small.mp4",
"interviews/Wiek-small.mp4"
});
//
static MediaPlayer * mediaPlayers = nullptr;
static VectorMemory vectorMemory;
static VectorParticleSystem vectorParticleSystem;
//
static void drawSoundVolume(const SoundVolume & volume)
{
gxPushMatrix();
{
gxMultMatrixf(volume.transform.m_v);
gxPushMatrix(); { gxTranslatef(-1, 0, 0); drawGrid3dLine(10, 10, 1, 2); } gxPopMatrix();
gxPushMatrix(); { gxTranslatef(+1, 0, 0); drawGrid3dLine(10, 10, 1, 2); } gxPopMatrix();
gxPushMatrix(); { gxTranslatef(0, -1, 0); drawGrid3dLine(10, 10, 2, 0); } gxPopMatrix();
gxPushMatrix(); { gxTranslatef(0, +1, 0); drawGrid3dLine(10, 10, 2, 0); } gxPopMatrix();
gxPushMatrix(); { gxTranslatef(0, 0, -1); drawGrid3dLine(10, 10, 0, 1); } gxPopMatrix();
gxPushMatrix(); { gxTranslatef(0, 0, +1); drawGrid3dLine(10, 10, 0, 1); } gxPopMatrix();
}
gxPopMatrix();
}
static bool intersectSoundVolume(const SoundVolume & soundVolume, Vec3Arg pos, Vec3Arg dir, Vec3 & p, float & t)
{
auto & soundToWorld = soundVolume.transform;
const Mat4x4 worldToSound = soundToWorld.CalcInv();
const Vec3 pos_sound = worldToSound.Mul4(pos);
const Vec3 dir_sound = worldToSound.Mul3(dir);
const float d = pos_sound[2];
const float dd = dir_sound[2];
t = - d / dd;
p = pos_sound + dir_sound * t;
return
p[0] >= -1.f && p[0] <= +1.f &&
p[1] >= -1.f && p[1] <= +1.f;
}
static double s_videoClipSpeedMultiplier = 1.0;
static float s_videoClipScale = 1.f;
static float s_videoClipVolume = 0.f;
static bool s_videoClipDrawGrid = true;
static Color s_videoClipGridColor(1.f, 1.f, 1.f, 1.f);
static Color s_videoClipGridColor2(1.f, 1.f, 1.f, 1.f);
static float s_videoAspect = 1.f;
static float s_videoScale = 1.f;
static float s_videoSpacing = 200.f;
static float s_videoDistance = 400.f;
static float s_videoNearDistance = 200.f;
static float s_videoAngleWobbleX = 0.f;
static float s_videoAngleWobbleY = 0.f;
static float s_videoSaturation = 1.f;
static float s_videoPerlinScale = 1.f;
static float s_videoPerlinThreshold = 0.f;
static float s_wobbleSpeedX = 1.f;
static float s_wobbleSpeedY = 1.f;
static float s_videoRetain = 0.f;
static float s_particlesLineOpacity = 0.f;
static float s_particlesCoronaOpacity = 0.f;
static Surface * s_videoMask = nullptr;
static Surface * s_circleMask = nullptr;
struct Videoclip
{
Mat4x4 transform;
#if ENABLE_WELCOME
#if USE_STREAMING
AudioSourceVorbis soundSource;
#else
AudioSourcePcm soundSource;
#endif
#else
AudioSourceMix soundSource;
#endif
SoundVolume soundVolume;
float gain;
int index;
bool hover;
bool isPaused;
bool isPlaying;
double time;
Videoclip()
: transform()
, soundSource()
, soundVolume()
, gain(0.f)
, index(-1)
, hover(false)
, isPaused(true)
, isPlaying(false)
, time(timeSeed)
{
}
void init(
const binaural::HRIRSampleSet * sampleSet,
binaural::Mutex * mutex,
const int _index, const char * audio, const char * video, const float _gain)
{
soundVolume.audioSource.init(sampleSet, mutex, &soundSource);
//
index = _index;
#if ENABLE_WELCOME
#if USE_STREAMING
soundSource.open(audio, true);
#else
const PcmData * pcmData = getPcmData(audio);
soundSource.init(pcmData, 0);
soundSource.play();
soundSource.loop = true;
#endif
#endif
gain = _gain;
}
void shut()
{
if (isPlaying)
{
g_audioMixer->removeVolumeSource(&soundVolume.audioSource);
isPlaying = false;
}
}
bool intersectRayWithPlane(Vec3Arg pos, Vec3Arg dir, Vec3 & p, float & t) const
{
return intersectSoundVolume(soundVolume, pos, dir, p, t);
}
void evalVideoClipParams(Vec3 & scale, Quat & rotation, Vec3 & position, float & opacity) const
{
const float moveSpeed = (1.f + index / float(NUM_VIDEOCLIPS)) * .1f;
const float moveAmount = 1.f;
const float x = sinf(moveSpeed * time / 15.678f) * moveAmount * .2f - index * 2.7f - 8.f;
const float y = sinf(moveSpeed * time / 13.456f) * moveAmount;
const float z = sinf(moveSpeed * time / 11.234f) * moveAmount;
const float scaleSpeed = 1.f + index / 5.f;
const float scaleY = lerp(.5f, 1.f, (cosf(scaleSpeed * time / 4.567f) + 1.f) / 2.f);
const float scaleX = scaleY * 4.f/3.f;
//const float scaleZ = lerp(.05f, .5f, (cosf(scaleSpeed * time / 8.765f) + 1.f) / 2.f);
const float scaleZ = lerp(.05f, .1f, (cosf(scaleSpeed * time / 8.765f) + 1.f) / 2.f);
const float rotateSpeed = 1.f + index / 10.f;
scale = Vec3(scaleX, scaleY, scaleZ);
rotation =
Quat(Vec3(0.f, 0.f, 1.f), rotateSpeed * time / 3.456f) *
Quat(Vec3(0.f, 1.f, 0.f), rotateSpeed * time / 4.567f);
position = Vec3(x, y, z);
opacity = 1.f;
}
void tick(const Mat4x4 & worldToViewMatrix, const Vec3 & cameraPosition_world, const float dt)
{
if (isPaused)
{
if (isPlaying)
{
g_audioMixer->removeVolumeSource(&soundVolume.audioSource);
isPlaying = false;
}
}
else
{
if (!isPlaying)
{
g_audioMixer->addVolumeSource(&soundVolume.audioSource);
isPlaying = true;
}
}
time += dt * s_videoClipSpeedMultiplier;
Vec3 scale;
Quat rotation;
Vec3 position;
float opacity;
evalVideoClipParams(scale, rotation, position, opacity);
scale *= s_videoClipScale;
transform = Mat4x4(true).
Translate(position).
Rotate(rotation).
Scale(scale);
// update sample locations for binauralization given the new transform
soundVolume.transform = transform;
const bool enableNearest = true;
const bool enableVertices = true;
soundVolume.generateSampleLocations(worldToViewMatrix, cameraPosition_world, enableNearest, enableVertices, gain);
}
void drawSolid()
{
gxPushMatrix();
{
gxMultMatrixf(soundVolume.transform.m_v);
const GxTextureId texture = mediaPlayers[index % videoFilenames.size()].getTexture();
const float perlin1 = scaled_octave_noise_1d(8, .5f, s_videoPerlinScale, 0.f, 1.f, index);
const float perlin2 = s_videoPerlinThreshold;
Shader shader("videoclip");
setShader(shader);
shader.setTexture("image", 0, texture, true, true);
shader.setTexture("mask", 1, (GxTextureId)s_videoMask->getTexture(), true, true);
shader.setImmediate("saturation", s_videoSaturation);
shader.setImmediate("perlin", perlin1, perlin2);
{
setLumi(hover ? 255 : 200);
drawRect(-1, -1, +1, +1);
}
clearShader();
}
gxPopMatrix();
}
void drawTranslucent()
{
if (s_videoClipDrawGrid)
{
setColor(s_videoClipGridColor2);
drawSoundVolume(soundVolume);
}
}
};
struct Vfxclip
{
SoundVolume soundVolume;
VfxGraph * vfxGraph;
bool hover;
Vfxclip()
: soundVolume()
, vfxGraph(nullptr)
, hover(false)
{
}
~Vfxclip()
{
delete vfxGraph;
vfxGraph = nullptr;
}
void open(const char * filename)
{
Graph_TypeDefinitionLibrary typeDefinitionLibrary;
createVfxTypeDefinitionLibrary(typeDefinitionLibrary);
Graph graph;
if (graph.load(filename, &typeDefinitionLibrary))
{
vfxGraph = constructVfxGraph(graph, &typeDefinitionLibrary);
}
}
bool intersectRayWithPlane(Vec3Arg pos, Vec3Arg dir, Vec3 & p, float & t) const
{
return intersectSoundVolume(soundVolume, pos, dir, p, t);
}
void tick(const float dt)
{
vfxGraph->tick(1024, 1024, dt);
vfxGraph->traverseDraw();
}
void drawSolid()
{
gxPushMatrix();
{
gxMultMatrixf(soundVolume.transform.m_v);
const VfxNodeDisplay * displayNode = vfxGraph->getMainDisplayNode();
const GxTextureId texture = displayNode ? displayNode->getImage()->getTexture() : 0;
gxSetTexture(texture, GX_SAMPLE_LINEAR, true);
{
setLumi(255);
drawRect(-1, -1, +1, +1);
}
gxClearTexture();
if (hover)
{
setLumi(255);
drawRectLine(-1, -1, +1, +1);
}
}
gxPopMatrix();
}
void drawTranslucent()
{
if (s_videoClipDrawGrid)
{
setColor(s_videoClipGridColor2);
drawSoundVolume(soundVolume);
}
}
};
struct SpokenWord
{
enum State
{
kState_Inactive,
kState_Active
};
TextScroller textScroller;
AudioSourceVorbis soundSource;
SoundVolume soundVolume;
Vec3 pos;
State state;
bool hover;
Color currentColor;
Color desiredColor;
float currentGain;
float desiredGain;
float currentScale;
float desiredScale;
float currentAngle;
float desiredAngle;
SpokenWord()
: textScroller()
, soundSource()
, soundVolume()
, state(kState_Inactive)
, hover(false)
, currentColor(50, 50, 50)
, desiredColor(50, 50, 50)
, currentGain(0.f)
, desiredGain(0.f)
, currentScale(0.f)
, desiredScale(.1f)
, currentAngle(0.f)
, desiredAngle(0.f)
{
}
void init(
const binaural::HRIRSampleSet * sampleSet,
binaural::Mutex * mutex,
const char * text,
const char * textFile, const char * audioFile,
Vec3Arg _pos)
{
if (text != nullptr)
textScroller.initFromText(text);
else
textScroller.initFromFile(textFile);
if (audioFile != nullptr)
{
soundSource.open(audioFile, false);
}
//g_audioMixer->addPointSource(&soundSource);
soundVolume.init(sampleSet, mutex, &soundSource);
g_audioMixer->addVolumeSource(&soundVolume.audioSource);
pos = _pos;
}
void shut()
{
g_audioMixer->removeVolumeSource(&soundVolume.audioSource);
}
bool intersectRayWithPlane(Vec3Arg pos, Vec3Arg dir, Vec3 & p, float & t) const
{
return intersectSoundVolume(soundVolume, pos, dir, p, t);
}
void toActive()
{
soundVolume.audioSource.mutex->lock();
{
const std::string filename = soundSource.filename;
soundSource.open(filename.c_str(), false);
}
soundVolume.audioSource.mutex->unlock();
state = kState_Active;
}
void toInactive()
{
state = kState_Inactive;
}
void tick(const Mat4x4 & worldToViewMatrix, Vec3Arg cameraPosition_world, const float dt)
{
//const float y = sinf(framework.time / 3.45f) * 1.f;
const float y = 0.f;
//const float angleY = sinf(framework.time / 4.56f) * 1.f;
const float angleY = currentAngle * M_PI / 180.f;
soundVolume.transform = Mat4x4(true)
.Translate(pos)
.Translate(0.f, 0.f, y)
.RotateY(angleY)
.Scale(currentScale, currentScale, currentScale)
.Scale(1.f, 1.f, .1f);
soundVolume.generateSampleLocations(worldToViewMatrix, cameraPosition_world, true, true, currentGain);
textScroller.progress += dt / 530.f;
//
switch (state)
{
case kState_Inactive:
desiredColor = Color(50, 50, 50);
desiredGain = 0.f;
desiredScale = .4f;
desiredAngle = 0.f;
#if ENABLE_INTERACTIVITY
if (hover && (mouse.wentDown(BUTTON_LEFT) || gamepad[0].wentDown(GAMEPAD_A)))
{
toActive();
break;
}
#endif
break;
case kState_Active:
desiredColor = Color(255, 0, 0);
desiredGain = 1.f;
desiredScale = 1.f;
desiredAngle = 180.f;
if (soundSource.hasEnded)
{
toInactive();
break;
}
#if ENABLE_INTERACTIVITY
if (hover && (mouse.wentDown(BUTTON_LEFT) || gamepad[0].wentDown(GAMEPAD_A)))
{
toInactive();
break;
}
#endif
break;
}
//
const float speed = .7f;
const float retain = powf(1.f - speed, dt);
currentColor = desiredColor.interp(currentColor, retain);
currentGain = lerp(desiredGain, currentGain, retain);
currentScale = lerp(desiredScale, currentScale, retain);
currentAngle = lerp(desiredAngle, currentAngle, retain);
}
void drawSolid() const
{
gxPushMatrix();
{
gxMultMatrixf(soundVolume.transform.m_v);
setColor(colorWhite);
drawCircle(0, 0, 1, 200);
}
gxPopMatrix();
}
void drawTranslucent() const
{
Color color = currentColor;
if (hover)
color = color.interp(colorWhite, .5f);
setColor(color);
drawSoundVolume(soundVolume);
}
void draw2d()
{
textScroller.draw();
}
};
struct VfxNodeDrawGrid : VfxNodeBase
{
enum Input
{
kInput_Draw,
kInput_Scale1,
kInput_Scale2,
kInput_NumSegments1,
kInput_NumSegments2,
kInput_Axis1,
kInput_Axis2,
kInput_Color,
kInput_Optimized,
kInput_COUNT
};
enum Output
{
kOutput_Draw,
kOutput_COUNT
};
VfxNodeDrawGrid()
: VfxNodeBase()
{
resizeSockets(kInput_COUNT, kOutput_COUNT);
addInput(kInput_Draw, kVfxPlugType_Draw);
addInput(kInput_Scale1, kVfxPlugType_Float);
addInput(kInput_Scale2, kVfxPlugType_Float);
addInput(kInput_NumSegments1, kVfxPlugType_Float);
addInput(kInput_NumSegments2, kVfxPlugType_Float);
addInput(kInput_Axis1, kVfxPlugType_Int);
addInput(kInput_Axis2, kVfxPlugType_Int);
addInput(kInput_Color, kVfxPlugType_Color);
addInput(kInput_Optimized, kVfxPlugType_Bool);
addOutput(kOutput_Draw, kVfxPlugType_Draw, this);
}
virtual void draw() const override
{
const VfxColor defaultColor(1.f, 1.f, 1.f, 1.f);
const float scale1 = getInputFloat(kInput_Scale1, 1.f);
const float scale2 = getInputFloat(kInput_Scale1, 1.f);
const int numSegments1 = getInputFloat(kInput_NumSegments1, 10);
const int numSegments2 = getInputFloat(kInput_NumSegments2, 10);
const int axis1 = clamp(getInputInt(kInput_Axis1, 0), 0, 2);
const int axis2 = clamp(getInputInt(kInput_Axis2, 2), 0, 2);
const VfxColor * color = getInputColor(kInput_Color, &defaultColor);
const bool optimized = getInputBool(kInput_Optimized, true);
float scale[3] = { 1.f, 1.f, 1.f };
scale[axis1] = scale1;
scale[axis2] = scale2;
gxPushMatrix();
{
gxScalef(scale[0], scale[1], scale[2]);
setColorf(color->r, color->g, color->b, color->a);
drawGrid3dLine(numSegments1, numSegments2, axis1, axis2, optimized);
}
gxPopMatrix();
}
};
VFX_NODE_TYPE(VfxNodeDrawGrid)
{
typeName = "draw.grid";
in("draw", "draw");
in("scale1", "float", "1");
in("scale2", "float", "1");
in("numSegs1", "float", "10");
in("numSegs2", "float", "10");
in("axis1", "int", "0");
in("axis2", "int", "2");
in("color", "color", "ffffffff");
in("optimized", "bool", "1");
out("draw", "draw");
}
//
struct FaceTile
{
Vec3 currentPos;
Vec3 desiredPos;
Vec3 finalPos;
float wobbleSpeed;
float wobbleMag;
float wobbleX;
float wobbleY;
float currentAngleX = 0.f;
float currentAngleY = 0.f;
float desiredAngleX = 0.f;
float desiredAngleY = 0.f;
float aspectRatio;
double time = 0.0;
MediaPlayer mp;
AudioSourceVorbis audioSource;
std::string audioFilename;
void init(const char * videoFilename, const char * _audioFilename)
{
mp.openAsync(videoFilename, MP::kOutputMode_RGBA);
audioFilename = _audioFilename;
wobbleSpeed = 1.f;
//wobbleMag = 50.f;
wobbleMag = 0.f;
aspectRatio = 1.f;
wobbleX = random(0.f, 1000.f);
wobbleY = random(0.f, 1000.f);
}
void shut()
{
mp.close(true);
}
void beginFocus()
{
#if ENABLE_FACETILE_AUDIO
auto openParams = mp.context->openParams;
mp.close(false);
mp.presentTime = 0.0;
mp.openAsync(openParams);
audioSource.open(audioFilename.c_str(), false);
g_audioMixer->addPointSource(&audioSource);
#endif
}
void endFocus()
{
#if ENABLE_FACETILE_AUDIO
g_audioMixer->removePointSource(&audioSource);
audioSource.close();
#endif
}
void tick(const float dt)
{
time += dt;
const double retainPerSecond = s_videoRetain;
const double retain = pow(retainPerSecond, dt);
currentPos = lerp(desiredPos, currentPos, retain);
wobbleX += wobbleSpeed * s_wobbleSpeedX * dt;
wobbleY += wobbleSpeed * s_wobbleSpeedY * dt;
const Vec3 wobblePos(
sinf(wobbleX) * wobbleMag,
sinf(wobbleY) * wobbleMag,
0.f);
currentAngleX = lerp(desiredAngleX, currentAngleX, retain);
currentAngleY = lerp(desiredAngleY, currentAngleY, retain);
finalPos = currentPos + wobblePos;
aspectRatio = s_videoAspect;
if (audioSource.isOpen())
{
// advance video in sync with audio
mp.presentTime = audioSource.samplePosition / double(audioSource.sampleRate);
mp.tick(mp.context, true);
}
else
{
// advance video
mp.presentTime += dt;
mp.tick(mp.context, true);
// loop when finished
if (mp.isActive(mp.context) && mp.presentedLastFrame(mp.context))
{
auto openParams = mp.context->openParams;
mp.close(false);
mp.presentTime = 0.0;
mp.openAsync(openParams);
}
}
}
};
struct Faces
{
static const int kGridSx = 5;
static const int kGridSy = 3;
enum CompositionMode
{
kCompositionMode_Grid,
kCompositionMode_Focus,
kCompositionMode_COUNT
};
std::vector<FaceTile*> tiles;
CompositionMode compositionMode = kCompositionMode_Grid;
float opacity = 0.f;
int focusIndex = -1;
double time = 0.0;
float focus = 0.f;
Surface * mask = nullptr;
void init()
{
// create mask texture
mask = new Surface(400, 500, false, false, SURFACE_R8);
pushSurface(mask);
{
mask->clear();
setColor(colorWhite);
pushBlend(BLEND_OPAQUE);
pushColorPost(POST_PREMULTIPLY_RGB_WITH_ALPHA);
hqBegin(HQ_FILLED_ROUNDED_RECTS);
hqFillRoundedRect(0, 0, mask->getWidth(), mask->getHeight(), 24);
hqEnd();
popColorPost();
popBlend();
}
popSurface();
// create tiles
const int numTiles = kGridSx * kGridSy;
std::vector<int> indices;
for (int i = 0; i < numTiles; ++i)
indices.push_back(i % interviewFilenames.size());
std::random_shuffle(indices.begin(), indices.end());
// make sure tile #3 is Lisa
const int kLisa = 4;
for (int i = 0; i < numTiles; ++i)
if (indices[i] == kLisa)
std::swap(indices[i], indices[2]);
for (int i = 0; i < numTiles; ++i)
{
FaceTile * tile = new FaceTile();
const int index = indices[i];
const char * videoFilename = interviewFilenames[index].c_str();
const std::string audioFilename = Path::ReplaceExtension(videoFilename, "ogg");
tile->init(videoFilename, audioFilename.c_str());
tile->wobbleSpeed = random(.5f, 1.f);
tiles.push_back(tile);
}
}
void shut()
{
for (auto & tile : tiles)
{
tile->shut();
delete tile;
tile = nullptr;
}
tiles.clear();
delete mask;
mask = nullptr;
}
void beginFocus(const int index)
{
if (index == focusIndex)
{
return;
}
if (focusIndex >= 0)
{
tiles[focusIndex]->endFocus();
focusIndex = -1;
}
if (index >= 0 && index < tiles.size())
{
focusIndex = index;
tiles[focusIndex]->beginFocus();
compositionMode = kCompositionMode_Focus;
}
else
{
compositionMode = kCompositionMode_Grid;
}
}
void endFocus()
{
beginFocus(-1);
}
static void calcGridProperties(const int index, FaceTile & tile)
{
const int tileX = index % kGridSx;
const int tileY = index / kGridSx;
const float spacing = s_videoSpacing;
const float x = lerp(-1.f, +1.f, (tileX + .5f) / float(kGridSx)) * kGridSx * spacing;
const float y = lerp(-1.f, +1.f, (tileY + .5f) / float(kGridSy)) * kGridSy * spacing * s_videoAspect;
tile.desiredPos = Vec3(x, y, s_videoDistance);
tile.desiredAngleX = 0.f;
tile.desiredAngleY = 0.f;
tile.desiredAngleX += sin(tile.time + index) * s_videoAngleWobbleX;
tile.desiredAngleY += sin(tile.time + index) * s_videoAngleWobbleY;
}
static void calcFocusProperties(const int index, FaceTile & tile)
{
tile.desiredPos = Vec3(0, 0, s_videoNearDistance);
tile.desiredAngleX = 0.f;
tile.desiredAngleY = 180.f;
}
void tick(const float dt)
{
time += dt;
// check if focus tile has ended audio playback
if (focusIndex >= 0)
{
if (keyboard.wentDown(SDLK_SPACE))
focusIndex = (focusIndex + 1) % (kGridSx * kGridSy);
FaceTile * tile = tiles[focusIndex];
if (tile->audioSource.isOpen() && tile->audioSource.hasEnded)
{
endFocus();
}
}
// update tile composition and properties
float desiredFocus = 0.f;
if (compositionMode == kCompositionMode_Grid)
{
int index = 0;
for (auto tile : tiles)
{
calcGridProperties(index, *tile);
index++;
}
}
else if (compositionMode == kCompositionMode_Focus)
{
desiredFocus = 1.f;
int index = 0;
for (auto tile : tiles)
{
if (index == focusIndex)
{
calcFocusProperties(index, *tile);
}
else
{
calcGridProperties(index, *tile);
}
index++;
}
}
else
{
Assert(false);
}
const double retainPerSecond = s_videoRetain;
const double retain = pow(retainPerSecond, dt);
focus = lerp(desiredFocus, focus, retain);
// update tiles
for (auto tile : tiles)
{
tile->tick(dt);
}
}
void draw2d()
{
projectPerspective3d(90.f, 1.f, 1000.f);
gxPushMatrix();
gxScalef(1, -1, 1);
auto sortedTiles = tiles;
std::sort(sortedTiles.begin(), sortedTiles.end(), [](FaceTile * t1, FaceTile * t2) { return t1->currentPos[2] > t2->currentPos[2]; });
for (auto tile : sortedTiles)
{
GxTextureId texture = tile->mp.getTexture();
if (texture == 0)
continue;
Shader tileShader("face-tile");
setShader(tileShader);
tileShader.setTexture("image", 0, texture, true, true);
tileShader.setTexture("mask", 1, (GxTextureId)mask->getTexture(), true, true);
tileShader.setImmediate("range", s_videoNearDistance, s_videoDistance);
tileShader.setImmediate("focus", focus);
tileShader.setImmediate("opacity", opacity);
gxPushMatrix();
{
const float rsy = 768 * s_videoScale;
const float rsx = rsy / tile->aspectRatio;
gxTranslatef(
tile->currentPos[0],
tile->currentPos[1],
tile->currentPos[2]);
gxScalef(rsx/2.f, rsy/2.f, 1.f);
gxRotatef(tile->currentAngleX, 1, 0, 0);
gxRotatef(tile->currentAngleY, 0, 1, 0);
setColor(colorWhite);
drawRect(-1, -1, +1, +1);
}
gxPopMatrix();
clearShader();
}
gxPopMatrix();
projectScreen2d();
}
};
//
struct NewBeat
{
std::vector<GxTextureId> textures;
bool isActive = false;
int activeTexture = -1;
float timer = 0.f;
float interval = 1.f;
float scale = 1.f;
float opacity = 1.f;
MediaPlayer mp;
std::string videoFilename;
void init(const char * path)
{
auto files = listFiles(path, false);
for (auto & file : files)
{
auto ext = Path::GetExtension(file, true);
if (ext == "png")
{
GxTextureId texture = getTexture(file.c_str());
if (texture != 0)
{
textures.push_back(texture);
}
}
else if (ext == "mp4")
{
videoFilename = file;
}
}
}
void shut()
{
textures.clear();
}
void tick(const float dt)
{
if (opacity == 0.f)
{
if (isActive)
end();
}
else
{
if (!isActive)
begin();
}
if (isActive)
{
timer = fmaxf(0.f, timer - dt);
if (timer == 0.f)
{
next();
}
if (mp.isActive(mp.context))
{
mp.presentTime += dt;
mp.tick(mp.context, true);
}
else
{
mp.presentTime = 0.0;
mp.openAsync(videoFilename.c_str(), MP::kOutputMode_RGBA);
}
}
else
{
if (mp.isActive(mp.context))
{
mp.close(true);
}
}
}
void next()
{
timer = interval;
if (textures.empty())
{
activeTexture = -1;
}
else
{
if (activeTexture == -1)
{
activeTexture = rand() % textures.size();
}
else
{
activeTexture = (activeTexture + 1) % textures.size();
}
}
}
void draw()
{
#if 0
if (isActive && activeTexture >= 0 && activeTexture < textures.size() && opacity > 0.f)
{
const GxTextureId texture = textures[activeTexture];
#else
if (isActive && mp.getTexture() != 0)
{
const GxTextureId texture = mp.getTexture();
#endif
int sx;
int sy;
gxGetTextureSize(texture, sx, sy);
sx *= PARTICLE_SCALE;
sy *= PARTICLE_SCALE;
gxPushMatrix();
{
gxTranslatef(GFX_SX/2, GFX_SY/2, 0);
gxScalef(sx/2.f, sy/2.f, 1);
gxScalef(scale, scale, 1.f);
gxSetTexture(texture, GX_SAMPLE_LINEAR, true);
setColorf(1.f, 1.f, 1.f, opacity);
pushBlend(BLEND_ALPHA);
{
drawRect(-1, -1, +1, +1);
}
popBlend();
gxClearTexture();
}
gxPopMatrix();
}
}
void begin()
{
end();
//
isActive = true;
timer = 0.f;
}
void end()
{
isActive = false;
activeTexture = -1;
}
};
static NewBeat * s_newBeat = nullptr;
struct VfxNodeNewBeat : VfxNodeBase
{
enum Input
{
kInput_Path,
kInput_Interval,
kInput_Scale,
kInput_Opacity,
kInput_Begin,
kInput_End,
kInput_COUNT
};
enum Output
{
kOutput_COUNT
};
std::string currentPath;
VfxNodeNewBeat()
: VfxNodeBase()
, newBeat()
{
resizeSockets(kInput_COUNT, kOutput_COUNT);
addInput(kInput_Path, kVfxPlugType_String);
addInput(kInput_Interval, kVfxPlugType_Float);
addInput(kInput_Scale, kVfxPlugType_Float);
addInput(kInput_Opacity, kVfxPlugType_Float);
addInput(kInput_Begin, kVfxPlugType_Trigger);
addInput(kInput_End, kVfxPlugType_Trigger);
if (s_newBeat == nullptr)
s_newBeat = &newBeat;
}
virtual ~VfxNodeNewBeat() override
{
if (s_newBeat == &newBeat)
s_newBeat = nullptr;
}
virtual void tick(const float dt) override
{
const char * path = getInputString(kInput_Path, "");
if (path != currentPath)
{
currentPath = path;
newBeat.shut();
newBeat.init(path);
}
newBeat.interval = getInputFloat(kInput_Interval, 1.f);
newBeat.scale = getInputFloat(kInput_Scale, 1.f);
newBeat.opacity = getInputFloat(kInput_Opacity, 1.f);
newBeat.tick(dt);
}
virtual void handleTrigger(const int index) override
{
}
NewBeat newBeat;
};
VFX_NODE_TYPE(VfxNodeNewBeat)
{
typeName = "newbeat";
in("path", "string");
in("interval", "float", "1");
in("scale", "float", "1");
in("opacity", "float", "1");
in("begin!", "trigger");
in("end!", "trigger");
}
//
struct World
{
struct HitTestResult
{
Videoclip * videoclip;
Vfxclip * vfxclip;
SpokenWord * spokenWord;
HitTestResult()
: videoclip(nullptr)
, vfxclip(nullptr)
, spokenWord(nullptr)
{
}
};
Camera3d camera;
Videoclip videoclips[NUM_VIDEOCLIPS];
float videoclipsOpacity;
#if NUM_VFXCLIPS > 0
Vfxclip vfxclips[NUM_VFXCLIPS];
#endif
std::vector<SpokenWord*> spokenWords;
Faces faces;
HitTestResult hitTestResult;
World()
: camera()
, videoclips()
, videoclipsOpacity(0.f)
#if NUM_VFXCLIPS > 0
, vfxclips()
#endif
, spokenWords()
, faces()
, hitTestResult()
{
vectorParticleSystem.spawn = [](VectorParticleSystem & ps, const float life)
{
const int spawnIndex = ps.nextSpawnIndex();
const float x1 = -100.f;
const float y1 = -1.f;
const float z1 = -1.f;
const float x2 = +0.f;
const float y2 = +1.f;
const float z2 = +1.f;
ps.lt[spawnIndex] = life;
ps.lr[spawnIndex] = 1.f / life;
ps.x[spawnIndex] = random(x1, x2);
ps.y[spawnIndex] = random(y1, y2);
ps.z[spawnIndex] = random(z1, z2);
ps.vx[spawnIndex] = random(-1.f, +1.f);
ps.vy[spawnIndex] = random(-1.f, +2.f);
ps.vz[spawnIndex] = random(-1.f, +1.f);
};
}
void init(binaural::HRIRSampleSet * sampleSet, binaural::Mutex * mutex)
{
mediaPlayers = new MediaPlayer[videoFilenames.size()];
for (int i = 0; i < videoFilenames.size(); ++i)
{
const char * videoFilename = videoFilenames[i].c_str();
mediaPlayers[i].openAsync(videoFilename, MP::kOutputMode_RGBA);
}
for (int i = 0; i < NUM_VIDEOCLIPS; ++i)
{
const int audioIndex = i % NUM_AUDIOCLIP_SOURCES;
const int videoIndex = i % videoFilenames.size();
const char * audioFilename = audioFilenames[audioIndex];
const char * videoFilename = videoFilenames[videoIndex].c_str();
videoclips[i].init(sampleSet, mutex, i, audioFilename, videoFilename, videoclipsOpacity);
}
#if NUM_VFXCLIPS > 0
for (int i = 0; i < NUM_VFXCLIPS; ++i)
{
vfxclips[i].open("groooplogo.xml");
}
#endif
faces.init();
}
void shut()
{
Assert(spokenWords.empty());
faces.shut();
for (int i = 0; i < NUM_VIDEOCLIPS; ++i)
{
videoclips[i].shut();
}
for (int i = 0; i < videoFilenames.size(); ++i)
{
mediaPlayers[i].close(true);
}
delete [] mediaPlayers;
mediaPlayers = nullptr;
}
void beginVideoClips()
{
for (int i = 0; i < NUM_VIDEOCLIPS; ++i)
{
videoclips[i].isPaused = false;
}
}
void pauseVideoClips()
{
for (int i = 0; i < NUM_VIDEOCLIPS; ++i)
{
videoclips[i].isPaused = true;
}
}
SpokenWord * createSpokenWord()
{
SpokenWord * spokenWord = new SpokenWord();
spokenWords.push_back(spokenWord);
return spokenWord;
}
void freeSpokenWord(SpokenWord *& spokenWord)
{
if (spokenWord == nullptr)
return;
auto i = std::find(spokenWords.begin(), spokenWords.end(), spokenWord);
Assert(i != spokenWords.end());
spokenWords.erase(i);
//
spokenWord->shut();
delete spokenWord;
spokenWord = nullptr;
}
HitTestResult hitTest(Vec3Arg pos, Vec3Arg dir)
{
HitTestResult result;
float bestDistance = std::numeric_limits<float>::infinity();
for (int i = 0; i < NUM_VIDEOCLIPS; ++i)
{
auto & videoclip = videoclips[i];
Vec3 p;
float t;
if (videoclip.intersectRayWithPlane(pos, dir, p, t) && t >= 0.f)
{
if (t < bestDistance)
{
bestDistance = t;
result = HitTestResult();
result.videoclip = &videoclip;
}
}
}
#if NUM_VFXCLIPS > 0
for (int i = 0; i < NUM_VFXCLIPS; ++i)
{
auto & vfxclip = vfxclips[i];
Vec3 p;
float t;
if (vfxclip.intersectRayWithPlane(pos, dir, p, t) && t >= 0.f)
{
if (t < bestDistance)
{
bestDistance = t;
result = HitTestResult();
result.vfxclip = &vfxclip;
}
}
}
#endif
for (auto spokenWord : spokenWords)
{
Vec3 p;
float t;
if (spokenWord->intersectRayWithPlane(pos, dir, p, t) && t >= 0.f)
{
if (t < bestDistance)
{
bestDistance = t;
result = HitTestResult();
result.spokenWord = spokenWord;
}
}
}
return result;
}
void tick(const float dt)
{
// update the camera
#if ENABLE_INTERACTIVITY
const bool doCamera = !(keyboard.isDown(SDLK_LSHIFT) || keyboard.isDown(SDLK_RSHIFT));
#else
const bool doCamera = false;
#endif
camera.tick(dt, doCamera);
// pause/resume video clips
const float opacity = clamp(videoclipsOpacity, 0.f, 1.f);
if (opacity <= 1.f / 100.f)
pauseVideoClips();
else
beginVideoClips();
//
camera.pushViewMatrix();
Mat4x4 worldToViewMatrix;
gxGetMatrixf(GX_MODELVIEW, worldToViewMatrix.m_v);
const Vec3 cameraPosition_world = worldToViewMatrix.CalcInv().GetTranslation();
// update media players
for (int i = 0; i < videoFilenames.size(); ++i)
{
mediaPlayers[i].presentTime += dt;
mediaPlayers[i].tick(mediaPlayers[i].context, true);
if (mediaPlayers[i].presentedLastFrame(mediaPlayers[i].context))
{
auto openParams = mediaPlayers[i].context->openParams;
mediaPlayers[i].close(false);
mediaPlayers[i].presentTime = 0.0;
mediaPlayers[i].openAsync(openParams);
}
}
// update video clips
for (int i = 0; i < NUM_VIDEOCLIPS; ++i)
{
videoclips[i].gain = videoclipsOpacity * s_videoClipVolume * 4.f;
videoclips[i].tick(worldToViewMatrix, cameraPosition_world, dt);
}
#if NUM_VFXCLIPS > 0
// update vfx clips
for (int i = 0; i < NUM_VFXCLIPS; ++i)
{
vfxclips[i].tick(dt);
}
#endif
// update spoken words
for (auto spokenWord : spokenWords)
{
spokenWord->tick(worldToViewMatrix, cameraPosition_world, dt);
}
// update faces
faces.tick(dt);
// updated vector lines
auto previousState = vectorParticleSystem;
vectorParticleSystem.tick(-.5f, dt);
for (int i = (vectorParticleSystem.spawnIndex + 1) % VectorParticleSystem::kMaxParticles; i != previousState.spawnIndex; i = (i + 1) % VectorParticleSystem::kMaxParticles)
{
if (previousState.lt[i] <= 0.f || vectorParticleSystem.lt[i] <= 0.f)
continue;
vectorMemory.addLine(
previousState.x[i],
previousState.y[i],
previousState.z[i],
vectorParticleSystem.x[i],
vectorParticleSystem.y[i],
vectorParticleSystem.z[i], 4.f);
}
vectorMemory.tick(dt);
//
if (hitTestResult.videoclip)
hitTestResult.videoclip->hover = false;
if (hitTestResult.vfxclip)
hitTestResult.vfxclip->hover = false;
if (hitTestResult.spokenWord)
hitTestResult.spokenWord->hover = false;
const Vec3 origin = camera.getWorldMatrix().GetTranslation();
const Vec3 direction = camera.getWorldMatrix().GetAxis(2);
hitTestResult = hitTest(origin, direction);
if (hitTestResult.videoclip)
hitTestResult.videoclip->hover = true;
if (hitTestResult.vfxclip)
hitTestResult.vfxclip->hover = true;
if (hitTestResult.spokenWord)
hitTestResult.spokenWord->hover = true;
camera.popViewMatrix();
}
void drawHorizon()
{
pushBlend(BLEND_OPAQUE);
const float roll = camera.roll * M_PI / 180.f;
const Vec2 xAxis = Vec2(cosf(-roll), sinf(-roll));
const Vec2 yAxis = Vec2(cosf(-roll - float(M_PI / 2.0)), sinf(-roll - float(M_PI / 2.0)));
Shader shader("horizon");
setShader(shader);
shader.setImmediate("size", GFX_SX, GFX_SY);
shader.setImmediate("xAxis", xAxis[0], xAxis[1]);
shader.setImmediate("yAxis", yAxis[0], yAxis[1]);
drawRect(0, 0, GFX_SX, GFX_SY);
clearShader();
popBlend();
}
void draw3d()
{
camera.pushViewMatrix();
pushLineSmooth(true);
pushDepthTest(true, DEPTH_LESS);
{
pushBlend(BLEND_OPAQUE);
{
for (int i = 0; i < NUM_VIDEOCLIPS; ++i)
{
videoclips[i].drawSolid();
}
#if NUM_VFXCLIPS > 0
for (int i = 0; i < NUM_VFXCLIPS; ++i)
{
vfxclips[i].drawSolid();
}
#endif
for (auto spokenWord : spokenWords)
{
spokenWord->drawSolid();
}
}
popBlend();
}
popDepthTest();
pushDepthTest(true, DEPTH_LESS, false);
{
for (int i = 0; i < NUM_VIDEOCLIPS; ++i)
{
videoclips[i].drawTranslucent();
}
#if NUM_VFXCLIPS > 0
for (int i = 0; i < NUM_VFXCLIPS; ++i)
{
vfxclips[i].drawTranslucent();
}
#endif
for (auto spokenWord : spokenWords)
{
spokenWord->drawTranslucent();
}
pushBlend(BLEND_ALPHA);
{
vectorMemory.draw(s_particlesLineOpacity);
}
popBlend();
pushBlend(BLEND_ADD);
{
setColorf(1.f, 1.f, 1.f, s_particlesCoronaOpacity);
Shader shader("particles");
setShader(shader);
shader.setTexture("source", 0, getTexture("particle.jpg"), true, true);
shader.setImmediate("pointScale", PARTICLE_SCALE);
vectorParticleSystem.draw();
clearShader();
}
popBlend();
}
popDepthTest();
popLineSmooth();
camera.popViewMatrix();
}
void drawSpokeWords()
{
for (auto spokenWord : spokenWords)
{
spokenWord->draw2d();
}
}
};
static World * s_world = nullptr;
struct VfxNodeWorld : VfxNodeBase
{
enum Input
{
kInput_CameraX,
kInput_CameraY,
kInput_CameraZ,
kInput_CameraYaw,
kInput_CameraRoll,
kInput_WorldOpacity,
kInput_FacesOpacity,
kInput_VideoClipTimeMultiplier,
kInput_VideoClipScale,
kInput_VideoClipVolume,
kInput_VideoClipDrawGrid,
kInput_VideoClipGridColor,
kInput_VideoClipGridColor2,
kInput_VideoBegin,
kInput_VideoEnd,
kInput_VideoAspect,
kInput_VideoScale,
kInput_VideoSpacing,
kInput_VideoDistance,
kInput_VideoNearDistance,
kInput_VideoAngleWobbleX,
kInput_VideoAngleWobbleY,
kInput_VideoWobbleX,
kInput_VideoWobbleY,
kInput_VideoRetain,
kInput_VideoSaturation,
kInput_VideoNoisePerlinScale,
kInput_VideoNoisePerlinThreshold,
kInput_VideoFocus,
kInput_VideoFocusIndex,
kInput_ParticleLineOpacity,
kInput_ParticleCoronaOpacity,
kInput_COUNT
};
enum Output
{
kOutput_COUNT
};
VfxNodeWorld()
: VfxNodeBase()
{
resizeSockets(kInput_COUNT, kOutput_COUNT);
addInput(kInput_CameraX, kVfxPlugType_Float);
addInput(kInput_CameraY, kVfxPlugType_Float);
addInput(kInput_CameraZ, kVfxPlugType_Float);
addInput(kInput_CameraYaw, kVfxPlugType_Float);
addInput(kInput_CameraRoll, kVfxPlugType_Float);
addInput(kInput_WorldOpacity, kVfxPlugType_Float);
addInput(kInput_FacesOpacity, kVfxPlugType_Float);
addInput(kInput_VideoClipTimeMultiplier, kVfxPlugType_Float);
addInput(kInput_VideoClipScale, kVfxPlugType_Float);
addInput(kInput_VideoClipVolume, kVfxPlugType_Float);
addInput(kInput_VideoClipDrawGrid, kVfxPlugType_Bool);
addInput(kInput_VideoClipGridColor, kVfxPlugType_Color);
addInput(kInput_VideoClipGridColor2, kVfxPlugType_Color);
addInput(kInput_VideoBegin, kVfxPlugType_Trigger);
addInput(kInput_VideoEnd, kVfxPlugType_Trigger);
addInput(kInput_VideoAspect, kVfxPlugType_Float);
addInput(kInput_VideoScale, kVfxPlugType_Float);
addInput(kInput_VideoSpacing, kVfxPlugType_Float);
addInput(kInput_VideoDistance, kVfxPlugType_Float);
addInput(kInput_VideoNearDistance, kVfxPlugType_Float);
addInput(kInput_VideoAngleWobbleX, kVfxPlugType_Float);
addInput(kInput_VideoAngleWobbleY, kVfxPlugType_Float);
addInput(kInput_VideoWobbleX, kVfxPlugType_Float);
addInput(kInput_VideoWobbleY, kVfxPlugType_Float);
addInput(kInput_VideoRetain, kVfxPlugType_Float);
addInput(kInput_VideoSaturation, kVfxPlugType_Float);
addInput(kInput_VideoNoisePerlinScale, kVfxPlugType_Float);
addInput(kInput_VideoNoisePerlinThreshold, kVfxPlugType_Float);
addInput(kInput_VideoFocus, kVfxPlugType_Trigger);
addInput(kInput_VideoFocusIndex, kVfxPlugType_Float);
addInput(kInput_ParticleLineOpacity, kVfxPlugType_Float);
addInput(kInput_ParticleCoronaOpacity, kVfxPlugType_Float);
}
virtual ~VfxNodeWorld() override
{
}
virtual void tick(const float dt) override
{
s_world->camera.position = Vec3(
getInputFloat(kInput_CameraX, 0.f),
getInputFloat(kInput_CameraY, 0.f),
getInputFloat(kInput_CameraZ, 0.f));
s_world->camera.yaw = getInputFloat(kInput_CameraYaw, 0.f);
s_world->camera.roll = getInputFloat(kInput_CameraRoll, 0.f);
s_world->videoclipsOpacity = getInputFloat(kInput_WorldOpacity, 0.f);
s_world->faces.opacity = getInputFloat(kInput_FacesOpacity, 0.f);
s_videoClipSpeedMultiplier = getInputFloat(kInput_VideoClipTimeMultiplier, 1.f);
s_videoClipScale = getInputFloat(kInput_VideoClipScale, 1.f);
s_videoClipVolume = getInputFloat(kInput_VideoClipVolume, 0.f);
s_videoClipDrawGrid = getInputBool(kInput_VideoClipDrawGrid, true);
VfxColor defaultColor(1.f, 1.f, 1.f, 1.f);
const VfxColor * gridColor = getInputColor(kInput_VideoClipGridColor, &defaultColor);
s_videoClipGridColor.r = gridColor->r;
s_videoClipGridColor.g = gridColor->g;
s_videoClipGridColor.b = gridColor->b;
s_videoClipGridColor.a = gridColor->a;
const VfxColor * gridColor2 = getInputColor(kInput_VideoClipGridColor2, &defaultColor);
s_videoClipGridColor2.r = gridColor2->r;
s_videoClipGridColor2.g = gridColor2->g;
s_videoClipGridColor2.b = gridColor2->b;
s_videoClipGridColor2.a = gridColor2->a;
s_videoAspect = getInputFloat(kInput_VideoAspect, 1.f);
s_videoScale = getInputFloat(kInput_VideoScale, .2f);
s_videoSpacing = getInputFloat(kInput_VideoSpacing, 200.f);
s_videoDistance = getInputFloat(kInput_VideoDistance, 400.f);
s_videoNearDistance = getInputFloat(kInput_VideoNearDistance, 200.f);
s_videoAngleWobbleX = getInputFloat(kInput_VideoAngleWobbleX, 0.f);
s_videoAngleWobbleY = getInputFloat(kInput_VideoAngleWobbleY, 0.f);
s_wobbleSpeedX = getInputFloat(kInput_VideoWobbleX, 1.f);
s_wobbleSpeedY = getInputFloat(kInput_VideoWobbleY, 1.f);
s_videoSaturation = getInputFloat(kInput_VideoSaturation, 1.f);
s_videoPerlinScale = getInputFloat(kInput_VideoNoisePerlinScale, 1.f);
s_videoPerlinThreshold = getInputFloat(kInput_VideoNoisePerlinThreshold, 0.f);
s_videoRetain = getInputFloat(kInput_VideoRetain, 0.f);
s_particlesLineOpacity = getInputFloat(kInput_ParticleLineOpacity, 0.f);
s_particlesCoronaOpacity = getInputFloat(kInput_ParticleCoronaOpacity, 0.f);
}
virtual void handleTrigger(const int index) override
{
if (index == kInput_VideoBegin)
{
s_world->beginVideoClips();
}
else if (index == kInput_VideoEnd)
{
s_world->pauseVideoClips();
}
else if (index == kInput_VideoFocus)
{
const int focusIndex = getInputFloat(kInput_VideoFocusIndex, 0.f);
if (focusIndex >= 0 && focusIndex < s_world->faces.tiles.size())
{
if (focusIndex == s_world->faces.focusIndex)
s_world->faces.endFocus();
else
s_world->faces.beginFocus(focusIndex);
}
}
}
};
VFX_NODE_TYPE(VfxNodeWorld)
{
typeName = "world";
in("camera.x", "float");
in("camera.y", "float");
in("camera.z", "float");
in("camera.yaw", "float");
in("camera.roll", "float");
in("world.a", "float");
in("faces.a", "float");
in("video.tmult", "float", "1");
in("video.cscale", "float", "1");
in("video.cvol", "float", "0");
in("video.dgrid", "bool", "1");
in("gridcolor", "color", "ffffffff");
in("gridcolor2", "color", "ffffffff");
in("video.begin!", "trigger");
in("video.end!", "trigger");
in("video.aspect", "float", "1");
in("video.scale", "float", "0.2");
in("video.spacing", "float", "200");
in("video.fdist", "float", "400");
in("video.ndist", "float", "200");
in("video.awob.x", "float");
in("video.awob.y", "float");
in("wobble.x", "float", "1");
in("wobble.y", "float", "1");
in("video.retain", "float");
in("video.sat", "float", "1");
in("video.p.scale", "float", "1");
in("video.p.thres", "float");
in("video.focus", "trigger");
in("video.findex", "float");
in("p.opacity", "float", "p.line");
in("p.corona.opacity", "float", "p.corona");
}
//
struct VfxNodeSpokenWord : VfxNodeBase
{
enum Input
{
kInput_Text,
kInput_Sound,
kInput_Time,
kInput_X,
kInput_Y,
kInput_Z,
kInput_Begin,
kInput_End,
kInput_COUNT
};
enum Output
{
kOutput_COUNT
};
SpokenWord * spokenWord;
std::string currentText;
std::string currentSoundFilename;
float currentTime;
VfxNodeSpokenWord()
: VfxNodeBase()
, spokenWord(nullptr)
, currentText()
, currentSoundFilename()
, currentTime(0.f)
{
resizeSockets(kInput_COUNT, kOutput_COUNT);
addInput(kInput_Text, kVfxPlugType_String);
addInput(kInput_Sound, kVfxPlugType_String);
addInput(kInput_Time, kVfxPlugType_Float);
addInput(kInput_X, kVfxPlugType_Float);
addInput(kInput_Y, kVfxPlugType_Float);
addInput(kInput_Z, kVfxPlugType_Float);
addInput(kInput_Begin, kVfxPlugType_Trigger);
addInput(kInput_End, kVfxPlugType_Trigger);
}
virtual ~VfxNodeSpokenWord() override
{
s_world->freeSpokenWord(spokenWord);
}
virtual void tick(const float dt) override
{
if (isPassthrough)
{
s_world->freeSpokenWord(spokenWord);
currentText.clear();
currentSoundFilename.clear();
currentTime = 0.f;
return;
}
const char * text = getInputString(kInput_Text, "");
const char * soundFilename = getInputString(kInput_Sound, "");
const float time = getInputFloat(kInput_Time, 0.f);
const float x = getInputFloat(kInput_X, 0.f);
const float y = getInputFloat(kInput_Y, 0.f);
const float z = getInputFloat(kInput_Z, 0.f);
if (spokenWord == nullptr || text != currentText || soundFilename != currentSoundFilename || time != currentTime)
{
currentText = text;
currentSoundFilename = soundFilename;
currentTime = time;
s_world->freeSpokenWord(spokenWord);
spokenWord = s_world->createSpokenWord();
spokenWord->init(g_sampleSet, g_binauralMutex, text, nullptr, soundFilename, Vec3(0.f, 0.f, 0.f));
}
spokenWord->pos = Vec3(x, y, z);
}
virtual void handleTrigger(const int index) override
{
if (isPassthrough)
return;
if (index == kInput_Begin)
{
spokenWord->toActive();
}
else if (index == kInput_End)
{
spokenWord->toInactive();
}
}
virtual void draw() const override
{
if (isPassthrough)
return;
if (spokenWord == nullptr)
return;
spokenWord->drawSolid();
spokenWord->drawTranslucent();
}
};
VFX_NODE_TYPE(VfxNodeSpokenWord)
{
typeName = "spokenWord";
in("text", "string");
in("sound", "string");
in("time", "float");
in("x", "float");
in("y", "float");
in("z", "float");
in("begin!", "trigger");
in("end!", "trigger");
}
//
struct Starfield
{
VectorParticleSystem ps;
VectorMemory vm;
float starOpacity = 1.f;
float lineOpacity = 1.f;
float speedMultiplier = 1.f;
void init()
{
ps.spawn = [&](VectorParticleSystem & ps, const float life)
{
const int spawnIndex = ps.nextSpawnIndex();
const float x1 = -1.f;
const float y1 = -1.f;
const float z1 = +10.f;
const float x2 = +1.f;
const float y2 = +1.f;
const float z2 = +10.f;
const float speedMultiplier = .2f;
ps.lt[spawnIndex] = life;
ps.lr[spawnIndex] = 1.f / life;
ps.x[spawnIndex] = random(x1, x2);
ps.y[spawnIndex] = random(y1, y2);
ps.z[spawnIndex] = random(z1, z2);
ps.vx[spawnIndex] = speedMultiplier * random(-1.f, +1.f);
ps.vy[spawnIndex] = speedMultiplier * random(-1.f, +1.f);
ps.vz[spawnIndex] = speedMultiplier * random(-10.f, -10.f);
};
}
void shut()
{
}
void tick(const float dt)
{
auto previousState = ps;
ps.tick(0.f, dt * speedMultiplier);
for (int i = (ps.spawnIndex + 1) % VectorParticleSystem::kMaxParticles; i != previousState.spawnIndex; i = (i + 1) % VectorParticleSystem::kMaxParticles)
{
if (previousState.lt[i] <= 0.f || ps.lt[i] <= 0.f)
continue;
vm.addLine(
previousState.x[i],
previousState.y[i],
previousState.z[i],
ps.x[i],
ps.y[i],
ps.z[i], 2.3f);
}
vm.tick(dt);
}
void draw3d()
{
draw3dTranslucent();
}
void draw3dTranslucent()
{
pushBlend(BLEND_ALPHA);
{
vm.draw(lineOpacity);
}
popBlend();
pushBlend(BLEND_ADD);
{
setColorf(1.f, 1.f, 1.f, starOpacity);
Shader shader("particles");
setShader(shader);
shader.setTexture("source", 0, getTexture("particle.jpg"), true, true);
shader.setImmediate("pointScale", PARTICLE_SCALE);
{
ps.draw();
}
clearShader();
}
popBlend();
}
};
static Starfield * s_starfield = nullptr;
struct VfxNodeStarfield : VfxNodeBase
{
enum Input
{
kInput_StarOpacity,
kInput_LineOpacity,
kInput_Speed,
kInput_COUNT
};
enum Output
{
kOutput_COUNT
};
VfxNodeStarfield()
: VfxNodeBase()
{
resizeSockets(kInput_COUNT, kOutput_COUNT);
addInput(kInput_StarOpacity, kVfxPlugType_Float);
addInput(kInput_LineOpacity, kVfxPlugType_Float);
addInput(kInput_Speed, kVfxPlugType_Float);
}
virtual void tick(const float dt) override
{
s_starfield->starOpacity = getInputFloat(kInput_StarOpacity, 1.f);
s_starfield->lineOpacity = getInputFloat(kInput_LineOpacity, 1.f);
s_starfield->speedMultiplier = getInputFloat(kInput_Speed, 1.f);
}
};
VFX_NODE_TYPE(VfxNodeStarfield)
{
typeName = "starfield";
in("star.opacity", "float", "1");
in("line.opacity", "float", "1");
in("speed", "float", "1");
}
//
#define MAX_SPACE_POINTS 200
struct GamepadController
{
float controlValues[3] = { };
int desiredMorph = 0;
bool wasDown = false;
void tick()
{
// broken joystick reports values for X-axis: -1 .. +0.62, with -0.26 at center position
//printf("%g\n", gamepad[0].getAnalog(0, ANALOG_X));
controlValues[2] = (gamepad[0].getAnalog(0, ANALOG_X) + .26f) / 1.26f / 1.6f;
const float alpha = (clamp(gamepad[0].getAnalog(0, ANALOG_Y) * 1.5f, -1.f, +1.f) + 1.f) / 2.f;// * (.5f / .6f);
const bool isDown = gamepad[0].isDown(GAMEPAD_A);
if (isDown && !wasDown)
desiredMorph = (desiredMorph + 1) % 3;
wasDown = isDown;
const float desiredMorphValues[2] =
{
desiredMorph == 1 ? .7f + alpha / .5f * .6f : desiredMorph == 0 ? (alpha - .5f) * .6f : 0.f,
desiredMorph == 2 ? .7f + alpha / .5f * .6f : desiredMorph == 0 ? (alpha - .5f) * .0f : 0.f
};
const float retain = gamepad[0].isDown(DPAD_DOWN) ? .998f : .99f;
const float decay = 1.f - retain;
for (int i = 0; i < 2; ++i)
{
controlValues[i] = controlValues[i] * retain + desiredMorphValues[i] * decay;
}
}
};
struct SpacePoint
{
Vec3 position;
Vec3 direction;
};
static double s_morph1 = 0.0;
static double s_morph2 = 1.0;
static double s_speed = 0.0;
static bool s_slowMode = false;
struct SpacePoints
{
GamepadController controller;
SpacePoint points[MAX_SPACE_POINTS];
double t = 0.0;
float currentOpacity = 0.f;
float desiredOpacity = 1.f;
static Vec3 evalCircle(const double t, const float radius)
{
Vec3 p;
p[0] = cosf(t * float(2.0 * M_PI));
p[1] = sinf(t * float(2.0 * M_PI));
return p * radius;
}
static Vec3 evalQuad(const double t, const float radius)
{
const double u = fmod(fabs(t), 1.0) * 4.0;
const int s = int(u);
const double f = u - s;
Vec3 p;
if (s == 0)
{
p[0] = -1.f + f * 2.f;
p[1] = -1.f;
}
else if (s == 1)
{
p[0] = +1.f;
p[1] = -1.f + f * 2.f;
}
else if (s == 2)
{
p[0] = +1.f - f * 2.f;
p[1] = +1.f;
}
else if (s == 3)
{
p[0] = -1.f;
p[1] = +1.f - f * 2.f;
}
return p * radius;
}
static Vec3 evalSnake(const double t)
{
Vec3 p;
p[0] = cosf(t * float(2.0 * M_PI) / 2.345) * 16.f;
p[1] = sinf(t * float(2.0 * M_PI) / 1.234) * 6.f;
return p;
}
static Vec3 evalParticlePosition(const float i, const double t)
{
const double pt = t * (i + .5f) / 6.f;
auto p1 = evalQuad(pt / 1.123, 12.f);
auto p2 = evalCircle(pt, 12.f);
auto p3 = evalSnake(pt / 1.234);
Vec3 p = p1;
p = lerp(p, p2, s_morph1);
p = lerp(p, p3, s_morph2);
return p;
}
void tickParticles(const float dt)
{
if (keyboard.wentDown(SDLK_s))
s_slowMode = !s_slowMode;
if (s_slowMode)
t += s_speed * dt * .25f;
else
t += s_speed * dt;
if (gamepad[0].isDown(GAMEPAD_R2))
t *= powf(.1f, dt);
for (int i = 0; i < MAX_SPACE_POINTS; ++i)
{
auto & p = points[i];
p.position = evalParticlePosition(i, t);
Vec3 d = evalParticlePosition(i + .01f, t) - evalParticlePosition(i - .01f, t);
p.direction[0] = -d[1];
p.direction[1] = +d[0];
p.direction.Normalize();
}
}
void tick(const float dt)
{
currentOpacity = lerp(desiredOpacity, currentOpacity, powf(.2f, dt));
// update control values
controller.tick();
s_morph1 = controller.controlValues[0];
s_morph2 = controller.controlValues[1];
const float speed = controller.controlValues[2];
const float speedSign = speed < 0.f ? -1.f : +1.f;
const float speedMag = fabs(speed);
const float speedMagCurve = powf(speedMag, 3.f);
s_speed = speedMagCurve * speedSign / 100.f;
s_speed *= 80.f;
// update particles
tickParticles(dt);
}
void draw()
{
gxPushMatrix();
gxTranslatef(GFX_SX/2, GFX_SY/2, 0);
gxScalef(14, 14, 1);
gxScalef(PARTICLE_SCALE, PARTICLE_SCALE, 1.f);
hqBegin(HQ_LINES, true);
{
setColor(255, 255, 255, currentOpacity * 160);
const float s = 1.4f;
for (auto & p : points)
hqLine(
p.position[0],
p.position[1],
3.f * PARTICLE_SCALE,
p.position[0] + p.direction[0] * s,
p.position[1] + p.direction[1] * s,
.7f * PARTICLE_SCALE);
}
hqEnd();
hqBegin(HQ_STROKED_CIRCLES, true);
{
setColor(0, 255, 0, currentOpacity * 255.f);
for (auto & p : points)
hqStrokeCircle(p.position[0], p.position[1], 7.f * PARTICLE_SCALE, 1.2f * PARTICLE_SCALE);
}
hqEnd();
gxPopMatrix();
}
};
static SpacePoints * s_spacePoints = nullptr;
struct VfxNodeSpacePoints : VfxNodeBase
{
enum Input
{
kInput_Opacity,
kInput_COUNT
};
enum Output
{
kOutput_COUNT
};
VfxNodeSpacePoints()
: VfxNodeBase()
{
resizeSockets(kInput_COUNT, kOutput_COUNT);
addInput(kInput_Opacity, kVfxPlugType_Float);
}
virtual void tick(const float dt) override
{
s_spacePoints->desiredOpacity = getInputFloat(kInput_Opacity, 0.f);
}
};
VFX_NODE_TYPE(VfxNodeSpacePoints)
{
typeName = "spacepoints";
in("opacity", "float");
}
//
#include "vfxNodeBase.h"
struct VfxNodeScalarSmoothe : VfxNodeBase
{
enum SmoothingUnit
{
kSmoothingUnit_PerSecond,
kSmoothingUnit_PerMillisecond
};
enum Input
{
kInput_Value,
kInput_InitialValue,
kInput_SmoothingUnit,
kInput_Smoothness,
kInput_COUNT
};
enum Output
{
kOutput_Result,
kOutput_COUNT
};
float resultOutput;
double currentValue;
VfxNodeScalarSmoothe()
: VfxNodeBase()
, resultOutput()
, currentValue(0.0)
{
resizeSockets(kInput_COUNT, kOutput_COUNT);
addInput(kInput_Value, kVfxPlugType_Float);
addInput(kInput_InitialValue, kVfxPlugType_Float);
addInput(kInput_SmoothingUnit, kVfxPlugType_Int);
addInput(kInput_Smoothness, kVfxPlugType_Float);
addOutput(kOutput_Result, kVfxPlugType_Float, &resultOutput);
}
virtual void init(const GraphNode & node) override
{
currentValue = getInputFloat(kInput_InitialValue, 0.f);
}
virtual void tick(const float dt) override;
};
VFX_ENUM_TYPE(smoothing_mode)
{
elem("perSecond");
elem("perMillisecond");
}
VFX_NODE_TYPE(VfxNodeScalarSmoothe)
{
typeName = "scalar.smoothe";
in("value", "float");
in("value.init", "float");
inEnum("smoothing", "smoothing_mode");
in("smoothness", "float", "0.5");
out("result", "float");
}
void VfxNodeScalarSmoothe::tick(const float _dt)
{
vfxCpuTimingBlock(VfxNodeScalarSmoothe);
const float value = getInputFloat(kInput_Value, 0.f);
const SmoothingUnit smoothingUnit = (SmoothingUnit)getInputInt(kInput_SmoothingUnit, 0);
const float retain = getInputFloat(kInput_Smoothness, .5f);
const double dt = (smoothingUnit == kSmoothingUnit_PerSecond) ? _dt : _dt * 1000.0;
if (isPassthrough)
{
resultOutput = value;
}
else
{
const double retainPerSecond = fminf(1.f, fmaxf(0.f, retain));
const double retainPerSample = pow(retainPerSecond, dt);
const double followPerSample = 1.0 - retainPerSample;
resultOutput = currentValue;
currentValue = currentValue * retainPerSample + value * followPerSample;
}
}
//
void VideoLandscape::init()
{
// create mask texture for videos
s_videoMask = new Surface(640, 360, false, false, SURFACE_R8);
pushSurface(s_videoMask);
{
s_videoMask->clear();
setColor(colorWhite);
pushBlend(BLEND_OPAQUE);
pushColorPost(POST_PREMULTIPLY_RGB_WITH_ALPHA);
hqBegin(HQ_FILLED_ROUNDED_RECTS);
hqFillRoundedRect(0, 0, s_videoMask->getWidth(), s_videoMask->getHeight(), 64);
hqEnd();
popColorPost();
popBlend();
}
popSurface();
// create mask texture for the entire projection
s_circleMask = new Surface(GFX_SX, GFX_SY, false, false, SURFACE_R8);
pushSurface(s_circleMask);
{
s_circleMask->clear();
Shader shader("circleMask");
setShader(shader);
shader.setImmediate("size", GFX_SX, GFX_SY);
pushBlend(BLEND_OPAQUE);
drawRect(0, 0, GFX_SX, GFX_SY);
popBlend();
clearShader();
}
popSurface();
//
world = new World();
world->init(g_sampleSet, g_binauralMutex);
s_world = world;
starfield = new Starfield();
starfield->init();
s_starfield = starfield;
spacePoints = new SpacePoints();
s_spacePoints = spacePoints;
}
void VideoLandscape::shut()
{
delete spacePoints;
spacePoints = nullptr;
s_spacePoints = nullptr;
starfield->shut();
delete starfield;
starfield = nullptr;
s_starfield = nullptr;
world->shut();
delete world;
world = nullptr;
s_world = nullptr;
}
void VideoLandscape::tick(const float dt)
{
SDL_LockMutex(g_audioMutex);
{
g_audioMixer->voiceGroups[kVoiceGroup_Videoclips].desiredGain =
keyboard.isDown(SDLK_w) ? .1f : 1.f;
}
SDL_UnlockMutex(g_audioMutex);
// update video clips
world->tick(dt);
// update starfield
starfield->tick(dt);
// update space points
spacePoints->tick(dt);
}
void VideoLandscape::draw()
{
world->drawHorizon();
projectPerspective3d(fov, near, far);
{
world->draw3d();
}
projectScreen2d();
const float opacity = clamp(world->videoclipsOpacity, 0.f, 1.f);
setColorf(0.f, 0.f, 0.f, 1.f - opacity);
drawRect(0, 0, GFX_SX, GFX_SY);
world->drawSpokeWords();
projectPerspective3d(fov, near, far);
{
starfield->draw3d();
}
projectScreen2d();
// draw circular mask
pushBlend(BLEND_MUL);
setColor(colorWhite);
gxSetTexture(s_circleMask->getTexture(), GX_SAMPLE_LINEAR, true);
pushColorPost(POST_SET_RGB_TO_R);
drawRect(0, 0, GFX_SX, GFX_SY);
popColorPost();
gxClearTexture();
popBlend();
//
world->faces.draw2d();
//
if (s_newBeat != nullptr)
{
s_newBeat->draw();
}
//
spacePoints->draw();
}
|
68ffbc74b9ec4dccebcdc56a891f44fe9ccc9dd2
|
2550a0de6c2285d94fd3f42b24f8f2a6696045c3
|
/Normal/221/C.cpp
|
7f2858337e438b97029b1b6dfaa2cc13fb393ee5
|
[] |
no_license
|
Mohd-3/Codeforces-Solutions
|
a2b26cf2072de7cdc0d2e754d7f0df0bad50174f
|
97b0caf353a811f134a4c0206fd3c74fb4707149
|
refs/heads/master
| 2020-09-01T22:51:20.581848
| 2019-11-04T00:25:09
| 2019-11-04T00:25:09
| 219,078,353
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 620
|
cpp
|
C.cpp
|
#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;
int n, arr[100001], sorted[100001], cnt;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
scanf("%d", arr+i);
sorted[i] = arr[i];
}
sort(sorted, sorted+n);
for (int i = 0; i < n; ++i) {
if (arr[i] != sorted[i]) {
cnt++;
}
if (cnt>2) {
puts("NO");
return 0;
}
}
puts ("YES");
return 0;
}
|
b59139b962098e82a00836b6e47bc92fce02bffe
|
5769d6baeb0f16f64506f6baee319906878c09e0
|
/dfs_bfs/generate_permutations/GeneratePermutations.cpp
|
5b54312c228e7715cf0068bf3de5ecc5a763a94b
|
[] |
no_license
|
Tsdevendra1/Algorithms
|
ff0b7141384b00e174c605fc35ef5debdf23f95d
|
6f396c8989a2df788c53c7b81a4632fb1d0e9b5b
|
refs/heads/master
| 2023-01-06T10:38:15.853153
| 2020-10-20T19:21:41
| 2020-10-20T19:21:41
| 263,338,663
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,552
|
cpp
|
GeneratePermutations.cpp
|
//
// Created by Tharuka Devendra on 08/08/2020.
//
#include "GeneratePermutations.h"
#include "iostream"
#include "vector"
#include "unordered_set"
#include "queue"
#include "../../Utils.h"
using namespace std;
vector<vector<int>> perms1(const vector<int> &nums) {
vector<vector<int>> result;
queue<vector<int>> permutations;
permutations.push(vector<int>());
for (auto currentNumber : nums) {
// we will take all existing permutations and add the current number to create new
// permutations
int n = permutations.size();
for (int i = 0; i < n; i++) {
vector<int> oldPermutation = permutations.front();
permutations.pop();
// create a new permutation by adding the current number at every position
for (int j = 0; j <= oldPermutation.size(); j++) {
vector<int> newPermutation(oldPermutation);
newPermutation.insert(newPermutation.begin() + j, currentNumber);
if (newPermutation.size() == nums.size()) {
result.push_back(newPermutation);
} else {
permutations.push(newPermutation);
}
}
}
}
return result;
}
vector<vector<int>> perms2(vector<int> &choices) {
// Theres also the DFS version of this
vector<int> possibleChoices = choices;
queue<pair<unordered_set<int>, vector<int>>> tracker;
tracker.push({});
vector<vector<int>> answer;
while (!tracker.empty()) {
auto seen = tracker.front().first;
auto currentMove = tracker.front().second;
tracker.pop();
if (currentMove.size() == possibleChoices.size()) {
answer.push_back(currentMove);
continue;
}
for (int choice: possibleChoices) {
if (seen.find(choice) == seen.end()) {
currentMove.push_back(choice);
seen.insert(choice);
tracker.push({seen, currentMove});
currentMove.pop_back();
seen.erase(choice);
}
}
}
return answer;
}
void perms3Helper(vector<int> &choices, int swapPosition, vector<vector<int>> &answer) {
// Base case
if (swapPosition == choices.size() - 1) {
answer.push_back(choices);
} else {
// Permutations made
for (int i = swapPosition; i < choices.size(); i++) {
swap(choices[swapPosition], choices[i]);
perms3Helper(choices, swapPosition + 1, answer);
swap(choices[swapPosition], choices[i]);
}
}
}
vector<vector<int>> perms3(vector<int> &choices) {
vector<vector<int>> answer;
perms3Helper(choices, 0, answer);
return answer;
}
bool perms3UniquePermutationShouldSwap(vector<int> &choices, int swapPosition, int toSwapWithPosition) {
for (int i = swapPosition; i < toSwapWithPosition; ++i) {
if (choices[toSwapWithPosition] == choices[i]) {
return false;
}
}
return true;
}
void perms3HelperUniquePermutations(int swapPosition, vector<int> &choices, vector<vector<int>> &answer) {
if (swapPosition == choices.size() - 1) {
answer.push_back(choices);
} else {
for (int toSwapWith = swapPosition; toSwapWith < choices.size(); ++toSwapWith) {
bool shouldSwap = perms3UniquePermutationShouldSwap(choices, swapPosition, toSwapWith);
if (shouldSwap) {
swap(choices[swapPosition], choices[toSwapWith]);
perms3HelperUniquePermutations(swapPosition + 1, choices, answer);
swap(choices[swapPosition], choices[toSwapWith]);
}
}
}
}
vector<vector<int>> perms3UniquePermutations(vector<int> &choices) {
vector<vector<int>> answer;
perms3HelperUniquePermutations(0, choices, answer);
return answer;
}
void testGeneratePermutations() {
vector<int> choices = {1, 2, 3};
auto answer = perms2(choices);
auto answer2 = perms1(choices);
auto answer3 = perms3(choices);
vector<int> choicesWithDuplicates = {1, 2, 3, 1};
auto answer4 = perms3UniquePermutations(choicesWithDuplicates);
assert(answer4.size() == 12);
int similar = 0;
for (auto &a1: answer) {
for (auto &a2: answer2) {
if (a1 == a2) {
++similar;
}
}
}
assert(similar == 6);
assert(perms1(choices).size() == 6);
assert(answer.size() == 6);
assert(answer3.size() == 6);
}
|
fbb84bf244984dc47d9cc858c8b164fbedc730e6
|
91e5679af627543e055726d0df921c82ad75dac9
|
/src/Compare.h
|
b67c957433597599b0c09526527cca6aaa18ef05
|
[
"MIT"
] |
permissive
|
KatOfCats/w2rap-contigger
|
c23cdba059ddcc1b091ca5a961234eaf54d2d287
|
5c9df00fd133b31edf391a162a8c76582796d3b5
|
refs/heads/master
| 2021-07-07T23:11:23.287522
| 2020-08-31T15:59:30
| 2020-08-31T15:59:30
| 181,926,110
| 0
| 0
|
MIT
| 2019-04-17T16:09:53
| 2019-04-17T16:09:53
| null |
UTF-8
|
C++
| false
| false
| 1,885
|
h
|
Compare.h
|
///////////////////////////////////////////////////////////////////////////////
// SOFTWARE COPYRIGHT NOTICE AGREEMENT //
// This software and its documentation are copyright (2010) by the //
// Broad Institute. All rights are reserved. This software is supplied //
// without any warranty or guaranteed support whatsoever. The Broad //
// Institute is not responsible for its use, misuse, or functionality. //
///////////////////////////////////////////////////////////////////////////////
/*
* \file Compare.h
* \author tsharpe
* \date Mar 4, 2010
*
* \brief
*/
#ifndef COMPARE_H_
#define COMPARE_H_
#include <algorithm>
#include <string>
#include <type_traits>
#include <vector>
template <class T, class = typename std::enable_if<std::is_scalar<T>::value,bool>::type>
inline int compare( T const& t1, T const& t2 )
{
return (t2 < t1) - (t1 < t2);
}
template <class T1, class T2>
inline int compare( std::pair<T1,T2> const& p1, std::pair<T1,T2> const& p2 )
{
int result = compare(p1.first,p2.first);
if ( !result ) result = compare(p1.second,p2.second);
return result;
}
template <class T, class A>
inline int compare( std::vector<T,A> const& v1, std::vector<T,A> const& v2 )
{
typedef typename std::vector<T,A>::const_iterator Itr;
Itr itr1 = v1.begin();
Itr itr2 = v2.begin();
using std::min; Itr end = itr1 + min(v1.size(),v2.size());
int result = 0;
while ( !result && itr1 != end )
{ result = compare(*itr1,*itr2); ++itr1; ++itr2; }
if ( !result ) result = compare(v1.size(),v2.size());
return result;
}
inline int compare( std::string const& s1, std::string const& s2 )
{ return s1.compare(s2); }
template <class T>
struct CompareFunctor
{
int operator()(T const& t1, T const& t2)
{ return compare(t1,t2); }
};
#endif /* COMPARE_H_ */
|
5ff15d7a08f1574edb6760fb08997b3f91cc04d1
|
8885341976b143285c839095dfe06a72659eacf2
|
/Code C/chi la sap xep.cpp
|
69c9e0547fe476c55db1c61be6421a11b165dbac
|
[] |
no_license
|
nguyendohoangkhoi/CodeC
|
f4cc41329dfc8b47a830dcabbadf5b79ceca8c6a
|
1fcf66b0cccb74c9dc2a89f156fbb2d6b43c447b
|
refs/heads/master
| 2023-04-30T20:29:28.873389
| 2021-05-29T13:30:07
| 2021-05-29T13:30:07
| 160,067,230
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,157
|
cpp
|
chi la sap xep.cpp
|
#include <iostream>// ham vao ra co ban
#include <cmath>// de dung ham toan hoc
#include <cstdlib>// de dung cac lam co ban
#include <ctime>// de dung thoi gian
#include <cstring>// de dung chuoi ( C )
#include <string>// de dung chuoi
#include<iomanip>// de dung ham setw
#include<stack>// de dung ham ngan xep
#include<algorithm>
using namespace std;
static int a[1000000],b[1000000],n,m;
int Init(){
cin>>n>>m;
for (int i=0;i<n;i++){
cin>>a[i];
}
for (int i=0;i<m;i++){
cin>>b[i];
}
}
//int InterChangeSort(){
// for (int i=0;i<n-1;i++){
// for (int j=i+1;j<n;j++){
// if( a[i]>a[j] ) swap(a[i],a[j]);
// }
// }
//}
//void QuickSort(){
// int i=left, j= right;
//}
int BinarySearch( int x ){
int low=0, high=n-1;
int mid=(high+low)/2;
while(low<=high){
if ( x>=a[mid] ) low = mid+1;
else if ( x<a[mid] ) high=mid-1;
mid=(high+low)/2;
}
mid=(high+low)/2;
// if (x>a[mid]) return mid+1;
// else return mid;
return mid+1;
}
int main()
{
Init();
//InterChangeSort();
sort(a,a+n);
for (int i=0;i<m;i++){
if (b[i]<a[0]){
cout<<"0"<<endl;
}
else if(b[i]>a[n-1]){
cout<<n<<endl;
}
else cout<<BinarySearch(b[i])<<endl;
}
}
|
c338537a555aad5d4037db4f1c42938ba9dd37d6
|
0319cf358118101879a723910213a8cf8d4d1a0d
|
/dragon/operators/training/update_ops.h
|
43ad12679fe5038e3776956b875a04d5b2ea19c4
|
[
"BSD-2-Clause"
] |
permissive
|
ORG-MARS/dragon
|
d1e42afe1a5e0ba6191fab2c2518af14571c7911
|
6bfe3e73ecb9d95030d12df2efed046551a396e1
|
refs/heads/master
| 2023-02-28T05:45:12.172455
| 2021-02-04T16:06:31
| 2021-02-04T16:06:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,669
|
h
|
update_ops.h
|
/*!
* Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
*
* Licensed under the BSD 2-Clause License.
* You should have received a copy of the BSD 2-Clause License
* along with the software. If not, See,
*
* <https://opensource.org/licenses/BSD-2-Clause>
*
* ------------------------------------------------------------
*/
#ifndef DRAGON_OPERATORS_TRAINING_UPDATE_OPS_H_
#define DRAGON_OPERATORS_TRAINING_UPDATE_OPS_H_
#include "dragon/core/operator.h"
namespace dragon {
template <class Context>
class UpdateOpBase : public Operator<Context> {
public:
UpdateOpBase(const OperatorDef& def, Workspace* ws)
: Operator<Context>(def, ws),
lr_mult_(OP_SINGLE_ARG(float, "lr_mult", 1.f)),
decay_mult_(OP_SINGLE_ARG(float, "decay_mult", 1.f)) {}
USE_OPERATOR_FUNCTIONS;
void RunOnDevice() override;
virtual void ComputeUpdate(Tensor* dX) = 0;
template <typename T>
void AdjustGradient(Tensor* dX, Tensor* X);
template <typename T>
void ApplyUpdate(Tensor* dX, Tensor* X);
Tensor* Slot(const string& name);
float Parameter(const string& name) const;
protected:
float lr_mult_, decay_mult_;
};
#define USE_PARAM_UPDATE_FUNCTIONS \
using UpdateOpBase<Context>::Slot; \
using UpdateOpBase<Context>::Parameter
template <class Context>
class SGDUpdateOp final : public UpdateOpBase<Context> {
public:
SGDUpdateOp(const OperatorDef& def, Workspace* ws)
: UpdateOpBase<Context>(def, ws), last_lr_(-1.f), correction_(1.f) {}
USE_OPERATOR_FUNCTIONS;
USE_PARAM_UPDATE_FUNCTIONS;
void ComputeUpdate(Tensor* dX) override;
protected:
float last_lr_, correction_;
};
template <class Context>
class NesterovUpdateOp final : public UpdateOpBase<Context> {
public:
NesterovUpdateOp(const OperatorDef& def, Workspace* ws)
: UpdateOpBase<Context>(def, ws) {}
USE_OPERATOR_FUNCTIONS;
USE_PARAM_UPDATE_FUNCTIONS;
void ComputeUpdate(Tensor* dX) override;
};
template <class Context>
class RMSpropUpdateOp final : public UpdateOpBase<Context> {
public:
RMSpropUpdateOp(const OperatorDef& def, Workspace* ws)
: UpdateOpBase<Context>(def, ws) {}
USE_OPERATOR_FUNCTIONS;
USE_PARAM_UPDATE_FUNCTIONS;
void ComputeUpdate(Tensor* dX) override;
};
template <class Context>
class AdamUpdateOp final : public UpdateOpBase<Context> {
public:
AdamUpdateOp(const OperatorDef& def, Workspace* ws)
: UpdateOpBase<Context>(def, ws), t_(0) {}
USE_OPERATOR_FUNCTIONS;
USE_PARAM_UPDATE_FUNCTIONS;
void ComputeUpdate(Tensor* dX) override;
protected:
int t_;
};
#undef USE_PARAM_UPDATE_FUNCTIONS
} // namespace dragon
#endif // DRAGON_OPERATORS_TRAINING_UPDATE_OPS_H_
|
9b9469815a6ef193b954d8b0b6fd638248d6ef9d
|
6c154d9f8db9bd4da5a1f275376393cc3dcce451
|
/wordpresspost.h
|
c2d520236f41117a3b3e610f8af5d7c244a34ed0
|
[] |
no_license
|
kshlm/FreOffice-Blog-Plugin
|
bb53d1126edda93643e077fe5161f5517e4df286
|
baeba614cd29e55c37345b13cb34590d57b80be7
|
refs/heads/master
| 2020-05-19T03:20:48.101541
| 2011-07-13T06:01:20
| 2011-07-13T06:01:20
| 833,311
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,660
|
h
|
wordpresspost.h
|
/*
* Copyright (c) 2010 Kaushal M <kshlmster@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef WORDPRESSPOST_H
#define WORDPRESSPOST_H
#include <QString>
#include <QMap>
#include <QVariantMap>
class wordpressPost
{
private:
QString title;
QString description;
QString postid;
QVariantList categories;
QString post_status;
QString wp_author_display_name;
QString mt_keywords;
public:
wordpressPost();
void setTitle(QString &);
QString *getTitle();
void setDescription(QString &);
QString *getDescription();
void setPostStatus(QString &);
QString *getPostStatus();
void addCategory(QString &);
QVariantList getCategories();
void setAuthorName(QString &);
QString *getAuthorName();
void setPostid(QString &);
QString *getPostid();
void setTags(QString &);
QString *getTags();
QVariantMap preparePost();
signals:
void error();
};
#endif // WORDPRESSPOST_H
|
4e971ac556f5073af5409ae8fe920dd70a583d3f
|
6099e0ebd8e78311c5e3dfae1a4678c2a4d51873
|
/3rdParty/rocksdb/6.27/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc
|
ec7bd04dc9da7412c657573abe74bcd30ff6a939
|
[
"Apache-2.0",
"AGPL-3.0-only",
"GPL-2.0-only",
"BSD-3-Clause",
"ICU",
"LGPL-2.1-or-later",
"OpenSSL",
"GPL-1.0-or-later",
"Zlib",
"MIT",
"ISC",
"CC0-1.0",
"BSL-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-pcre",
"BSD-4-Clause",
"Python-2.0",
"Bison-exception-2.2",
"JSON",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense"
] |
permissive
|
vishalbelsare/arangodb
|
be647e192dd7505a9907263892fe65112ce81d2d
|
a6bd3ccd6f622fab2a288d2e3a06ab8e338d3ec1
|
refs/heads/devel
| 2023-09-05T13:34:28.350423
| 2021-12-27T07:16:58
| 2021-12-27T07:16:58
| 137,596,199
| 0
| 0
|
Apache-2.0
| 2021-12-28T14:39:52
| 2018-06-16T16:54:10
|
C++
|
UTF-8
|
C++
| false
| false
| 17,700
|
cc
|
lock_request.cc
|
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=2:softtabstop=2:
#ifndef ROCKSDB_LITE
#ifndef OS_WIN
#ident "$Id$"
/*======
This file is part of PerconaFT.
Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
PerconaFT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2,
as published by the Free Software Foundation.
PerconaFT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
PerconaFT is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License, version 3,
as published by the Free Software Foundation.
PerconaFT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
======= */
#ident \
"Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
#include "lock_request.h"
#include "../portability/toku_race_tools.h"
#include "../portability/txn_subst.h"
#include "../util/dbt.h"
#include "locktree.h"
namespace toku {
// initialize a lock request's internals
void lock_request::create(toku_external_mutex_factory_t mutex_factory) {
m_txnid = TXNID_NONE;
m_conflicting_txnid = TXNID_NONE;
m_start_time = 0;
m_left_key = nullptr;
m_right_key = nullptr;
toku_init_dbt(&m_left_key_copy);
toku_init_dbt(&m_right_key_copy);
m_type = type::UNKNOWN;
m_lt = nullptr;
m_complete_r = 0;
m_state = state::UNINITIALIZED;
m_info = nullptr;
// psergey-todo: this condition is for interruptible wait
// note: moved to here from lock_request::create:
toku_external_cond_init(mutex_factory, &m_wait_cond);
m_start_test_callback = nullptr;
m_start_before_pending_test_callback = nullptr;
m_retry_test_callback = nullptr;
}
// destroy a lock request.
void lock_request::destroy(void) {
invariant(m_state != state::PENDING);
invariant(m_state != state::DESTROYED);
m_state = state::DESTROYED;
toku_destroy_dbt(&m_left_key_copy);
toku_destroy_dbt(&m_right_key_copy);
toku_external_cond_destroy(&m_wait_cond);
}
// set the lock request parameters. this API allows a lock request to be reused.
void lock_request::set(locktree *lt, TXNID txnid, const DBT *left_key,
const DBT *right_key, lock_request::type lock_type,
bool big_txn, void *extra) {
invariant(m_state != state::PENDING);
m_lt = lt;
m_txnid = txnid;
m_left_key = left_key;
m_right_key = right_key;
toku_destroy_dbt(&m_left_key_copy);
toku_destroy_dbt(&m_right_key_copy);
m_type = lock_type;
m_state = state::INITIALIZED;
m_info = lt ? lt->get_lock_request_info() : nullptr;
m_big_txn = big_txn;
m_extra = extra;
}
// get rid of any stored left and right key copies and
// replace them with copies of the given left and right key
void lock_request::copy_keys() {
if (!toku_dbt_is_infinite(m_left_key)) {
toku_clone_dbt(&m_left_key_copy, *m_left_key);
m_left_key = &m_left_key_copy;
}
if (!toku_dbt_is_infinite(m_right_key)) {
toku_clone_dbt(&m_right_key_copy, *m_right_key);
m_right_key = &m_right_key_copy;
}
}
// what are the conflicts for this pending lock request?
void lock_request::get_conflicts(txnid_set *conflicts) {
invariant(m_state == state::PENDING);
const bool is_write_request = m_type == type::WRITE;
m_lt->get_conflicts(is_write_request, m_txnid, m_left_key, m_right_key,
conflicts);
}
// build a wait-for-graph for this lock request and the given conflict set
// for each transaction B that blocks A's lock request
// if B is blocked then
// add (A,T) to the WFG and if B is new, fill in the WFG from B
void lock_request::build_wait_graph(wfg *wait_graph,
const txnid_set &conflicts) {
uint32_t num_conflicts = conflicts.size();
for (uint32_t i = 0; i < num_conflicts; i++) {
TXNID conflicting_txnid = conflicts.get(i);
lock_request *conflicting_request = find_lock_request(conflicting_txnid);
invariant(conflicting_txnid != m_txnid);
invariant(conflicting_request != this);
if (conflicting_request) {
bool already_exists = wait_graph->node_exists(conflicting_txnid);
wait_graph->add_edge(m_txnid, conflicting_txnid);
if (!already_exists) {
// recursively build the wait for graph rooted at the conflicting
// request, given its set of lock conflicts.
txnid_set other_conflicts;
other_conflicts.create();
conflicting_request->get_conflicts(&other_conflicts);
conflicting_request->build_wait_graph(wait_graph, other_conflicts);
other_conflicts.destroy();
}
}
}
}
// returns: true if the current set of lock requests contains
// a deadlock, false otherwise.
bool lock_request::deadlock_exists(const txnid_set &conflicts) {
wfg wait_graph;
wait_graph.create();
build_wait_graph(&wait_graph, conflicts);
std::function<void(TXNID)> reporter;
if (m_deadlock_cb) {
reporter = [this](TXNID a) {
lock_request *req = find_lock_request(a);
if (req) {
m_deadlock_cb(req->m_txnid, (req->m_type == lock_request::WRITE),
req->m_left_key, req->m_right_key);
}
};
}
bool deadlock = wait_graph.cycle_exists_from_txnid(m_txnid, reporter);
wait_graph.destroy();
return deadlock;
}
// try to acquire a lock described by this lock request.
int lock_request::start(void) {
int r;
txnid_set conflicts;
conflicts.create();
if (m_type == type::WRITE) {
r = m_lt->acquire_write_lock(m_txnid, m_left_key, m_right_key, &conflicts,
m_big_txn);
} else {
invariant(m_type == type::READ);
r = m_lt->acquire_read_lock(m_txnid, m_left_key, m_right_key, &conflicts,
m_big_txn);
}
// if the lock is not granted, save it to the set of lock requests
// and check for a deadlock. if there is one, complete it as failed
if (r == DB_LOCK_NOTGRANTED) {
copy_keys();
m_state = state::PENDING;
m_start_time = toku_current_time_microsec() / 1000;
m_conflicting_txnid = conflicts.get(0);
if (m_start_before_pending_test_callback)
m_start_before_pending_test_callback();
toku_external_mutex_lock(&m_info->mutex);
insert_into_lock_requests();
if (deadlock_exists(conflicts)) {
remove_from_lock_requests();
r = DB_LOCK_DEADLOCK;
}
toku_external_mutex_unlock(&m_info->mutex);
if (m_start_test_callback) m_start_test_callback(); // test callback
}
if (r != DB_LOCK_NOTGRANTED) {
complete(r);
}
conflicts.destroy();
return r;
}
// sleep on the lock request until it becomes resolved or the wait time has
// elapsed.
int lock_request::wait(uint64_t wait_time_ms) {
return wait(wait_time_ms, 0, nullptr);
}
int lock_request::wait(uint64_t wait_time_ms, uint64_t killed_time_ms,
int (*killed_callback)(void),
void (*lock_wait_callback)(void *, lock_wait_infos *),
void *callback_arg) {
uint64_t t_now = toku_current_time_microsec();
uint64_t t_start = t_now;
uint64_t t_end = t_start + wait_time_ms * 1000;
toku_external_mutex_lock(&m_info->mutex);
// check again, this time locking out other retry calls
if (m_state == state::PENDING) {
lock_wait_infos conflicts_collector;
retry(&conflicts_collector);
if (m_state == state::PENDING) {
report_waits(&conflicts_collector, lock_wait_callback, callback_arg);
}
}
while (m_state == state::PENDING) {
// check if this thread is killed
if (killed_callback && killed_callback()) {
remove_from_lock_requests();
complete(DB_LOCK_NOTGRANTED);
continue;
}
// compute the time until we should wait
uint64_t t_wait;
if (killed_time_ms == 0) {
t_wait = t_end;
} else {
t_wait = t_now + killed_time_ms * 1000;
if (t_wait > t_end) t_wait = t_end;
}
int r = toku_external_cond_timedwait(&m_wait_cond, &m_info->mutex,
(int64_t)(t_wait - t_now));
invariant(r == 0 || r == ETIMEDOUT);
t_now = toku_current_time_microsec();
if (m_state == state::PENDING && (t_now >= t_end)) {
m_info->counters.timeout_count += 1;
// if we're still pending and we timed out, then remove our
// request from the set of lock requests and fail.
remove_from_lock_requests();
// complete sets m_state to COMPLETE, breaking us out of the loop
complete(DB_LOCK_NOTGRANTED);
}
}
uint64_t t_real_end = toku_current_time_microsec();
uint64_t duration = t_real_end - t_start;
m_info->counters.wait_count += 1;
m_info->counters.wait_time += duration;
if (duration >= 1000000) {
m_info->counters.long_wait_count += 1;
m_info->counters.long_wait_time += duration;
}
toku_external_mutex_unlock(&m_info->mutex);
invariant(m_state == state::COMPLETE);
return m_complete_r;
}
// complete this lock request with the given return value
void lock_request::complete(int complete_r) {
m_complete_r = complete_r;
m_state = state::COMPLETE;
}
const DBT *lock_request::get_left_key(void) const { return m_left_key; }
const DBT *lock_request::get_right_key(void) const { return m_right_key; }
TXNID lock_request::get_txnid(void) const { return m_txnid; }
uint64_t lock_request::get_start_time(void) const { return m_start_time; }
TXNID lock_request::get_conflicting_txnid(void) const {
return m_conflicting_txnid;
}
int lock_request::retry(lock_wait_infos *conflicts_collector) {
invariant(m_state == state::PENDING);
int r;
txnid_set conflicts;
conflicts.create();
if (m_type == type::WRITE) {
r = m_lt->acquire_write_lock(m_txnid, m_left_key, m_right_key, &conflicts,
m_big_txn);
} else {
r = m_lt->acquire_read_lock(m_txnid, m_left_key, m_right_key, &conflicts,
m_big_txn);
}
// if the acquisition succeeded then remove ourselves from the
// set of lock requests, complete, and signal the waiting thread.
if (r == 0) {
remove_from_lock_requests();
complete(r);
if (m_retry_test_callback) m_retry_test_callback(); // test callback
toku_external_cond_broadcast(&m_wait_cond);
} else {
m_conflicting_txnid = conflicts.get(0);
add_conflicts_to_waits(&conflicts, conflicts_collector);
}
conflicts.destroy();
return r;
}
void lock_request::retry_all_lock_requests(
locktree *lt, void (*lock_wait_callback)(void *, lock_wait_infos *),
void *callback_arg, void (*after_retry_all_test_callback)(void)) {
lt_lock_request_info *info = lt->get_lock_request_info();
// if there are no pending lock requests than there is nothing to do
// the unlocked data race on pending_is_empty is OK since lock requests
// are retried after added to the pending set.
if (info->pending_is_empty) return;
// get my retry generation (post increment of retry_want)
unsigned long long my_retry_want = (info->retry_want += 1);
toku_mutex_lock(&info->retry_mutex);
lock_wait_infos conflicts_collector;
// here is the group retry algorithm.
// get the latest retry_want count and use it as the generation number of
// this retry operation. if this retry generation is > the last retry
// generation, then do the lock retries. otherwise, no lock retries
// are needed.
if ((my_retry_want - 1) == info->retry_done) {
for (;;) {
if (!info->running_retry) {
info->running_retry = true;
info->retry_done = info->retry_want;
toku_mutex_unlock(&info->retry_mutex);
retry_all_lock_requests_info(info, &conflicts_collector);
if (after_retry_all_test_callback) after_retry_all_test_callback();
toku_mutex_lock(&info->retry_mutex);
info->running_retry = false;
toku_cond_broadcast(&info->retry_cv);
break;
} else {
toku_cond_wait(&info->retry_cv, &info->retry_mutex);
}
}
}
toku_mutex_unlock(&info->retry_mutex);
report_waits(&conflicts_collector, lock_wait_callback, callback_arg);
}
void lock_request::retry_all_lock_requests_info(lt_lock_request_info *info,
lock_wait_infos *collector) {
toku_external_mutex_lock(&info->mutex);
// retry all of the pending lock requests.
for (uint32_t i = 0; i < info->pending_lock_requests.size();) {
lock_request *request;
int r = info->pending_lock_requests.fetch(i, &request);
invariant_zero(r);
// retry the lock request. if it didn't succeed,
// move on to the next lock request. otherwise
// the request is gone from the list so we may
// read the i'th entry for the next one.
r = request->retry(collector);
if (r != 0) {
i++;
}
}
// future threads should only retry lock requests if some still exist
info->should_retry_lock_requests = info->pending_lock_requests.size() > 0;
toku_external_mutex_unlock(&info->mutex);
}
void lock_request::add_conflicts_to_waits(txnid_set *conflicts,
lock_wait_infos *wait_conflicts) {
wait_conflicts->push_back({m_lt, get_txnid(), m_extra, {}});
uint32_t num_conflicts = conflicts->size();
for (uint32_t i = 0; i < num_conflicts; i++) {
wait_conflicts->back().waitees.push_back(conflicts->get(i));
}
}
void lock_request::report_waits(lock_wait_infos *wait_conflicts,
void (*lock_wait_callback)(void *,
lock_wait_infos *),
void *callback_arg) {
if (lock_wait_callback) (*lock_wait_callback)(callback_arg, wait_conflicts);
}
void *lock_request::get_extra(void) const { return m_extra; }
void lock_request::kill_waiter(void) {
remove_from_lock_requests();
complete(DB_LOCK_NOTGRANTED);
toku_external_cond_broadcast(&m_wait_cond);
}
void lock_request::kill_waiter(locktree *lt, void *extra) {
lt_lock_request_info *info = lt->get_lock_request_info();
toku_external_mutex_lock(&info->mutex);
for (uint32_t i = 0; i < info->pending_lock_requests.size(); i++) {
lock_request *request;
int r = info->pending_lock_requests.fetch(i, &request);
if (r == 0 && request->get_extra() == extra) {
request->kill_waiter();
break;
}
}
toku_external_mutex_unlock(&info->mutex);
}
// find another lock request by txnid. must hold the mutex.
lock_request *lock_request::find_lock_request(const TXNID &txnid) {
lock_request *request;
int r = m_info->pending_lock_requests.find_zero<TXNID, find_by_txnid>(
txnid, &request, nullptr);
if (r != 0) {
request = nullptr;
}
return request;
}
// insert this lock request into the locktree's set. must hold the mutex.
void lock_request::insert_into_lock_requests(void) {
uint32_t idx;
lock_request *request;
int r = m_info->pending_lock_requests.find_zero<TXNID, find_by_txnid>(
m_txnid, &request, &idx);
invariant(r == DB_NOTFOUND);
r = m_info->pending_lock_requests.insert_at(this, idx);
invariant_zero(r);
m_info->pending_is_empty = false;
}
// remove this lock request from the locktree's set. must hold the mutex.
void lock_request::remove_from_lock_requests(void) {
uint32_t idx;
lock_request *request;
int r = m_info->pending_lock_requests.find_zero<TXNID, find_by_txnid>(
m_txnid, &request, &idx);
invariant_zero(r);
invariant(request == this);
r = m_info->pending_lock_requests.delete_at(idx);
invariant_zero(r);
if (m_info->pending_lock_requests.size() == 0)
m_info->pending_is_empty = true;
}
int lock_request::find_by_txnid(lock_request *const &request,
const TXNID &txnid) {
TXNID request_txnid = request->m_txnid;
if (request_txnid < txnid) {
return -1;
} else if (request_txnid == txnid) {
return 0;
} else {
return 1;
}
}
void lock_request::set_start_test_callback(void (*f)(void)) {
m_start_test_callback = f;
}
void lock_request::set_start_before_pending_test_callback(void (*f)(void)) {
m_start_before_pending_test_callback = f;
}
void lock_request::set_retry_test_callback(void (*f)(void)) {
m_retry_test_callback = f;
}
} /* namespace toku */
#endif // OS_WIN
#endif // ROCKSDB_LITE
|
36366948c38eb68a55eec2d76182a20ecdbd2492
|
c26ad913f9408b0cf713fcac1e9071727db87a37
|
/codeforces/50/A.cpp
|
a955853324f95d831f07ee70f7f1e333864ad1d5
|
[] |
no_license
|
anuragjha8/Codeforces
|
40fe895b09b57f07a96528c71a0d66d33804f488
|
7805cadf24d3830d074864a6540bb959a065a63e
|
refs/heads/master
| 2023-02-19T06:07:27.821578
| 2020-08-22T12:06:00
| 2021-01-22T06:09:49
| 331,848,407
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 141
|
cpp
|
A.cpp
|
#include <iostream>
using namespace std;
int main() {
int m,n;
cin >> m>>n;
int l=m*n;
if(l%2==1)
l=l-1;
l=l/2;
cout<<l;
return 0;
}
|
fad6d3d42eb8d0a73eec495b44a86da9b40c4dce
|
797903547ae39279d998fd96ac2b77fc47c4e115
|
/GCVM.cpp
|
d7303750e194be615cba3e9092c96d50c67c5496
|
[] |
no_license
|
agsilvarafael/ImplementacaoTCC
|
4022c728bf3b7d563cd6b475afe1db1675911bff
|
4d20ea47d57d3f85f36e247b368af016a580af67
|
refs/heads/master
| 2020-12-10T18:37:59.793384
| 2020-01-14T12:30:03
| 2020-01-14T12:30:03
| 233,674,687
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,291
|
cpp
|
GCVM.cpp
|
#include<bits/stdc++.h>
using namespace std;
class Grafo {
public:
int qtdArestas;
int qtdVertices;
vector<pair<int,int>> arestas;
Grafo(){
string s;
int a,b;
//Ler comentarios ate encontrar o "p"
cin >> s;
while(s.compare("p")!=0){
cin >> s;
}
//Ler nome do grafo
cin >> s;
//Ler qtd de vertices
cin >> s;
qtdVertices = stoi(s);
//Ler qtd de arestas
cin >> s;
qtdArestas = stoi(s);
//Ler arestas
for(int i = 0; i<qtdArestas; i++){
//Ler o "e"
cin >> s;
while(s.compare("e")!=0){
cin >> s;
}
//Ler o primeiro vertice
cin >> s;
a = stoi(s);
//Ler o segundo vertice
cin >> s;
b = stoi(s);
arestas.push_back({a,b});
}
}
};
Grafo g;
vector<bool> v_in_C;
vector<bool> melhor_C;
int solucao_melhor_C = INT32_MAX;
int indice_melhor_troca = 0;
int melhor_solucao = INT32_MAX;
int solucao_atual;
int melhor_qtd_iter;
int solucao() {
int sum = 0;
//aumenta o custo em 1 para cada vertice na cobertura.
for (int i = 0; i < g.qtdVertices; i++) {
if(v_in_C[i]){
sum ++;
}
}
for (int i = 0; i < g.qtdArestas; i++) {
//verificando se nenhum dos vertices da aresta esta na cobertura.
if(!v_in_C[g.arestas[i].first-1] && !v_in_C[g.arestas[i].second-1]){
//aumenta o custo em |V| para cada aresta nao coberta
sum += g.qtdVertices;
}
}
return sum;
}
bool randBool() {
return rand()%2>0;
}
//Passar qtd de iteracoes e qtd de tentativas
int main(int argc, char const *argv[])
{
//Grafo g ja foi criado globalmente. O construtor existente le o grafo da entrada
clock_t start = clock();
int qtd_iter = atoi(argv[1]);
int qtd_tentativas = atoi(argv[2]);
srand (time(NULL));
//Criando cobertura aleatoria
for (int i = 0; i < g.qtdVertices; i++)
{
v_in_C.push_back(randBool());
}
for (int tentativa = 0; tentativa < qtd_tentativas; tentativa++)
{
melhor_solucao = INT32_MAX;
int iteracao = 0;
for (; iteracao < qtd_iter; iteracao++)
{
indice_melhor_troca = -1;
for (int i = 0; i < g.qtdVertices; ++i) {
//Troca o valor do vertice e testa o valor da nova cobertura
v_in_C[i] = !v_in_C[i];
solucao_atual = solucao();
if(solucao_atual<melhor_solucao){
melhor_solucao = solucao_atual;
indice_melhor_troca = i;
}
v_in_C[i] = !v_in_C[i];
}
if(indice_melhor_troca>=0){
//Troca o vertice que trara maior ganho
v_in_C[indice_melhor_troca] = !v_in_C[indice_melhor_troca];
}
else{
//melhor solucao atual ja encontrada
break;
}
}
if(solucao_melhor_C > melhor_solucao){
solucao_melhor_C = melhor_solucao;
melhor_C = v_in_C;
melhor_qtd_iter = iteracao;
}
}
int qtd_vertices = 0;
cout<< "Vertices na Cobertura:" << endl;
for (int i = 0; i < g.qtdVertices; i++) {
if(melhor_C[i]){
cout<< i+1 <<" ";
qtd_vertices++;
}
}
cout<< "\n\nTotal de Vertices na Cobertura: "<< qtd_vertices << endl;
if(qtd_vertices!=solucao_melhor_C){
printf("\nO CONJUNTO ACIMA NAO E' UMA COBERTURA: Total de vertices != Funcao Fitness (%d != %d)\nCOBERTURA NAO ENCONTRADA!",qtd_vertices,solucao_melhor_C);
}
cout<< "\n\nQuantidade de Iteracoes para Encontrar a Cobertura: "<< melhor_qtd_iter << endl;
clock_t nowtime = clock();
double totaltime = double(nowtime - start) / CLOCKS_PER_SEC;
cout<< "\n\nTempo total: "<< totaltime << endl;
return 0;
}
|
5ce25880c3bf24125291e8c90bdd997824c3d3ed
|
65b0c79a170360edcfd7371e364e1d8e43c30340
|
/GApp.h
|
3045e3f636d8c675609672309ea726b3ba5f4802
|
[] |
no_license
|
SoylentGraham/GutGut
|
85c4a5d6008f79888fecb77158f9a3ce2b0ce81f
|
9d8a1a81258f784720f62e5cb752322721a14828
|
refs/heads/master
| 2021-01-01T05:25:13.415894
| 2016-04-13T09:58:23
| 2016-04-13T09:58:23
| 56,140,833
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,610
|
h
|
GApp.h
|
/*------------------------------------------------
GApp Header file
-------------------------------------------------*/
#ifndef __GAPP__H_
#define __GAPP__H_
// Includes
//------------------------------------------------
#include "GMain.h"
#include "GCamera.h"
#include "GMenu.h"
#include "GStats.h"
#include "GWin32.h"
#include "GDisplay.h"
#include "GString.h"
// Macros
//------------------------------------------------
#define g_App (GApp::g_pApp)
namespace GAppFlags
{
const u32 QuitApp = 1<<0;
const u32 SyncFrames = 1<<1;
const u32 Win32Wait = 1<<2; // if set, we dont do an update every frame, we wait for windows messages
const u32 Default = 0x0;
};
// Types
//------------------------------------------------
class GMenuItem;
class GMenuSubMenu;
class GWinControl;
class GWinTreeView;
class GWinTreeItem;
class GApp
{
public:
static GApp* g_pApp;
static HINSTANCE g_HInstance;
static GString g_AppPath; // base path for files (usually exe's path)
static GString g_AppFilename; // app's original exe/dll filename
static GString g_AppParams; // program arguments
static Bool SetAppPath(GString& Path); // pass in exe or dll file and this will extract the path
static Bool SetAppFilename(GString& Filename); // set app's filename
static Bool SetAppParams(GString& Params); // set app's params
public:
u32 m_AppFlags; // GAppFlags
GStats m_Stats;
GDisplay m_Display;
float m_SlowMotionModifier; // 1.f is regular FrameDelta, use to speedup/slowdown physics
protected:
GWindow* m_pWindow;
public:
GApp();
~GApp();
Bool Init();
Bool DllInit(); // init without the display
Bool Update();
void Draw();
inline void QuitGame() { m_AppFlags |= GAppFlags::QuitApp; };
void Shutdown();
inline float FrameDelta() { return m_Stats.m_FrameDelta * m_SlowMotionModifier; }; // sum in a second adds to 1
inline float FrameDelta60() { return FrameDelta() * 60.f; }; // sum in a second adds to 60
// game code
virtual Bool GameInit() { return TRUE; }; // first initialisation
virtual Bool GameDisplayInit() { return TRUE; }; // post display creation initialisation (Create controls etc)
virtual Bool GameUpdate() { return TRUE; }; // regular update
virtual void GameDraw() { };
virtual void GameDestroy() { };
virtual const char* GameName() { return "GutGut App"; }; // basic description, used for title bars etc
virtual const char* GameDescription() { return "Base GutGut App"; }; // longer description, used for DLL descriptions
// win32
inline GWindow* Window() { return m_pWindow; };
virtual Bool CreateAppWindow() { m_pWindow = new GAppWindow; return TRUE; };
inline HWND Hwnd() { return Window()->Hwnd(); };
virtual void OnMove() { }; // called after resize, m_ClientSize has been updated
virtual void OnResize() { }; // called after resize, m_ClientSize has been updated
virtual int HandleMessage(u32 message, WPARAM wParam, LPARAM lParam) { return 0; }; // message has been sent to this control matching the hwnd
virtual void OnMenuClick(GMenuItem* pMenuItem) { };
virtual void OnMenuPopup(GMenuSubMenu* pSubMenu) { };
virtual GMenuSubMenu* GetSubMenu( HMENU HMenu ) { return NULL; };
virtual GMenuItem* GetMenuItem( u16 ItemID ) { return NULL; };
};
// Declarations
//------------------------------------------------
// Inline Definitions
//-------------------------------------------------
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.