From 332ba8302d944dccc8272fedc3258bb840b5d5e2 Mon Sep 17 00:00:00 2001 From: jackson4800 Date: Sun, 6 Oct 2019 09:35:14 +0400 Subject: [PATCH] cpp solution --- CodeBattleCPP/CodeBattleCpp.sln | 20 +- CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.cpp | 53 - .../CodeBattleCpp/CodeBattleCpp.vcxproj | 41 +- .../CodeBattleCpp.vcxproj.filters | 55 +- CodeBattleCPP/CodeBattleCpp/client.cpp | 107 + CodeBattleCPP/CodeBattleCpp/client.hpp | 88 + .../easywsclient/easywsclient.cpp | 0 .../easywsclient/easywsclient.hpp | 0 CodeBattleCPP/CodeBattleCpp/game_board.cpp | 158 + CodeBattleCPP/CodeBattleCpp/game_board.hpp | 45 + CodeBattleCPP/CodeBattleCpp/graphics.cpp | 188 + CodeBattleCPP/CodeBattleCpp/graphics.hpp | 34 + CodeBattleCPP/CodeBattleCpp/json.hpp | 20842 ++++++++++++++++ CodeBattleCPP/CodeBattleCpp/main.cpp | 35 + .../CodeBattleCpp/player_command.hpp | 13 + .../CodeBattleCpp/resources/brick.png | Bin 0 -> 190 bytes .../CodeBattleCpp/resources/cement.png | Bin 0 -> 847 bytes .../CodeBattleCpp/resources/drill_pit.png | Bin 0 -> 245 bytes .../CodeBattleCpp/resources/enemy_ladder.png | Bin 0 -> 345 bytes .../CodeBattleCpp/resources/enemy_left.png | Bin 0 -> 282 bytes .../resources/enemy_pipe_left.png | Bin 0 -> 333 bytes .../resources/enemy_pipe_right.png | Bin 0 -> 336 bytes .../CodeBattleCpp/resources/enemy_pit.png | Bin 0 -> 302 bytes .../CodeBattleCpp/resources/enemy_right.png | Bin 0 -> 238 bytes CodeBattleCPP/CodeBattleCpp/resources/ent.png | Bin 0 -> 159 bytes .../CodeBattleCpp/resources/gold.png | Bin 0 -> 289 bytes .../CodeBattleCpp/resources/hero_die.png | Bin 0 -> 355 bytes .../resources/hero_drill_left.png | Bin 0 -> 342 bytes .../resources/hero_drill_right.png | Bin 0 -> 340 bytes .../resources/hero_fall_left.png | Bin 0 -> 341 bytes .../resources/hero_fall_right.png | Bin 0 -> 334 bytes .../CodeBattleCpp/resources/hero_ladder.png | Bin 0 -> 386 bytes .../CodeBattleCpp/resources/hero_left.png | Bin 0 -> 325 bytes .../resources/hero_pipe_left.png | Bin 0 -> 370 bytes .../resources/hero_pipe_right.png | Bin 0 -> 368 bytes .../CodeBattleCpp/resources/hero_right.png | Bin 0 -> 327 bytes .../resources/hero_shadow_drill_left.png | Bin 0 -> 337 bytes .../resources/hero_shadow_drill_right.png | Bin 0 -> 343 bytes .../resources/hero_shadow_fall_left.png | Bin 0 -> 330 bytes .../resources/hero_shadow_fall_right.png | Bin 0 -> 327 bytes .../resources/hero_shadow_ladder.png | Bin 0 -> 384 bytes .../resources/hero_shadow_left.png | Bin 0 -> 330 bytes .../resources/hero_shadow_pipe_left.png | Bin 0 -> 353 bytes .../resources/hero_shadow_pipe_right.png | Bin 0 -> 356 bytes .../resources/hero_shadow_right.png | Bin 0 -> 327 bytes .../CodeBattleCpp/resources/ladder.png | Bin 0 -> 227 bytes .../CodeBattleCpp/resources/none.png | Bin 0 -> 141 bytes .../resources/other_hero_die.png | Bin 0 -> 349 bytes .../resources/other_hero_ladder.png | Bin 0 -> 397 bytes .../resources/other_hero_left.png | Bin 0 -> 316 bytes .../resources/other_hero_pipe_left.png | Bin 0 -> 360 bytes .../resources/other_hero_pipe_right.png | Bin 0 -> 350 bytes .../resources/other_hero_right.png | Bin 0 -> 327 bytes .../CodeBattleCpp/resources/pipe.png | Bin 0 -> 158 bytes .../CodeBattleCpp/resources/pit_fill_1.png | Bin 0 -> 231 bytes .../CodeBattleCpp/resources/pit_fill_2.png | Bin 0 -> 205 bytes .../CodeBattleCpp/resources/pit_fill_3.png | Bin 0 -> 204 bytes .../CodeBattleCpp/resources/pit_fill_4.png | Bin 0 -> 197 bytes .../CodeBattleCpp/resources/slide.png | Bin 0 -> 173 bytes .../resources/the_shadow_pill.png | Bin 0 -> 823 bytes .../CodeBattleCpp/resources/treasure.png | Bin 0 -> 571 bytes .../resources/undestroyable_wall.png | Bin 0 -> 159 bytes .../CodeBattleCpp/resources/wall.png | Bin 0 -> 1263 bytes CodeBattleCPP/CodeBattleCpp/tile.hpp | 115 + CodeBattleCPP/CodeBattleCpp/vec.cpp | 45 + CodeBattleCPP/CodeBattleCpp/vec.hpp | 32 + CodeBattleCPP/CodeBattleCpp/window.cpp | 70 + CodeBattleCPP/CodeBattleCpp/window.hpp | 36 + .../CodeBattleCpp/x64/Debug/CodeBattleCpp.log | 4 - .../CodeBattleCpp/x64/Debug/CodeBattleCpp.obj | Bin 369569 -> 0 bytes .../CodeBattleCpp.tlog/CL.command.1.tlog | Bin 1558 -> 0 bytes .../Debug/CodeBattleCpp.tlog/CL.read.1.tlog | Bin 90012 -> 0 bytes .../Debug/CodeBattleCpp.tlog/CL.write.1.tlog | Bin 1142 -> 0 bytes .../CodeBattleCpp.lastbuildstate | 2 - .../CodeBattleCpp.tlog/link.command.1.tlog | Bin 2738 -> 0 bytes .../Debug/CodeBattleCpp.tlog/link.read.1.tlog | Bin 7836 -> 0 bytes .../CodeBattleCpp.tlog/link.write.1.tlog | Bin 1078 -> 0 bytes .../CodeBattleCpp/x64/Debug/vc141.idb | Bin 658432 -> 0 bytes .../CodeBattleCpp/x64/Debug/vc141.pdb | Bin 626688 -> 0 bytes .../CodeBattleCppLibrary/BoardElement.h | 41 - .../CodeBattleCppLibrary/BoardPoint.cpp | 50 - .../CodeBattleCppLibrary/BoardPoint.h | 24 - .../CodeBattleCppLibrary.vcxproj.user | 4 - .../CodeBattleCppLibrary/GameBoard.cpp | 165 - .../CodeBattleCppLibrary/GameBoard.h | 35 - .../GameClientLodeRunner.cpp | 110 - .../GameClientLodeRunner.h | 79 - .../CodeBattleCppLibrary/LoderunnerAction.h | 13 - .../CodeBatt.8F09F71F.tlog/CL.command.1.tlog | Bin 4642 -> 0 bytes .../CodeBatt.8F09F71F.tlog/CL.read.1.tlog | Bin 188990 -> 0 bytes .../CodeBatt.8F09F71F.tlog/CL.write.1.tlog | Bin 6622 -> 0 bytes .../CodeBattleCppLibrary.lastbuildstate | 2 - .../Lib-link.write.1.tlog | Bin 1234 -> 0 bytes .../CodeBatt.8F09F71F.tlog/Lib.command.1.tlog | Bin 1684 -> 0 bytes .../CodeBatt.8F09F71F.tlog/Lib.read.1.tlog | Bin 2686 -> 0 bytes .../x64/Debug/CodeBattleCppLibrary.idb | Bin 666624 -> 0 bytes .../x64/Debug/CodeBattleCppLibrary.log | 11 - .../x64/Debug/CodeBattleCppLibrary.pdb | Bin 733184 -> 0 bytes .../x64/Debug/GameClientLodeRunner.obj | Bin 606669 -> 0 bytes .../x64/Debug/easywsclient.obj | Bin 866939 -> 0 bytes CodeBattleCPP/Include/D2D1.h | 6996 ++++++ CodeBattleCPP/Include/D2D1Helper.h | 948 + CodeBattleCPP/Include/D2DBaseTypes.h | 145 + CodeBattleCPP/Include/D2Derr.h | 206 + CodeBattleCPP/Include/D3D10.h | 6723 +++++ CodeBattleCPP/Include/D3D10_1.h | 1775 ++ CodeBattleCPP/Include/D3D10_1shader.h | 301 + CodeBattleCPP/Include/D3D10effect.h | 1455 ++ CodeBattleCPP/Include/D3D10shader.h | 534 + CodeBattleCPP/Include/D3D11.h | 10227 ++++++++ CodeBattleCPP/Include/D3D11SDKLayers.h | 1669 ++ CodeBattleCPP/Include/D3D11Shader.h | 296 + CodeBattleCPP/Include/D3DCSX.h | 409 + CodeBattleCPP/Include/D3DX10.h | 72 + CodeBattleCPP/Include/D3DX10core.h | 444 + CodeBattleCPP/Include/D3DX10math.h | 1866 ++ CodeBattleCPP/Include/D3DX10math.inl | 2228 ++ CodeBattleCPP/Include/D3DX10mesh.h | 286 + CodeBattleCPP/Include/D3DX10tex.h | 766 + CodeBattleCPP/Include/D3DX11.h | 74 + CodeBattleCPP/Include/D3DX11async.h | 164 + CodeBattleCPP/Include/D3DX11core.h | 128 + CodeBattleCPP/Include/D3DX11tex.h | 772 + .../Include/D3DX_DXGIFormatConvert.inl | 800 + CodeBattleCPP/Include/D3Dcommon.h | 787 + CodeBattleCPP/Include/D3Dcompiler.h | 397 + CodeBattleCPP/Include/DWrite.h | 4995 ++++ CodeBattleCPP/Include/DXGI.h | 2901 +++ CodeBattleCPP/Include/DXGIFormat.h | 112 + CodeBattleCPP/Include/DXGIType.h | 123 + CodeBattleCPP/Include/Dcommon.h | 65 + CodeBattleCPP/Include/DxErr.h | 99 + CodeBattleCPP/Include/PIXPlugin.h | 120 + CodeBattleCPP/Include/X3DAudio.h | 316 + CodeBattleCPP/Include/XAPO.h | 645 + CodeBattleCPP/Include/XAPOBase.h | 337 + CodeBattleCPP/Include/XAPOFX.h | 167 + CodeBattleCPP/Include/XAudio2.h | 1282 + CodeBattleCPP/Include/XAudio2fx.h | 431 + CodeBattleCPP/Include/XDSP.h | 754 + CodeBattleCPP/Include/XInput.h | 283 + CodeBattleCPP/Include/audiodefs.h | 263 + CodeBattleCPP/Include/comdecl.h | 59 + CodeBattleCPP/Include/d3d10misc.h | 143 + CodeBattleCPP/Include/d3d10sdklayers.h | 1361 + CodeBattleCPP/Include/d3d9.h | 2791 +++ CodeBattleCPP/Include/d3d9caps.h | 567 + CodeBattleCPP/Include/d3d9types.h | 2416 ++ CodeBattleCPP/Include/d3dx10async.h | 290 + CodeBattleCPP/Include/d3dx9.h | 78 + CodeBattleCPP/Include/d3dx9anim.h | 1114 + CodeBattleCPP/Include/d3dx9core.h | 753 + CodeBattleCPP/Include/d3dx9effect.h | 873 + CodeBattleCPP/Include/d3dx9math.h | 1796 ++ CodeBattleCPP/Include/d3dx9math.inl | 2251 ++ CodeBattleCPP/Include/d3dx9mesh.h | 3007 +++ CodeBattleCPP/Include/d3dx9shader.h | 1010 + CodeBattleCPP/Include/d3dx9shape.h | 221 + CodeBattleCPP/Include/d3dx9tex.h | 1735 ++ CodeBattleCPP/Include/d3dx9xof.h | 299 + CodeBattleCPP/Include/dinput.h | 4417 ++++ CodeBattleCPP/Include/dinputd.h | 755 + CodeBattleCPP/Include/dsconf.h | 195 + CodeBattleCPP/Include/dsetup.h | 283 + CodeBattleCPP/Include/dsound.h | 2385 ++ CodeBattleCPP/Include/dxdiag.h | 187 + CodeBattleCPP/Include/dxfile.h | 239 + CodeBattleCPP/Include/dxsdkver.h | 18 + CodeBattleCPP/Include/gameux.h | 719 + CodeBattleCPP/Include/rmxfguid.h | 223 + CodeBattleCPP/Include/rmxftmpl.h | 339 + CodeBattleCPP/Include/rpcsal.h | 499 + CodeBattleCPP/Include/xact3.h | 1551 ++ CodeBattleCPP/Include/xact3d3.h | 275 + CodeBattleCPP/Include/xact3wb.h | 598 + CodeBattleCPP/Include/xma2defs.h | 718 + CodeBattleCPP/Include/xnamath.h | 2938 +++ CodeBattleCPP/Include/xnamathconvert.inl | 5785 +++++ CodeBattleCPP/Include/xnamathmatrix.inl | 3254 +++ CodeBattleCPP/Include/xnamathmisc.inl | 2464 ++ CodeBattleCPP/Include/xnamathvector.inl | 13279 ++++++++++ CodeBattleCPP/Lib/x86/D3DCSX.lib | Bin 0 -> 3832 bytes CodeBattleCPP/Lib/x86/D3DCSXd.lib | Bin 0 -> 3854 bytes CodeBattleCPP/Lib/x86/DxErr.lib | Bin 0 -> 5415290 bytes CodeBattleCPP/Lib/x86/X3DAudio.lib | Bin 0 -> 2016 bytes CodeBattleCPP/Lib/x86/XAPOFX.lib | Bin 0 -> 1722 bytes CodeBattleCPP/Lib/x86/XInput.lib | Bin 0 -> 3432 bytes CodeBattleCPP/Lib/x86/d2d1.lib | Bin 0 -> 2664 bytes CodeBattleCPP/Lib/x86/d3d10.lib | Bin 0 -> 9272 bytes CodeBattleCPP/Lib/x86/d3d10_1.lib | Bin 0 -> 9360 bytes CodeBattleCPP/Lib/x86/d3d11.lib | Bin 0 -> 14362 bytes CodeBattleCPP/Lib/x86/d3d9.lib | Bin 0 -> 5210 bytes CodeBattleCPP/Lib/x86/d3dcompiler.lib | Bin 0 -> 6062 bytes CodeBattleCPP/Lib/x86/d3dx10.lib | Bin 0 -> 48486 bytes CodeBattleCPP/Lib/x86/d3dx10d.lib | Bin 0 -> 48890 bytes CodeBattleCPP/Lib/x86/d3dx11.lib | Bin 0 -> 14636 bytes CodeBattleCPP/Lib/x86/d3dx11d.lib | Bin 0 -> 14908 bytes CodeBattleCPP/Lib/x86/d3dx9.lib | Bin 0 -> 87600 bytes CodeBattleCPP/Lib/x86/d3dx9d.lib | Bin 0 -> 87926 bytes CodeBattleCPP/Lib/x86/d3dxof.lib | Bin 0 -> 1746 bytes CodeBattleCPP/Lib/x86/dinput8.lib | Bin 0 -> 284368 bytes CodeBattleCPP/Lib/x86/dsetup.lib | Bin 0 -> 5994 bytes CodeBattleCPP/Lib/x86/dsound.lib | Bin 0 -> 4038 bytes CodeBattleCPP/Lib/x86/dwrite.lib | Bin 0 -> 1758 bytes CodeBattleCPP/Lib/x86/dxgi.lib | Bin 0 -> 3580 bytes CodeBattleCPP/Lib/x86/dxguid.lib | Bin 0 -> 896294 bytes CodeBattleCPP/Lib/x86/xapobase.lib | Bin 0 -> 623810 bytes CodeBattleCPP/Lib/x86/xapobased.lib | Bin 0 -> 846528 bytes CodeBattleCPP/README.md | 23 +- CodeBattleCPP/x64/Debug/CodeBattleCpp.exe | Bin 361984 -> 1010176 bytes CodeBattleCPP/x64/Debug/CodeBattleCpp.ilk | Bin 1792624 -> 3183072 bytes CodeBattleCPP/x64/Debug/CodeBattleCpp.pdb | Bin 1806336 -> 2895872 bytes .../x64/Debug/CodeBattleCppLibrary.lib | Bin 2152822 -> 0 bytes .../x64/Debug/CodeBattleCppLibrary.pdb | Bin 733184 -> 0 bytes code_battle_dp/.gitkeep | 0 code_battle_dp/CodeBattleCpp.sln | 31 + .../CodeBattleCpp/CodeBattleCpp.vcxproj | 101 +- .../CodeBattleCpp.vcxproj.filters | 68 +- .../CodeBattleCpp}/LodeRunnerBlocks.h | 0 .../CodeBattleCpp}/PlayerAction.h | 0 code_battle_dp/CodeBattleCpp/client.cpp | 112 + code_battle_dp/CodeBattleCpp/client.hpp | 91 + .../easywsclient/easywsclient.cpp | 526 + .../easywsclient/easywsclient.hpp | 72 + code_battle_dp/CodeBattleCpp/game_board.cpp | 395 + code_battle_dp/CodeBattleCpp/game_board.hpp | 54 + code_battle_dp/CodeBattleCpp/graphics.cpp | 188 + code_battle_dp/CodeBattleCpp/graphics.hpp | 34 + .../CodeBattleCpp/interpolation.cpp | 106 + .../CodeBattleCpp/interpolation.hpp | 33 + code_battle_dp/CodeBattleCpp/json.hpp | 20842 ++++++++++++++++ code_battle_dp/CodeBattleCpp/main.cpp | 35 + .../CodeBattleCpp/player_command.hpp | 13 + .../CodeBattleCpp/resources/brick.png | Bin 0 -> 190 bytes .../CodeBattleCpp/resources/cement.png | Bin 0 -> 847 bytes .../CodeBattleCpp/resources/drill_pit.png | Bin 0 -> 245 bytes .../CodeBattleCpp/resources/enemy_ladder.png | Bin 0 -> 345 bytes .../CodeBattleCpp/resources/enemy_left.png | Bin 0 -> 282 bytes .../resources/enemy_pipe_left.png | Bin 0 -> 333 bytes .../resources/enemy_pipe_right.png | Bin 0 -> 336 bytes .../CodeBattleCpp/resources/enemy_pit.png | Bin 0 -> 302 bytes .../CodeBattleCpp/resources/enemy_right.png | Bin 0 -> 238 bytes .../CodeBattleCpp/resources/ent.png | Bin 0 -> 159 bytes .../CodeBattleCpp/resources/gold.png | Bin 0 -> 289 bytes .../CodeBattleCpp/resources/hero_die.png | Bin 0 -> 355 bytes .../resources/hero_drill_left.png | Bin 0 -> 342 bytes .../resources/hero_drill_right.png | Bin 0 -> 340 bytes .../resources/hero_fall_left.png | Bin 0 -> 341 bytes .../resources/hero_fall_right.png | Bin 0 -> 334 bytes .../CodeBattleCpp/resources/hero_ladder.png | Bin 0 -> 386 bytes .../CodeBattleCpp/resources/hero_left.png | Bin 0 -> 325 bytes .../resources/hero_pipe_left.png | Bin 0 -> 370 bytes .../resources/hero_pipe_right.png | Bin 0 -> 368 bytes .../CodeBattleCpp/resources/hero_right.png | Bin 0 -> 327 bytes .../resources/hero_shadow_drill_left.png | Bin 0 -> 337 bytes .../resources/hero_shadow_drill_right.png | Bin 0 -> 343 bytes .../resources/hero_shadow_fall_left.png | Bin 0 -> 330 bytes .../resources/hero_shadow_fall_right.png | Bin 0 -> 327 bytes .../resources/hero_shadow_ladder.png | Bin 0 -> 384 bytes .../resources/hero_shadow_left.png | Bin 0 -> 330 bytes .../resources/hero_shadow_pipe_left.png | Bin 0 -> 353 bytes .../resources/hero_shadow_pipe_right.png | Bin 0 -> 356 bytes .../resources/hero_shadow_right.png | Bin 0 -> 327 bytes .../CodeBattleCpp/resources/ladder.png | Bin 0 -> 227 bytes .../CodeBattleCpp/resources/none.png | Bin 0 -> 141 bytes .../resources/other_hero_die.png | Bin 0 -> 349 bytes .../resources/other_hero_ladder.png | Bin 0 -> 397 bytes .../resources/other_hero_left.png | Bin 0 -> 316 bytes .../resources/other_hero_pipe_left.png | Bin 0 -> 360 bytes .../resources/other_hero_pipe_right.png | Bin 0 -> 350 bytes .../resources/other_hero_right.png | Bin 0 -> 327 bytes .../CodeBattleCpp/resources/pipe.png | Bin 0 -> 158 bytes .../CodeBattleCpp/resources/pit_fill_1.png | Bin 0 -> 231 bytes .../CodeBattleCpp/resources/pit_fill_2.png | Bin 0 -> 205 bytes .../CodeBattleCpp/resources/pit_fill_3.png | Bin 0 -> 204 bytes .../CodeBattleCpp/resources/pit_fill_4.png | Bin 0 -> 197 bytes .../CodeBattleCpp/resources/slide.png | Bin 0 -> 173 bytes .../resources/the_shadow_pill.png | Bin 0 -> 823 bytes .../CodeBattleCpp/resources/treasure.png | Bin 0 -> 571 bytes .../resources/undestroyable_wall.png | Bin 0 -> 159 bytes .../CodeBattleCpp/resources/wall.png | Bin 0 -> 1263 bytes code_battle_dp/CodeBattleCpp/tile.hpp | 121 + code_battle_dp/CodeBattleCpp/vec.cpp | 45 + code_battle_dp/CodeBattleCpp/vec.hpp | 32 + code_battle_dp/CodeBattleCpp/window.cpp | 70 + code_battle_dp/CodeBattleCpp/window.hpp | 36 + code_battle_dp/Include/D2D1.h | 6996 ++++++ code_battle_dp/Include/D2D1Helper.h | 948 + code_battle_dp/Include/D2DBaseTypes.h | 145 + code_battle_dp/Include/D2Derr.h | 206 + code_battle_dp/Include/D3D10.h | 6723 +++++ code_battle_dp/Include/D3D10_1.h | 1775 ++ code_battle_dp/Include/D3D10_1shader.h | 301 + code_battle_dp/Include/D3D10effect.h | 1455 ++ code_battle_dp/Include/D3D10shader.h | 534 + code_battle_dp/Include/D3D11.h | 10227 ++++++++ code_battle_dp/Include/D3D11SDKLayers.h | 1669 ++ code_battle_dp/Include/D3D11Shader.h | 296 + code_battle_dp/Include/D3DCSX.h | 409 + code_battle_dp/Include/D3DX10.h | 72 + code_battle_dp/Include/D3DX10core.h | 444 + code_battle_dp/Include/D3DX10math.h | 1866 ++ code_battle_dp/Include/D3DX10math.inl | 2228 ++ code_battle_dp/Include/D3DX10mesh.h | 286 + code_battle_dp/Include/D3DX10tex.h | 766 + code_battle_dp/Include/D3DX11.h | 74 + code_battle_dp/Include/D3DX11async.h | 164 + code_battle_dp/Include/D3DX11core.h | 128 + code_battle_dp/Include/D3DX11tex.h | 772 + .../Include/D3DX_DXGIFormatConvert.inl | 800 + code_battle_dp/Include/D3Dcommon.h | 787 + code_battle_dp/Include/D3Dcompiler.h | 397 + code_battle_dp/Include/DWrite.h | 4995 ++++ code_battle_dp/Include/DXGI.h | 2901 +++ code_battle_dp/Include/DXGIFormat.h | 112 + code_battle_dp/Include/DXGIType.h | 123 + code_battle_dp/Include/Dcommon.h | 65 + code_battle_dp/Include/DxErr.h | 99 + code_battle_dp/Include/PIXPlugin.h | 120 + code_battle_dp/Include/X3DAudio.h | 316 + code_battle_dp/Include/XAPO.h | 645 + code_battle_dp/Include/XAPOBase.h | 337 + code_battle_dp/Include/XAPOFX.h | 167 + code_battle_dp/Include/XAudio2.h | 1282 + code_battle_dp/Include/XAudio2fx.h | 431 + code_battle_dp/Include/XDSP.h | 754 + code_battle_dp/Include/XInput.h | 283 + code_battle_dp/Include/audiodefs.h | 263 + code_battle_dp/Include/comdecl.h | 59 + code_battle_dp/Include/d3d10misc.h | 143 + code_battle_dp/Include/d3d10sdklayers.h | 1361 + code_battle_dp/Include/d3d9.h | 2791 +++ code_battle_dp/Include/d3d9caps.h | 567 + code_battle_dp/Include/d3d9types.h | 2416 ++ code_battle_dp/Include/d3dx10async.h | 290 + code_battle_dp/Include/d3dx9.h | 78 + code_battle_dp/Include/d3dx9anim.h | 1114 + code_battle_dp/Include/d3dx9core.h | 753 + code_battle_dp/Include/d3dx9effect.h | 873 + code_battle_dp/Include/d3dx9math.h | 1796 ++ code_battle_dp/Include/d3dx9math.inl | 2251 ++ code_battle_dp/Include/d3dx9mesh.h | 3007 +++ code_battle_dp/Include/d3dx9shader.h | 1010 + code_battle_dp/Include/d3dx9shape.h | 221 + code_battle_dp/Include/d3dx9tex.h | 1735 ++ code_battle_dp/Include/d3dx9xof.h | 299 + code_battle_dp/Include/dinput.h | 4417 ++++ code_battle_dp/Include/dinputd.h | 755 + code_battle_dp/Include/dsconf.h | 195 + code_battle_dp/Include/dsetup.h | 283 + code_battle_dp/Include/dsound.h | 2385 ++ code_battle_dp/Include/dxdiag.h | 187 + code_battle_dp/Include/dxfile.h | 239 + code_battle_dp/Include/dxsdkver.h | 18 + code_battle_dp/Include/gameux.h | 719 + code_battle_dp/Include/rmxfguid.h | 223 + code_battle_dp/Include/rmxftmpl.h | 339 + code_battle_dp/Include/rpcsal.h | 499 + code_battle_dp/Include/xact3.h | 1551 ++ code_battle_dp/Include/xact3d3.h | 275 + code_battle_dp/Include/xact3wb.h | 598 + code_battle_dp/Include/xma2defs.h | 718 + code_battle_dp/Include/xnamath.h | 2938 +++ code_battle_dp/Include/xnamathconvert.inl | 5785 +++++ code_battle_dp/Include/xnamathmatrix.inl | 3254 +++ code_battle_dp/Include/xnamathmisc.inl | 2464 ++ code_battle_dp/Include/xnamathvector.inl | 13279 ++++++++++ code_battle_dp/Lib/x86/D3DCSX.lib | Bin 0 -> 3832 bytes code_battle_dp/Lib/x86/D3DCSXd.lib | Bin 0 -> 3854 bytes code_battle_dp/Lib/x86/DxErr.lib | Bin 0 -> 5415290 bytes code_battle_dp/Lib/x86/X3DAudio.lib | Bin 0 -> 2016 bytes code_battle_dp/Lib/x86/XAPOFX.lib | Bin 0 -> 1722 bytes code_battle_dp/Lib/x86/XInput.lib | Bin 0 -> 3432 bytes code_battle_dp/Lib/x86/d2d1.lib | Bin 0 -> 2664 bytes code_battle_dp/Lib/x86/d3d10.lib | Bin 0 -> 9272 bytes code_battle_dp/Lib/x86/d3d10_1.lib | Bin 0 -> 9360 bytes code_battle_dp/Lib/x86/d3d11.lib | Bin 0 -> 14362 bytes code_battle_dp/Lib/x86/d3d9.lib | Bin 0 -> 5210 bytes code_battle_dp/Lib/x86/d3dcompiler.lib | Bin 0 -> 6062 bytes code_battle_dp/Lib/x86/d3dx10.lib | Bin 0 -> 48486 bytes code_battle_dp/Lib/x86/d3dx10d.lib | Bin 0 -> 48890 bytes code_battle_dp/Lib/x86/d3dx11.lib | Bin 0 -> 14636 bytes code_battle_dp/Lib/x86/d3dx11d.lib | Bin 0 -> 14908 bytes code_battle_dp/Lib/x86/d3dx9.lib | Bin 0 -> 87600 bytes code_battle_dp/Lib/x86/d3dx9d.lib | Bin 0 -> 87926 bytes code_battle_dp/Lib/x86/d3dxof.lib | Bin 0 -> 1746 bytes code_battle_dp/Lib/x86/dinput8.lib | Bin 0 -> 284368 bytes code_battle_dp/Lib/x86/dsetup.lib | Bin 0 -> 5994 bytes code_battle_dp/Lib/x86/dsound.lib | Bin 0 -> 4038 bytes code_battle_dp/Lib/x86/dwrite.lib | Bin 0 -> 1758 bytes code_battle_dp/Lib/x86/dxgi.lib | Bin 0 -> 3580 bytes code_battle_dp/Lib/x86/dxguid.lib | Bin 0 -> 896294 bytes code_battle_dp/Lib/x86/xapobase.lib | Bin 0 -> 623810 bytes code_battle_dp/Lib/x86/xapobased.lib | Bin 0 -> 846528 bytes code_battle_dp/README.md | 2 + 395 files changed, 275372 insertions(+), 667 deletions(-) delete mode 100644 CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.cpp create mode 100644 CodeBattleCPP/CodeBattleCpp/client.cpp create mode 100644 CodeBattleCPP/CodeBattleCpp/client.hpp rename CodeBattleCPP/{CodeBattleCppLibrary => CodeBattleCpp}/easywsclient/easywsclient.cpp (100%) rename CodeBattleCPP/{CodeBattleCppLibrary => CodeBattleCpp}/easywsclient/easywsclient.hpp (100%) create mode 100644 CodeBattleCPP/CodeBattleCpp/game_board.cpp create mode 100644 CodeBattleCPP/CodeBattleCpp/game_board.hpp create mode 100644 CodeBattleCPP/CodeBattleCpp/graphics.cpp create mode 100644 CodeBattleCPP/CodeBattleCpp/graphics.hpp create mode 100644 CodeBattleCPP/CodeBattleCpp/json.hpp create mode 100644 CodeBattleCPP/CodeBattleCpp/main.cpp create mode 100644 CodeBattleCPP/CodeBattleCpp/player_command.hpp create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/brick.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/cement.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/drill_pit.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/enemy_ladder.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/enemy_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/enemy_pipe_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/enemy_pipe_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/enemy_pit.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/enemy_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/ent.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/gold.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_die.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_drill_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_drill_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_fall_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_fall_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_ladder.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_pipe_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_pipe_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_shadow_drill_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_shadow_drill_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_shadow_fall_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_shadow_fall_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_shadow_ladder.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_shadow_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_shadow_pipe_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_shadow_pipe_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/hero_shadow_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/ladder.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/none.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/other_hero_die.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/other_hero_ladder.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/other_hero_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/other_hero_pipe_left.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/other_hero_pipe_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/other_hero_right.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/pipe.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/pit_fill_1.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/pit_fill_2.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/pit_fill_3.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/pit_fill_4.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/slide.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/the_shadow_pill.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/treasure.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/undestroyable_wall.png create mode 100644 CodeBattleCPP/CodeBattleCpp/resources/wall.png create mode 100644 CodeBattleCPP/CodeBattleCpp/tile.hpp create mode 100644 CodeBattleCPP/CodeBattleCpp/vec.cpp create mode 100644 CodeBattleCPP/CodeBattleCpp/vec.hpp create mode 100644 CodeBattleCPP/CodeBattleCpp/window.cpp create mode 100644 CodeBattleCPP/CodeBattleCpp/window.hpp delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/CodeBattleCpp.log delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/CodeBattleCpp.obj delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/CodeBattleCpp.tlog/CL.command.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/CodeBattleCpp.tlog/CL.read.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/CodeBattleCpp.tlog/CL.write.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/CodeBattleCpp.tlog/CodeBattleCpp.lastbuildstate delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/CodeBattleCpp.tlog/link.command.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/CodeBattleCpp.tlog/link.read.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/CodeBattleCpp.tlog/link.write.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/vc141.idb delete mode 100644 CodeBattleCPP/CodeBattleCpp/x64/Debug/vc141.pdb delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/BoardElement.h delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/BoardPoint.cpp delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/BoardPoint.h delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/CodeBattleCppLibrary.vcxproj.user delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/GameBoard.cpp delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/GameBoard.h delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/GameClientLodeRunner.cpp delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/GameClientLodeRunner.h delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/LoderunnerAction.h delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBatt.8F09F71F.tlog/CL.command.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBatt.8F09F71F.tlog/CL.read.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBatt.8F09F71F.tlog/CL.write.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBatt.8F09F71F.tlog/CodeBattleCppLibrary.lastbuildstate delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBatt.8F09F71F.tlog/Lib-link.write.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBatt.8F09F71F.tlog/Lib.command.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBatt.8F09F71F.tlog/Lib.read.1.tlog delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBattleCppLibrary.idb delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBattleCppLibrary.log delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/CodeBattleCppLibrary.pdb delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/GameClientLodeRunner.obj delete mode 100644 CodeBattleCPP/CodeBattleCppLibrary/x64/Debug/easywsclient.obj create mode 100644 CodeBattleCPP/Include/D2D1.h create mode 100644 CodeBattleCPP/Include/D2D1Helper.h create mode 100644 CodeBattleCPP/Include/D2DBaseTypes.h create mode 100644 CodeBattleCPP/Include/D2Derr.h create mode 100644 CodeBattleCPP/Include/D3D10.h create mode 100644 CodeBattleCPP/Include/D3D10_1.h create mode 100644 CodeBattleCPP/Include/D3D10_1shader.h create mode 100644 CodeBattleCPP/Include/D3D10effect.h create mode 100644 CodeBattleCPP/Include/D3D10shader.h create mode 100644 CodeBattleCPP/Include/D3D11.h create mode 100644 CodeBattleCPP/Include/D3D11SDKLayers.h create mode 100644 CodeBattleCPP/Include/D3D11Shader.h create mode 100644 CodeBattleCPP/Include/D3DCSX.h create mode 100644 CodeBattleCPP/Include/D3DX10.h create mode 100644 CodeBattleCPP/Include/D3DX10core.h create mode 100644 CodeBattleCPP/Include/D3DX10math.h create mode 100644 CodeBattleCPP/Include/D3DX10math.inl create mode 100644 CodeBattleCPP/Include/D3DX10mesh.h create mode 100644 CodeBattleCPP/Include/D3DX10tex.h create mode 100644 CodeBattleCPP/Include/D3DX11.h create mode 100644 CodeBattleCPP/Include/D3DX11async.h create mode 100644 CodeBattleCPP/Include/D3DX11core.h create mode 100644 CodeBattleCPP/Include/D3DX11tex.h create mode 100644 CodeBattleCPP/Include/D3DX_DXGIFormatConvert.inl create mode 100644 CodeBattleCPP/Include/D3Dcommon.h create mode 100644 CodeBattleCPP/Include/D3Dcompiler.h create mode 100644 CodeBattleCPP/Include/DWrite.h create mode 100644 CodeBattleCPP/Include/DXGI.h create mode 100644 CodeBattleCPP/Include/DXGIFormat.h create mode 100644 CodeBattleCPP/Include/DXGIType.h create mode 100644 CodeBattleCPP/Include/Dcommon.h create mode 100644 CodeBattleCPP/Include/DxErr.h create mode 100644 CodeBattleCPP/Include/PIXPlugin.h create mode 100644 CodeBattleCPP/Include/X3DAudio.h create mode 100644 CodeBattleCPP/Include/XAPO.h create mode 100644 CodeBattleCPP/Include/XAPOBase.h create mode 100644 CodeBattleCPP/Include/XAPOFX.h create mode 100644 CodeBattleCPP/Include/XAudio2.h create mode 100644 CodeBattleCPP/Include/XAudio2fx.h create mode 100644 CodeBattleCPP/Include/XDSP.h create mode 100644 CodeBattleCPP/Include/XInput.h create mode 100644 CodeBattleCPP/Include/audiodefs.h create mode 100644 CodeBattleCPP/Include/comdecl.h create mode 100644 CodeBattleCPP/Include/d3d10misc.h create mode 100644 CodeBattleCPP/Include/d3d10sdklayers.h create mode 100644 CodeBattleCPP/Include/d3d9.h create mode 100644 CodeBattleCPP/Include/d3d9caps.h create mode 100644 CodeBattleCPP/Include/d3d9types.h create mode 100644 CodeBattleCPP/Include/d3dx10async.h create mode 100644 CodeBattleCPP/Include/d3dx9.h create mode 100644 CodeBattleCPP/Include/d3dx9anim.h create mode 100644 CodeBattleCPP/Include/d3dx9core.h create mode 100644 CodeBattleCPP/Include/d3dx9effect.h create mode 100644 CodeBattleCPP/Include/d3dx9math.h create mode 100644 CodeBattleCPP/Include/d3dx9math.inl create mode 100644 CodeBattleCPP/Include/d3dx9mesh.h create mode 100644 CodeBattleCPP/Include/d3dx9shader.h create mode 100644 CodeBattleCPP/Include/d3dx9shape.h create mode 100644 CodeBattleCPP/Include/d3dx9tex.h create mode 100644 CodeBattleCPP/Include/d3dx9xof.h create mode 100644 CodeBattleCPP/Include/dinput.h create mode 100644 CodeBattleCPP/Include/dinputd.h create mode 100644 CodeBattleCPP/Include/dsconf.h create mode 100644 CodeBattleCPP/Include/dsetup.h create mode 100644 CodeBattleCPP/Include/dsound.h create mode 100644 CodeBattleCPP/Include/dxdiag.h create mode 100644 CodeBattleCPP/Include/dxfile.h create mode 100644 CodeBattleCPP/Include/dxsdkver.h create mode 100644 CodeBattleCPP/Include/gameux.h create mode 100644 CodeBattleCPP/Include/rmxfguid.h create mode 100644 CodeBattleCPP/Include/rmxftmpl.h create mode 100644 CodeBattleCPP/Include/rpcsal.h create mode 100644 CodeBattleCPP/Include/xact3.h create mode 100644 CodeBattleCPP/Include/xact3d3.h create mode 100644 CodeBattleCPP/Include/xact3wb.h create mode 100644 CodeBattleCPP/Include/xma2defs.h create mode 100644 CodeBattleCPP/Include/xnamath.h create mode 100644 CodeBattleCPP/Include/xnamathconvert.inl create mode 100644 CodeBattleCPP/Include/xnamathmatrix.inl create mode 100644 CodeBattleCPP/Include/xnamathmisc.inl create mode 100644 CodeBattleCPP/Include/xnamathvector.inl create mode 100644 CodeBattleCPP/Lib/x86/D3DCSX.lib create mode 100644 CodeBattleCPP/Lib/x86/D3DCSXd.lib create mode 100644 CodeBattleCPP/Lib/x86/DxErr.lib create mode 100644 CodeBattleCPP/Lib/x86/X3DAudio.lib create mode 100644 CodeBattleCPP/Lib/x86/XAPOFX.lib create mode 100644 CodeBattleCPP/Lib/x86/XInput.lib create mode 100644 CodeBattleCPP/Lib/x86/d2d1.lib create mode 100644 CodeBattleCPP/Lib/x86/d3d10.lib create mode 100644 CodeBattleCPP/Lib/x86/d3d10_1.lib create mode 100644 CodeBattleCPP/Lib/x86/d3d11.lib create mode 100644 CodeBattleCPP/Lib/x86/d3d9.lib create mode 100644 CodeBattleCPP/Lib/x86/d3dcompiler.lib create mode 100644 CodeBattleCPP/Lib/x86/d3dx10.lib create mode 100644 CodeBattleCPP/Lib/x86/d3dx10d.lib create mode 100644 CodeBattleCPP/Lib/x86/d3dx11.lib create mode 100644 CodeBattleCPP/Lib/x86/d3dx11d.lib create mode 100644 CodeBattleCPP/Lib/x86/d3dx9.lib create mode 100644 CodeBattleCPP/Lib/x86/d3dx9d.lib create mode 100644 CodeBattleCPP/Lib/x86/d3dxof.lib create mode 100644 CodeBattleCPP/Lib/x86/dinput8.lib create mode 100644 CodeBattleCPP/Lib/x86/dsetup.lib create mode 100644 CodeBattleCPP/Lib/x86/dsound.lib create mode 100644 CodeBattleCPP/Lib/x86/dwrite.lib create mode 100644 CodeBattleCPP/Lib/x86/dxgi.lib create mode 100644 CodeBattleCPP/Lib/x86/dxguid.lib create mode 100644 CodeBattleCPP/Lib/x86/xapobase.lib create mode 100644 CodeBattleCPP/Lib/x86/xapobased.lib delete mode 100644 CodeBattleCPP/x64/Debug/CodeBattleCppLibrary.lib delete mode 100644 CodeBattleCPP/x64/Debug/CodeBattleCppLibrary.pdb create mode 100644 code_battle_dp/.gitkeep create mode 100644 code_battle_dp/CodeBattleCpp.sln rename CodeBattleCPP/CodeBattleCppLibrary/CodeBattleCppLibrary.vcxproj => code_battle_dp/CodeBattleCpp/CodeBattleCpp.vcxproj (55%) rename CodeBattleCPP/CodeBattleCppLibrary/CodeBattleCppLibrary.vcxproj.filters => code_battle_dp/CodeBattleCpp/CodeBattleCpp.vcxproj.filters (55%) rename {CodeBattleCPP/CodeBattleCppLibrary => code_battle_dp/CodeBattleCpp}/LodeRunnerBlocks.h (100%) rename {CodeBattleCPP/CodeBattleCppLibrary => code_battle_dp/CodeBattleCpp}/PlayerAction.h (100%) create mode 100644 code_battle_dp/CodeBattleCpp/client.cpp create mode 100644 code_battle_dp/CodeBattleCpp/client.hpp create mode 100644 code_battle_dp/CodeBattleCpp/easywsclient/easywsclient.cpp create mode 100644 code_battle_dp/CodeBattleCpp/easywsclient/easywsclient.hpp create mode 100644 code_battle_dp/CodeBattleCpp/game_board.cpp create mode 100644 code_battle_dp/CodeBattleCpp/game_board.hpp create mode 100644 code_battle_dp/CodeBattleCpp/graphics.cpp create mode 100644 code_battle_dp/CodeBattleCpp/graphics.hpp create mode 100644 code_battle_dp/CodeBattleCpp/interpolation.cpp create mode 100644 code_battle_dp/CodeBattleCpp/interpolation.hpp create mode 100644 code_battle_dp/CodeBattleCpp/json.hpp create mode 100644 code_battle_dp/CodeBattleCpp/main.cpp create mode 100644 code_battle_dp/CodeBattleCpp/player_command.hpp create mode 100644 code_battle_dp/CodeBattleCpp/resources/brick.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/cement.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/drill_pit.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/enemy_ladder.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/enemy_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/enemy_pipe_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/enemy_pipe_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/enemy_pit.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/enemy_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/ent.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/gold.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_die.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_drill_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_drill_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_fall_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_fall_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_ladder.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_pipe_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_pipe_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_shadow_drill_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_shadow_drill_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_shadow_fall_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_shadow_fall_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_shadow_ladder.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_shadow_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_shadow_pipe_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_shadow_pipe_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/hero_shadow_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/ladder.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/none.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/other_hero_die.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/other_hero_ladder.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/other_hero_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/other_hero_pipe_left.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/other_hero_pipe_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/other_hero_right.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/pipe.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/pit_fill_1.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/pit_fill_2.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/pit_fill_3.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/pit_fill_4.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/slide.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/the_shadow_pill.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/treasure.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/undestroyable_wall.png create mode 100644 code_battle_dp/CodeBattleCpp/resources/wall.png create mode 100644 code_battle_dp/CodeBattleCpp/tile.hpp create mode 100644 code_battle_dp/CodeBattleCpp/vec.cpp create mode 100644 code_battle_dp/CodeBattleCpp/vec.hpp create mode 100644 code_battle_dp/CodeBattleCpp/window.cpp create mode 100644 code_battle_dp/CodeBattleCpp/window.hpp create mode 100644 code_battle_dp/Include/D2D1.h create mode 100644 code_battle_dp/Include/D2D1Helper.h create mode 100644 code_battle_dp/Include/D2DBaseTypes.h create mode 100644 code_battle_dp/Include/D2Derr.h create mode 100644 code_battle_dp/Include/D3D10.h create mode 100644 code_battle_dp/Include/D3D10_1.h create mode 100644 code_battle_dp/Include/D3D10_1shader.h create mode 100644 code_battle_dp/Include/D3D10effect.h create mode 100644 code_battle_dp/Include/D3D10shader.h create mode 100644 code_battle_dp/Include/D3D11.h create mode 100644 code_battle_dp/Include/D3D11SDKLayers.h create mode 100644 code_battle_dp/Include/D3D11Shader.h create mode 100644 code_battle_dp/Include/D3DCSX.h create mode 100644 code_battle_dp/Include/D3DX10.h create mode 100644 code_battle_dp/Include/D3DX10core.h create mode 100644 code_battle_dp/Include/D3DX10math.h create mode 100644 code_battle_dp/Include/D3DX10math.inl create mode 100644 code_battle_dp/Include/D3DX10mesh.h create mode 100644 code_battle_dp/Include/D3DX10tex.h create mode 100644 code_battle_dp/Include/D3DX11.h create mode 100644 code_battle_dp/Include/D3DX11async.h create mode 100644 code_battle_dp/Include/D3DX11core.h create mode 100644 code_battle_dp/Include/D3DX11tex.h create mode 100644 code_battle_dp/Include/D3DX_DXGIFormatConvert.inl create mode 100644 code_battle_dp/Include/D3Dcommon.h create mode 100644 code_battle_dp/Include/D3Dcompiler.h create mode 100644 code_battle_dp/Include/DWrite.h create mode 100644 code_battle_dp/Include/DXGI.h create mode 100644 code_battle_dp/Include/DXGIFormat.h create mode 100644 code_battle_dp/Include/DXGIType.h create mode 100644 code_battle_dp/Include/Dcommon.h create mode 100644 code_battle_dp/Include/DxErr.h create mode 100644 code_battle_dp/Include/PIXPlugin.h create mode 100644 code_battle_dp/Include/X3DAudio.h create mode 100644 code_battle_dp/Include/XAPO.h create mode 100644 code_battle_dp/Include/XAPOBase.h create mode 100644 code_battle_dp/Include/XAPOFX.h create mode 100644 code_battle_dp/Include/XAudio2.h create mode 100644 code_battle_dp/Include/XAudio2fx.h create mode 100644 code_battle_dp/Include/XDSP.h create mode 100644 code_battle_dp/Include/XInput.h create mode 100644 code_battle_dp/Include/audiodefs.h create mode 100644 code_battle_dp/Include/comdecl.h create mode 100644 code_battle_dp/Include/d3d10misc.h create mode 100644 code_battle_dp/Include/d3d10sdklayers.h create mode 100644 code_battle_dp/Include/d3d9.h create mode 100644 code_battle_dp/Include/d3d9caps.h create mode 100644 code_battle_dp/Include/d3d9types.h create mode 100644 code_battle_dp/Include/d3dx10async.h create mode 100644 code_battle_dp/Include/d3dx9.h create mode 100644 code_battle_dp/Include/d3dx9anim.h create mode 100644 code_battle_dp/Include/d3dx9core.h create mode 100644 code_battle_dp/Include/d3dx9effect.h create mode 100644 code_battle_dp/Include/d3dx9math.h create mode 100644 code_battle_dp/Include/d3dx9math.inl create mode 100644 code_battle_dp/Include/d3dx9mesh.h create mode 100644 code_battle_dp/Include/d3dx9shader.h create mode 100644 code_battle_dp/Include/d3dx9shape.h create mode 100644 code_battle_dp/Include/d3dx9tex.h create mode 100644 code_battle_dp/Include/d3dx9xof.h create mode 100644 code_battle_dp/Include/dinput.h create mode 100644 code_battle_dp/Include/dinputd.h create mode 100644 code_battle_dp/Include/dsconf.h create mode 100644 code_battle_dp/Include/dsetup.h create mode 100644 code_battle_dp/Include/dsound.h create mode 100644 code_battle_dp/Include/dxdiag.h create mode 100644 code_battle_dp/Include/dxfile.h create mode 100644 code_battle_dp/Include/dxsdkver.h create mode 100644 code_battle_dp/Include/gameux.h create mode 100644 code_battle_dp/Include/rmxfguid.h create mode 100644 code_battle_dp/Include/rmxftmpl.h create mode 100644 code_battle_dp/Include/rpcsal.h create mode 100644 code_battle_dp/Include/xact3.h create mode 100644 code_battle_dp/Include/xact3d3.h create mode 100644 code_battle_dp/Include/xact3wb.h create mode 100644 code_battle_dp/Include/xma2defs.h create mode 100644 code_battle_dp/Include/xnamath.h create mode 100644 code_battle_dp/Include/xnamathconvert.inl create mode 100644 code_battle_dp/Include/xnamathmatrix.inl create mode 100644 code_battle_dp/Include/xnamathmisc.inl create mode 100644 code_battle_dp/Include/xnamathvector.inl create mode 100644 code_battle_dp/Lib/x86/D3DCSX.lib create mode 100644 code_battle_dp/Lib/x86/D3DCSXd.lib create mode 100644 code_battle_dp/Lib/x86/DxErr.lib create mode 100644 code_battle_dp/Lib/x86/X3DAudio.lib create mode 100644 code_battle_dp/Lib/x86/XAPOFX.lib create mode 100644 code_battle_dp/Lib/x86/XInput.lib create mode 100644 code_battle_dp/Lib/x86/d2d1.lib create mode 100644 code_battle_dp/Lib/x86/d3d10.lib create mode 100644 code_battle_dp/Lib/x86/d3d10_1.lib create mode 100644 code_battle_dp/Lib/x86/d3d11.lib create mode 100644 code_battle_dp/Lib/x86/d3d9.lib create mode 100644 code_battle_dp/Lib/x86/d3dcompiler.lib create mode 100644 code_battle_dp/Lib/x86/d3dx10.lib create mode 100644 code_battle_dp/Lib/x86/d3dx10d.lib create mode 100644 code_battle_dp/Lib/x86/d3dx11.lib create mode 100644 code_battle_dp/Lib/x86/d3dx11d.lib create mode 100644 code_battle_dp/Lib/x86/d3dx9.lib create mode 100644 code_battle_dp/Lib/x86/d3dx9d.lib create mode 100644 code_battle_dp/Lib/x86/d3dxof.lib create mode 100644 code_battle_dp/Lib/x86/dinput8.lib create mode 100644 code_battle_dp/Lib/x86/dsetup.lib create mode 100644 code_battle_dp/Lib/x86/dsound.lib create mode 100644 code_battle_dp/Lib/x86/dwrite.lib create mode 100644 code_battle_dp/Lib/x86/dxgi.lib create mode 100644 code_battle_dp/Lib/x86/dxguid.lib create mode 100644 code_battle_dp/Lib/x86/xapobase.lib create mode 100644 code_battle_dp/Lib/x86/xapobased.lib create mode 100644 code_battle_dp/README.md diff --git a/CodeBattleCPP/CodeBattleCpp.sln b/CodeBattleCPP/CodeBattleCpp.sln index cb91f1f..5dbba59 100644 --- a/CodeBattleCPP/CodeBattleCpp.sln +++ b/CodeBattleCPP/CodeBattleCpp.sln @@ -1,14 +1,9 @@ п»ї Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29230.47 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CodeBattleCpp", "CodeBattleCpp\CodeBattleCpp.vcxproj", "{A9F8773C-9D2C-4F38-9E5F-0D1A84A7D36A}" - ProjectSection(ProjectDependencies) = postProject - {8F09F71F-E153-4C37-B12E-692A4CA8FE7A} = {8F09F71F-E153-4C37-B12E-692A4CA8FE7A} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CodeBattleCppLibrary", "CodeBattleCppLibrary\CodeBattleCppLibrary.vcxproj", "{8F09F71F-E153-4C37-B12E-692A4CA8FE7A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -26,16 +21,11 @@ Global {A9F8773C-9D2C-4F38-9E5F-0D1A84A7D36A}.Release|x64.Build.0 = Release|x64 {A9F8773C-9D2C-4F38-9E5F-0D1A84A7D36A}.Release|x86.ActiveCfg = Release|Win32 {A9F8773C-9D2C-4F38-9E5F-0D1A84A7D36A}.Release|x86.Build.0 = Release|Win32 - {8F09F71F-E153-4C37-B12E-692A4CA8FE7A}.Debug|x64.ActiveCfg = Debug|x64 - {8F09F71F-E153-4C37-B12E-692A4CA8FE7A}.Debug|x64.Build.0 = Debug|x64 - {8F09F71F-E153-4C37-B12E-692A4CA8FE7A}.Debug|x86.ActiveCfg = Debug|Win32 - {8F09F71F-E153-4C37-B12E-692A4CA8FE7A}.Debug|x86.Build.0 = Debug|Win32 - {8F09F71F-E153-4C37-B12E-692A4CA8FE7A}.Release|x64.ActiveCfg = Release|x64 - {8F09F71F-E153-4C37-B12E-692A4CA8FE7A}.Release|x64.Build.0 = Release|x64 - {8F09F71F-E153-4C37-B12E-692A4CA8FE7A}.Release|x86.ActiveCfg = Release|Win32 - {8F09F71F-E153-4C37-B12E-692A4CA8FE7A}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {48FA613C-AF86-4007-AA7E-59069CCAD5D6} + EndGlobalSection EndGlobal diff --git a/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.cpp b/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.cpp deleted file mode 100644 index 6b4a631..0000000 --- a/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include - -#include "GameClientLodeRunner.h" - - /* - Если при сборке появилась ошибка типа - The Windows SDK version 10.0.16299.0 was not found... - делаем следующее: - 1)Правой кнопкой мыши по CodeBattleCpp и жмём на properties. - 2)Вкладка Configuration Properties->General - 3)Находим Windows SDK Version и берем доступную в выпадающем списке - 4)Нажимаем Apply - 5)Повторяем тоже самое с CodeBattleCppLibrary - */ - - -void main() -{ - srand(time(0)); - /* - После регистрации вас переведёт на страницу с картой и списком игроков. - URL будет примерно такой: http://localhost:8888/codenjoy-contest/board/player/cg601yim3186cotnftue?code=8887669793631271133&gameName=loderunner - из url берём: - адрес сервера = localhost:8888 - id пользователя = cg601yim3186cotnftue - код пользователя = 8887669793631271133 - */ - std::string url = "localhost:8888"; - std::string userId = "cg601yim3186cotnftue"; - std::string userCode = "8887669793631271133"; - GameClientLodeRunner *gcb = new GameClientLodeRunner(url, userId, userCode); - gcb->Run([&]() - { - GameBoard* gb = gcb->get_GameBoard(); - std::list gold = gb->getGoldPositions(); - - bool done = false; - switch (rand() % 5) - { - case 0: gcb->LoderunnerAction(LoderunnerAction::GO_UP); done = true; - case 1: gcb->LoderunnerAction(LoderunnerAction::GO_DOWN); done = true; - case 2: gcb->LoderunnerAction(LoderunnerAction::GO_LEFT); done = true; - case 3: gcb->LoderunnerAction(LoderunnerAction::GO_RIGHT); done = true; - case 4: gcb->LoderunnerAction(LoderunnerAction::DRILL); done = true; - } - if (!done) { - gcb->LoderunnerAction(LoderunnerAction::DO_NOTHING); - } - }); - - getchar(); -} diff --git a/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.vcxproj b/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.vcxproj index 0bff4ad..015b823 100644 --- a/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.vcxproj +++ b/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.vcxproj @@ -22,7 +22,7 @@ {A9F8773C-9D2C-4F38-9E5F-0D1A84A7D36A} Win32Proj CodeBattleCpp - 10.0.17134.0 + 10.0.17763.0 @@ -41,7 +41,7 @@ Application true - v141 + v142 Unicode @@ -74,12 +74,16 @@ true + $(SolutionDir)Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 + $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); false false + $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(SolutionDir)Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 @@ -104,12 +108,13 @@ Level3 Disabled _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ..\CodeBattleCppLibrary;%(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + stdcpp17 - Console + Windows true - CodeBattleCppLibrary.lib;%(AdditionalDependencies) + %(AdditionalDependencies) ..\x64\Debug;%(AdditionalLibraryDirectories) @@ -143,18 +148,38 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\CodeBattleCppLibrary;%(AdditionalIncludeDirectories) + stdcpp17 - Console + Windows true true true - CodeBattleCppLibrary.lib;%(AdditionalDependencies) + %(AdditionalDependencies) ..\x64\Release;%(AdditionalLibraryDirectories) - + + + + + + + + + + + + + + + + + + + + diff --git a/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.vcxproj.filters b/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.vcxproj.filters index 31b398c..d166865 100644 --- a/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.vcxproj.filters +++ b/CodeBattleCPP/CodeBattleCpp/CodeBattleCpp.vcxproj.filters @@ -15,8 +15,61 @@ - + Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + \ No newline at end of file diff --git a/CodeBattleCPP/CodeBattleCpp/client.cpp b/CodeBattleCPP/CodeBattleCpp/client.cpp new file mode 100644 index 0000000..34d3d7b --- /dev/null +++ b/CodeBattleCPP/CodeBattleCpp/client.cpp @@ -0,0 +1,107 @@ +#include "client.hpp" +#include "json.hpp" +#include + +using namespace std::chrono_literals; + +client::client(std::string_view _server, std::string_view _userId, std::string_view _code) +{ + map_.clear(); + board = nullptr; + + path = "ws://"; + path += _server; + path += "/codenjoy-contest/ws?user="; + path += _userId; + path += "&code="; + path += _code; + statistic_info = "ws://"; + statistic_info += _server; + statistic_info += "/codenjoy-contest/screen-ws?user="; + statistic_info += _userId; + user_id = _userId; + is_running = false; +} + + +client::~client() +{ + is_running = false; + work_thread->join(); +} + +void client::run(std::function _message_handler) +{ + is_running = true; + work_thread = new std::thread(&client::update_func, this, _message_handler); +} + +void client::update_func(std::function _message_handler) +{ +#ifdef _WIN32 + WSADATA wsaData; + + if (WSAStartup(MAKEWORD(2, 2), &wsaData)) + throw new std::exception("WSAStartup Failed.\n"); + else + std::cout << "Connection established" << std::endl; +#endif + + web_socket = easywsclient::WebSocket::from_url(path); + if (web_socket == nullptr)is_running = false; + nlohmann::json object; + object["allPlayersScreen"] = false; + object["gameName"] = "loderunner"; + object["name"] = "getScreen"; + object["players"][0] = user_id; + auto web_socket1 = easywsclient::WebSocket::from_url(statistic_info); + if (web_socket1) + web_socket1->send(object.dump()); + while (is_running) + { + web_socket->poll(); + web_socket->dispatch([&](const std::string& message) + { + int size_needed = MultiByteToWideChar(CP_UTF8, 0, &message[0], (int)message.size(), NULL, 0); + std::wstring wmessage(size_needed, 0); + MultiByteToWideChar(CP_UTF8, 0, &message[0], (int)message.size(), &wmessage[0], size_needed); + + uint32_t size = sqrt(wmessage.size() - 6); + if (map_.size() != size) + { + map_.clear(); + map_.resize(size); + //map = new tile*[map_size]; + for (uint32_t j = 0; j < size; j++) + { + map_[j].resize(size); + for (uint32_t i = 0; i < size; i++) + map_[j][i] = tile(static_cast(tile::NONE)); + } + } + + uint32_t chr = 6; + for (uint32_t j = 0; j < map_.size(); j++) + for (uint32_t i = 0; i < map_.size(); i++) + map_[j][i] = tile(static_cast(wmessage[chr++])); + lock(); + board = std::make_shared(map_); + unlock(); + _message_handler(); + }); + web_socket1->poll(); + web_socket1->dispatch([&](const std::string& message) { + auto obj = nlohmann::json::parse(message, nullptr, false); + if (!obj.is_discarded()) { + std::cout << "score: " << obj[user_id]["score"].get() << "\n"; + } + web_socket1->send(object.dump()); + }); + std::this_thread::sleep_for(1ms); + } + if (web_socket)web_socket->close(); + +#ifdef _WIN32 + WSACleanup(); +#endif +} diff --git a/CodeBattleCPP/CodeBattleCpp/client.hpp b/CodeBattleCPP/CodeBattleCpp/client.hpp new file mode 100644 index 0000000..d41039c --- /dev/null +++ b/CodeBattleCPP/CodeBattleCpp/client.hpp @@ -0,0 +1,88 @@ +#pragma once + +#include +#include +#include "easywsclient\easywsclient.hpp" +#ifdef _WIN32 +#pragma comment( lib, "ws2_32" ) +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tile.hpp" +#include "player_command.hpp" +#include "game_board.hpp" + + +class tile; + +class client +{ + std::vector> map_; + std::shared_ptr board; + + easywsclient::WebSocket* web_socket; + std::string path, statistic_info, user_id; + + bool is_running; + std::thread* work_thread; + void update_func(std::function _message_handler); + +public: + client(std::string_view _server, std::string_view _userEmail, std::string_view _userPassword = ""); + ~client(); + + void run(std::function _message_handler); + void send(player_command action = player_command::idle) { + switch (action) + { + case player_command::dig_left: + send(std::string("ACT,LEFT")); + break; + case player_command::dig_right: + send(std::string("ACT,RIGHT")); + break; + case player_command::down: + send(std::string("DOWN")); + break; + case player_command::up: + send(std::string("UP")); + break; + case player_command::left: + send(std::string("LEFT")); + break; + case player_command::right: + send(std::string("RIGHT")); + break; + case player_command::kill_self: + send(std::string("ACT(0)")); + break; + case player_command::dig: + send(std::string("ACT")); + break; + default: + send(std::string("STOP")); + break; + } + } + std::shared_ptr get_game_board() { return board; } + const std::vector>& get_map() { return map_; } + void lock() { board_lock.lock(); } + void unlock() { board_lock.unlock(); } + bool try_lock() { return board_lock.try_lock(); } +private: + std::mutex board_lock; + void send(std::string msg) + { + std::cout << "Sending: " << msg << std::endl; + web_socket->send(msg); + } +}; diff --git a/CodeBattleCPP/CodeBattleCppLibrary/easywsclient/easywsclient.cpp b/CodeBattleCPP/CodeBattleCpp/easywsclient/easywsclient.cpp similarity index 100% rename from CodeBattleCPP/CodeBattleCppLibrary/easywsclient/easywsclient.cpp rename to CodeBattleCPP/CodeBattleCpp/easywsclient/easywsclient.cpp diff --git a/CodeBattleCPP/CodeBattleCppLibrary/easywsclient/easywsclient.hpp b/CodeBattleCPP/CodeBattleCpp/easywsclient/easywsclient.hpp similarity index 100% rename from CodeBattleCPP/CodeBattleCppLibrary/easywsclient/easywsclient.hpp rename to CodeBattleCPP/CodeBattleCpp/easywsclient/easywsclient.hpp diff --git a/CodeBattleCPP/CodeBattleCpp/game_board.cpp b/CodeBattleCPP/CodeBattleCpp/game_board.cpp new file mode 100644 index 0000000..e4e0c64 --- /dev/null +++ b/CodeBattleCPP/CodeBattleCpp/game_board.cpp @@ -0,0 +1,158 @@ +#include "game_board.hpp" + + +game_board::game_board(std::vector>& map) + : map(map) { + next_action_ = player_command::kill_self; +} +vec game_board::get_myself() { + std::list result = find_all(tile::HERO_DIE); + result.splice(result.end(), find_all(tile::HERO_DRILL_LEFT)); + result.splice(result.end(), find_all(tile::HERO_DRILL_RIGHT)); + result.splice(result.end(), find_all(tile::HERO_LADDER)); + result.splice(result.end(), find_all(tile::HERO_LEFT)); + result.splice(result.end(), find_all(tile::HERO_RIGHT)); + result.splice(result.end(), find_all(tile::HERO_FALL_LEFT)); + result.splice(result.end(), find_all(tile::HERO_FALL_RIGHT)); + result.splice(result.end(), find_all(tile::HERO_PIPE_LEFT)); + result.splice(result.end(), find_all(tile::HERO_PIPE_RIGHT)); + return result.front(); +} +bool game_board::is_game_over() { + for (uint32_t j = 0; j < map.size(); j++) + { + for (uint32_t i = 0; i < map.size(); i++) + { + if (map[j][i] == tile::HERO_DIE) + return true; + } + } + return false; +} +bool game_board::has_element_at(vec point, tile element) { + auto val = get_element_at(point); + return val.has_value() && val.value() == element; +} +std::optional game_board::get_element_at(vec point) { + if (point.isOutOfBoard(map.size())) + return std::nullopt; + return map[point.y][point.x]; +} +std::list game_board::find_all(tile element) { + std::list result; + for (uint32_t j = 0; j < map.size(); j++) + { + for (uint32_t i = 0; i < map.size(); i++) + { + if (map[j][i] == element) { + result.push_back(vec(i, j)); + } + } + } + return result; +} +std::list game_board::get_other_players() { + std::list result = find_all(tile::OTHER_HERO_DIE); + result.splice(result.end(), find_all(tile::OTHER_HERO_LEFT)); + result.splice(result.end(), find_all(tile::OTHER_HERO_RIGHT)); + result.splice(result.end(), find_all(tile::OTHER_HERO_LADDER)); + result.splice(result.end(), find_all(tile::OTHER_HERO_PIPE_LEFT)); + result.splice(result.end(), find_all(tile::OTHER_HERO_PIPE_RIGHT)); + return result; +} +std::list game_board::get_walls() { + std::list result = find_all(tile::BRICK); + result.splice(result.end(), find_all(tile::UNDESTROYABLE_WALL)); + return result; +} +std::list game_board::get_ladders() { + std::list result = find_all(tile::LADDER); + result.splice(result.end(), find_all(tile::HERO_LADDER)); + result.splice(result.end(), find_all(tile::OTHER_HERO_LADDER)); + result.splice(result.end(), find_all(tile::ENEMY_LADDER)); + return result; +} +std::list game_board::get_gold() { + auto res = find_all(tile::YELLOW_GOLD); + res.splice(res.end(), find_all(tile::RED_GOLD)); + res.splice(res.end(), find_all(tile::GREEN_GOLD)); + return res; +} +std::list game_board::get_pipes() { + std::list result = find_all(tile::PIPE); + result.splice(result.end(), find_all(tile::HERO_PIPE_LEFT)); + result.splice(result.end(), find_all(tile::HERO_PIPE_RIGHT)); + result.splice(result.end(), find_all(tile::OTHER_HERO_PIPE_LEFT)); + result.splice(result.end(), find_all(tile::OTHER_HERO_PIPE_RIGHT)); + result.splice(result.end(), find_all(tile::ENEMY_PIPE_LEFT)); + result.splice(result.end(), find_all(tile::ENEMY_PIPE_RIGHT)); + return result; +} +std::list game_board::get_hunters() { + std::list result = find_all(tile::ENEMY_LADDER); + result.splice(result.end(), find_all(tile::ENEMY_LEFT)); + result.splice(result.end(), find_all(tile::ENEMY_PIPE_LEFT)); + result.splice(result.end(), find_all(tile::ENEMY_PIPE_RIGHT)); + result.splice(result.end(), find_all(tile::ENEMY_RIGHT)); + result.splice(result.end(), find_all(tile::ENEMY_PIT)); + return result; +} +bool game_board::is_near_to(vec point, tile element) { + if (point.isOutOfBoard(map.size())) { + return false; + } + return has_element_at(point.shiftBottom(), element) + || has_element_at(point.shiftTop(), element) + || has_element_at(point.shiftLeft(), element) + || has_element_at(point.shiftRight(), element); +} +bool game_board::has_hunter(vec point) { + auto elem = get_element_at(point).value_or(tile::NONE); + return elem == tile::ENEMY_LADDER || elem == tile::ENEMY_LEFT || elem == tile::ENEMY_PIPE_LEFT || elem == tile::ENEMY_PIPE_RIGHT || elem == tile::ENEMY_RIGHT || elem == tile::ENEMY_PIT; +} +bool game_board::has_player(vec point) { + std::list enemies = get_other_players(); + for (std::list::iterator it = enemies.begin(); it != enemies.end(); ++it) { + if (it->x == point.x && it->y == point.y) + return true; + + } + return false; +} +bool game_board::has_wall(vec point) { + std::list enemies = get_walls(); + for (std::list::iterator it = enemies.begin(); it != enemies.end(); ++it) { + if (it->x == point.x && it->y == point.y) + return true; + } + return false; +} +bool game_board::has_ladder(vec point) { + std::list enemies = get_ladders(); + for (std::list::iterator it = enemies.begin(); it != enemies.end(); ++it) { + if (it->x == point.x && it->y == point.y) + return true; + } + return false; +} +bool game_board::has_gold(vec point) { + std::list enemies = get_gold(); + for (std::list::iterator it = enemies.begin(); it != enemies.end(); ++it) { + if (it->x == point.x && it->y == point.y) + return true; + } + return false; +} +bool game_board::has_pipe(vec point) { + std::list enemies = get_pipes(); + for (std::list::iterator it = enemies.begin(); it != enemies.end(); ++it) { + if (it->x == point.x && it->y == point.y) + return true; + } + return false; +} +game_board::~game_board() +{ + +} + diff --git a/CodeBattleCPP/CodeBattleCpp/game_board.hpp b/CodeBattleCPP/CodeBattleCpp/game_board.hpp new file mode 100644 index 0000000..4007817 --- /dev/null +++ b/CodeBattleCPP/CodeBattleCpp/game_board.hpp @@ -0,0 +1,45 @@ +п»ї#pragma once + +#include "tile.hpp" +#include "vec.hpp" +#include "player_command.hpp" +#include +#include +#include +#include + +class game_board +{ +public: + game_board(std::vector>& map); + vec get_myself(); + bool is_game_over(); + bool has_element_at(vec point, tile element); + std::optional get_element_at(vec point); + //void printBoard(); + std::list find_all(tile element); + std::list get_other_players(); + std::list get_walls(); + std::list get_ladders(); + std::list get_gold(); + std::list get_pipes(); + std::list get_hunters(); + bool is_near_to(vec point, tile element); + bool has_hunter(vec point); + bool has_player(vec point); + bool has_wall(vec point); + bool has_ladder(vec point); + bool has_gold(vec point); + bool has_pipe(vec point); + ~game_board(); + player_command current_act() { + return next_action_; + } + const std::vector& get_current_path() { + return opt_path; + } +private: + std::vector>& map; + std::vector opt_path; + player_command next_action_; +}; \ No newline at end of file diff --git a/CodeBattleCPP/CodeBattleCpp/graphics.cpp b/CodeBattleCPP/CodeBattleCpp/graphics.cpp new file mode 100644 index 0000000..fb49861 --- /dev/null +++ b/CodeBattleCPP/CodeBattleCpp/graphics.cpp @@ -0,0 +1,188 @@ +#include "client.hpp" +#include "graphics.hpp" + + +using namespace std::chrono_literals; + +static constexpr std::array, 45> texture_paths_ = { + std::pair{L"resources/brick.png",tile::BRICK}, + std::pair{L"resources/drill_pit.png",tile::DRILL_PIT}, + std::pair{L"resources/enemy_ladder.png",tile::ENEMY_LADDER}, + std::pair{L"resources/enemy_left.png",tile::ENEMY_LEFT}, + std::pair{L"resources/enemy_pipe_left.png",tile::ENEMY_PIPE_LEFT}, + std::pair{L"resources/enemy_pipe_right.png",tile::ENEMY_PIPE_RIGHT}, + std::pair{L"resources/enemy_pit.png",tile::ENEMY_PIT}, + std::pair{L"resources/enemy_right.png",tile::ENEMY_RIGHT}, + std::pair{L"resources/gold.png",tile::YELLOW_GOLD}, + std::pair{L"resources/gold.png",tile::RED_GOLD}, + std::pair{L"resources/gold.png",tile::GREEN_GOLD}, + std::pair{L"resources/hero_die.png",tile::HERO_DIE}, + std::pair{L"resources/hero_drill_left.png",tile::HERO_DRILL_LEFT}, + std::pair{L"resources/hero_drill_right.png",tile::HERO_DRILL_RIGHT}, + std::pair{L"resources/hero_fall_left.png",tile::HERO_FALL_LEFT}, + std::pair{L"resources/hero_fall_right.png",tile::HERO_FALL_RIGHT}, + std::pair{L"resources/hero_ladder.png",tile::HERO_LADDER}, + std::pair{L"resources/hero_left.png",tile::HERO_LEFT}, + std::pair{L"resources/hero_pipe_left.png",tile::HERO_PIPE_LEFT}, + std::pair{L"resources/hero_pipe_right.png",tile::HERO_PIPE_RIGHT}, + std::pair{L"resources/hero_right.png",tile::HERO_RIGHT}, + std::pair{L"resources/hero_shadow_drill_left.png",tile::HERO_SHADOW_DRILL_LEFT}, + std::pair{ L"resources/hero_shadow_drill_right.png",tile::HERO_SHADOW_DRILL_RIGHT}, + std::pair{ L"resources/hero_shadow_fall_left.png",tile::HERO_SHADOW_FALL_LEFT}, + std::pair{ L"resources/hero_shadow_fall_right.png",tile::HERO_SHADOW_FALL_RIGHT}, + std::pair{ L"resources/hero_shadow_ladder.png",tile::HERO_SHADOW_LADDER}, + std::pair{ L"resources/hero_shadow_left.png",tile::HERO_SHADOW_LEFT}, + std::pair{ L"resources/hero_shadow_right.png",tile::HERO_SHADOW_RIGHT}, + std::pair{ L"resources/hero_shadow_pipe_left.png",tile::HERO_SHADOW_PIPE_LEFT}, + std::pair{ L"resources/hero_shadow_pipe_right.png",tile::HERO_SHADOW_PIPE_RIGHT}, + std::pair{ L"resources/ladder.png",tile::LADDER}, + std::pair{ L"resources/none.png",tile::NONE}, + std::pair{ L"resources/other_hero_die.png",tile::OTHER_HERO_DIE}, + std::pair{ L"resources/other_hero_ladder.png",tile::OTHER_HERO_LADDER}, + std::pair{ L"resources/other_hero_left.png",tile::OTHER_HERO_LEFT}, + std::pair{ L"resources/other_hero_pipe_left.png",tile::OTHER_HERO_PIPE_LEFT}, + std::pair{ L"resources/other_hero_pipe_right.png",tile::OTHER_HERO_PIPE_RIGHT}, + std::pair{ L"resources/other_hero_right.png",tile::OTHER_HERO_RIGHT}, + std::pair{ L"resources/pipe.png",tile::PIPE}, + std::pair{ L"resources/pit_fill_1.png",tile::PIT_FILL_1}, + std::pair{ L"resources/pit_fill_2.png",tile::PIT_FILL_2}, + std::pair{ L"resources/pit_fill_3.png",tile::PIT_FILL_3}, + std::pair{ L"resources/pit_fill_4.png",tile::PIT_FILL_4}, + std::pair{ L"resources/the_shadow_pill.png",tile::THE_SHADOW_PILL}, + std::pair{ L"resources/undestroyable_wall.png",tile::UNDESTROYABLE_WALL}, +}; + + +void graphics::invalidate() { + D3DXCreateSprite(device_, &sprite_); + for (auto& elem : texture_paths_) + D3DXCreateTextureFromFile(device_, elem.first.data(), &textures_[elem.second]); + +} + +graphics::graphics(HWND hwnd) { + if ((pd3d = Direct3DCreate9(D3D_SDK_VERSION)) == nullptr) { + std::cout << "pD3D == nullptr\n"; + return; + } + ZeroMemory(&d3dpp, sizeof(d3dpp)); + d3dpp.Windowed = true; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.BackBufferCount = D3DFMT_UNKNOWN; + d3dpp.EnableAutoDepthStencil = true; + d3dpp.AutoDepthStencilFormat = D3DFMT_D16; + d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; + + + if (pd3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &device_) < 0) { + pd3d->Release(); + pd3d = nullptr; + std::cout << "device is dead :c"; + return; + } + invalidate(); +} + +void graphics::render_scene(std::shared_ptr& gcb) { + device_->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(255, 0, 0, 0), 1.f, 0); + auto hresult = device_->TestCooperativeLevel(); + if (hresult == D3DERR_DEVICELOST || hresult == D3DERR_DEVICENOTRESET) { + device_->Reset(&d3dpp); + sprite_->Release(); + sprite_ = nullptr; + for (auto& tex : textures_) + { + if(tex.second) + tex.second->Release(); + tex.second = nullptr; + } + + if (!FAILED(device_->Reset(&d3dpp))) + invalidate(); + + else return; + } + auto result = device_->BeginScene(); + if (SUCCEEDED(result)) { + std::vector t(gcb->get_map()); + struct { + float x, y; + } pos{ 0,0 }; + std::vector t_path; + if (gcb->try_lock()) { + if (gcb->get_game_board().get()) + t_path = gcb->get_game_board()->get_current_path(); + gcb->unlock(); + } + for (auto& line : t) { + for (auto& row : line) { + auto texture = textures_[row.get_id()]; + D3DXMATRIX world; + D3DXMATRIX scale; + D3DXMATRIX translation; + D3DXMatrixIdentity(&world); + D3DSURFACE_DESC img_info; + texture->GetLevelDesc(0, &img_info); + float scl_x = float(img_info.Width) / 16.f; + float scl_y = float(img_info.Height) / 16.f; + D3DXMatrixScaling(&scale, scl_x, scl_y, 1.f); + D3DXMatrixTranslation(&translation, 0.f, 0.f, 0.f); + world = scale * translation; + auto vec = D3DXVECTOR3(pos.x, pos.y, 0.f); + sprite_->Begin(D3DXSPRITE_ALPHABLEND); + auto color = D3DCOLOR_RGBA(255, 255, 255, 255); + if (row == tile::RED_GOLD) + color = D3DCOLOR_RGBA(255, 0, 0, 255); + if (row == tile::GREEN_GOLD) + color = D3DCOLOR_RGBA(255, 0, 0, 255); + sprite_->Draw(texture, nullptr, nullptr, &vec, color); + sprite_->End(); + pos.x += 16; + } + pos.x = 0; + pos.y += 16; + } + if (t_path.size()) { + auto prev = t_path.front(); + prev.y = prev.y * 16 + 8; + prev.x = prev.x * 16 + 8; + for (auto point : t_path) { + point.y = point.y * 16 + 8; + point.x = point.x * 16 + 8; + draw_line(vec(prev.x - 1, prev.y - 1), vec(point.x - 1, point.y - 1), D3DCOLOR_ARGB(255, 0, 240, 0)); + draw_line(prev, point, D3DCOLOR_ARGB(255, 0, 240, 0)); + draw_line(vec(prev.x + 1, prev.y + 1), vec(point.x + 1, point.y + 1), D3DCOLOR_ARGB(255, 0, 240, 0)); + prev = point; + } + } + device_->EndScene(); + } + result = device_->Present(NULL, NULL, NULL, NULL); + if (!SUCCEEDED(result)) MessageBox(0, 0, 0, 0); + std::this_thread::sleep_for(1ms); +} + +void graphics::draw_line(vec p1, vec p2, uint32_t col) { + + vertex vert[2] = + { + { p1.x, p1.y, 0.0f, 1.0f, col }, + { p2.x, p2.y, 0.0f, 1.0f, col } + }; + + device_->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE); + device_->DrawPrimitiveUP(D3DPT_LINELIST, 1, &vert, sizeof(vertex)); + +} + +graphics::~graphics() { + device_->Release(); + sprite_->Release(); + sprite_ = nullptr; + for (auto& tex : textures_) + { + if (tex.second) + tex.second->Release(); + tex.second = nullptr; + } +} \ No newline at end of file diff --git a/CodeBattleCPP/CodeBattleCpp/graphics.hpp b/CodeBattleCPP/CodeBattleCpp/graphics.hpp new file mode 100644 index 0000000..cd56f2d --- /dev/null +++ b/CodeBattleCPP/CodeBattleCpp/graphics.hpp @@ -0,0 +1,34 @@ +#pragma once +#include +#include + +#include +#include +#include +#include +#include + + +#pragma comment(lib,"d3dx9.lib") +#pragma comment(lib,"d3d9.lib") + +class client; + +class graphics { + struct vertex { + float x, y, z, rhw; + uint32_t color; + }; + LPDIRECT3D9 pd3d; + D3DPRESENT_PARAMETERS d3dpp; + LPDIRECT3DDEVICE9 device_; + LPD3DXSPRITE sprite_; + //std::thread worker_; + std::map textures_; +public: + graphics(HWND hwnd); + ~graphics(); + void invalidate(); + void render_scene(std::shared_ptr& client); + void draw_line(vec p1, vec p2, uint32_t color); +}; \ No newline at end of file diff --git a/CodeBattleCPP/CodeBattleCpp/json.hpp b/CodeBattleCPP/CodeBattleCpp/json.hpp new file mode 100644 index 0000000..c6ed89a --- /dev/null +++ b/CodeBattleCPP/CodeBattleCpp/json.hpp @@ -0,0 +1,20842 @@ +/* + __ _____ _____ _____ + __| | __| | | | JSON for Modern C++ +| | |__ | | | | | | version 3.6.1 +|_____|_____|_____|_|___| https://github.com/nlohmann/json + +Licensed under the MIT License . +SPDX-License-Identifier: MIT +Copyright (c) 2013-2019 Niels Lohmann . + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ + +#define NLOHMANN_JSON_VERSION_MAJOR 3 +#define NLOHMANN_JSON_VERSION_MINOR 6 +#define NLOHMANN_JSON_VERSION_PATCH 1 + +#include // all_of, find, for_each +#include // assert +#include // and, not, or +#include // nullptr_t, ptrdiff_t, size_t +#include // hash, less +#include // initializer_list +#include // istream, ostream +#include // random_access_iterator_tag +#include // unique_ptr +#include // accumulate +#include // string, stoi, to_string +#include // declval, forward, move, pair, swap +#include // vector + +// #include + + +#include + +// #include + + +#include // transform +#include // array +#include // and, not +#include // forward_list +#include // inserter, front_inserter, end +#include // map +#include // string +#include // tuple, make_tuple +#include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible +#include // unordered_map +#include // pair, declval +#include // valarray + +// #include + + +#include // exception +#include // runtime_error +#include // to_string + +// #include + + +#include // size_t + +namespace nlohmann +{ +namespace detail +{ +/// struct to capture the start position of the current token +struct position_t +{ + /// the total number of characters read + std::size_t chars_read_total = 0; + /// the number of characters read in the current line + std::size_t chars_read_current_line = 0; + /// the number of lines read + std::size_t lines_read = 0; + + /// conversion to size_t to preserve SAX interface + constexpr operator size_t() const + { + return chars_read_total; + } +}; + +} // namespace detail +} // namespace nlohmann + + +namespace nlohmann +{ +namespace detail +{ +//////////////// +// exceptions // +//////////////// + +/*! +@brief general exception of the @ref basic_json class + +This class is an extension of `std::exception` objects with a member @a id for +exception ids. It is used as the base class for all exceptions thrown by the +@ref basic_json class. This class can hence be used as "wildcard" to catch +exceptions. + +Subclasses: +- @ref parse_error for exceptions indicating a parse error +- @ref invalid_iterator for exceptions indicating errors with iterators +- @ref type_error for exceptions indicating executing a member function with + a wrong type +- @ref out_of_range for exceptions indicating access out of the defined range +- @ref other_error for exceptions indicating other library errors + +@internal +@note To have nothrow-copy-constructible exceptions, we internally use + `std::runtime_error` which can cope with arbitrary-length error messages. + Intermediate strings are built with static functions and then passed to + the actual constructor. +@endinternal + +@liveexample{The following code shows how arbitrary library exceptions can be +caught.,exception} + +@since version 3.0.0 +*/ +class exception : public std::exception +{ + public: + /// returns the explanatory string + const char* what() const noexcept override + { + return m.what(); + } + + /// the id of the exception + const int id; + + protected: + exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} + + static std::string name(const std::string& ename, int id_) + { + return "[json.exception." + ename + "." + std::to_string(id_) + "] "; + } + + private: + /// an exception object as storage for error messages + std::runtime_error m; +}; + +/*! +@brief exception indicating a parse error + +This exception is thrown by the library when a parse error occurs. Parse errors +can occur during the deserialization of JSON text, CBOR, MessagePack, as well +as when using JSON Patch. + +Member @a byte holds the byte index of the last read character in the input +file. + +Exceptions have ids 1xx. + +name / id | example message | description +------------------------------ | --------------- | ------------------------- +json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position. +json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. +json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. +json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects. +json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. +json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`. +json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character. +json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences. +json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number. +json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. +json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. +json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read. +json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet). + +@note For an input with n bytes, 1 is the index of the first character and n+1 + is the index of the terminating null byte or the end of file. This also + holds true when reading a byte vector (CBOR or MessagePack). + +@liveexample{The following code shows how a `parse_error` exception can be +caught.,parse_error} + +@sa - @ref exception for the base class of the library exceptions +@sa - @ref invalid_iterator for exceptions indicating errors with iterators +@sa - @ref type_error for exceptions indicating executing a member function with + a wrong type +@sa - @ref out_of_range for exceptions indicating access out of the defined range +@sa - @ref other_error for exceptions indicating other library errors + +@since version 3.0.0 +*/ +class parse_error : public exception +{ + public: + /*! + @brief create a parse error exception + @param[in] id_ the id of the exception + @param[in] pos the position where the error occurred (or with + chars_read_total=0 if the position cannot be + determined) + @param[in] what_arg the explanatory string + @return parse_error object + */ + static parse_error create(int id_, const position_t& pos, const std::string& what_arg) + { + std::string w = exception::name("parse_error", id_) + "parse error" + + position_string(pos) + ": " + what_arg; + return parse_error(id_, pos.chars_read_total, w.c_str()); + } + + static parse_error create(int id_, std::size_t byte_, const std::string& what_arg) + { + std::string w = exception::name("parse_error", id_) + "parse error" + + (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") + + ": " + what_arg; + return parse_error(id_, byte_, w.c_str()); + } + + /*! + @brief byte index of the parse error + + The byte index of the last read character in the input file. + + @note For an input with n bytes, 1 is the index of the first character and + n+1 is the index of the terminating null byte or the end of file. + This also holds true when reading a byte vector (CBOR or MessagePack). + */ + const std::size_t byte; + + private: + parse_error(int id_, std::size_t byte_, const char* what_arg) + : exception(id_, what_arg), byte(byte_) {} + + static std::string position_string(const position_t& pos) + { + return " at line " + std::to_string(pos.lines_read + 1) + + ", column " + std::to_string(pos.chars_read_current_line); + } +}; + +/*! +@brief exception indicating errors with iterators + +This exception is thrown if iterators passed to a library function do not match +the expected semantics. + +Exceptions have ids 2xx. + +name / id | example message | description +----------------------------------- | --------------- | ------------------------- +json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. +json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. +json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. +json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid. +json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid. +json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range. +json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. +json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. +json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. +json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. +json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to. +json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container. +json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered. +json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin(). + +@liveexample{The following code shows how an `invalid_iterator` exception can be +caught.,invalid_iterator} + +@sa - @ref exception for the base class of the library exceptions +@sa - @ref parse_error for exceptions indicating a parse error +@sa - @ref type_error for exceptions indicating executing a member function with + a wrong type +@sa - @ref out_of_range for exceptions indicating access out of the defined range +@sa - @ref other_error for exceptions indicating other library errors + +@since version 3.0.0 +*/ +class invalid_iterator : public exception +{ + public: + static invalid_iterator create(int id_, const std::string& what_arg) + { + std::string w = exception::name("invalid_iterator", id_) + what_arg; + return invalid_iterator(id_, w.c_str()); + } + + private: + invalid_iterator(int id_, const char* what_arg) + : exception(id_, what_arg) {} +}; + +/*! +@brief exception indicating executing a member function with a wrong type + +This exception is thrown in case of a type error; that is, a library function is +executed on a JSON value whose type does not match the expected semantics. + +Exceptions have ids 3xx. + +name / id | example message | description +----------------------------- | --------------- | ------------------------- +json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead. +json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. +json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t &. +json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types. +json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types. +json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types. +json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types. +json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types. +json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types. +json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types. +json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types. +json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types. +json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined. +json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers. +json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive. +json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. | +json.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) | + +@liveexample{The following code shows how a `type_error` exception can be +caught.,type_error} + +@sa - @ref exception for the base class of the library exceptions +@sa - @ref parse_error for exceptions indicating a parse error +@sa - @ref invalid_iterator for exceptions indicating errors with iterators +@sa - @ref out_of_range for exceptions indicating access out of the defined range +@sa - @ref other_error for exceptions indicating other library errors + +@since version 3.0.0 +*/ +class type_error : public exception +{ + public: + static type_error create(int id_, const std::string& what_arg) + { + std::string w = exception::name("type_error", id_) + what_arg; + return type_error(id_, w.c_str()); + } + + private: + type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} +}; + +/*! +@brief exception indicating access out of the defined range + +This exception is thrown in case a library function is called on an input +parameter that exceeds the expected range, for instance in case of array +indices or nonexisting object keys. + +Exceptions have ids 4xx. + +name / id | example message | description +------------------------------- | --------------- | ------------------------- +json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1. +json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. +json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object. +json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved. +json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. +json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF. +json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. | +json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. | +json.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string | + +@liveexample{The following code shows how an `out_of_range` exception can be +caught.,out_of_range} + +@sa - @ref exception for the base class of the library exceptions +@sa - @ref parse_error for exceptions indicating a parse error +@sa - @ref invalid_iterator for exceptions indicating errors with iterators +@sa - @ref type_error for exceptions indicating executing a member function with + a wrong type +@sa - @ref other_error for exceptions indicating other library errors + +@since version 3.0.0 +*/ +class out_of_range : public exception +{ + public: + static out_of_range create(int id_, const std::string& what_arg) + { + std::string w = exception::name("out_of_range", id_) + what_arg; + return out_of_range(id_, w.c_str()); + } + + private: + out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} +}; + +/*! +@brief exception indicating other library errors + +This exception is thrown in case of errors that cannot be classified with the +other exception types. + +Exceptions have ids 5xx. + +name / id | example message | description +------------------------------ | --------------- | ------------------------- +json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. + +@sa - @ref exception for the base class of the library exceptions +@sa - @ref parse_error for exceptions indicating a parse error +@sa - @ref invalid_iterator for exceptions indicating errors with iterators +@sa - @ref type_error for exceptions indicating executing a member function with + a wrong type +@sa - @ref out_of_range for exceptions indicating access out of the defined range + +@liveexample{The following code shows how an `other_error` exception can be +caught.,other_error} + +@since version 3.0.0 +*/ +class other_error : public exception +{ + public: + static other_error create(int id_, const std::string& what_arg) + { + std::string w = exception::name("other_error", id_) + what_arg; + return other_error(id_, w.c_str()); + } + + private: + other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} +}; +} // namespace detail +} // namespace nlohmann + +// #include + + +#include // pair + +// This file contains all internal macro definitions +// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them + +// exclude unsupported compilers +#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) + #if defined(__clang__) + #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #endif +#endif + +// disable float-equal warnings on GCC/clang +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + +// disable documentation warnings on clang +#if defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdocumentation" +#endif + +// allow for portable deprecation warnings +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #define JSON_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) + #define JSON_DEPRECATED __declspec(deprecated) +#else + #define JSON_DEPRECATED +#endif + +// allow for portable nodiscard warnings +#if defined(__has_cpp_attribute) + #if __has_cpp_attribute(nodiscard) + #define JSON_NODISCARD [[nodiscard]] + #elif __has_cpp_attribute(gnu::warn_unused_result) + #define JSON_NODISCARD [[gnu::warn_unused_result]] + #else + #define JSON_NODISCARD + #endif +#else + #define JSON_NODISCARD +#endif + +// allow to disable exceptions +#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) + #define JSON_THROW(exception) throw exception + #define JSON_TRY try + #define JSON_CATCH(exception) catch(exception) + #define JSON_INTERNAL_CATCH(exception) catch(exception) +#else + #include + #define JSON_THROW(exception) std::abort() + #define JSON_TRY if(true) + #define JSON_CATCH(exception) if(false) + #define JSON_INTERNAL_CATCH(exception) if(false) +#endif + +// override exception macros +#if defined(JSON_THROW_USER) + #undef JSON_THROW + #define JSON_THROW JSON_THROW_USER +#endif +#if defined(JSON_TRY_USER) + #undef JSON_TRY + #define JSON_TRY JSON_TRY_USER +#endif +#if defined(JSON_CATCH_USER) + #undef JSON_CATCH + #define JSON_CATCH JSON_CATCH_USER + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_CATCH_USER +#endif +#if defined(JSON_INTERNAL_CATCH_USER) + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER +#endif + +// manual branch prediction +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #define JSON_LIKELY(x) __builtin_expect(x, 1) + #define JSON_UNLIKELY(x) __builtin_expect(x, 0) +#else + #define JSON_LIKELY(x) x + #define JSON_UNLIKELY(x) x +#endif + +// C++ language standard detection +#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 +#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 +#endif + +/*! +@brief macro to briefly define a mapping between an enum and JSON +@def NLOHMANN_JSON_SERIALIZE_ENUM +@since version 3.4.0 +*/ +#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ + template \ + inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [e](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.first == e; \ + }); \ + j = ((it != std::end(m)) ? it : std::begin(m))->second; \ + } \ + template \ + inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [j](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.second == j; \ + }); \ + e = ((it != std::end(m)) ? it : std::begin(m))->first; \ + } + +// Ugly macros to avoid uglier copy-paste when specializing basic_json. They +// may be removed in the future once the class is split. + +#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ + template class ObjectType, \ + template class ArrayType, \ + class StringType, class BooleanType, class NumberIntegerType, \ + class NumberUnsignedType, class NumberFloatType, \ + template class AllocatorType, \ + template class JSONSerializer> + +#define NLOHMANN_BASIC_JSON_TPL \ + basic_json + +// #include + + +#include // not +#include // size_t +#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type + +namespace nlohmann +{ +namespace detail +{ +// alias templates to reduce boilerplate +template +using enable_if_t = typename std::enable_if::type; + +template +using uncvref_t = typename std::remove_cv::type>::type; + +// implementation of C++14 index_sequence and affiliates +// source: https://stackoverflow.com/a/32223343 +template +struct index_sequence +{ + using type = index_sequence; + using value_type = std::size_t; + static constexpr std::size_t size() noexcept + { + return sizeof...(Ints); + } +}; + +template +struct merge_and_renumber; + +template +struct merge_and_renumber, index_sequence> + : index_sequence < I1..., (sizeof...(I1) + I2)... > {}; + +template +struct make_index_sequence + : merge_and_renumber < typename make_index_sequence < N / 2 >::type, + typename make_index_sequence < N - N / 2 >::type > {}; + +template<> struct make_index_sequence<0> : index_sequence<> {}; +template<> struct make_index_sequence<1> : index_sequence<0> {}; + +template +using index_sequence_for = make_index_sequence; + +// dispatch utility (taken from ranges-v3) +template struct priority_tag : priority_tag < N - 1 > {}; +template<> struct priority_tag<0> {}; + +// taken from ranges-v3 +template +struct static_const +{ + static constexpr T value{}; +}; + +template +constexpr T static_const::value; +} // namespace detail +} // namespace nlohmann + +// #include + + +#include // not +#include // numeric_limits +#include // false_type, is_constructible, is_integral, is_same, true_type +#include // declval + +// #include + + +#include // random_access_iterator_tag + +// #include + + +namespace nlohmann +{ +namespace detail +{ +template struct make_void +{ + using type = void; +}; +template using void_t = typename make_void::type; +} // namespace detail +} // namespace nlohmann + +// #include + + +namespace nlohmann +{ +namespace detail +{ +template +struct iterator_types {}; + +template +struct iterator_types < + It, + void_t> +{ + using difference_type = typename It::difference_type; + using value_type = typename It::value_type; + using pointer = typename It::pointer; + using reference = typename It::reference; + using iterator_category = typename It::iterator_category; +}; + +// This is required as some compilers implement std::iterator_traits in a way that +// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. +template +struct iterator_traits +{ +}; + +template +struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> + : iterator_types +{ +}; + +template +struct iterator_traits::value>> +{ + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; +}; +} // namespace detail +} // namespace nlohmann + +// #include + +// #include + +// #include + + +#include + +// #include + + +// http://en.cppreference.com/w/cpp/experimental/is_detected +namespace nlohmann +{ +namespace detail +{ +struct nonesuch +{ + nonesuch() = delete; + ~nonesuch() = delete; + nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; + void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; +}; + +template class Op, + class... Args> +struct detector +{ + using value_t = std::false_type; + using type = Default; +}; + +template class Op, class... Args> +struct detector>, Op, Args...> +{ + using value_t = std::true_type; + using type = Op; +}; + +template